Transformer dry run

Transformer dry run - a tiny GPT shown number-exact, from forward pass to RLHF step.

Working when we checked on .

Visit Transformer dry run

What is Transformer dry run?

Transformer dry run is an interactive educational tool that computes every step of a working miniature GPT live in the browser from its trained weights. It is aimed at people learning how transformer language models work internally, from tokenization to next-token sampling. The model mirrors GPT-2's architecture shrunk to 1,952 parameters, with 2 blocks, 2 heads, an 18-word vocabulary and a 6-token context. Users can change the prompt and step through every lookup, matrix multiplication, LayerNorm and softmax, hovering over any number to see how it was computed.

Transformer dry run pricing

Pricing model: Free

Transformer dry run pros

  • Every calculation is computed live in browser from real trained weights
  • Same architecture as GPT-2, shrunk to 1,952 parameters that fit on screen
  • Interactive: change the prompt and every step recomputes
  • Hover over any number to see exactly how it was computed
  • Trained with NumPy and a hand-written, gradient-checked backward pass
  • Loss of 0.4994 nats per token matches the best achievable on its corpus

Transformer dry run cons

  • Toy model with only 18 words of vocabulary and 6-token context
  • Trained on just 36 toy sentences, so it cannot handle general text
  • No pricing, account, or support information shown on the page

Frequently asked questions about Transformer dry run

What does Transformer dry run do?

It walks through every lookup, matrix multiplication, normalisation and softmax that turns a prompt into a probability distribution over the next token, computed live in the browser from a trained miniature GPT's actual weights.

Who is it for?

It is for anyone learning how GPT-style transformer language models work internally, showing each computation step by step with the exact numbers involved.

How does the model compare to GPT-2 small?

It uses the same architecture as GPT-2 small but shrunk: 18 words of vocabulary instead of 50,257 BPE tokens, context length 6 instead of 1,024, model width 8 instead of 768, and 2 blocks instead of 12, for 1,952 parameters versus 124 million.

Can I change the prompt?

Yes. You can change the prompt at the top at any time, and every step recomputes automatically.

Are the visualisations illustrated or actually computed?

Everything shown is computed live in the browser from the trained weights, not illustrated. All arithmetic uses 64-bit floats, and weights were rounded to 4 decimals after training so displayed values are exact.

How was the model trained?

It was trained with Adam for 6,000 full-batch steps using training/train-tiny-gpt.py, plain NumPy with a hand-written, gradient-checked backward pass.

How well does the model perform?

Its loss is 0.4994 nats per token, which equals the best achievable on its corpus, meaning it has learned the corpus statistics essentially perfectly.

What training data was used?

The model was trained on 36 toy sentences, such as 'the cat sat on the mat .' and 'the dog chased the ball .', covering simple subject-verb-object patterns.

How do I navigate the tool?

You can use the left and right arrow keys or the on-screen buttons to step through stages, and click any stage in the architecture diagram to jump to it.

How should the visualisations be read?

Rows are token positions, columns are feature dimensions. Orange cells are positive, blue negative, intensity is proportional to magnitude, and purple cells are probabilities; the ▸ marks the last position that predicts the next token.

Categories

Use cases

Alternatives to Transformer dry run

Similar AI tools

Search AI tools on NeedAnAI · All AI tools A–Z