Hebbian Surgery
All basin surgery operations use Hebbian and anti-Hebbian learning rules — rank-1 perturbations of the weight matrix W.
Hebbian Learning
The classic Hebbian rule: "neurons that fire together wire together." In matrix form:
ΔW = α · outer(pattern, f(pattern))This strengthens the association at pattern, making it a deeper basin in the energy landscape.
Anti-Hebbian Learning
The inverse: weaken an association.
ΔW = -α · outer(pattern, f(pattern))This raises the energy at pattern, reducing or eliminating the basin.
Strength Normalization
The strength parameter α is normalized relative to the existing weight matrix:
α = strength · ‖W‖_F / ‖outer(pattern, f(pattern))‖_FThis makes surgery scale-preserving — a strength of 0.1 means approximately 0.1% change to the Frobenius norm of W, regardless of the model size or layer.
Operations
Inject
W_new = W + α · outer(target, f(target))Creates or deepens a basin at target. The target vector is first converged to find the natural basin direction, then the outer product update is applied.
Remove
W_new = W - α · outer(target, f(target))Weakens or eliminates the basin nearest to target.
Move
W_tmp = W - α · outer(source, f(source)) # remove at source
W_new = W_tmp + α · outer(dest, f(dest)) # inject at destinationCombines remove and inject in sequence.
Strengthen / Weaken
Same as inject/remove but applied to an existing basin with a scaling factor.
Verification
After every surgery, verification checks that the edit worked:
- Take the target state
- Add 10% Gaussian noise
- Run convergence dynamics
- Check if cosine similarity to original target > 0.9
If yes: the basin exists (surgery succeeded). If no: the basin was not created or was destroyed (adjust strength).
Why Rank-1?
A rank-1 update is the minimal perturbation that can create or destroy a single basin. Higher-rank updates would affect multiple basins simultaneously, making surgery imprecise. The Hebbian outer product targets exactly one pattern while minimally disturbing the rest of the landscape.