Generation

Using TokenPrint

Generation mode runs a real autoregressive forward pass and replays the result as a 3D animation. Each operation in the computation graph lights up the corresponding 3D component as it executes.

Three engine options are available, selected via the Inference engine dropdown:

EngineSourceNotes
Python backendStreams over WS /ws/generateFull capabilities — attention, hidden states, logit lens, KV cache. Decoding modes dependent on the backend.
Browser GPT-2 · WebGPURuns fully client-side in a Web WorkerGreedy only, ≤ 32 new tokens, ~500 MB cached download. See Browser GPT-2.
Browser GPT-2 · CPU (WASM)Runs fully client-side in a Web WorkerSame as WebGPU, but CPU compute — an explicit choice, never an automatic fallback.
Tip

The browser engine requires no backend at all. To export a run for reproducible verification, use the Experiments panel in Debugger mode, or hit the API reference directly for defaults.


Op catalog

Before animation begins, the backend engine sends a complete op catalog describing every operation in the forward pass. The browser GPT-2 engine does not instrument layer-level ops — it streams per-token frames with num_layer_stats: 0 and an explicit honesty note. For the reference model, the backend catalog contains 243 ops:

  • 10 ops per layer × 24 layers = 240 layer ops
  • 3 top-level ops: embedding lookup, final norm, vocabulary unembedding

Each op entry includes the op name, layer index, input/output shapes, bias status, and cumulative parameter count. The final op (vocabulary unembedding) shows cumulative parameters used: 630,167,424 (exceeds unique param count due to weight tying — the embedding matrix is counted twice).


Playback controls

ControlAction
Play / PauseStart or pause the animation
Speed slider1× to 16× animation speed
Step buttonsMove one op forward or backward
Layer skipJump to the first op of the next layer
Follow modeAuto-pan camera to the active operation

Prediction game

Before the model reveals each predicted token, the top-k panel offers a prediction game: guess which token the model will produce. Your score depends on whether your guess matches the real argmax. The game is scored against the real torch.argmax output, not a simulation.

Note

Capped at 40 new tokens by default. With the browser engine the cap is clamped to 32. TokenPrint uses greedy decoding by default; the prediction game is deterministic — the same prompt always produces the same token sequence for greedy runs.


Decoding strategies

Behind the scenes, generation options support four decoding modes — greedy, sampling, sliding window, and speculative — plus temperature, top-k, top-p, and seed. The browser engine is greedy-only. See the Decoding Strategies concept page for what each mode does and what its options mean.