6.3.11 · D1Interpretability & Explainability

Foundations — Concept-based explanations

3,391 words15 min readBack to topic

Everything below is a tool you need before that sentence makes full sense. We build each symbol from nothing, anchor it to a picture, and say why the topic can't live without it. We introduce them in strict order: no symbol appears before the section that defines it.


1. A vector: a list of numbers that is also an arrow

Why the word "vector" and not just "list"? Because a list of numbers has a picture: an arrow from the origin (the point ) to the point those numbers name.

Figure — Concept-based explanations

Look at the burnt-orange arrow: it starts at the origin and its tip lands at . The two numbers "3 right, 1 up" are the arrow. In this topic, when a picture (say a zebra) is fed to a model, the model turns it into a list of numbers — so the picture becomes an arrow in a space we can reason about geometrically.


2. Two vector operations: adding arrows, and scaling arrows

Before we compare arrows we need two ways to combine them. Both are defined slot by slot, so both work in any dimension.

Division by a number is just scaling by its reciprocal: , again slot by slot. We will need exactly this in to shrink an arrow to length 1.


3. Dimension and : how many numbers in the list

  • = points on a flat page (2 numbers: across, up).
  • = points in a room (3 numbers).
  • = a list of 2048 numbers. We can't draw it, but every rule from 2D still holds.

4. Activations : the model's thought at layer

A neural network is a stack of layers. Each layer takes the numbers from the layer before, mixes them, and produces a new list of numbers. That output list at a chosen layer is what we call the activation.

Figure — Concept-based explanations

Follow the teal path: an image enters on the left, flows through layers, and at the marked layer we tap off the numbers. Different images give different taps — each becomes its own dot in activation space.


5. Norm and length: how long an arrow is

We define length before the dot product, because the dot-product identity will refer to it.

The norm is for one and only one vector — the zero vector — because that's the only arrow with no length. We will use this fact in .


6. Normalization: shrinking an arrow to length 1

Using scaling from and length from , we can force any arrow to length exactly 1 while keeping its direction.


7. The dot product: how much two arrows agree

Here is the single most important tool of the whole topic. We only use symbols already defined above — vectors (), scaling (), and length ().

Why THIS tool and not another? We want a single number that answers "do these two arrows point the same way?" The dot product does exactly that. Here is why those slot-wise products secretly measure an angle.

First, what does "angle" even mean when there are more than 3 slots? We define to be the angle you would measure inside the ordinary flat triangle formed by the two arrows and the segment joining their tips — and any two arrows, no matter how many slots, always lie inside a single flat plane, so that triangle is a real 2D picture even in .

Now the connection. Suppose both arrows have length 1. Slide arrow 's shadow onto arrow : the length of that shadow (the projection) is exactly — that is the very definition of cosine on a right triangle ("adjacent over hypotenuse," and here the hypotenuse is 1). The slot-wise sum turns out to compute precisely this shadow length. Scaling each arrow back up by its own length (defined in ) multiplies the shadow by both lengths, giving the identity:

So the sum-of-products is not a coincidence: it is "how much one arrow's shadow falls along the other," and shadow direction is exactly what "do they agree?" means.

Figure — Concept-based explanations

Read the three cases in the figure:

  • Same direction ( small): near , dot product positive — the arrows agree.
  • Perpendicular (): , dot product zero — no agreement either way.
  • Opposite ( near ): near , dot product negative — the arrows disagree.

8. A hyperplane and its normal vector: the fence and the direction across it

A general hyperplane is described by a direction and a number (the bias or intercept): the wall is the set of points with (using the dot product from ).

Every hyperplane has one special direction: the normal vector , the arrow that points straight across the wall (perpendicular to it). The bias only moves the wall; it does not change this crossing direction.

Figure — Concept-based explanations

In the figure the plum dots are "striped" activations and the grey dots are "random" activations. The teal line is the hyperplane that best separates them — notice it does not pass through the origin, which is exactly what the bias buys us. The burnt-orange arrow is its normal — pointing from the random side toward the striped side.


9. A linear classifier and its loss: drawing that fence

To get the hyperplane, we train a linear classifier: it finds a direction and a bias so that the score is positive for one group and negative for the other.

Now the pieces of the training objective:

  • means "the values of and that make the following quantity smallest." (arg = argument = the input that wins.)
  • (script L) is a loss — a number measuring how wrong the classifier is on one example; smaller is better. We must pick a concrete form.
  • is a regularizer: a penalty on large weights (using the norm from ) so the fence stays simple. (Greek lambda) sets how hard we push. By convention the bias is left out of this penalty.

10. The logit : the model's raw score for class

We use the raw score, not the final probability, because it's easier to differentiate cleanly (see ).


11. The gradient : the arrow of steepest increase

Why THIS tool? We want to know "which way should the thought move to make the model more sure of class ?" The gradient answers exactly that question and hands back an arrow — which we can dot () with the concept arrow ().


12. Expectation , the example set , and the indicator

Putting the last three sections together, the complete score the parent note writes is:


Equipment checklist

Read each question, answer in your head, then reveal.

What does look like as a picture?
An arrow from the origin to the point 3-right, 1-up.
Add and , and picture the result.
— walk the first arrow, then the second tip-to-tail, landing at 4-right, 1-up.
Scale by and say what happens to its length.
— same direction, half as long.
What does the superscript in count?
The dimension — how many numbers are in the list.
What is in one phrase?
The list of numbers a chosen layer outputs for an input.
Compute the length of .
.
How do you normalize a vector, and what must you check first?
Scale it by ; first check the length is not zero, since a zero vector has no direction.
Compute the dot product of and , and what does the answer mean?
; the arrows are perpendicular — no agreement.
A dot product is negative. What does that say about the two arrows?
They point in roughly opposite directions.
Why does the slot-wise sum recover ?
It computes the length of one unit arrow's shadow (projection) onto the other, which is exactly .
What role does the bias play in a hyperplane ?
It slides the wall off the origin so it can sit anywhere between the two point clouds.
Write the CAV in terms of the classifier's normal .
— the normal shrunk to length 1.
What loss does the TCAV classifier minimize, and when is it small?
Logistic loss ; small when the score's sign matches the label with large magnitude.
What does mean?
The values of and that make the following quantity smallest.
What does the gradient point toward?
The direction in activation space that increases the class- score fastest.
What is the set ?
The bag of test examples belonging to class (e.g. many zebra images) that we average over.
If the dot product is exactly , does the indicator count it?
No — strict excludes it; it means the concept is perpendicular (neutral), and this case is vanishingly rare anyway.
Why take an expectation over the set ?
To average out single-image noise and get a stable fraction in .

Connections

  • Same foundations in Hinglish →
  • Probing Classifiers — also lives in activation space; here we built the vector/hyperplane tools both methods share.
  • Feature Attribution Methods — uses the same gradient , but attributes to inputs instead of concept directions.
  • Layer-wise Relevance Propagation — another way to trace a score backward through layers.
  • Model Editing — once the concept direction is a concrete arrow, you can push activations away from it.
  • Adversarial Examples — small moves in activation space that flip ; same geometry, different intent.