An interactive essay · Active Circuit Discovery

A Neuroscientist's Tool to Pick AI's Brain

We trust large language models to write, reason, and decide — yet we can barely see how they do it. This is the story of an agent that borrows a 30-year-old theory of the brain to hunt, one experiment at a time, for the circuits hidden inside an AI's mind.

by Dr. Sharath Sathish · a guided tour for the curious and the technical alike

Scroll to begin

Act I

The Black Box

We grew these minds. We never learned to read them.

02 The problem

We built it. We can't read it.

Here is the strange truth at the heart of modern AI: nobody designed a large language model's behaviour. We designed a learning process, poured in much of the internet, and a mind precipitated out — billions of numbers that somehow know grammar, geography, and how to code. We can run it. We can't open it.

It's the difference between an engineer's blueprint and a biologist's specimen. A circuit board is designed; you can read its schematic. A brain is grown; you have to dissect it to learn how it works. Today's models are far closer to the brain: grown, not authored.

Just how opaque is it, really?+

A frontier model holds hundreds of billions of parameters. The natural unit to inspect — the neuron — is polysemantic: a single neuron fires for dozens of unrelated concepts at once, because the network packs far more features than it has neurons (a phenomenon called superposition). Behavioural testing — "red-teaming" — samples outputs but never reveals mechanism, the way a crash test never explains the engine. Regulators have noticed: the EU AI Act and NIST's AI risk framework both lean on transparency the field cannot yet deliver.

Act II

A Microscope for Minds

Mechanistic interpretability: reverse-engineering thought into parts you can name.

03 Mechanistic interpretability

A microscope for artificial minds

A small field is building that microscope. Mechanistic interpretability treats a trained network like an organism to be reverse-engineered: find the internal features it represents, and the circuits that wire those features into behaviour.

The first surprise is that there's structure to find at all. In vision models, researchers found neurons for curves, then circuits that assemble curves into car wheels. The same playbook moved to language. But there's a catch: look at a single neuron and you'll see nonsense — it lights up for "the Golden Gate Bridge," "Python errors," and "the year 1987." Concepts are superposed.

The fix is a kind of prism. A sparse autoencoder (or transcoder) decomposes the tangled activations back into many clean, single-meaning features — one for the Golden Gate Bridge, one for Python errors, and so on. This is the picture below: a real attribution graph (the haystack of features), trimmed to the most influential.

L0L6L13L19L25layerWhenJohnandMarywenttothestore,Johngavethebagtolayer 5 · token " the" · activation 10.6 · influence 80%layer 23 · token " Mary" · activation 38.4 · influence 80%layer 1 · token "When" · activation 1.1 · influence 80%layer 6 · token "," · activation 2.4 · influence 80%layer 5 · token " John" · activation 3.8 · influence 80%layer 5 · token " bag" · activation 5.8 · influence 80%layer 4 · token " bag" · activation 5.6 · influence 80%layer 3 · token " Mary" · activation 1.1 · influence 80%layer 0 · token " went" · activation 1.4 · influence 80%layer 2 · token " to" · activation 1.9 · influence 80%layer 4 · token "," · activation 2.9 · influence 80%layer 3 · token "," · activation 1.6 · influence 80%layer 1 · token " bag" · activation 2.0 · influence 80%layer 0 · token " Mary" · activation 0.8 · influence 80%layer 3 · token "," · activation 3.1 · influence 80%layer 1 · token " to" · activation 2.9 · influence 80%layer 18 · token " to" · activation 6.2 · influence 80%layer 8 · token " John" · activation 6.6 · influence 80%layer 14 · token " John" · activation 7.1 · influence 80%layer 3 · token " Mary" · activation 1.5 · influence 80%layer 1 · token " Mary" · activation 1.1 · influence 80%layer 0 · token " gave" · activation 2.0 · influence 80%layer 11 · token "When" · activation 24.3 · influence 80%layer 1 · token "When" · activation 1.6 · influence 80%layer 6 · token " the" · activation 0.0 · influence 80%layer 3 · token " and" · activation 1.7 · influence 80%layer 14 · token " bag" · activation 11.0 · influence 80%layer 3 · token " went" · activation 3.6 · influence 80%layer 3 · token " gave" · activation 3.6 · influence 80%layer 3 · token " to" · activation 3.4 · influence 80%layer 17 · token " John" · activation 17.4 · influence 80%layer 4 · token " to" · activation 2.2 · influence 80%layer 10 · token " store" · activation 6.1 · influence 80%layer 10 · token " store" · activation 6.9 · influence 80%layer 2 · token " went" · activation 2.3 · influence 80%layer 9 · token " Mary" · activation 2.9 · influence 80%layer 1 · token " store" · activation 2.8 · influence 80%layer 10 · token "," · activation 5.8 · influence 80%layer 4 · token "When" · activation 2.8 · influence 80%layer 1 · token " gave" · activation 2.6 · influence 80%layer 8 · token " Mary" · activation 4.2 · influence 80%layer 4 · token " store" · activation 1.9 · influence 80%layer 13 · token "When" · activation 35.8 · influence 80%layer 8 · token " John" · activation 4.5 · influence 80%layer 3 · token " John" · activation 3.1 · influence 80%layer 4 · token " gave" · activation 4.5 · influence 80%layer 2 · token " John" · activation 3.3 · influence 80%layer 3 · token " to" · activation 2.1 · influence 80%layer 4 · token " and" · activation 3.1 · influence 80%layer 12 · token " bag" · activation 14.8 · influence 80%layer 0 · token " John" · activation 1.1 · influence 80%layer 0 · token " John" · activation 2.2 · influence 80%layer 4 · token " and" · activation 2.6 · influence 80%layer 1 · token " and" · activation 1.6 · influence 80%layer 0 · token " bag" · activation 1.9 · influence 80%layer 4 · token " John" · activation 2.3 · influence 80%layer 18 · token " Mary" · activation 9.4 · influence 80%layer 6 · token " went" · activation 6.5 · influence 80%layer 7 · token "," · activation 3.1 · influence 80%layer 0 · token " store" · activation 1.4 · influence 80%layer 8 · token " store" · activation 7.4 · influence 80%layer 2 · token " store" · activation 3.0 · influence 80%layer 1 · token " the" · activation 3.0 · influence 80%layer 5 · token " gave" · activation 2.9 · influence 80%layer 2 · token " and" · activation 1.7 · influence 80%layer 4 · token " went" · activation 2.8 · influence 80%layer 7 · token " Mary" · activation 2.7 · influence 80%layer 0 · token " gave" · activation 1.6 · influence 80%layer 0 · token " store" · activation 1.5 · influence 80%layer 4 · token " went" · activation 4.1 · influence 80%layer 0 · token " and" · activation 0.9 · influence 80%layer 0 · token " to" · activation 2.2 · influence 80%layer 5 · token " John" · activation 5.6 · influence 80%layer 9 · token " Mary" · activation 4.0 · influence 80%layer 0 · token " John" · activation 0.5 · influence 80%layer 4 · token "When" · activation 2.6 · influence 80%layer 8 · token "When" · activation 3.6 · influence 80%layer 3 · token " to" · activation 3.9 · influence 80%layer 4 · token " the" · activation 0.0 · influence 79%layer 5 · token " store" · activation 2.2 · influence 79%layer 5 · token " gave" · activation 5.8 · influence 79%layer 8 · token " to" · activation 3.8 · influence 79%layer 4 · token " gave" · activation 3.2 · influence 79%layer 5 · token "," · activation 4.9 · influence 79%layer 4 · token "," · activation 2.7 · influence 79%layer 6 · token " to" · activation 5.9 · influence 79%layer 13 · token " and" · activation 0.0 · influence 79%layer 5 · token " store" · activation 3.4 · influence 79%layer 1 · token " went" · activation 3.1 · influence 79%layer 5 · token " John" · activation 4.9 · influence 79%layer 10 · token " John" · activation 4.4 · influence 79%layer 4 · token " and" · activation 2.6 · influence 79%layer 5 · token " to" · activation 11.2 · influence 79%layer 3 · token " to" · activation 1.3 · influence 79%layer 11 · token " John" · activation 15.8 · influence 79%layer 4 · token " to" · activation 1.8 · influence 79%layer 2 · token " Mary" · activation 1.6 · influence 79%layer 10 · token " John" · activation 4.6 · influence 79%layer 16 · token " John" · activation 10.6 · influence 79%layer 9 · token " Mary" · activation 5.7 · influence 79%layer 0 · token " John" · activation 2.8 · influence 79%layer 3 · token " the" · activation 5.5 · influence 79%layer 0 · token " John" · activation 1.8 · influence 79%layer 7 · token " store" · activation 4.1 · influence 79%layer 2 · token " store" · activation 3.0 · influence 79%layer 17 · token " bag" · activation 34.8 · influence 79%layer 0 · token " to" · activation 2.3 · influence 79%layer 5 · token " bag" · activation 3.9 · influence 79%layer 9 · token " bag" · activation 3.3 · influence 79%logit output · token " to" · activation 0.0 · influence 0%
early layers late layers logit output dot size = causal influence · 110 features from 679,825 edges, on the real IOI prompt
Features, superposition, and dictionary learning+

A model with hidden width d can represent D ≫ d features by placing them as nearly-orthogonal directions in activation space — superposition. Polysemantic neurons are the symptom. Sparse autoencoders (Bricken et al. 2023; Cunningham et al. 2024) learn an overcomplete dictionary of directions with an L1/JumpReLU sparsity penalty, recovering monosemantic features; transcoders extend this to predict the next layer, letting you trace features across layers. Gemma Scope (Lieberum et al. 2024) released millions of such features for Gemma 2 — the exact backend this paper builds on.

04 A worked example

Features, circuits, and the name-mover

Make it concrete with the field's fruit-fly task — and the very prompt this paper probes:

"When John and Mary went to the store, John gave the bag to ___"

You answered Mary without thinking. So does the model — and in GPT-2 researchers mapped exactly how. A circuit of ~26 attention heads cooperates: some heads notice that "John" appears twice, others inhibit that repeated name, and a special group — the "name-mover heads" — copy the other name to the output. Ablate them and accuracy collapses from ~90% to chance. That is a circuit: a minimal, causal, nameable mechanism.

The IOI circuit (Wang et al. 2022)+

Indirect Object Identification spans all 12 layers of GPT-2 small: duplicate-token heads → inhibition heads → name-mover heads at layers 9–11 attending from the final position to the indirect-object token, copying it to the logits. ~6 "backup" heads provide redundancy, which is why single-head ablations often barely dent performance — a recurring theme in real circuits.

05 The method behind the microscope

How you prove a part matters

How do you show a part is causal, not just present? The same way a mechanic tests a theory about spark plugs — interfere, and watch what breaks. Three interventions, increasingly gentle:

Ablation

Switch the feature off entirely. The bluntest, most informative probe — like pulling the spark plug to see if the engine dies.

Patching

Replace its value with one from a different run. A precise, confirmatory swap — does this signal carry that effect?

Steering

Amplify it. The gentlest nudge — turn it up and see how far behaviour bends (this is how Golden Gate Claude was made).

The yardstick throughout is KL divergence: a number for how much the model's output distribution moved after the intervention. Big move ⇒ the part mattered.

Ablation vs activation patching vs causal scrubbing+

Ablation (zero or mean) measures necessity but can knock the model off-distribution. Activation patching (Meng et al.; Syed et al. 2023) swaps a clean activation into a corrupted run (or vice versa) for a sharper causal estimate. Causal scrubbing stress-tests a hypothesised circuit by resampling everything outside it. All reduce to one question: does intervening here change the output, measured as KL between clean and intervened logits?

Act III

The Brain That Predicts

To choose the next experiment well, borrow how a brain copes with not-knowing.

06 A clue from neuroscience

The brain that predicts

Step away from AI for a moment. Cover half a line of text on your phone with your thumb — you still "see" the whole sentence. Your brain didn't photograph the words; it predicted them and showed you the guess. You only notice when a prediction is wrong.

This is the brain-as-prediction-machine view, and its boldest formulation is Karl Friston's Free Energy Principle: living systems act to minimise surprise — the gap between what they predict and what they sense. Perception updates the model; action changes the world to match the model. Both reduce the same quantity.

Free energy, precisely+

"Surprise" (−log p(o)) is intractable, so the brain minimises a tractable upper bound — variational free energy — by keeping an internal belief q(s) close to the true posterior p(s|o):

F = DKL[ q(s) ‖ p(s|o) ]  −  log p(o)

Minimise F by changing beliefs (perception) or by acting to change observations (active inference). See Friston (2010) and Parr, Pezzulo & Friston (2022).

07 The crux

One equation for curiosity

Now the idea that makes everything click. When an active-inference agent weighs an action, it scores it on two things at once — and a single quantity, Expected Free Energy, combines them:

  • Will it teach me something?epistemic value (information gain).
  • Will it get me what I want?pragmatic value (preference).

That's the whole explore-vs-exploit dilemma, resolved by one rule. Think of a student picking a class: photography (loved, but nothing new) versus philosophy (uncertain, but transformative). A good agent weighs both. Drag the slider — watch which experiment the agent prefers as its uncertainty changes:

Belief uncertainty {{ efe.uLabel }}
{{ c.name }} {{ c.pickLabel }}

{{ c.blurb }}

info gain
goal value
combined value

{{ efe.caption }}

Expected Free Energy, the math (and what's genuinely new)+

EFE scores a policy by expected information gain plus expected preference:

G(π) = −Eq[ DKL[ q(s|o,π) ‖ q(s|π) ] ]  −  Eq[ log p(o) ] epistemic · information gain      pragmatic · preference

Minimising the epistemic term means choosing experiments whose outcomes you can't yet predict — the most informative ones (MacKay 2003's optimal experimental design, recovered from first principles). The agent is built on discrete active inference (Da Costa et al. 2020) via the pymdp library (Heins et al. 2022), and learns its observation model online with Dirichlet (conjugate) updates. What's genuinely novel here isn't any single ingredient — it's wiring them into one loop for circuit discovery.

Act IV

The Meeting Point

Active Circuit Discovery: an agent that picks its next experiment the way a brain would.

08 The architecture

An agent that experiments on a mind

Two halves click together. A backend builds the haystack — an attribution graph of candidate features. An Active-Inference agent then decides, step by step, which feature to probe and how.

Attribution-graph backendActive-Inference POMDP agent (pymdp)candidatesfeedbackPrompt xLLM with transcoders(Gemma-2-2B / Llama-3.2-1B)circuit-tracer / EAP(edge attribution patching)Attribution graph{(l,p,f)}, W, aPruning (≥ 80% influence)Candidate features+ importance imp(i)A · P(o|s)B · P(s′|s,a)C · P(o)D · P(s)Variational inference q(s|o)EFE G(i,a) = epistemic + pragmaticAction selection (i*, a*)feature_intervention API(ablation / patching / steering)Intervened logits + KL divergence
The Active Circuit Discovery architecture, recreated from the paper. The backend builds the candidate features; the agent loop probes them. The violet dashed edge is the feedback loop that lets each experiment reshape the next choice.

The agent holds a belief about every candidate feature along three axes — how important, which depth, and how influential — and it owns the three interventions you just met. Crucially, those actions differ in how much they teach: ablation is high-information (for exploring), steering is low-information (for confirming). So the explore-then-exploit rhythm isn't hand-coded — it falls out of Expected Free Energy.

Generative model (the agent’s world-model)updateA — likelihoodP(o | s)B — transitionP(s′ | s, a)C — preferenceP(o)D — priorP(s)1 · Variational inferenceinfer beliefs q(s | o)2 · Expected Free EnergyG(i,a) = epistemic + pragmatic3 · Action selection(i*, a*) = argmin G(i,a)4a · Executeapply a* to feature i*4b · ObserveKL, activation, connectivity5 · Online learningDirichlet update of A(o|s)
The agent’s perception–action loop: infer beliefs → evaluate Expected Free Energy → act → learn → repeat.

1 · Believe

From its generative model (A, B, C, D) the agent maintains a probabilistic belief over each feature's hidden state.

2 · Evaluate

For every (feature, action) pair it computes Expected Free Energy — the blend of information gain and preference.

3 · Act

It executes the single best experiment via the feature_intervention API and measures the KL shift, activation, and connectivity.

4 · Learn

It updates its beliefs and refines its own observation model online with a Dirichlet update — then repeats, sharper than before.

The POMDP, factor by factor+

Three hidden state factors — importance {negligible…high}, layer-role {early/mid/late}, causal influence {weak…strong} — and three observation modalities (KL magnitude, activation, graph connectivity). The transition model B(a) encodes the action semantics: ablation has the widest, highest-entropy belief updates (max epistemic value), steering the narrowest. That single design choice is what makes exploration emerge. The per-step decision loop:

yesnoStart step tEAP + prune graph →candidate features {(l,p,f)} + imp(i)Derive prior observationfrom imp(i)Compute EFE G(i,a)for all candidate–action pairsSelect (i*, a*) = argmin G(i,a)Execute interventionfeature_intervention(l*,p*,f*)Measure KL divergence,activation, connectivityUpdate q(s), A(o|s),layer priorst < B andnot converged?increment tStop — output circuit
One step of the agent, from candidate features to the convergence check.
09 Watch it think

Watch the agent explore

Theory is cheap; here is a real run on a real prompt, twenty experiments deep. Each bar is one intervention coloured by the action chosen; below it, the agent's belief entropy (its uncertainty) and expected free energy. Scrub through every step.

Prompt
{{ t.w }}
{{ tl.nCand }} candidate features · {{ tl.n }}-step budget
{{ l.label }}
KL divergence per intervention
belief entropy (teal) & expected free energy (violet)
Scrub the {{ tl.n }} interventions — or click a bar
Step{{ tl.readout.step }} / {{ tl.readout.n }}
Action{{ tl.readout.action }}
KL{{ tl.readout.kl }}
Belief entropy{{ tl.readout.ent }}
EFE{{ tl.readout.efe }}

Act V

The Verdict

Does borrowing a brain's instincts actually find circuits? Sometimes — and the data shows exactly when.

10 Does it work?

Does it find the circuit?

To grade discovery we use bounded oracle efficiency: how close the agent's chosen features come to a perfect oracle that already knows each feature's true effect. 100% = oracle-level. Compare methods, tasks, and both models.

{{ eff.caption }}

{{ b.label }} {{ b.val }}

{{ eff.h1text }}

On Gemma-2-2B's IOI task the agent reaches 82.0%, decisively beating random selection. The gradient baseline (EAP) is the one to beat — a genuinely strong, cheap ranking — and the agent trades blows with the bandit. On Llama-3.2-1B it only reaches 52.1%, about level with random.

Why is EAP so hard to beat?+

Attribution patching uses gradient information about the true output, so it's a strong static prior. The agent's edge is adaptivity under uncertainty — most valuable when signal is noisy or the budget tiny, less decisive when one gradient ranking is already near-perfect. In short, the POMDP reliably beats uninformed search and is competitive with the best heuristics, rather than dominating them.

11 Reading the big number

The 1255% that isn't what it looks like

One number looks spectacular: with steering on, the agent's cumulative effect reaches 1255% of the ablation oracle on Gemma IOI. Super-oracle discovery? No. And the data says why.

{{ rck.caption }}

100% (oracle)
{{ b.label }}{{ b.val }}

We can pin it down. Take circuit-selected features and matched random controls, scale each from ×1.5 to ×10, and count how often the prediction flips:

Circuit-selected Random control

{{ steer.caption }}

{{ g.selV }}
{{ g.ctrlV }}
{{ g.mult }}
H2a · manipulability
Accepted

Amplifying features does change predictions — steering is real.

binomial p ≈ 2.6 × 10⁻¹² (Gemma, ×10)

H2b · selectivity
Rejected

Circuit-selected features are only marginally more steerable than random active ones — selectivity is not significant.

selected vs control p ≈ 0.31 (Gemma, ×10); pooled p ≈ 0.10

12 Where it breaks

Where the method breaks

The sharpest failure is the most instructive. On Llama's multi-step reasoning task, efficiency collapses to 9.3% — below random.

73.0%Gemma · multi-step
9.3%Llama · multi-step (3 bins)
37.8%Llama · after the fix (6 bins)

The cause isn't the theory — it's resolution. The agent bins layers into three coarse thirds. Gemma has 26 layers; Llama only 16, so three bins smear together the early layers where reasoning lives. Refine to six bins and efficiency more than triples, to 37.8% — confirming the diagnosis.

13 A pattern in the depths

Different thoughts, different layers

Run the agent across five kinds of knowledge and it stays robust everywhere — but where the important features sit depends on the task and the model.

Early Middle Late

{{ dom.caption }}

{{ d.name }} {{ s.show }} {{ d.eff }}

Each bar = the top causal features for that domain, split by depth. Longer bars simply found more high-influence features.

On Gemma the most influential features cluster in early layers across every domain. On Llama the balance tips later for some (geography, maths) and stays early for others (logic, history). There's no single universal "facts-live-here" rule — and that's the useful part: rather than assuming a layout, the agent surfaces each task's layer fingerprint for inspection. Toggle the models to compare.

The actual prompts

Every run, the exact prompts — and where each domain lights up

These are the verbatim prompts from the experiment code. For each knowledge domain the bar shows its layer fingerprint on Gemma — how the top causal features split across early / middle / late layers. Factual lookups and compositional reasoning leave visibly different prints.

Geography
14 early · 0 mid · 6 late features
"The capital of France is"
"The Golden Gate Bridge connects San Francisco to"
Mathematics
16 early · 1 mid · 3 late features
"The square root of 64 is"
"If 2 + 3 = 5 then 3 + 4 ="
Science
11 early · 3 mid · 6 late features
"Water is made of hydrogen and"
"The speed of light is approximately"
Logic
14 early · 1 mid · 5 late features
"All mammals are warm-blooded. A whale is a mammal. Therefore a whale is"
"All birds have wings. A penguin is a bird. Therefore a penguin has"
History
15 early · 2 mid · 3 late features
"The year World War II ended was"
"The first person to walk on the moon was"

The three benchmark task families

Indirect Object Identification
5 prompts
"When John and Mary went to the store, John gave the bag to"
"After Alice and Bob finished lunch, Alice handed the receipt to"
"While Sarah and Tom were at the park, Sarah threw the ball to"
"When Emma and David arrived at the office, Emma passed the keys to"
"As Lisa and Mike left the restaurant, Lisa returned the coat to"
Multi-step reasoning
3 prompts
"If Alice is taller than Bob, and Bob is taller than Carol, then the tallest person is"
"The capital of France is Paris. Paris is in Europe. The continent containing Paris is"
"All dogs are animals. Fido is a dog. Therefore Fido is"
Concept steering
5 prompts
"The Golden Gate Bridge is"
"The Eiffel Tower is located in"
"Mount Everest is the tallest"
"The Great Wall of China was built"
"The Statue of Liberty stands in"
14 Why it matters

Why this matters

The headline isn't a leaderboard win. It's a reframing: interpretability under a budget is an experimental-design problem, and a theory of the brain gives us a principled way to run those experiments.

  • Auditing under budget. When you can't test everything, spend each probe where it teaches the most.
  • Uncertainty as a first-class citizen. The agent knows what it doesn't know, and acts on it.
  • Clean metrics. Separating discovery (bounded ≤100%) from amplification (unbounded) keeps the claims clean.
  • A bridge. Sparse features, attribution graphs, and active inference can compose into one loop.
15 Go deeper

Read more

Every number in this essay is computed from the paper's real released results — no figures were redrawn by hand or invented. Explore the code, reproduce the runs, or read the sources behind the ideas.

About the author

Dr. Sharath Sathish works at the intersection of mechanistic interpretability and active inference. Read the paper and the code, or follow the work below.

References

  1. {{ c.num }} {{ c.title }}. {{ c.meta }}
Active Circuit Discovery

Written by Dr. Sharath Sathish. Built as an interactive essay · visuals recreated from the paper's released data · all numbers precomputed from the repository's results/.