Proving Linear Mode Connectivity of Neural Networks via Optimal Transport

Damien Ferbach, Baptiste Goujaud, Gauthier Gidel, Aymeric Dieuleveut · DOI

Abstract

Linear Mode Connectivity (LMC) suggests that two independently trained neural networks can be connected by a low-loss linear path after accounting for permutation invariance. While empirically observed, a theoretical foundation has been lacking. This paper frames neuron permutation as an Optimal Transport problem, proving that LMC is guaranteed for sufficiently wide networks. We introduce a novel weight-matching algorithm based on activation covariance that outperforms standard methods, providing both theoretical bounds and empirical validation for the existence of these low-loss paths.

Introduction: The Mystery of the Loss Landscape

Training deep neural networks involves navigating a complex, non-convex loss landscape. Conventional wisdom suggests that different random initializations lead to isolated local minima separated by high-loss barriers. However, recent empirical studies have challenged this, showing that if the neurons of one network are correctly reordered (permuted), the linear interpolation between two sets of weights often remains within a low-loss region. This phenomenon, known as Linear Mode Connectivity (LMC), implies a much simpler connectivity in the loss landscape than previously thought.

The primary challenge has been the lack of a rigorous theoretical explanation. Why do these paths exist, and what conditions—such as network width—are necessary to guarantee them? This paper addresses these questions by leveraging the mathematical framework of Optimal Transport (OT).

Methodology: Permutation as Optimal Transport

The authors propose that finding the optimal permutation to align two models is equivalent to solving the Monge problem, a classic task in OT theory aimed at moving mass between distributions with minimal cost.

The OT Framework

By treating the neurons in a hidden layer as a discrete distribution, the task of reordering them to match another network becomes a problem of finding a permutation matrix that minimizes the distance between weight distributions.

Illustration of neuron permutation to achieve linear mode connectivity between two networks.

For two-layer networks, the authors employ "mean-field" theory, which models neurons as particles in a continuous fluid. This allows the use of the Wasserstein distance to bound the error along the linear path between models. For deeper Multi-Layer Perceptrons (MLPs), they develop a recursive framework to demonstrate how alignment at one layer propagates through the network.

Activation-Aware Weight Matching

Standard weight-matching techniques often align models based solely on static weight values. The authors argue this is "naive" because it ignores how neurons actually process data. They introduce WM (ours), a method that incorporates the covariance of activations. By matching neurons based on their functional behavior on real data, this approach finds a more effective alignment than static weight analysis alone.

Key Insights: Dimensionality and Training

A critical finding of this research is the relationship between LMC and the intrinsic dimension of the weight distribution. The "curse of dimensionality" suggests that as the dimensionality of the weights increases, the network width required to guarantee LMC grows exponentially.

However, the authors observe that the training process itself simplifies the landscape. Training tends to push weights into a lower-dimensional subspace. This reduction in "effective" dimension explains why LMC is more easily achieved after some training—the Optimal Transport problem becomes significantly easier to solve with a finite number of neurons.

Empirical Results

The theoretical predictions were validated using MNIST and CIFAR10 datasets. The experiments focused on measuring the "error barrier"—the maximum loss encountered along the linear path between two models.

LMC error across different learning rates, comparing the proposed weight-matching (WM) method against baselines.

As shown in the results, the proposed activation-aware weight-matching method consistently achieves a lower error barrier compared to naive weight matching and other baselines, particularly at higher learning rates. Furthermore, the researchers empirically confirmed that LMC effectiveness correlates strongly with the approximate dimension of the weight distribution, supporting their OT-based theory.

Limitations and Future Directions

While providing a significant theoretical leap, the study notes several areas for future work:

  • Independence Assumption: The current proofs assume neuron weights are approximately independent, a condition that might not hold in extremely deep or highly regularized networks.
  • Architectural Complexity: Extending this rigor to Convolutional Neural Networks (CNNs) and Transformers is challenging due to weight sharing and attention mechanisms.
  • Optimizer Influence: The results were more pronounced for SGD than for Adam, suggesting that the choice of optimizer plays a role in how the weight dimensionality evolves during training.

Conclusion

By bridging deep learning and Optimal Transport, this work provides the first explicit width bounds and theoretical guarantees for Linear Mode Connectivity. The shift from static weight matching to activation-aware alignment offers a more principled way to merge and compare neural network models, opening new doors for understanding the geometry of deep learning loss landscapes.

Summary updated

BibTeX
@inproceedings{ferbach2024proving,
  author = {Damien Ferbach and Baptiste Goujaud and Gauthier Gidel and Aymeric Dieuleveut},
  title = {{Proving Linear Mode Connectivity of Neural Networks via Optimal Transport}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=OAe4MokZn3},
}
Figure