Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Reading a model’s mind with a small test
To find out whether a model ‘knows’ that a word is a noun, we can train a tiny classifier to read that fact from the model’s internal numbers. If the tiny classifier succeeds, the information is there. But a clever classifier can learn the answer by itself, and information can be present without the model ever using it, like a fact written in a book nobody opens. The demo compares a probe’s accuracy on the real property with a control task of random labels.
Probes are used to check whether a robot policy’s internal state tracks object positions or whether a model represents whether a statement is true.
- 1. A probe is…
- 2. High probe accuracy shows information is…
- 3. A control task uses…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Linear probes: logistic regression on activations at one layer; the default because they can do little computation themselves.
- Layer sweeps: BERT encodes part of speech early, syntax in the middle and semantics later (Tenney et al., 2019).
- Famous findings: syntax trees as distances (structural probe), world state in Othello-GPT (linear after a change of basis), truth directions, space and time in Llama.
- Pitfalls: nonlinear probes can memorise; correlated features; probing accuracy depends on probe capacity and data.
- Controls: selectivity = task accuracy − control-task accuracy (Hewitt & Liang, 2019); minimum description length probing (Voita & Titov, 2020).
- Causal checks: remove or alter the probed direction (amnesic probing, INLP, LEACE) and see whether the model’s behaviour changes; interventions are needed to claim use.
- 1. Why prefer linear probes?
- 2. Selectivity is task accuracy minus…
- 3. To claim the model uses a feature, you need…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Probing in practice
Exercise 1.
- A closed-form linear probe.
- Selectivity.
- Projecting out a direction.
Practice.
- Extract activations with Hugging Face (output_hidden_states=True) or TransformerLens hooks; cache them to disk.
- Train linear probes per layer with held-out data split by document or by type when types repeat.
- Report the majority baseline, a control task and a random-model baseline (same architecture, untrained).
- For causal claims, erase the direction (LEACE) or steer along it and measure behaviour.
- Libraries: scikit-learn for probes, TransformerLens and nnsight for activations.
import torch
from transformers import AutoModel, AutoTokenizer
from sklearn.linear_model import LogisticRegression
tok = AutoTokenizer.from_pretrained("bert-base-uncased"); model = AutoModel.from_pretrained("bert-base-uncased", output_hidden_states=True)
with torch.no_grad(): hs = model(**tok(sentences, return_tensors="pt", padding=True)).hidden_states
X = hs[6][mask].numpy() # layer 6 states of the tokens being probed
probe = LogisticRegression(max_iter=1000).fit(X_train, y_train); print(probe.score(X_test, y_test))- 1. Hidden states in Hugging Face come from…
- 2. Split probe data by…
- 3. A concept-erasure method:
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
What a probe measures. Probe accuracy is a joint property of the representation and the probe family. With enough capacity a probe can map any distinct inputs to any labels: for a finite set of word types, a large MLP can memorise a random label per type. So accuracy alone does not say whether the representation organises the property.
Control tasks. Assign each word type a random label. A representation-agnostic probe that memorises types does well on both tasks; a probe that reads a structured property does well only on the real task. Selectivity isolates the second.
Decodable vs used. If the model’s computation reads only direction u, any information orthogonal to u is decodable but unused; removing it leaves outputs unchanged. Conversely, removing a direction the model reads changes its outputs.
- 1. A large probe on finite types can…
- 2. Information orthogonal to the readout is…
- 3. Removing a used direction…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.When does probe accuracy reflect what a representation encodes, and when does it reflect the probe or unused information?
History.
- G. Alain and Y. Bengio, “Understanding intermediate layers using linear classifier probes” (2016).
- J. Hewitt and P. Liang, “Designing and interpreting probes with control tasks” (2019).
- Y. Elazar et al., “Amnesic probing” (2021).
Exercise 2. A frozen toy model.
- Model: 200 word types with 32-dimensional embeddings; hidden state tanh(W e + noise) with 64 dimensions; output = sign(u · h).
- Properties: A and C are linear in the embedding; B is an XOR of two linear properties; the control task gives each type a random label.
- Probes: logistic and one-hidden-layer MLP (24 units), trained on 1000 tokens and tested on 1000.
- Causal test: remove the linear-probe direction for C, or for the model’s own output, and measure how often the output is unchanged.
| property | linear probe | MLP probe |
|---|---|---|
| A (linear) | 0.894 | 0.984 |
| B (XOR) | 0.707 | 0.986 |
| C (linear, unused) | 0.941 | 0.985 |
| control (random per type) | 0.638 | 0.968 |
| selectivity for A | 0.256 | 0.016 |
| direction removed | outputs unchanged |
|---|---|
| C’s probe direction | 0.982 |
| the output’s own direction | 0.496 |
- The linear probe read the linear properties and only partly the XOR.
- The MLP probe reached near-perfect accuracy on everything, including random labels: its accuracy says nothing about structure.
- C was decodable but unused: erasing it barely changed outputs.
- Seeds 1 and 2: linear selectivity 0.234 and 0.218; MLP control 0.985 and 0.986; outputs kept after removing C 0.983 and 0.952, after removing the used direction 0.517 and 0.543.
- Caveat: a single random layer; real models have many layers and features in superposition.
Probing in AI, robotics and aerospace
- Robot policies: probes check whether visual policies encode object poses or contact states before trusting them.
- World models: probing learned simulators for physical quantities (velocity, energy) tests whether they track physics.
- Truthfulness monitors: linear probes on LLM activations flag likely false statements; validated with controls and interventions.
References
- G. Alain and Y. Bengio (2017). “Understanding intermediate layers using linear classifier probes.” ICLR Workshop.
- J. Hewitt and P. Liang (2019). “Designing and interpreting probes with control tasks.” EMNLP.
- E. Voita and I. Titov (2020). “Information-theoretic probing with minimum description length.” EMNLP.
- Y. Elazar, S. Ravfogel, A. Jacovi and Y. Goldberg (2021). “Amnesic probing.” TACL.