attnlab
A set of labs, walked in order, that run real TransformerLens models behind a web page. Type a prompt, pick a model, and see how it is tokenized, where every head attends, and when the model knows its answer.
Open tools and interactive explainers for mechanistic interpretability. Type a prompt, pick a real model, and look at what every token, attention head and layer is doing, without opening a notebook.
Free · Open source · Real models, real numbers
Free, open-source tools that run real language models behind a web page: tokenizers, attention patterns, the logit lens and speculative decoding.
A set of labs, walked in order, that run real TransformerLens models behind a web page. Type a prompt, pick a model, and see how it is tokenized, where every head attends, and when the model knows its answer.
A small draft model guesses a few tokens, a large target model checks them all in one forward pass, and the text comes out exactly as the large model alone would write it. The playground runs that loop on real models and lets you inspect every round.
Interactive, visual explainers of how transformers work and how they are trained: neurons, attention, the residual stream, the logit lens and multi-GPU parallelism.
Somewhere in the middle of a chat model, the residual stream decides whether to help you or say "I can't." A rotatable globe and measured numbers from the papers' own code show one refusal direction, a separate harmfulness direction, and where the 3D picture stops being a good guide.
Ask Llama-2 to translate fleur into Chinese and its middle layers say flower, in English, before the last layers settle on 花. A rotatable sphere shows why: the hidden state moves from input space through an English-leaning concept space to the output language.
A tiny real transformer (d = 8, 2 heads, an 8 → 32 → 8 MLP, 4 blocks) runs on the sentence you type. Every circle holds the number it actually computed, and hovering one shows the weighted lines that feed it.
One concrete configuration, followed from start to finish: a 1.27B-parameter model with Llama 2 7B's layer shape, trained on a single 8-GPU node split 2-way tensor × 2-way pipeline × 2-way data parallel, then post-trained and deployed.
Follow four tokens through a single transformer block from the residual stream's point of view. Every matrix is shown with real numbers, computed live, so you can trace one token's row from embedding to next-token probabilities.
Watch GPT-2 build its prediction layer by layer. A runnable walkthrough that decodes the residual stream after every block, shows why ln_final matters, and plots top-k and rank heatmaps.
More writing on transformers and NLP lives on Nirajan Paudel’s site.
Planned labs, built in the open. Each one answers a single question and links to the step before it.
How does a model copy what it has seen before?
Repeated random tokens, per-head induction scores, and the loss drop in the second half of the sequence.
Which components actually matter?
Zero- or mean-ablate heads and measure the change in loss and logits.
Sarvabhaum AI makes the inside of language models something you can look at. The tools run small, real models such as GPT-2, Pythia and Qwen3 on a server we host, and the explainers show every matrix with real numbers, so each idea can be checked rather than taken on trust.
Everything here is free and open source. New labs and explainers are added as they are finished.
It stands on other people’s open work, above all TransformerLens and the ARENA curriculum. Every page lists the libraries, models, data and papers it builds on.