Abstract Physics-informed neural networks (PINNs) commonly use the mean squared error (MSE) as the loss function. However, this MSE is sensitive to outliers and noise, often causing nonconvergence, overfitting, and loss imbalance during training. To address these challenges, we propose a dynamic Huber loss function that combines the robustness of the Huber loss with a residual-driven weighting mechanism. The Huber loss transitions smoothly from the MSE for small residuals, ensuring accuracy, to the mean absolute error (MAE) for large residuals, enhancing robustness against outliers. Furthermore, the dynamic weighting mechanism adaptively adjusts loss weights on the basis of residual variations at each training point, effectively mitigating loss imbalance and enabling PINNs to focus on high-residual regions. To validate the effectiveness of the proposed method, we conduct comparative experiments, ablation studies, and noise sensitivity tests on the Allen–Cahn equation, the Burgers equation, and the Helmholtz equation. The experimental results show that the proposed strategy improves both accuracy and convergence speed, while maintaining computational efficiency.
Jing et al. (Wed,) studied this question.