Traversing the solution space of neural networks with Hessian Null Space Continuation
Organizations: Harvard University · Harvard Medical School · Kempner Institute · Massachusetts Institute of Technology ·
Abstract
On a single task, deep networks can learn many solutions, depending on their optimizer, training data, architecture, and hyperparameters. Many of these solutions are mode-connected: rather than isolated points in weight space, they are connected by low-loss regions. Yet how their internal computation varies within these regions is unknown. A parallel line of work has identified the degeneracy of neural representations: many networks reach similar training loss with distinct internal structures. However, it is unclear how these solutions are related in weight space. We unify these subfields and show for the first time that many different internal mechanisms exist within a local mode-connected region in weight space. To do so, we introduce Hessian Null Space Continuation (HNC), a scalable method that uses local curvature to traverse regions of weight space that preserve network function, and can be steered toward solutions with specified properties. In RNNs trained on a memory task, HNC reaches drastically different representations and dynamics with maintained behavior. In ImageNet-trained Vision Transformers, HNC finds representations that differ more from the original network than any independently trained model with a different architecture or objective. In reinforcement-learning agents, HNC uncovers a distinct navigation strategy at comparable return and exposes reward hacking in an AI Safety Gridworld. Finally, HNC measures the local geometry of the solution set, showing how model size and task complexity shape its dimension and functional sensitivity. Our results show that a surprisingly large amount of representational diversity exists near a single trained solution, unseen by standard gradient-based optimization. HNC identifies and quantifies this diversity, opening new possibilities for mechanistic understanding of solution spaces and for model merging, editing, and fine-tuning.
Figures & tables
Appendix figures & tables46 assets
Supplementary material from the paper’s appendix.
Appendix
| Dense eigendecomposition | Matrix-free LOBPCG | |
|---|---|---|
| Time | ||
| Memory | ||
| Memory, 3BFF RNN ( ) | MB | MB ( ) |
| Time, 3BFF RNN | s | s ( ) |
| Memory, ViT-S ( M) | PB | GB ( ) |
| Time, ViT-S | products to assemble ( months of GPU time), factorization infeasible | s per product; one continuation step min |
| Pred. match (probe) with | ||||
|---|---|---|---|---|
| Preserved quantity | # constraints | |||
| Full logits | ||||
| Per-image cross-entropy | ||||
| Mean cross-entropy | ||||
| absolute flatness threshold | median dimension | fraction of | ||
|---|---|---|---|---|
| 1701 | 36.9% | |||
| 2896 | 62.8% | |||
| 3684 | 79.9% | |||
| 4145 | 89.9% | |||
| 4418 | 95.8% | |||
| 4565 | 99.0% |
| Hyperparameter | Value |
|---|---|
| Flat directions | explicit basis of eigenvectors with |
| Step direction | one random heading direction uniformly sampled from , held fixed and re-projected onto the current basis at every relinearization |
| Restore steps | per null-space step |
| Null-space step size | starts at , halved on rejection and grown on acceptance of a step; lower bounded by and upper bounded by |
| Loss ceiling | |
| Relinearization | every accepted steps or on rejection, at most times |
| Hyperparameter | Value |
|---|---|
| Flat directions | soft projection with damping |
| Step direction | gradient of the steering objective, after a seeded random first step |
| Steering objective | between the hidden states of the current network and the anchor, on a probe of trials |
| Solver | plain CG, iterations, started from zero at every step (Appendix A.3 ) |
| Restore steps | per null-space step |
| Null-space step size | starts at ; halved on rejection down to |
| Hyperparameter | Value |
|---|---|
| Flat directions | soft projection with damping |
| Step direction | gradient of the steering objective, after a seeded random first step |
| Steering objective | DSA distance between the hidden-state dynamics of the current network and the anchor ( delays, rank ), on a probe of trials |
| Solver | plain CG, iterations, started from zero at every step (Appendix A.3 ) |
| Restore steps | per null-space step |
| Null-space step size | starts at ; halved on rejection down to |
| Hyperparameter | Value |
|---|---|
| Anchor | ImageNet-trained ViT-S/16, M parameters |
| Probe set | Places-365 images |
| Flat directions | soft projection with damping |
| Solver | preconditioned conjugate gradient, iterations |
| Steering objective | of Eq. 12 , |
| First step | random direction, soft-projected |
| Hyperparameter | Value |
|---|---|
| Anchor | ImageNet-trained ViT-S/16, M parameters |
| Probe set | Places-365 images |
| Flat directions | soft projection with damping |
| Solver | preconditioned conjugate gradient, iterations |
| Steering objective | of Eq. 13 , , |
| First step | random direction, soft-projected |
| Hyperparameter | Value |
|---|---|
| Anchor | PPO-trained -unit recurrent policy |
| Buffer | episodes of the current policy, re-collected every steps |
| Flat directions | soft projection with damping |
| Solver | conjugate gradient, iterations |
| Steering objective | of Eq. 23 |
| Restore steps | per null-space step |
| Hyperparameter | Value |
|---|---|
| Anchor | ten PPO-trained two-layer policies (Appendix I.6 ) |
| Buffer | episodes of the current policy with -greedy exploration, ; re-collected every steps |
| Flat directions | soft projection with damping |
| Solver | conjugate gradient, iterations |
| Steering objective | of Eq. 20 |
| Restore steps | per null-space step |
| Hyperparameter | Value |
|---|---|
| Anchor | PPO-trained feed-forward actor with hidden units |
| Buffer | transitions of the current policy, re-collected every steps |
| Flat directions | soft projection with damping |
| Solver | conjugate gradient, iterations |
| Steering objective | of Eq. 23 |
| Restore steps | per null-space step |
| Width | at | at |
|---|---|---|
Mode Connectivity
Mode connectivity studies low-loss paths between separately trained neural-network solutions and what those paths reveal about optimization and model behavior.
See all 11 papers