A deep neural network is a stack of layers, and all layers are trained to lower one shared error. A change in one layer can therefore reach every other layer. Because the error is shared by all layers, one would expect the other layers to respond alike, whether they are next to the changed layer or far from it. We find that early in training the response is weak and its order by distance is not stable. As training proceeds, the response grows, and neighboring layers come to respond to changes in each other more strongly than layers further apart, in almost every network. This locality forms during training, although training links every layer to every other. We show this by pushing one layer of a copy of the network at many stages of training and measuring how much of the push reaches each of the other layers. The experiments use 512 five-layer networks trained on modular addition with each of two optimizers, AdamW and stochastic gradient Langevin dynamics.
Figures & tables
Figure 1: Sketch of the main result. One layer of a copy of the network is pushed (red), and the bars show how strongly the other layers respond (blue for the neighbors, orange for the layer two apart). Early in training the response is small and is not ordered by the distance from the pushed layer. Late in training the neighbors of the pushed layer respond most, and layers further away respond less. The first layer, labeled input layer, is left out of the analysis.
Figure 2: Mutual response by distance against the training step of the push, for AdamW (left) and SGLD (right). (a), (b) Mutual response χij(t,512,32) , 511 steps after the first push. (c), (d) Mutual response χij(t,2,2) , one step after the first push. Pairs are grouped by distance, for pushes at α=0.1 for AdamW and at h=0.1 for SGLD. Each point includes only the networks with a pushed copy that passes the crash filter. For AdamW these are 511 or 512 networks at every point. For SGLD they are 232–388 of the 512 networks at τ=512 , and 479–504 at τ=2 . Bands show the 95% bootstrap interval.
AdamW
SGLD
Early (%)
Late (%)
Early (%)
Late (%)
τ=512
30.3
99.6
26.1
92.1
(26.4–34.2)
(99.0–100.0)
(19.4–32.7)
(87.9–95.8)
τ=2
23.2
97.5
39.3
82.4
(19.7–27.0)
(96.1–98.8)
(35.2–43.6)
(79.1–85.7)
Table 1: Fraction of networks that are in the full order early and late in training. In each network the mutual response is computed from the pushes made up to step 15 000 (Early) and from step 60 000 on (Late). The table uses the networks that pass the filter on every layer, both early and late. These are all 512 AdamW networks, and 165 SGLD networks at τ=512 and all 512 at τ=2 . The rows give the fraction of networks in the full order of χij(t,512,32) ( τ=512 ) and of χij(t,2,2) ( τ=2 ). The 95% bootstrap interval is given in parentheses below each fraction.
AdamW (%)
SGLD (%)
Step 10 000
1.6
–
(1.5–1.6)
Step 20 000
2.0
16.3
(1.9–2.0)
(12.7–19.5)
Step 40 000
1.8
4.9
(1.7–1.8)
(4.4–5.4)
Table 2: Frobenius norm of the second term of Eq. ( 12 ) divided by that of the first term, at three training steps and from step 60 000 on. The squared norms are summed over the pairs. The SGLD column has no entry at step 10 000, because the weights of the SGLD networks were saved every 20 000 steps. All 512 AdamW networks enter in every row. For SGLD, 507, 491, and 512 networks survive the crash filter in the three rows, respectively. The 95% bootstrap interval is given in parentheses.
Figure 3: Mean line-up of neighboring layers and their mutual response over the networks, for AdamW (left) and SGLD (right). (a), (b) Line-up of the strongest patterns, ∣u1(Wi)⋅v1(Wi+1)∣ , averaged over the three neighbor pairs (solid line, left axis), and mutual response of neighbors one step after the first push, χij(t,2,2) (dashed line, right axis), against the training step. The scale of the right axis is chosen so that the two curves agree from step 60 000 on, to compare their shapes. (c), (d) Mutual response of neighbors one step after the first push, χij(t,2,2) , against the line-up of neighbors. At each training step, the networks are sorted by their line-up, averaged over the three neighbor pairs, and cut into ten groups of equal size. Each curve shows the ten groups sorted by line-up at each step, with 49–52 networks in a group. The dotted lines mark unrelated patterns (0.050). The line-up in (a), (b) and the curves in (c), (d) use the saved states with training accuracy at least 0.5, as in Table 2 , with 512 AdamW and 491–507 SGLD networks at each step. The response in (a), (b) is the neighbor curve of Fig. 2 (c), (d), with the same networks. Bands around the response in (a), (b) and error bars in (c), (d) show the 95% bootstrap interval. For the line-up in (a), (b) this interval is at most ±0.02 .
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: Collapses and the largest curvature of the loss in 508 of the 512 SGLD networks, along their training from step 100 000 to step 105 000. The dashed line is the stability limit 2/η=20 of the fixed step. (a) One example of a collapsed network. The largest curvature of the training loss (blue, left axis) and the training accuracy (gray, right axis). (b) The largest curvature against the steps from a collapse, where the dots are the medians over all 946 collapses. The shaded band spans the 10th to 90th percentiles over the collapses. The vertical line marks the collapse. Near it the band extends beyond the top of the axis, to 41 at 20 steps before the collapse and to 121 at the collapse.
χij(t,512,32)
χij(t,2,2)
Method
Strength
Full order (%)
Neighbors > 3 apart (%)
Full order (%)
Neighbors > 3 apart (%)
AdamW
α=0.1
99.4 (98.6–100.0)
99.6 (99.0–100.0)
95.9 (94.1–97.5)
99.0 (98.0–99.8)
α=0.03
100.0 (100.0–100.0)
100.0 (100.0–100.0)
98.0 (96.7–99.2)
99.4 (98.6–100.0)
α=0.01
99.8 (99.4–100.0)
100.0 (100.0–100.0)
98.0 (96.7–99.2)
99.6 (99.0–100.0)
SGLD
h=0.1
93.5 (90.6–96.4)
98.2 (96.4–99.6)
69.3 (65.2–73.2)
95.7 (93.9–97.3)
h=0.03
89.1 (85.5–92.4)
98.6 (97.1–99.6)
65.0 (60.7–69.1)
94.9 (93.0–96.7)
Appendix
Table 3: Fraction of networks with the order by distance, for each push strength, for χij(t,512,32) and for χij(t,2,2) . The mutual response of a network is computed from its pushes made from step 60 000 on, at the push steps that all three strengths share. For χij(t,512,32) , 510 AdamW and 276 SGLD networks enter, those that pass the crash filter at all three strengths. For χij(t,2,2) , all 512 networks of each optimizer enter. Fewer push steps enter than in Table 1 , and for χij(t,512,32) not the same set of networks, so the fractions at α=0.1 and h=0.1 differ from those there. The 95% bootstrap interval is given in parentheses.
Figure 5: Mutual response by distance for three push strengths, for AdamW at α=0.1 , 0.03, and 0.01 and for SGLD at h=0.1 , 0.03, and 0.01, against the push at different training steps. (a)–(f) Mutual response χij(t,512,32) and (g)–(l) mutual response χij(t,2,2) . Pairs are grouped by distance. The vertical axes are logarithmic. Each point is the mean over the pushes made at one training step t , at the push steps that all three strengths share. All 512 networks of each optimizer are pushed. A network enters a point if at least one of its pushed copies passes the crash filter there at all three strengths. For AdamW these are all 512 networks at every point. For SGLD they are 224–387 of the 512 networks at τ=512 , and 486–504 at τ=2 . Bands show the 95% bootstrap interval.
AdamW
SGLD
Early
Late
Early
Late
τ=512
Median C2
0.80
0.93
0.97
0.94
(0.74–0.87)
(0.92–0.93)
(0.84–1.10)
(0.93–0.96)
Median C3
0.71
0.87
1.00
0.99
(0.63–0.82)
(0.86–0.88)
(0.70–1.25)
(0.92–1.04)
Appendix
Table 4: Ratios C2 and C3 of Eq. ( 19 ). The filtered networks are those of Table 1 , except that for SGLD at τ=2 the 124 networks (Early) and 4 networks (Late) in which one of the six pairs has a mutual response of zero are left out. The ratios are given as medians over the networks, because single networks reach ratios above 10. The 95% bootstrap interval is given in parentheses below each value.
Never above 0.03
Other networks
Early
Late
Early
Late
Networks
14
498
Final test accuracy
0.02
0.97
Line-up
0.35
0.98
0.43
0.96
Full order, τ=512
1
14
154
496
Full order, τ=2
4
11
115
488
Appendix
Table 5: The 14 AdamW networks whose test accuracy never exceeds 0.03 and the other 498 AdamW networks. Early and Late are the pushes made up to step 15 000 and from step 60 000 on, as in Table 1 . The final test accuracy is the mean over the last 10 000 training steps. The line-up is the mean over the three neighbor pairs, at step 10 000 (Early) and over the steps from 60 000 on (Late). The last two rows give the number of networks in the full order of χij(t,512,32) ( τ=512 ) and of χij(t,2,2) ( τ=2 ).
Training step
Neighbors
2 apart
3 apart
AdamW
10 000
0.19
0.22
0.24
(0.17–0.20)
(0.20–0.24)
(0.21–0.27)
20 000
0.41
0.49
0.61
(0.39–0.43)
(0.47–0.51)
(0.58–0.64)
30 000
0.75
0.66
0.67
Appendix
Table 6: Cosine between the changes of the scores made by the pushes on two layers, in the AdamW and SGLD networks, averaged over the pairs of layers at the same distance. Means over the networks, at one training step or over all saved steps from 60 000 on. The networks are the same as in Table 2 . The 95% bootstrap interval is given in parentheses below each mean.
Figure 6: Line-up and response of each neighbor pair, and their correlation, for AdamW (left) and SGLD (right). (a), (b) Line-up of each pair against the training step, as the mean over the networks. The dotted line marks the level of unrelated patterns (0.050). (c), (d) Mutual response one step after the first push, χij(t,2,2) . (e), (f) Correlation across the networks between the line-up of a pair and χij(t,2,2) . Open symbols mark correlations that are not significant in a permutation test, with the procedure of Ref. [ 47 ] for many tests, set to a false discovery rate of 5%. All panels use the networks that pass the crash filter, all 512 AdamW networks and 479–507 SGLD networks at each point. Bands show the 95% bootstrap interval.
Layers
Off-ratio
Line-up
Correlation with
fi
fi
σ1
2–3
0.57
0.04
0.09
−0.06
(0.56–0.58)
(0.04–0.04)
( −0.06 to 0.28)
( −0.16 to 0.02)
3–4
0.05
0.40
−0.28
0.57
(0.04–0.06)
(0.39–0.41)
( −0.36 to −0.16 )
(0.51–0.63)
4–5
0.18
0.28
−0.37
−0.18
Appendix
Table 7: Mean off-ratio fi of the strongest output pattern of Wi and mean line-up of layers i and i+1 , for the neighbor pairs of the SGLD networks from step 60 000 on. The last two columns give the Pearson correlation across the networks of the line-up with fi and with the strength σ1 of the strongest pattern of Wi . All 512 SGLD networks enter. The 95% bootstrap interval is given in parentheses below each value.
Neural network training dynamics studies how parameters and representations change during optimization and how those changes shape learning, stability, and generalization.