Hopfield memory: scribble, scramble, recall

Store a tiny pattern in a 1982-style associative memory, flip random bits, and watch asynchronous recall pull the shape back while energy drops: physics on a 10×10 grid.

y26w42

Last week you talked to a rule-based therapist with zero neurons. This week the opposite trick: no hand-written rules, just a soup of ±1 cells and symmetric weights that John Hopfield described in 1982, the same associative-memory idea that helped earn him a share of the 2024 Nobel Prize in Physics.

A Hopfield network is content-addressable memory. You show it a pattern once; Hebbian learning etches pairwise correlations into the weights. Later you can feed in a noisy or partial version and the network relaxes cell by cell until a familiar shape reappears, or until it lands in a wrong “spurious” attractor if you stored too many patterns at once. The update rule is local (each cell listens to its neighbors), but the global story is energy minimization: every flip lowers an energy function borrowed from statistical physics.

How to play:

  1. Pick Smiley, Heart, or Letter H (or draw your own), then press Memorize.
  2. Drag Noise and hit Scramble until the face is barely recognizable.
  3. Press Recall run and watch the grid snap back while Energy ticks downward. Try Recall step if you want to see each synchronous sweep.

Store two different presets back-to-back, scramble hard, and see whether the network recalls the first pattern, the second, or a ghost blend (a toy version of limited capacity).

Why this matters

Before deep learning’s giant matrices, Hopfield nets made “learning” feel like dynamics: memories as valleys in an energy landscape. Geoffrey Hinton’s Boltzmann machines grew directly from this picture. Today’s transformers are far away in architecture, but the intuition survives: inference as settling into a low-energy state.

Read how Hopfield’s work surfaced in our Nobel 2024 piece, or revisit the 1958 perceptron for the earlier single-layer story. For vocabulary, see neural network and unsupervised learning: storing patterns without labels is the point.

Missed the earlier editions? Train a perceptron, watch a Markov chain babble, lose to unbeatable tic-tac-toe, teach a filter to see edges, watch an agent learn from reward, see how a model reads text in tokens, watch one roll downhill to learn, let a machine find groups on its own, see a line learn to bend, watch words decide who to listen to, explore vs exploit on slot machines, or chat with ELIZA.

Presets

Hopfield networks store patterns as an energy landscape. Memorize turns your black cells into Hebbian weights; Scramble flips random bits; Recall lets each cell follow its neighbors until the grid stops changing. Watch energy fall as the network “rolls downhill”.