Attribution: attribution patching and activation patching over prompt pairs
Attribution in Ozera finds which attention heads and layers a model behaviour runs through, using attribution patching over pairs of clean and corrupted prompts, then checks the estimates with exact activation patching and ablation.
It runs on every model in Ozera, with built-in tasks or your own prompt pairs: pick a task, run a sweep, and verify the cells that stand out, with no code.
Prompt pairs and the metric
An experiment is a set of prompt pairs: a clean prompt, a corrupted prompt that differs just enough to change the answer, and each one’s next word (the correct and the incorrect answer). A pair is usable when its two prompts have the same number of tokens on the model and its two answers start with different tokens; pairs that are not are dropped and listed with the reason.
The built-in tasks:
- Indirect object identification: two people, and one gives something to the other; in the corrupted prompt the other one gives.
- Induction: ten random tokens, then the same tokens again but the last; in the corrupted prompt the first run is other random tokens.
- Subject-verb agreement: a subject and a distracting noun before the verb; in the corrupted prompt the subject’s number is flipped.
- Capitals: a country before its capital; in the corrupted prompt, another country.
Your own pairs upload as CSV, TSV, JSON or JSONL with clean and corrupted fields (correct and incorrect optional): up to 200 pairs, each prompt up to 128 tokens.
The metric is the logit difference between the correct and the incorrect answer at the last position; for pairs without answers it is minus the KL divergence from the clean run’s next-token distribution. Effects are normalized so that the corrupted run scores 0 and the clean run 1: a change in the metric divided by the mean clean-minus-corrupted gap over the pairs.
Views
Sweep: attribution patching
Attribution patching is a fast, gradient-based approximation of activation patching: the effect of patching an activation from the clean run into the corrupted run is estimated as the difference between the two activations times the gradient of the metric on the corrupted run. One clean pass, one corrupted pass and one backward pass estimate the effect of every attention head, and of each layer’s residual stream, attention output and MLP output at every position.
The estimates can be wrong in either direction where the metric is not linear in an activation, so a component counts as mattering only once exact patching confirms it.
Verify: activation patching
Activation patching is a causal intervention: it runs the corrupted prompt with one activation replaced by its value from the clean run and measures how much of the clean behaviour comes back. Verify patches the cells you choose exactly and shows each exact effect, with its standard error, next to its estimate, together with the Spearman rank correlation between estimates and exact effects.
Heads
For one attention head: its estimated effect, its exact effect, its direct logit attribution (what it wrote that the unembedding reads, in logits, on the clean run) and its attention pattern on a pair. A head that matters by feeding later heads patches large and writes little.
Ablate
Ablation removes components to test whether the model needs them. The heads or layer outputs you choose (up to 64) are ablated together on the clean prompts by zero ablation (outputs set to zero), mean ablation (set to their mean over the pair set’s prompts) or resample ablation (set to their value on the pair’s corrupted prompt), next to five random sets of as many components of the same kinds.
Continuation
Generate from a prompt with and without patches or ablations applied, and compare the two texts: this shows whether an intervention changes what the model writes, without a metric.
Models
Attribution runs on every model in Ozera: Ozera-Nano and Ozera-Mini; SmolLM2 135M and 360M, SmolLM3 3B, Gemma 3 270M and 1B, and Qwen3 0.6B, 1.7B and 4B, each as a base and an instruct model (an instruct model’s prompts go through its chat template); and your own custom model. Pairs are checked against the model’s own tokenizer.
Cost
Each sweep, verification and ablation is priced from its estimated GPU time and shown before it runs. A sweep on a built-in task, or a verification or ablation of ordinary size, costs the per-request minimum ($0.12 on the L4 GPU tier and $0.10 on the A10G tier, as of November 2026); larger runs cost more.
Frequently asked questions
Can I do activation patching without writing code?
Yes. On Ozera’s Attribution page you choose a model and a built-in task or upload prompt pairs, run a sweep, then patch the cells you want exactly in the Verify view. Everything runs on cloud GPUs from the browser.
What is the difference between attribution patching and activation patching?
Activation patching measures one component at a time by actually replacing its activation with the clean run’s. Attribution patching estimates the effect of every component at once from a single backward pass, with a first-order (linear) approximation. Ozera uses the estimate to find candidates and exact patching to confirm them.
Can I use my own prompt pairs?
Yes. Upload up to 200 pairs as CSV, TSV, JSON or JSONL, each with a clean prompt and a corrupted prompt, and optionally a correct and an incorrect answer (without answers, the metric is the KL divergence from the clean run). Both prompts must have the same number of tokens on the model, and the answers must start with different tokens.
What does an effect of 1 mean?
Effects are normalized so that the corrupted run is 0 and the clean run is 1. A component with an exact effect of 1 restores the whole clean-minus-corrupted gap in the metric on its own.
Which models does Attribution support?
Every model in Ozera: Ozera-Nano, Ozera-Mini, the open-weight SmolLM2, SmolLM3, Gemma 3 and Qwen3 models (base and instruct) and your custom model.