TL;DR
When you train two neural networks independently, you can often merge them by simply averaging their weights—provided you first unscramble their hidden neurons so they match up. Until now, this unscrambling mostly relied on rigid, one-to-one neuron swaps, which fail when networks have different widths or distribute a single task across multiple neurons. Spectral Re-Basin solves this by treating each layer as a graph of neurons and aligning their underlying "frequencies," allowing us to smoothly merge models even when their widths don't match or their symmetries are broken.
What Problem Does This Paper Address?
Imagine two chefs who independently invent the exact same soup recipe, except Chef A lists the ingredients alphabetically and Chef B lists them by weight. If you blindly average their recipes line-by-line, culinary disaster ensues.
Neural networks suffer from the same quirk. Two independently trained models might learn the exact same representations, yet sit miles apart in weight space because their hidden neurons are ordered differently. If you average their weights directly, accuracy plummets—a phenomenon known as a loss barrier. When you can draw a straight line between two models in weight space without the loss spiking, they enjoy Linear Mode Connectivity (LMC).
Standard "re-basin" methods achieve LMC by finding a one-to-one permutation—literally playing matchmaker to swap Chef A’s neurons into Chef B’s order ("teleporting" Model A into Model B's loss basin).
But one-to-one swaps are far too rigid for real-world messy networks:
- Neuron splitting: Model A might use one strong neuron to detect an edge, while Model B splits that exact same job across two weaker duplicate neurons (as shown above). Swapping indices cannot merge or split neurons.
- Mismatched widths: You cannot do a bijective, one-to-one swap between a layer of 128 neurons and a layer of 256 neurons.
- Broken symmetries: Some modern architectures intentionally break permutation symmetries, leaving traditional matchmakers helpless.
Methods
Instead of matching raw neuron indices, the authors borrow a brilliant trick from 3D shape matching (functional maps) and graph signal processing: align the relational geometry of the neurons.
Here is how Spectral Re-Basin works at each layer:
- Build a Neuron Graph: Unlike a computational graph, the vertices here are the layer's neurons. Each neuron gets a descriptor (either its incoming weight vector or its activation vector across data). Edges connect neurons with similar descriptors via a Gaussian kernel, capturing which neurons play similar functional roles.
- Go Spectral: From this graph, they compute a Graph Shift Operator (like a graph Laplacian, $\Delta_l$), whose eigenvectors act like a Fourier basis—capturing smooth, global "frequencies" across the neuron population.
- Find Functional Alignments: Rather than searching for a discrete permutation matrix (which requires clunky combinatorial solvers), they look for a continuous linear map $T_l$ that aligns the weights/activations and commutes with the graph operators ($\Delta_l^B T_l \approx T_l \Delta_l^A$).
- Solve via Simple Least-Squares: Expressed in the truncated, low-frequency spectral basis, finding this alignment reduces to an unconstrained, convex quadratic problem. It has a fast, closed-form least-squares solution, naturally filters out high-frequency noise, and effortlessly handles rectangular maps between layers of different widths!
Datasets
The authors evaluate their methods on standard vision and graph benchmarks (no new datasets are introduced):
- CIFAR-10 & CIFAR-100: Used for matching identical-width and mismatched-width VGG11 and ResNet20 models, as well as asymmetric ResNet20s.
- MNIST: Used for evaluating cross-width asymmetric MLPs.
- ogbn-arXiv: A citation network dataset used to test Graph Isomorphism Networks (GIN) with asymmetric, mismatched widths.
Key Insights and Ideas
- Permutations are just a special case: Classic hidden-unit permutations are simply graph automorphisms. By relaxing permutations to graph functional shifts (orthogonal operators commuting with the graph Laplacian) and rectangular intertwining maps, you capture neuron cloning, splitting, and rotations within functional subspaces.
- Math that bounds the barrier: The authors prove theoretically that the exact layerwise least-squares residual minimized by their algorithm directly upper-bounds how far the rebased weights land from the target network—and, consequently, bounds the height of the linear interpolation loss barrier.
- Activations decouple the layers: When matching weights, layer $l$ depends on how you aligned layer $l-1$. When using the activation-based variant of Spectral Re-Basin, every layer's alignment problem decouples completely and captures what neurons actually do on data rather than just how they are wired.
Key Results
Across every regime, activation-based Spectral Re-Basin leads the pack, while the weight-based variant consistently beats standard weight matching.
- Identical Architectures: When merging pairs of VGG11 ($\times 1, \times 8$ width) on CIFAR-10 and ResNet20 ($\times 1, \times 8$ width) on CIFAR-100, naïve weight averaging crashes to under 20% accuracy. Activation-based Spectral Re-Basin recovers midpoint accuracy nearly identical to the original base models (~87% on VGG11 and ~78% on ResNet20 $\times 8$), beating Optimal Transport (OT) fusion and CCA merge.
- Mismatched Widths: When merging narrower models into wider ones (e.g., $\times 1 \rightarrow \times 4$ and $\times 4 \rightarrow \times 8$), baselines padded with zeros struggle. Activation-based Spectral Re-Basin achieves the highest midpoint accuracy across all four transitions (topping ~85% on VGG11 $\times 4 \rightarrow \times 8$, where CCA variants sit around 40–65%).
- Asymmetric Networks: Even when parameter symmetries are explicitly broken and widths differ (e.g., ResNet20 $\times 4 \rightarrow \times 8$), Spectral Re-Basin slashes the midpoint test loss barrier from over 3.0 (naïve) down to near-zero, succeeding on CIFAR-10 and ogbn-arXiv where OT and CCA fail.
Limitations and Future Work
- No depth mismatch (yet): The framework aligns models layer-by-layer, meaning it cannot currently align a 10-layer network with a 20-layer network where one layer's job is spread across a multi-layer block.
- Approximate symmetries & data dependence: Dense or rectangular maps aren't exact symmetries of nonlinear networks like permutations are, so rebasing can slightly distort the endpoint function. Furthermore, the top-performing activation variant relies on a sample of training data, meaning alignment could degrade under distribution shifts.
- Next steps: The authors point toward aligning entire computational subgraphs/blocks across different depths, and applying Spectral Re-Basin to task-vector merging—combining fine-tuned specialist models into a single multi-talented network.
Summary updated