Networks

The Hopfield Network

A web of simple on/off units wired by a single rule becomes an associative memory: show it a corrupted, half-erased pattern and it cleans itself up — flowing back, pixel by pixel, into the complete memory it most resembles.

Pick a stored pattern with recall and the network shows you a corrupted cue of it; press play and watch the noise melt away as the state slides downhill into the clean memory. Drag on the grid to flip neurons and draw your own pattern, then run it to see which memory it collapses into. The readout tracks the falling energy and the overlap with the nearest stored pattern (→ 1.0 on perfect recall).

What you're seeing

A grid of 576 tiny units (24×24), each holding just one bit — on (bright) or off (dark). Every unit is wired to every other, and a handful of whole-grid patterns — a heart, a ring, a checkerboard, stripes, a pinwheel — have been stored in those wires. Hand the network a damaged version of one of them, with a quarter of its pixels randomly flipped, and let it run. Unit by unit it corrects itself, the static dissolves, and a recognizable memory condenses out of the noise. No single unit "knows" the heart; the memory lives only in the pattern of connections, and recall is the network physically relaxing into it.

The rule

Two ingredients — one to store, one to recall.

The magic is that every such update can only ever lower a single global quantity, the energy  E = −½ Σij Wij si sj. So the state can never climb; it slides monotonically downhill and comes to rest at the bottom of an energy valley — a fixed point where no unit wants to flip. Hebbian storage carves a valley around each stored pattern, so the network settles into whichever memory the cue was nearest. Watch the energy readout fall and then flatten: that flattening is the moment of recall.

Why it matters

This is content-addressable memory and collective computation emerging from dumb two-state parts. Ordinary computer memory is addressed by location — you must know where a thing is stored to retrieve it. A Hopfield network is addressed by content: hand it a fragment or a noisy version, and it completes and corrects it. No unit holds a memory; the memories live in the pattern of connections, and recall is a physical relaxation to an energy minimum, exactly like a ball rolling into the nearest bowl. John Hopfield's 1982 paper that introduced this is literally titled "Neural networks and physical systems with emergent collective computational abilities" — the emergence is the whole point. It made the energy-landscape picture of memory concrete, seeded the statistical physics of neural networks, and shares its mathematics with spin glasses and with this Atlas's Ising model (the same energy E = −½ Σ Jij si sj over ±1 spins). The work was recognized with the 2024 Nobel Prize in Physics, shared by Hopfield and Geoffrey Hinton.

There is a hard limit, and it is instructive. A network of N units can store only about 0.138·N random patterns before recall breaks down (Amit, Gutfreund & Sompolinsky, 1985). Push the stored slider past that capacity and the valleys start to merge: clean recall decays into spurious states — blends and mixtures of several memories that the network invents but was never taught. That failure mode is not a bug in the demo; it is a real and well-studied property of the model.

In the wild

The Hopfield network is the textbook model of associative and content-addressable memory, and a clean illustration of error correction by relaxation: a corrupted signal flows back to the nearest stored "codeword." More broadly it gave us the energy-landscape view of memory and computation — the idea that solving a problem can mean letting a physical system roll downhill to a minimum, which also underlies optimization networks and Boltzmann machines. The idea is alive in current research: "modern Hopfield networks" with a sharper energy function can store exponentially many patterns and turn out to be mathematically equivalent to the attention mechanism at the heart of Transformer language models.

Honesty check: this is a principle-capturing toy, not a model of a brain. Real neurons are not binary, their connections are not symmetric, and no brain region is fully connected with weights frozen by a single Hebbian snapshot. The value here is the clean demonstration that robust, content-addressable memory and a tiny analog computer can emerge from simple, identical units wired by one local rule — not that biological memory works this way in detail. It does not.

Try this

The other Networks entries — Preferential Attachment and Slime Mould Networks — are about how a physical or transport network grows. This one is the complementary facet: how dynamics running on a fixed network can compute and remember.

References

  1. Hopfield, J. J. (1982). "Neural networks and physical systems with emergent collective computational abilities." Proceedings of the National Academy of Sciences 79(8), 2554–2558.
  2. Hopfield, J. J. (1984). "Neurons with graded response have collective computational properties like those of two-state neurons." Proceedings of the National Academy of Sciences 81(10), 3088–3092.
  3. Amit, D. J., Gutfreund, H. & Sompolinsky, H. (1985). "Storing infinite numbers of patterns in a spin-glass model of neural networks." Physical Review Letters 55(14), 1530–1533. (Capacity ≈ 0.138·N.)
  4. Hebb, D. O. (1949). The Organization of Behavior. Wiley. (The "fire together, wire together" rule.)
  5. "The Nobel Prize in Physics 2024" (John J. Hopfield and Geoffrey E. Hinton). nobelprize.org.