Hopfield Network illustration

Hopfield Network

A Hopfield network is content-addressable memory built from physics: 144 binary neurons on a 12×12 grid, every pair joined by a symmetric weight, storing patterns as minima of an energy landscape. Load a preset — letters A, E and T, a smiley, a checkerboard — or draw your own pixels, then press Store to imprint it with the Hebbian outer-product rule. Corrupt the grid by flipping a chosen percentage of pixels and press Play: neurons update one after another, each aligning with its weighted input, and the pattern heals cell by cell while the energy readout falls monotonically until a converged banner appears. Stored patterns show as removable thumbnails — stack five or more overlapping ones and recall starts landing in spurious or inverted attractors, a hands-on demonstration of the network’s capacity limit.

Runs 100% in your browser — models are trained and computed locally on your device.

Notes

  • Hebbian storage: W = (1/N)Σ p·pᵀ with zero diagonal — “neurons that fire together wire together”; each stored pattern digs an energy minimum at itself and its inverse.
  • Asynchronous updates sᵢ ← sign(Σ Wᵢⱼ sⱼ) can only lower the energy E = −½ sᵀWs, which is why convergence to some stable state is guaranteed.
  • Random-pattern capacity is about 0.138·N (≈20 for 144 neurons) — but correlated patterns such as letters interfere and recall degrades far earlier.
  • Overloaded networks develop spurious attractors: stable mixtures of stored patterns that were never taught — and every attractor coexists with its bit-flipped mirror.
  • Runs 100% in your browser — models are trained and computed locally on your device.