Gradient pathologies and adaptive weights

Part 3, Training pathologies and remedies

Learning objectives

  • Read the residual's and the other terms' gradients at the start, their largest and mean entries
  • Run the annealing that moves every weight toward the ratio of those gradients, and read the weights it finds
  • Give every point a weight of its own, raised by ascent where its residual stays large
  • Compare both rules with every weight 1, the NTK weights and the curvature scale

Measure the Gradients, Move the Weights

The residual's largest gradient entry at the start is 197 times the start term's mean entry, and the surface's 946: gradient descent serves the residual first. An annealing that measures every term's gradient every 10 steps and moves the weights to even them out ends 0.92 from FD, against 0.85 with every weight 1: it raises most the terms whose gradients are smallest, the ones already met. A weight for every point, raised where the point is missed, on top of the curvature scale's weights ends 0.23 from FD, against 0.31 at the curvature scale without them.

Adaptive Loss WeightsInteractive figure, enable JavaScript to interact.

The Annealing

Wang, Teng and Perdikaris (2020) traced a failure mode of PINNs to unbalanced back-propagated gradients and proposed a learning-rate annealing that uses the gradients' statistics to balance the terms. The book's form: every 10 steps each term's target is the residual's largest gradient entry over the term's mean entry, and its weight moves 90 % of the way there, the residual's held at 1. From every weight 1 the rule ends with the start at 239 and the surface at 340, and the start's rate, long since met, at 29973: a term's target grows as its gradient shrinks, so evening the gradients' sizes is not evening what the terms still ask, and the start term stays drowned.

A Weight for Every Point

McClenny and Braga-Neto (2020) made the weights fully trainable and applied to each training point individually, made to increase as the corresponding losses increase. The book's rule is a plain form of that idea: it gives each point ii a weight λi\lambda_i, its square the point's weight in the loss, and after every descent step on the network raises each λi\lambda_i by ascent in proportion to its residual: a point that stays missed gains weight. Here it runs on the curvature scale's weights; at the end the residual's points carry squared weights from 1.00 to 3.95.

Three Ways to Balance

Section 3.3's NTK weights end 0.08 from FD. All three rules read the network during training instead of a sweep, and all three hold the residual's weight below the start's; they differ in what they measure: the traces, the gradients' largest and mean entries, or each point's own residual. On the column the traces did best, the per-point weights next, and the annealing not at all.

What Comes Next

Section 3.5 weights the residual by time instead: the late times wait until the early ones are learnt.

References

  • Wang, S., Teng, Y. and Perdikaris, P. (2020). Understanding and mitigating gradient pathologies in physics-informed neural networks. arXiv:2001.04536.
  • McClenny, L. and Braga-Neto, U. (2020). Self-adaptive physics-informed neural networks using a soft attention mechanism. arXiv:2009.04544. doi:10.1016/j.jcp.2022.111722.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.