Skip to experiment
SYN·CO·RE LAB AI Experiment · PSY3230

Hopfield Network

Associative memory: store patterns, show the network a corrupted cue, and watch it fall into the nearest memory. John Hopfield, 1982 — Nobel Prize in Physics, 2024.
What is happening here?

Every pixel is a neuron (+1 black / −1 white), and every neuron is connected to every other. Storing a pattern strengthens connections between pixels that are on together — Hebb's rule: what fires together, wires together. Recall is each neuron repeatedly asking its neighbors what state it should be in.

This makes memory content-addressable: you retrieve with a partial or noisy version of the content itself, not with an address. Computers look up; this network settles — each update can only lower a global "energy", so the state rolls downhill into the nearest stored pattern, like a ball into a basin. That is pattern completion, and it is a serious model of how recalling the smell of a kitchen can summon the whole scene.

It also fails in instructive ways. With the classic Hebbian rule, capacity is only ~0.14 patterns per neuron (~14 here), and similar patterns are far worse: the letters S, C and R overlap so much that their basins merge and recall collapses into blends or spurious memories — stable states the network "remembers" although they were never stored. Switch the learning rule below to see this: the pseudo-inverse rule first decorrelates the patterns and recalls them cleanly; plain Hebbian learning fails on exactly the same memories. Interference between similar memories is a real phenomenon in human memory, too.

Pattern (draw with the mouse)

presets:
20%
learning rule:

Stored memories

Energy during recall

Each neuron update can only lower the energy — the network always settles, but not always where you hoped.