Hopfield network

Hopfield associative memory with live noise, presets, animated recall, and energy plot.

About this tool

A binary Hopfield memory stores one 8 × 8 pattern. Choose a preset or enter your own grid using . / # or 0 / 1. The three images show the stored pattern, seeded input cue and current recalled state. Blue cells are +1, empty cells −1.

Flip probability independently toggles each input pixel; it is not an exact percentage of changed pixels. The actual flip count is shown. Seed reproduces both the cue and shuffled update order. Agreement is the percentage of pixels matching the stored pattern: 100% is recovery and 0% is its complement.

Weights are unnormalized Hebbian products Wᵢⱼ = pᵢpⱼ for i ≠ j, with Wᵢᵢ = 0. One neuron changes at a time to the sign of its local field; at zero field it keeps its state. Energy E = −Σᵢ<ⱼ Wᵢⱼsᵢsⱼ cannot increase. There are no thresholds, learning epochs or trained image features.

Run animates four updates per frame. Pause/Resume preserves the current state; One update steps a single neuron. A full sweep without any changes confirms convergence; ten sweeps is a safety limit, not proof of convergence. The complement is equally stable, so high noise need not recover the original. Input changes discard the old run; Reset restores the same seeded cue, keeping your parameters. CSV exports the full energy/overlap trace with the actual pattern and seed.

This is a single-pattern teaching model, not a multi-pattern recognition system. Energy uses this weight convention and has no physical unit. The energy plot uses update count, not elapsed time. Hopfield (1982).