6.3.5 · D4Interpretability & Explainability

Exercises — Probing classifiers

2,613 words12 min readBack to topic

Level 1 — Recognition

Can you name the parts?

Exercise 1.1

State, in one sentence each, what these three symbols mean: , , .

Recall Solution
  • — the big pre-trained model we are studying (weights , kept frozen). It maps an input to some output, but we care about its insides.
  • — the representation: the vector of activations that produces at layer for a given input. This is the only thing the probe is allowed to look at.
  • — the probe: a small, separately trained classifier (weights ) that takes and predicts an auxiliary label.

Exercise 1.2

True or false: "When we train the probe, we also update the weights of the big model." Justify.

Recall Solution

False. The big model is frozen. Only (the probe's weights) change. If changed, the model could learn the property during probing, and we'd no longer be measuring what it knew beforehand — we'd be measuring its capacity to learn. Compare Fine-tuning vs. Feature Extraction: fine-tuning unfreezes; probing does not.

Exercise 1.3

Recall from the notation box that names the auxiliary task and is the probe's test accuracy for task at layer . Match each accuracy claim to its meaning: (a) (b) on a balanced 2-class task.

Recall Solution
  • (a) The property is strongly and linearly present in layer — a simple hyperplane separates the classes cleanly, so of held-out examples are labelled correctly.
  • (b) on a balanced binary task equals random guessing, so the probe found nothing — the info is absent, or so entangled a linear probe cannot reach it.

Level 2 — Application

Plug into the formulas.

Exercise 2.1

A binary linear probe outputs where is the sigmoid (it squashes any real number into , so we can read it as a probability). Labelling convention: we call the output the positive class () when , equivalently when ; otherwise the negative class (). Given , , and , compute the pre-activation and the predicted probability . Which class?

Recall Solution

The dot product multiplies matching entries and sums them: Then Since (equivalently ), by our convention the probe predicts the negative class .

Exercise 2.2

Two data points lie on either side of a probe's boundary: with label , and with label . The probe is , . Compute the margin (The margin is the signed distance from the closest point to the boundary; positive means correctly separated.)

Recall Solution

Why divide by ? The plain quantity measures "how far past the boundary" but in units that stretch if you scale up. Dividing by (the length of ) cancels that scaling and converts the number into an honest geometric distance in the representation space — the perpendicular distance from the point to the hyperplane. Multiplying by makes the distance positive exactly when the point is on its correct side. .

  • Point 1: , distance .
  • Point 2: , distance . Positive margin ⇒ the two classes are linearly separable by this probe, and comfortably so.

Exercise 2.3

A probe's L2-regularised objective is where the loss is the binary cross-entropy (it is small when the probe's probabilities match the true labels). If , compute the penalty term . Explain in one line why we add it.

Recall Solution

, so penalty . Why: the cross-entropy term rewards fitting the labels; the penalty keeps small so the probe stays simple. We want to test whether the info is easily linearly accessible — not whether a huge, memorising probe can dig it out.


Level 3 — Analysis

Read patterns and reason about them.

Exercise 3.1

A BERT POS-tag probing sweep gives: , , . Sketch the curve mentally and explain the shape: why does accuracy rise then dip? Reference the figure.

Figure — Probing classifiers

Figure — the horizontal axis is the layer index (0, 6, 12); the vertical axis is POS probe accuracy in percent. The teal curve climbs steeply from at layer 0 to a peak of at layer 6, then dips slightly to at layer 12. A dashed line at marks chance for a balanced binary task. The shape is an asymmetric "hump": a strong rise, a small fall.

Recall Solution
  • Rise (0→6): layer 0 is raw word embeddings — POS is guessable from word identity alone (), but ambiguous words ("run" noun vs verb) cap it. Middle layers mix in context (Attention Mechanisms let each token read its neighbours), so POS becomes almost trivial ().
  • Dip (6→12): the top layer specialises for the pre-training objective (masked-language modelling), spending capacity on task-specific prediction and slightly discarding generic syntax — hence . The takeaway: syntactic info peaks in the middle, not at the end.

Exercise 3.2

For semantic roles, layer 8 gives (nonlinear probe) but (linear probe). Compute the gap. What does a large linear-vs-nonlinear gap tell you about how the info is stored?

Recall Solution

Gap percentage points. A large gap means: the info is present (the MLP, which can bend its decision boundary, finds it) but is not linearly separable — it needs nonlinear combinations of features that only a hidden layer can form. In representation terms the classes are entangled; a straight hyperplane can't split them. Cleanly separating such factors is the goal of Disentangled Representations.

Exercise 3.3

At layer 10 the gap shrinks: , (gap ). A student says "the gap grew, so layer 10 entangles roles more than layer 8." Is that right?

Recall Solution

No — you must compare the right quantity. The absolute gap () is a red herring because the ceiling rose too. Look at the linear probe alone: it jumped , meaning roles became more linearly accessible at layer 10. Deeper layers untangle structure; the linear probe's rise is the honest signal, not the raw gap.


Level 4 — Synthesis

Combine ideas into a design.

Exercise 4.1

You suspect a vision model encodes shape but not texture. Design a two-probe experiment: name the tasks, the labels, what "shape encoded, texture not" would look like in the numbers.

Recall Solution
  • Task A (shape): classify object category on images where texture is scrambled but silhouette intact.
  • Task B (texture): classify texture patch label independent of shape. Freeze the model, extract per layer, train a linear probe for each task. "Shape yes, texture no" shows up as high (say ) while chance across layers. Run it per layer to see where shape emerges.

Exercise 4.2

Design a control that rules out the boring explanation "the probe itself is powerful enough to learn anything." Describe the control task and the number you'd compare against.

Recall Solution

Use a control task: keep the same inputs, but replace the true labels with random ones. Concretely, you assign each word type a fixed random label once (so "cat" always gets, say, label 3, "dog" always label 1 — the assignment is arbitrary but consistent, which is what "fixed per word type" means). There is now no real linguistic structure for the probe to exploit; it can only win by memorising the arbitrary word→label table. Train the same probe on this control and report selectivity .

  • If the real task scores but the random-label control also scores , selectivity is tiny — the probe is just memorising, and the high accuracy is not evidence the representation encodes .
  • High selectivity (real ≫ control) means the representation, not the probe's raw power, carries the signal.

Level 5 — Mastery

Full reasoning, edge cases, defence.

Exercise 5.1

A probe reaches on a balanced binary agreement task at layer 3, but at layer 6. A colleague concludes "the model does not encode agreement at layer 3." Steel-man and then critique this conclusion, covering the degenerate cases.

Recall Solution

Steel-man: a linear probe at = chance, so no linearly-accessible agreement signal at layer 3. That much is fair. Critique — the info might still be there, just entangled:

  1. Try a nonlinear (MLP) probe at layer 3. If it jumps to, say, , agreement is present but nonlinearly encoded — the linear probe was blind to it.
  2. Check the control task — maybe is genuinely floor, confirming absence.
  3. Degenerate case: if both linear and MLP sit at chance, and the control does too, then agreement really is absent at layer 3. Correct conclusion: "no linearly accessible agreement at layer 3" — silence from a linear probe is not proof of absence.

Exercise 5.2

An adversary slightly perturbs inputs so a fixed probe's accuracy collapses from to , while the model's own outputs barely change. What does this reveal, and which neighbouring topic explains it?

Recall Solution

The probe was reading a fragile, non-robust direction in representation space. Tiny input changes moved across the probe's hyperplane without changing the model's task behaviour — so the "encoding" the probe found was partly a brittle correlation, not a stable, causally-used feature. This is the domain of Adversarial Robustness: a feature that survives perturbation is trustworthy; one that doesn't may be a spurious probe artefact.

Exercise 5.3

Full numeric synthesis. A linear probe has learned , , and uses the convention class iff . Three verb-token representations arrive: , , . (i) Compute each . (ii) Predict class with threshold . (iii) For the zero vector , explain what the prediction depends on and why that is a meaningful edge case.

Recall Solution

(i) Dot products then add :

(ii) With the convention class iff : ; ; .

(iii) Zero-vector edge case: when , the weight vector contributes nothing, so the prediction is decided entirely by the bias . Here , negative. This is meaningful: it tells you the probe's default vote when the representation is empty/uninformative. If a real input ever produced a near-zero , the probe would just fall back on — a reminder that the bias, not the data, breaks ties.

Recall One-line self-test

What is the single most important thing probing does not tell you? ::: Whether the model uses the feature — probing shows presence, not usage; for usage you need causal intervention.