← Back to the collection
LEARNING / 2023—2026 / INTERACTIVE APPLICATION

Watch a network learn, one update at a time.

ANN Visualizer

Neural Observatory makes learning inspectable: follow a handwritten digit through signals, loss, gradients, and a real optimizer update in a 3D network.

MEDIUM
  • JavaScript
BUILT WITH
  • React
  • Three.js
  • React Three Fiber
  • Web Workers
ACCESS

Private source · project overview

Neural Observatory follows four consecutive MNIST batches through forward signals, gradients, optimizer updates, and before-and-after predictions
EXPLORE THE APPLICATIONLaunch Project
Fresh default run · four consecutive batches · real gradients and Adam updates · gentle camera orbit.Open film ↗
01

Begin with an untrained network

The observatory starts from seeded random weights, not a pretrained classifier. A handwritten MNIST digit feeds 784 inputs, two ReLU hidden layers, and ten softmax outputs. The default hidden layers have 16 units; a new run can use 8, 16, or 24. The visible digit is the first example in a minibatch, and both its true label and the model’s top prediction stay visible—even when the prediction is wrong.

02

Make the update part of the story

Input → Forward → Loss → Backward → Update → Compare is one recorded computation. A Web Worker loads the dataset, runs an explicit forward pass and backpropagation, and prepares the mean batch gradients. Reaching Update applies one SGD or Adam step. Compare evaluates the same batch with the new parameters. React readouts and the Three.js scene share these snapshots; TensorFlow.js is now a development reference for numerical checks, rather than the application’s training engine.

SYSTEM SKETCH / CONCEPTUAL OVERVIEW
MNIST + SEEDED RUN → WORKER: PREPARE → RECORDED STEP
                          │                 │
                     COMMIT AT UPDATE       ▼
                          └────────── 3D SCENE + INSPECTOR
                                      REPLAY / COMPARE
A reading of the architecture, not an application screenshot.
SYSTEM MAP / WORKER PROTOCOL / RECORDED COMPUTATION

Prepare the computation. Commit once. Inspect the record.

useTraining → MNIST dataset: initialize. useTraining → prepare: prepare request. MNIST dataset → prepare: minibatch. prepare → Recorded training step: prepared snapshot. useTraining → commit at Update: timeline reaches Update. prepare → commit at Update: mean gradients. commit at Update → Recorded training step: committed snapshot. Recorded training step → NetworkScene + Readouts: playhead / selection.1234567801 / MAIN THREADuseTrainingSeed + optimizer + batch sizeRun-scoped worker requests02 / WORKER INPUTMNIST datasetSeeded minibatch sampling64 fixed held-out probes03 / WORKER COMPUTATIONprepareForward + cross-entropy + backwardMean batch gradients; no update04 / OPTIMIZER BOUNDARYcommit at UpdateSGD or Adam; one commit per stepBefore / after + actual changes05 / BOUNDED HISTORYRecorded training stepInput + traces + parametersLast 32 steps; safe replay06 / SHARED PRESENTATIONNetworkScene + ReadoutsSignals / gradients / updatesNeuron inspector + weight maps
  1. 01 / main thread

    useTraining

    Seed + optimizer + batch size

    Run-scoped worker requests

    • initialize → 2. MNIST dataset
    • prepare request → 3. prepare
    • timeline reaches Update → 4. commit at Update
  2. 02 / worker input

    MNIST dataset

    Seeded minibatch sampling

    64 fixed held-out probes

    • minibatch → 3. prepare
  3. 03 / worker computation

    prepare

    Forward + cross-entropy + backward

    Mean batch gradients; no update

    • prepared snapshot → 5. Recorded training step
    • mean gradients → 4. commit at Update
  4. 04 / optimizer boundary

    commit at Update

    SGD or Adam; one commit per step

    Before / after + actual changes

    • committed snapshot → 5. Recorded training step
  5. 05 / bounded history

    Recorded training step

    Input + traces + parameters

    Last 32 steps; safe replay

    • playhead / selection → 6. NetworkScene + Readouts
  6. 06 / shared presentation

    NetworkScene + Readouts

    Signals / gradients / updates

    Neuron inspector + weight maps

    1. 1useTraining MNIST datasetinitialize
    2. 2useTraining prepareprepare request
    3. 3MNIST dataset prepareminibatch
    4. 4prepare Recorded training stepprepared snapshot
    5. 5useTraining commit at Updatetimeline reaches Update
    6. 6prepare commit at Updatemean gradients
    7. 7commit at Update Recorded training stepcommitted snapshot
    8. 8Recorded training step NetworkScene + Readoutsplayhead / selection
    Replay never commits an update twice. Sample neuron derivatives and mean batch weight gradients are distinct. History inspects snapshots without restoring optimizer checkpoints; the probe is not full test-set accuracy.
    Read from the implementation
    • src/hooks/useTraining.js
    • src/workers/worker.js
    • src/model/network.js
    • src/model/dataset.js
    • src/model/playback.js
    • src/scene/NetworkScene.jsx
    • src/ui/Readouts.jsx
    03

    Replay a calculation without training twice

    Pause, scrub, or replay a committed step to inspect its calculation. Replay moves through recorded states without applying another optimizer update. The history retains the last 32 steps; selecting an older step inspects a snapshot rather than restoring the model. The films follow the first four consecutive batches of a fresh default run, including mistakes, then replay the fourth step at the same speed. A gentle camera orbit keeps the spatial structure readable.

    04

    Follow a neuron back to its numbers

    The Neuron panel connects the picture to z = Σ(aᵢ × wᵢ) + b: weighted contributions, bias, activation, and the displayed example’s derivative. Individual weights expose mean batch gradients and measured optimizer changes. Adam includes running moment estimates, so its actual update is not simply −learningRate × gradient. Signals follows the forward computation, then switches to gradients in Backward and changes in Update; signed blue and orange edges use fixed, clipped display scales.

    05

    Keep the picture honest

    The default scene shows the eight strongest pixel links into each first hidden neuron and every connection between later layers: 544 visible links out of 12,960 model connections. Scene filtering changes the view, not the computation. Weight tiles reshape each first-layer neuron’s 784 learned parameters into a 28 × 28 map; they are not input digits. Loss history records pre-update mean batch loss, which can rise when the batch changes. The accuracy probe covers 64 fixed held-out digits, not the full test set, and one update can worsen an individual prediction.

    CONTINUE EXPLORING

    Word Embeddings →

    Ten thousand words, each with 200 dimensions. A browser-based exploration of relationships, analogies, and the space between meanings.

    2024—2026
    • JavaScript