$ init mech-interp-lab --model gpt2-small
Loading architecture: 12 layers, 12 heads, 768 hidden dim
Generating activation traces...
Building edge graph (6616 edges)...
✓ Ready. Scroll to explore.
Interactive visualization tools for understanding how transformer models process information internally.
Mechanistic interpretability treats neural networks like reverse-engineering a complex circuit. Instead of treating models as black boxes, we map their internal components—attention heads, neurons, weight matrices—to understand how they compute answers, not just what they output. This lab visualizes three core techniques: circuit tracing, attention pattern analysis, and the logit lens.
Trace activation paths and ablate nodes to find causal circuits
Visualize how tokens attend to each other across layers
Watch predictions evolve from early to final layers
Mapping the neural pathways of language understanding
Modern transformers process information through a series of layers, each containing attention heads and MLP neurons. This visualization maps these components as a 3D graph, showing how information flows from input to output. When you type a prompt, watch the activation trace light up—these are the specific neurons that fire to produce the prediction.
Attention heads (rings) and MLP neurons (grid) at each layer
Weighted connections showing information flow between layers
Disabling a node to test if it's causally important for the output
How tokens 'look at' each other during processing
Attention is the core mechanism that lets transformers understand context. Each attention head learns different patterns—some track syntax, others semantics, some copy information forward. The heatmap shows attention weights: brighter cells mean token A is paying more attention to token B. The beam view renders these same weights as curved connections in 3D space.
Deeper layers capture more abstract patterns
Each head specializes in different linguistic features
How much one token position 'attends to' another
Watching the model 'make up its mind' layer by layer
The logit lens technique applies the final unembedding matrix at each intermediate layer, letting us peek at what the model would predict if forced to output at that point. Early layers show diffuse, uncertain predictions. As we go deeper, the model converges toward its final answer. The 'commit point' is where the correct token first becomes the top prediction—revealing how many layers the model needs to 'solve' this particular prompt.
Converting hidden states back to vocabulary probabilities
The layer where the model first confidently predicts the answer
The highest-probability next tokens at each layer