Week 5 — Hopfield Dynamics and the Meaning of a Capacity

Notes for the neural-networks course, Unit 1. Written by an AI assistant under the researcher’s supervision; see ai-authorship.

Weeks 3 and 4 varied the weights with the data fixed. This week does the opposite: the couplings are built once from the stored patterns and then held, and it is the state that moves. The change is easy to state and easy to lose sight of, and half the confusions about associative memory come from losing it. The week ends with a capacity that is a different number for a different question, and with the reasons the two numbers do not compete.


Learning goals

  1. Recover a stored pattern from a corrupted cue by hand, and state which objects are fixed and which evolve.
  2. Prove that the Hopfield energy decreases at every actual flip, and identify every hypothesis the proof uses.
  3. Decompose the local field into signal and interference and say what the interference does at extensive load.
  4. Interpret together with the retrieval criterion and the ansatz that produce it.

Reading

Primary text. Chapter 2, §2.6 and §2.7, with the four-spin worked example and the asymmetric three-spin exercise.

Primary literature, through the bibliography: Hopfield (1982); Amit, Gutfreund and Sompolinsky (1985, 1987).

Prerequisites. Week 4 for the replica vocabulary; the retrieval equations here are quoted with their ansatz stated and are not re-derived.

1. From a corrupted cue to a stored pattern

An associative memory reconstructs a stored pattern from an incomplete or corrupted cue. Let the stored patterns be , , and define the symmetric Hebb couplings once:

The evolving state is . Its local field and energy are

At each step choose one site and replace by ; if , leave it unchanged. This is asynchronous updating. A fair schedule eventually visits every site. Couplings remain fixed throughout recall. This differs from training, which changes weights.

Four spins, with all fields visible

Store only , and start at . The overlap measures agreement: is exact retrieval, while initially . Since there is only one pattern,

Only the first spin opposes its field. Flipping it restores . Completing the sum in the energy gives

It changes from to . The overlap changes from to . Updating any other site first leaves this particular cue unchanged. The Hopfield browser experiment implements this example.

2. Why the energy decreases, and what the proof needs

With symmetric couplings and zero diagonal, collect all terms involving site as . Replacing by gives

For a flip , this is . A flip occurs only when the old value opposes a nonzero field, so every actual flip lowers the energy by .

The configuration space is finite. Strict decrease prevents any configuration recurring after a flip, so fair asynchronous updating reaches a fixed point. The energy is a Lyapunov function for the dynamics.

Four hypotheses carry this argument. Symmetry of the couplings, so the quadratic form’s site- terms collect. Zero diagonal, so a site does not act on itself. The asynchronous rule — updating all spins at once is a different dynamics and does not inherit the proof. And the tie convention at : nonincrease alone would permit motion at constant energy, and the strictness is what rules it out.

Physical picture. This is the standard termination argument and worth naming as such: a strictly decreasing function on a finite state space cannot cycle, so the dynamics halts. What it does not say is where. A fixed point is stable against single-spin changes, and need not be a global minimum; and the set of cues flowing to a given fixed point — its basin of attraction — is a separate object that the proof says nothing about. Successful memory needs suitable basins as well as suitable fixed points, and the laboratory measures exactly that gap.

3. Signal, interference, and extensive load

For a single stored pattern the field decomposes into the overlap times the pattern, minus a finite- self-term from the zero diagonal, as in the four-spin calculation above. For several patterns define . Direct substitution gives

The first term is the target signal, the sum is crosstalk from the other patterns, and the last term removes the diagonal interactions. This formula is exact. Treating the crosstalk as independent Gaussian noise is a further approximation.

At fixed and large the non-retrieved overlaps are typically of order and the crosstalk is negligible. At extensive load, , the summed fluctuations stay of order one, and the interference competes with the signal. That is the regime the capacity question lives in.

Physical picture. The natural first move is a signal-to-noise estimate: treat the crosstalk as a Gaussian of variance and ask when it flips a bit. The book does exactly that as an exercise and gets a capacity scaling like for the demand that every bit of a pattern be stable. What the estimate omits is feedback — the flipped bits change the state, which changes the interference — and the replica treatment exists to put that feedback back in. The difference between the naive estimate and the full answer is not a detail: it is the difference between a sum of independent random signs and a self-consistent one.

4. What means

Amit, Gutfreund and Sompolinsky studied the extensive-load problem for independent random binary patterns. The book quotes their zero-temperature replica-symmetric retrieval equations with the ansatz stated, and does not re-derive them: the effective field is the signal plus a Gaussian of variance , averaging its sign gives the overlap self-consistently, and a response relation with a feedback factor closes the system.

Here are the quoted zero-temperature replica-symmetric equations, so the number can be reproduced. Let be the target overlap, the amplification of crosstalk variance and the response factor:

These relations are a replica-symmetric ansatz, not the exact finite- local update. Put and eliminate to obtain

The retrieval branch terminates at the maximum of this curve, . The overlap there is still about : the branch does not degrade smoothly to zero, it ceases to exist.

Every word of the following qualification is doing work. The number refers to the replica-symmetric, thermodynamic-limit, Hebbian retrieval problem with independent random binary patterns and a macroscopic-overlap success criterion. It is a spinodal — the point at which the retrieval branch stops existing — and not automatically the point at which retrieval loses global equilibrium stability, which would require comparing free energies.

Physical picture. There is no contradiction with the perceptron’s , and seeing why is the point of the week. The perceptron question is whether some weight vector satisfies random classification constraints — an optimization over couplings, with the couplings free. The Hopfield question fixes the couplings by a particular prescription, the Hebb rule, and asks about the attractors of the dynamics that prescription produces. Optimizing the couplings instead changes the storage problem, and constraints such as symmetry and a required basin of attraction cannot be dropped when transferring a bound between the two. Different question, different construction, different number.

Checkpoints with answers

1. Which object moves during recall? The spin configuration . The stored patterns and the couplings computed from them remain fixed.

2. What proves termination of the stated rule? Each actual flip strictly lowers energy, there are finitely many configurations, and zero-field spins are left unchanged. A fair schedule eventually reaches a state with no allowed energy-lowering flip.

3. Does a final low energy prove retrieval? No. Compute the overlap with the intended pattern. Other local minima can have small target overlap even when every spin agrees with its field.


Subtleties and fine print

Low energy is not retrieval. A spin-glass state can have frozen local values and negligible overlap with any stored pattern. Energy descent is a termination certificate, not a retrieval certificate, and the laboratory must therefore state an overlap threshold for success in advance.

Asymmetric couplings break the proof, and can cycle. The book’s three-spin exercise exhibits a periodic orbit under repeated sweeps. The example shows possibility, not inevitability: it does not prove every asymmetric system cycles, nor that none admits some other Lyapunov function.

Synchronous updating is a different dynamics. It does not inherit the descent proof, and its fixed points and cycles are a separate question.

At zero temperature the freezing parameter does not identify retrieval. alone does not distinguish a retrieved frozen state from any other frozen state; the pattern overlap is what does.

A finite-size experiment will not reproduce exactly, and should not be forced to. The number is a thermodynamic-limit statement about a particular criterion. A protocol with its own corruption fraction, update schedule and success threshold has its own threshold, and reporting the difference honestly is the deliverable.


Key claims and status

ClaimStatus
at every actual flip[Exact], for symmetric couplings, zero diagonal, asynchronous rule, stated tie convention
Fair asynchronous updating reaches a fixed point[Exact], from strict decrease on a finite state space
Single-pattern field and energy from completing the sums[Exact.]
Crosstalk decomposition of the field around a target[Exact.]
Non-retrieved overlaps of order at fixed [Exact] as a typical statement
Gaussian signal-to-noise capacity scaling like for exact stability[Controlled approximation]; neglects feedback correlations
, overlap at the branch end[Replica-symmetric], thermodynamic limit, Hebbian, random binary patterns
A cycle exists for the stated asymmetric three-spin coupling[Exact] for that example

What the week establishes

  1. The Hopfield energy falls at every actual flip, and the dynamics therefore terminates — with four hypotheses, each shown to be load-bearing.
  2. The local field decomposes exactly into signal, crosstalk and a finite- self-term, and the crosstalk becomes competitive precisely at extensive load.
  3. A retrieval branch exists up to and terminates there discontinuously in the overlap, under the stated ansatz and criterion.
  4. The perceptron and Hopfield capacities answer different questions, and the reason is structural rather than numerical.

What to carry forward. A capacity is a number attached to a question, and quoting it without the question attached is the most common way to misuse the results of this unit. Week 6 will produce a third capacity scale, larger than both of these, and the first thing to ask about it is what resource it counts.

The practical session — Laboratory 2

Varied: the number of stored patterns , at several system sizes ; and the cue corruption fraction. Held fixed: the pattern ensemble, the zero-field tie rule, the update schedule, and the overlap threshold used to call a run successful — all declared before the runs, not after. Measured: the final overlap with the target, the retrieval frequency over repeated pattern draws and cues, and the energy.

Product: retrieval frequency against at each , with the success criterion stated; a comparison of the size dependence with what a replica-symmetric thermodynamic-limit result actually claims; and an explicit statement that the protocol’s threshold is not required to equal .

Begin by reproducing the four-spin example and its energy change by hand. A laboratory that cannot reproduce the exactly solvable case should not be trusted on the extensive one.


Connections to other parts of the wiki

  • Week 4 asks the feasibility question with the couplings free; this week fixes them by a prescription and asks about attractors.
  • Week 6 generalizes the energy, raising the capacity scale, and then derives the attention operation from a continuous version of the same construction.
  • The Lyapunov argument of §2 returns in Week 9, where a driven version of the same inequality is shown not to give a common decreasing energy.
  • nn-llm-unit-1 — the block skeleton this note implements.

Start here · All weeks · Book and experiments · Previous week · Next week