ConFIG: Towards Conflict-free Training of Physics Informed Neural Networks

Qiang Liu, Mengyu Chu, Nils Thuerey

TL;DR

Training Physics-Informed Neural Networks (PINNs) is notoriously difficult due to conflicting gradients between physics equations and boundary conditions. This paper introduces ConFIG (Conflict-Free Inverse Gradients), a novel optimization method that projects gradients into a conflict-free direction using a matrix pseudoinverse. Combined with an alternating momentum variant (M-ConFIG), the approach drastically improves both accuracy and training speed across challenging partial differential equations (PDEs) and multi-task learning benchmarks.

What Problem Does This Paper Address?

Physics-Informed Neural Networks (PINNs) solve partial differential equations (PDEs) by embedding physical laws directly into the neural network's loss function. A typical PINN loss function is multi-objective, combining terms for the PDE residuals, initial conditions, and boundary conditions.

However, training PINNs is notoriously unstable. The gradient magnitudes of the PDE residuals often dwarf those of the boundary conditions, biasing the network. Furthermore, because a PDE has infinite solutions without its boundary conditions, the PDE residual loss landscape is riddled with local minima. Standard gradient descent easily gets trapped in these local minima, satisfying the physics equations generally but failing catastrophically at the boundaries.

Figure 1: Visualization of toy example showing the conflict between different losses during optimization.

While existing methods attempt to reweight these loss terms, they only adjust gradient magnitudes, not their directions.

Methods

The authors propose ConFIG (Conflict-Free Inverse Gradients) to fundamentally alter the update direction.

  1. Conflict-Free Updates: ConFIG ensures that the final update direction has a positive dot product with every single loss-specific gradient. It achieves this by setting the update vector proportional to the pseudoinverse of the transposed normalized gradient matrix.
  2. Uniform Optimization Rates: It ensures that the projection length of the final gradient onto each individual task gradient is uniform, meaning all loss terms are optimized at the same rate.
  3. Adaptive Scaling: The final gradient magnitude dynamically scales down when task gradients oppose each other (high conflict) and scales up when they align, preventing the optimizer from stalling.
Figure 2: Sketch of PCGrad (a), IMTL-G (b), and our ConFIG (c) method with two loss terms. The PCGrad method directly sums two orthogonal components, and the IMTL-G method rescales the two vectors to the same magnitude. Our ConFIG method sums the unit vector of the orthogonal components and adjusts its magnitude with the projection length of each loss-specific gradient.

To combat the high computational cost of calculating separate backpropagations for every loss term, the authors introduce M-ConFIG (Momentum-ConFIG). Instead of computing all gradients at every iteration, M-ConFIG alternates which loss term it evaluates at each step and uses momentum to carry over information from previous steps. This reduces the per-iteration backpropagation cost to $1/m$ (where $m$ is the number of loss terms).

Datasets

The method was evaluated on two distinct domains:

  • PINN PDE Benchmarks: 1D unsteady Burgers equation, 1D unsteady Schrödinger equation, 2D Kovasznay flow, and 3D unsteady Beltrami flow. They also tested on three notoriously hard problems from the Pinnacle benchmark: N-dimensional Poisson (PNd), multi-scale heat transfer (HeatMS), and the chaotic Kuramoto-Sivashinsky (KS) equation.
  • Multi-Task Learning (MTL): The CelebA dataset, consisting of 200,000 facial images annotated with 40 binary attributes (representing a massive 40-task optimization challenge).

Key Insights and Ideas

  • The $>2$ Tasks Flaw in Existing Methods: Popular gradient-surgery methods like PCGrad work well for two conflicting losses, but fail when $m > 2$. For three or more conflicting vectors, sequentially projecting them can still result in an update that conflicts with earlier vectors. ConFIG's pseudoinverse approach is mathematically proven to be the only method that guarantees a conflict-free direction when the number of loss terms exceeds two.
  • Counter-Intuitive Speedups: Standard gradient manipulation methods are slower than simple loss-weighting because they require multiple backpropagation passes. However, M-ConFIG flips this script. Because backpropagating a single sub-loss (like a boundary condition with fewer sample points) is much faster than backpropagating the entire combined loss, alternating sub-losses actually makes M-ConFIG faster per iteration than standard Adam on the total loss.

Key Results

  • Superior Accuracy: ConFIG and M-ConFIG consistently outperformed standard Adam and state-of-the-art PINN weighting methods (like ReLoBRaLo and Learning Rate Annealing) across almost all standard PDEs. For instance, in the 3D Beltrami flow case, ConFIG significantly reduced the test Mean Squared Error (MSE) compared to the baselines.
  • Wall-Clock Efficiency: When evaluated under a strict wall-clock time budget, M-ConFIG decisively outperformed all competitors, achieving lower MSEs much faster due to its alternating gradient strategy.
  • MTL Success: On the 40-task CelebA benchmark, ConFIG variants achieved the top spot in both Mean Rank (MR) and F1 score against ten popular multi-task learning baselines.

Limitations and Future Work

  • Scalability to Massive Task Counts: While M-ConFIG excels, its performance degrades slightly if the number of tasks becomes exceptionally large (e.g., approaching 40) because the interval between updating any specific task's gradient becomes too wide. The authors suggest updating a stochastic subset of gradients rather than just one to mitigate this.
  • Memory Overhead: Storing independent gradients or momentum vectors for each loss term requires $O(nm)$ memory (where $n$ is parameters and $m$ is tasks), which could challenge extremely large-scale models.
  • Chaotic Limits: ConFIG did not solve the chaotic Kuramoto-Sivashinsky (KS) equation. The authors note that for chaotic systems, optimization adjustments alone are insufficient; fundamental architectural changes (like causality constraints) remain necessary.

Summary updated

BibTeX
@inproceedings{liu2025config,
  author = {Qiang Liu and Mengyu Chu and Nils Thuerey},
  title = {{ConFIG: Towards Conflict-free Training of Physics Informed Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=APojAzJQiq},
}
Figure