Averaging the weights of two deep neural networks is an intuitive way to fuse the knowledge of independent models, a technique prominently used in Federated Learning (FL) and "Model Soups." However, because the loss surfaces of state-of-the-art neural networks are highly non-convex, averaging models that perform well individually often results in a combined model that performs poorly. This spike in error is known as a "loss barrier."
While previous research into Linear Mode Connectivity (LMC) has focused on the network as a whole, this paper investigates a more granular question: Is the loss barrier a global phenomenon, or is it localized within specific layers? By introducing Layer-wise Linear Mode Connectivity (LLMC), the authors demonstrate that individual layers are almost always linearly connectable, and that loss barriers emerge primarily from the collective interaction of groups of layers.
The Problem with Model Averaging
In Federated Learning, practitioners often attempt to average only specific layers to balance global knowledge with local task adaptation—a process known as personalization. If models are averaged at the end of training, it only succeeds if the loss in the midpoint between the two models is sufficiently low. Guaranteeing this for non-convex losses is virtually impossible. Understanding exactly where these barriers form is crucial for designing better averaging strategies.
Measuring Layer-Wise Connectivity
To understand the effect of layer-wise averaging, the authors propose a new framework to measure connectivity at the layer level:
- Layer-wise Linear Interpolation Instability: A metric that measures the loss increase when only a single layer is interpolated between two models, while all other layers remain fixed to one of the original models.
- Cumulative Averaging: To observe how barriers emerge, layers are averaged one by one, starting from either the input or the output. This reveals when the collective weights trigger a performance collapse.
- Robustness and Curvature Analysis: The authors compare the sensitivity of the loss surface in the direction of another model versus random directions to determine if the path between models is geometrically unique.
Key Insights: Individual Layers are "Barrier-Free"
Across a comprehensive suite of datasets and architectures—including ResNets, Vision Transformers (ViTs), and Large Language Models (LLMs) like Pythia—the study reveals a striking pattern: individual layers are almost entirely barrier-free.
When averaging a single layer, the resulting model experiences virtually no loss increase, even in cases where averaging the entire network leads to total failure. For example, with ResNet18 on CIFAR-10, single-layer averaging stayed within ~2% of the original models' performance.
Interestingly, barriers do not typically start at the input or output layers. Instead, they emerge most strongly when middle layers are averaged together. This "Middle Layer Effect" aligns with recent theories suggesting that deep networks learn simple 1D functions in their middle sections, making their combined interactions highly sensitive. The notable exception is often the very last layer (the output head), which can show a higher barrier due to its direct impact on the final probability distribution.
Theoretical Foundation: Layer-wise Convexity
To back up these empirical findings, the authors provide a mathematical proof showing that for deep linear networks, the loss function is actually convex with respect to the weights of any single layer.
This theoretical insight suggests that the "complexity" and non-convexity of the loss surface are emergent properties of layer interactions, rather than inherent properties of the layers themselves. Furthermore, the direction pointing from one model to another is a "special" direction of high curvature. The network is much more sensitive to changes in the direction of a sibling model than it is to random noise of the same magnitude.
Implications for Federated Learning
These findings present a "Personalization Paradox" for Federated Learning. Common wisdom suggests averaging "global" layers and keeping "local" layers to handle non-i.i.d. data scenarios. However, the authors tested various partial averaging strategies (e.g., averaging only the body or only the head) and found that no specific layer-wise grouping consistently outperformed full averaging. Because layers are so deeply interconnected, partial averaging heuristics may need to be entirely rethought.
Future Directions
While this study provides a robust look at "end-of-training" models, investigating how these layer-wise barriers evolve during the training process could unlock deeper insights. Additionally, preliminary results suggest that hyperparameters like learning rate significantly affect LLMC, with higher learning rates promoting features that are easier to connect. Finally, extending the elegant linear network proofs to fully account for non-linearities (like ReLU or Attention) in very deep networks remains an exciting frontier for theoretical machine learning.
Summary updated