Transformative or Conservative? Conservation laws for ResNets and Transformers

Sibylle Marcotte, Rémi Gribonval, Gabriel Peyré

Introduction

In the field of deep learning, the training process is frequently treated as a "black box" of high-dimensional optimization. While we observe the loss decreasing, the underlying geometric transformations of the model's parameters often remain opaque. Researchers have previously identified "conservation laws"—mathematical quantities that remain constant throughout training—for simple architectures like two-layer linear or ReLU networks. These laws, such as the "balancedness" property where the difference between squared norms of weights in consecutive layers stays constant, are vital because they reveal the implicit bias of the optimization process. This bias dictates which specific solution a network converges to among the infinite possibilities.

However, modern deep learning relies on sophisticated structures: convolutional layers, residual (skip) connections, and self-attention mechanisms. Until now, it was unclear if these complex architectures obeyed similar "laws of physics." This paper extends the theory of conservation laws to ResNets and Transformers, proving that even these advanced models are governed by predictable geometric constraints.

Theoretical Framework: Euclidean Gradient Flow

To analyze these laws, the authors utilize Euclidean Gradient Flow, a framework that treats neural network training as a continuous-time dynamical system described by Ordinary Differential Equations (ODEs). This abstraction allows for a rigorous mathematical characterization of parameter evolution.

Methodological Innovations

  • Structure Theorem: The authors establish a correspondence between conservation laws in systems with weight decay and those without, simplifying the search for conserved quantities.
  • Lie Algebra Characterization: By analyzing the "trace of the Lie algebra" generated by the network's parameterization, the researchers can systematically count and identify independent conservation laws.
  • Block-wise Analysis: The paper introduces a "tailored analysis" strategy. By studying a subset of parameters—such as a single residual block or an individual attention head—in isolation, the authors can derive laws that hold for the entire global network.
  • Discrete Dynamics Analysis: Recognizing that real-world training uses discrete Stochastic Gradient Descent (SGD) rather than continuous flow, the authors use Taylor expansions to bound the "drift" of these laws, ensuring theoretical findings remain relevant to practical applications.

Conservation in Modern Architectures

The Neutrality of Skip Connections

One of the paper's most significant findings is the "Skip Connection Neutrality." The authors prove that adding a residual connection ($x + g(x)$) does not alter the conservation laws of the underlying block $g(x)$. This suggests that while ResNets are easier to train due to improved gradient flow, they do not fundamentally change the geometric constraints of the parameter space compared to their "plain" counterparts.

Attention is Conservative

For Transformers, the authors identified specific conserved matrices within single-head attention layers. Specifically, they found that quantities such as $QQ^\top - KK^\top$ (Query/Key) and $VV^\top - OO^\top$ (Value/Output) remain constant. This implies that the relationship between these weight matrices is geometrically constrained from the moment of initialization, providing a new lens through which to view the internal dynamics of self-attention.

Bridging Theory and Practice

In actual training environments, these laws are not perfectly constant because SGD takes discrete steps. However, the authors demonstrate that the "conservation error" or drift is highly predictable, scaling at a rate of $O(\text{step-size}^2)$. This means that if a practitioner reduces the learning rate by half, the deviation from the theoretical conservation law decreases by a factor of four.

Empirical Validation

The authors validated these findings through experiments on standard benchmarks:

  • CIFAR-10: Using a ResNet-18, they tracked the Frobenius norms between convolutional layers, confirming that the balancedness conditions held steady across thousands of iterations.
  • IMDb Sentiment Analysis: Using a Transformer, they tracked the evolution of query and key matrices, matching the theoretical $O(\tau^2)$ drift slope perfectly.

Conclusion and Future Work

This work provides the first complete description of conservation laws for multi-channel convolutional ResNets and single-head attention layers. It proves that the "laws of physics" for neural training are more robust than previously thought, persisting even through complex architectural modifications like skip connections.

Despite these advances, several frontiers remain. The current framework does not yet account for Normalization Layers (LayerNorm or BatchNorm), which are ubiquitous in modern models. Additionally, while laws were identified for multi-head attention, proving their "completeness"—that no other hidden laws exist—remains an open challenge. Future research will also need to integrate non-differentiable or non-linear operations like max-pooling and provide a more granular analysis of adaptive optimizers like Adam.

Summary updated

BibTeX
@inproceedings{marcotte2025transformative,
  author = {Sibylle Marcotte and Rémi Gribonval and Gabriel Peyré},
  title = {{Transformative or Conservative? Conservation laws for ResNets and Transformers}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=aTBwCSkPxv},
}
Figure