Interactive previews
Live, in-browser diagrams. Each one previews a concept the engine will implement.
Milestone M0 · the first and last thing every prompt touches
Before the model sees anything, text is split into integer token IDs from a learned vocabulary — common chunks become one token, rare ones split into pieces. Type below and watch it tokenize. This is a character-level merge toy with invented IDs and simplified whitespace. It uses JavaScript UTF-16 units, not Qwen's UTF-8 byte mapping, regex, or vocabulary. For real IDs, use the M0 CLI.
␣ chips). Whitespace and casing
change the tokens, which is why they matter.Milestone M3 · the last step of every token
The model’s forward pass ends with a logit (a raw score) for every token in the vocabulary. To sample the next token we turn those scores into probabilities with softmax, then choose. Three knobs shape that choice — drag them and watch the distribution move. The math here is the real softmax; only the logits are a fixed toy example.
The cat sat on the ___
Order here: temperature → top-k → top-p → final renormalization. The bars and percentages show final sampling probabilities (100% before display rounding); cut tokens have probability zero. Sample a token draws from that distribution. M3 will explicitly test the engine's filtering contract rather than treating this toy as an oracle.
Milestone M2 · the heart of the transformer
Inside each transformer block, a token builds its next representation by looking at the tokens before it and taking a weighted average of them. The weights come from how well a token’s query matches each other token’s key (Q·Kᵀ → softmax). Pick a token to see what it attends to. The softmax is real; the token vectors are a fixed toy example.
Work through the actual vectors, matrices, and numbers →
Milestone M4 · why decode isn’t quadratic
To produce the next token, attention needs the keys and values of every earlier token. Recomputing them at every step would be quadratic waste — so we cache each token’s K/V once and reuse it. Step through generation and watch the difference.
On the way
These arrive as their milestones land — see the abstraction ladder for where each one sits.