Loss functions and the loss landscape
Learning objectives
- Write a network's mean-squared loss on the column and read it as an RMS error in m/s
- Read a loss surface over two parameters: its minimum, its valley and its plateaus
- Say why the gradient all but vanishes on a plateau where a neuron's switch has left the data
- Read the two curvatures at a minimum and their ratio, the valley's aspect
The Ground Training Walks On
Training moves a network's parameters downhill on its loss, so the loss over the parameters is the ground training walks on. Even one neuron's is no bowl. Over the weight and bias of Section 0.1's trained neuron on the Marmousi2 column, its output layer held, the loss is a narrow curved valley where the switch sits inside the column, between two flat plateaus where it does not: there the neuron reads a constant and the slope all but vanishes, on the lower plateau. The valley's floor is the trained neuron, 211 m/s RMS, and at it the loss curves 413 times less along the valley than across it.
The Loss
The neuron is fitted at 176 depths of the column, every 10 m to 1750 m, with and the targets ( = 1800 m, = 1500 m/s). Its loss is the mean of the squared misses,
and is the RMS error in m/s the figure prints. Holding the output layer at the trained and leaves two parameters, so the loss can be drawn: the book's build computed it at 81 weights from to 16 and 73 biases from to 4, every 0.25, with the same kernel that trained the neuron. The column is the window at x = 3600 m of the Marmousi2 model, a 2D acoustic, constant-density slice of a synthetic model, not field data; the grid and the held output layer are the book's own choices.
A Valley and Two Plateaus
The two dashed lines in plate (a) are where the switch crosses the surface () and the column's last depth (). Between them, for a rising neuron, the switch is in the column and the loss changes fast as it moves: that is the valley, curved because the switch's depth is a ratio. Beyond them the switch has left the data. Above the surface the neuron is on at every depth and the loss is 1520 m/s RMS; below the column it is off at every depth and the loss is 843 m/s. Either way it reads a constant, moving or changes almost nothing, and the slope is tiny: and at the probe's first weight, 6, with the bias at the top and the bottom of the figure. Goodfellow, Bengio and Courville (2016) give the same reason for avoiding sigmoidal hidden units: they saturate across most of their domain, and that makes gradient-based learning very difficult.
The Minimum and Its Curvatures
The minimum is the trained neuron, , , 211 m/s RMS; the probe starts beside it on the grid, at , , 212 m/s. From there walk along the valley, doubling and together so the switch stays at 1275 m, and the loss rises only to 248 m/s; raise the bias by one instead and the switch moves to 975 m and the loss to 476 m/s. Near the minimum the loss is close to a quadratic whose Hessian has two eigenvalues, the curvatures across and along the valley: 0.28 and 0.00069, a ratio of 413, computed by the build from the kernel's gradient. Li et al. (2017) note that training neural networks relies on finding good minimisers of highly non-convex loss functions, and draw such surfaces for large networks; one neuron already shows their parts.
What It Means for a PINN
A PINN's loss adds a residual term to the data term, each with its own valleys and plateaus, over thousands of parameters. Part 3 is about the trouble that causes: terms whose slopes differ by orders of magnitude, and regions where a term's gradient vanishes.
What Comes Next
Section 0.5 puts gradient descent on this surface and writes every step out.
References
- Goodfellow, I., Bengio, Y. and Courville, A. (2016). Deep Learning, Chapter 6, Deep feedforward networks. MIT Press.
- Li, H., Xu, Z., Taylor, G., Studer, C. and Goldstein, T. (2017). Visualizing the loss landscape of neural nets. arXiv:1712.09913.