Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Valleys joined by hidden paths
Imagine a mountain range where every valley floor is a “good” set of weights for your network. Train twice from different starting points and you land in two different valleys. Walking in a straight line from one to the other means climbing over a ridge. Yet there is often a gentle curved path between them that stays low the whole way: the valleys are really parts of one long, winding canyon. This is mode connectivity.
Connected minima make model averaging, ensembling and merging possible. Averaging weights along a low-loss path, as in stochastic weight averaging or model soups, often improves robustness, and aligning networks before merging lets fine-tuned models be combined, for example perception models trained on different robots’ data.
- 1. Two independently trained networks usually end in…
- 2. The straight line between them typically…
- 3. Mode connectivity means…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Symmetries create many equivalent minima
Swapping two hidden units (with their incoming and outgoing weights) leaves the function unchanged. A layer of n units has n! such permutations, and a network has the product over its layers. For odd activations like tanh, flipping the signs of a unit’s incoming and outgoing weights is also a symmetry. So every minimum has a huge number of exact copies elsewhere in weight space.
Barriers
For two minima θ_A, θ_B, the linear barrier is
Two minima are linearly mode-connected if B is about 0.
Flatness and sharpness
The sharpness of a minimum is the largest Hessian eigenvalue . Flat minima (small , or small trace) are associated with better generalization and robustness, though sharpness depends on parameterization, so comparisons need care (Dinh et al., 2017).
- 1. Permutation symmetries of one hidden layer with 16 units:
- 2. Barrier for path losses (0.1, 0.5, 0.3, 0.1):
- 3. Sharpness is usually measured by…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Curves between minima
Garipov et al. (2018) parameterize a quadratic Bézier curve
and learn the control point φ by minimizing . The gradient is . Near-zero-barrier curves exist for modern networks, and ensembles of points along them are diverse yet accurate.
Weight matching (Git Re-Basin)
Find the permutation π of B’s hidden units that best matches A, for example by maximizing the similarity of corresponding units’ weight vectors (a linear assignment problem per layer). Then interpolate A with π(B). For wide enough networks the linear barrier almost vanishes (Entezari et al. conjecture that, modulo permutations, SGD solutions are linearly connected).
Visualizing landscapes
Loss along a line, or on a 2-D plane through three points (as in the demo), gives honest slices. Random-direction plots need filter normalization to be comparable across networks (Li et al., 2018). Any 2-D slice of a million-dimensional surface can mislead.
- 1. The gradient of L(θ(t)) with respect to the Bézier control point is…
- 2. Weight matching solves…
- 3. Random-direction landscape plots need…
Level 3: Advanced
★★★★☆ Advanced⏱ 35 minGraduate level, with full derivations and proofs.Why minima connect: overparameterization
For a network with many more parameters than constraints, the set of global minima is typically a high-dimensional manifold. Each training point imposes one equation, so with P parameters and m points the zero-loss set has dimension about P − m (Cooper, 2018). Large connected manifolds of minima make low-loss paths between solutions natural. Kuditipudi et al. (2019) prove connectivity for networks that are dropout-stable or noise-stable.
Sharpness, training and generalization
- GD at learning rate η can’t stay in regions with (edge of stability, B4.3), so large learning rates select flatter minima.
- Sharpness-aware minimization (SAM) explicitly minimizes .
- Reparameterization (scaling layer weights by c and 1/c in ReLU nets) can change sharpness arbitrarily without changing the function, so sharpness is not intrinsic.
Averaging and merging
If two solutions are linearly connected, their average is also a solution. Stochastic weight averaging (Izmailov et al., 2018) and model soups (Wortsman et al., 2022) average fine-tuned models from a shared pre-trained start, which are linearly connected, improving accuracy and robustness.
- 1. With P parameters and m constraints, the zero-loss set has dimension about…
- 2. Why is sharpness not intrinsic for ReLU nets?
- 3. Model soups average models that…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Landscapes, measured
Exercise 1 (2→16→1 tanh, regression, two seeds). Both networks fit to training loss of order 10⁻⁴, and a random permutation of hidden units changes the loss by less than 10⁻¹⁸. The linear barrier is 0.493, about the variance of the target. After greedy weight matching it drops to 0.0113, a 40× reduction, without changing either function. (Browser numbers; results differ slightly by platform, e.g. 0.0117 on desktop CPython.)
Exercise 2. A learned Bézier curve cuts the barrier from 0.493 to 0.0033 (seed 0) and from 0.481 to 0.0061 (seed 1). The network at the curve’s midpoint, a genuinely new model, has test loss 0.0027 and 0.0037: not quite as good as the endpoints (about 10⁻⁴), but a working network. The two “isolated” solutions sit in one connected valley.
Landscapes in AI, robotics and aerospace
- Model merging: combine perception models fine-tuned on different vehicles or sensors (align, then average).
- SWA and SAM improve robustness to distribution shift, which matters for flight hardware facing new conditions.
- Cheap ensembles from points along a connecting curve give uncertainty estimates at the cost of one training run.
- Federated learning across robots relies on averaging compatible (aligned) models.
References
- T. Garipov, P. Izmailov, D. Podoprikhin, D. Vetrov, A. G. Wilson (2018). “Loss surfaces, mode connectivity, and fast ensembling of DNNs.” NeurIPS.
- F. Draxler, K. Veschgini, M. Salmhofer, F. Hamprecht (2018). “Essentially no barriers in neural network energy landscape.” ICML.
- R. Entezari, H. Sedghi, O. Saukh, B. Neyshabur (2022). “The role of permutation invariance in linear mode connectivity of neural networks.” ICLR.
- S. K. Ainsworth, J. Hayase, S. Srinivasa (2023). “Git Re-Basin: merging models modulo permutation symmetries.” ICLR.
- H. Li, Z. Xu, G. Taylor, C. Studer, T. Goldstein (2018). “Visualizing the loss landscape of neural nets.” NeurIPS.
- L. Dinh, R. Pascanu, S. Bengio, Y. Bengio (2017). “Sharp minima can generalize for deep nets.” ICML.
- P. Foret, A. Kleiner, H. Mobahi, B. Neyshabur (2021). “Sharpness-aware minimization for efficiently improving generalization.” ICLR.