Edge of chaos as a guiding principle for modern neural network training

Lin Zhang, Ling Feng, Kan Chen, Choy Heng LaiarXiv 2021 · arXiv

Introduction

Despite the transformative success of deep learning, the process of hyperparameter tuning—selecting the right learning rate, batch size, and momentum—remains largely an empirical "black art." We lack a unified theoretical framework that explains why specific combinations of these parameters lead to superior generalization. This research proposes a physics-inspired solution: viewing a neural network as a dynamical system and identifying the "edge of chaos" as the optimal regime for training.

In dynamical systems, the edge of chaos is the transition point between an ordered phase (where inputs lead to stable, predictable outputs) and a chaotic phase (where infinitesimal changes in input cause wildly divergent outputs). This paper demonstrates that modern training algorithms naturally drive models toward this boundary, where information transmission is maximized and performance peaks.

Theoretical Framework and Methodology

The study focuses on a feedforward neural network with a single hidden layer and tanh activation functions. To analyze its behavior, the researchers employed Mean Field Theory—specifically concepts from the Sherrington-Kirkpatrick spin-glass model—to map the network's state onto a phase diagram defined by the mean ($J_0$) and variance ($J$) of its weights.

Key to this analysis is the Jacobian Norm ($J^*$). The researchers used the Frobenius norm of the Jacobian as a proxy for how information flows through the network. When $J^* = 1$, the system sits precisely at the edge of chaos. The study utilized the Fashion-MNIST dataset (70,000 grayscale images of clothing) to empirically track how Stochastic Gradient Descent (SGD) with momentum moves a model across this phase space during training.

Training Dynamics and the Optimal Regime

Models typically begin training in the ordered phase. As SGD updates the weights, the variance ($J^2$) increases, pushing the model toward the chaotic regime. A critical finding of this work is that the "sweet spot" for performance is not reached at the end of training, but specifically when the model hits the phase boundary.

Figure 2: Evolution of a neural network across the phase diagram. (a) The model moves from the ordered phase toward the 'edge of chaos' (dashed line). (b, c) Minimum test loss and maximum test accuracy are achieved precisely as the model reaches this boundary.

As shown in the phase mapping, the "optimal epoch" (marked by the green dot) aligns perfectly with the edge of chaos ($J \approx 1$). At this precise moment, the model achieves its minimum test loss and maximum test accuracy. Beyond this point, as the model enters the chaotic phase, it begins to overfit, and generalization performance degrades.

Universal Scaling Laws

The researchers identified a universal scale factor that governs how quickly a model approaches this chaotic boundary: $\frac{\eta}{(1-\alpha)B}$, where $\eta$ is the learning rate, $\alpha$ is momentum, and $B$ is the batch size. In the ordered phase, the growth of weight variance is linearly proportional to this factor.

Figure 5: Linear scaling of training dynamics. (a) Weight variance $J^2$ grows linearly with epochs. (b-d) The growth rate (Slope A) scales linearly with learning rate $\eta$, inverse momentum $1/(1-\alpha)$, and inverse batch size $1/B$.

This linear relationship allows for predictable hyperparameter scaling. For instance, a researcher could increase the learning rate or decrease the batch size to reach the edge of chaos faster without sacrificing final performance, provided the scale factor remains within the linear regime of the ordered phase. Once the model enters the chaotic phase, these relations become sub-linear and unpredictable, suggesting that the loss landscape is significantly easier to navigate before the transition.

The Regulatory Role of Weight Decay

If SGD pushes a model toward chaos, what keeps it from falling over the edge? The authors argue that weight decay acts as a physical regulator. Rather than being a generic penalty, weight decay provides a counter-force that pulls the model back toward the ordered phase. Optimal performance is achieved when weight decay perfectly balances the "push" of SGD, effectively anchoring the model at the edge of chaos. The researchers even derived an analytical formula for the optimal weight decay strength ($\lambda \approx 0.00005$), which closely matched their empirical findings ($\lambda \approx 0.00009$).

Conclusion and Future Work

This research provides a principled dynamical explanation for why certain hyperparameters work. By targeting the edge of chaos, practitioners can move away from trial-and-error and toward a more calculated approach to model training.

However, limitations remain. The current analysis relies on the specific properties of tanh activations and single-layer architectures. Future work is needed to determine if these scaling laws and the "edge of chaos" principle hold for deeper architectures like Transformers and ResNets, or for more complex optimizers like Adam. If universal, this framework could redefine our fundamental understanding of deep learning optimization.

Summary updated

BibTeX
@misc{zhang2021edge,
  author = {Lin Zhang and Ling Feng and Kan Chen and Choy Heng Lai},
  title = {{Edge of chaos as a guiding principle for modern neural network training}},
  year = {2021},
  eprint = {2107.09437},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.09437},
}
Figure