inside the model — sentence → reply
case file 04 — live inference, traced stage by stage

Watch a real language model turn a sentence into a reply.

This runs an actual distilgpt2 model client-side, in your browser — no server, no API. Type something below and step through what the model actually computes: tokenize, embed, attend, predict.

log
click run to load the model (first time only)
01Tokenize
02Embed
03Attend
04Predict
calibration notes
What's real
TOK EMB ATT PRE

Tokenization uses distilgpt2's actual BPE tokenizer. The vectors in "embed" are pulled directly from the model's first attention layer during the same forward pass used for prediction — genuine per-token internal state. "Predict" softmaxes the actual output logits from that same pass.

What's approximated
TOK EMB ATT PRE

The in-browser runtime doesn't expose distilgpt2's internal attention matrices, so "attend" shows cosine similarity between the real embeddings as a stand-in — a genuine signal from real vectors, but not literally the model's softmax attention weights.

§ Self-hosted vs. external
self-hosted ~13.6MBexternal ~50MB

The JS library and WASM runtime ship with this site. The distilgpt2 weights (~50MB) load from huggingface.co at runtime — too large to bundle under Cloudflare Pages' 25MB file limit. Cached after first load.