Concept-based and Mechanistic Interpretability
From "which pixels?" to "which concepts?": TCAV and concept bottleneck models, and a glimpse of mechanistic interpretability.
From pixels to concepts
A physician does not think about pixel (120, 45), but about “irregular margins” or “microcalcifications”. Concept-based explanation speaks this language.
TCAV
- Collect examples of the concept (such as striped images) and random examples.
- Extract their activations at layer \(l\).
- Train a linear classifier between them; the vector normal to its boundary is \(v_C\).
- For each image of class \(k\), compute the directional derivative:
$$S_{C,k}(x) = \nabla h_{l,k}(f_l(x)) \cdot v_C$$
- The TCAV score = the proportion of images for which \(S > 0\), with a significance test against random vectors.
Concept bottleneck models
| Stage | Output |
|---|---|
| Input → concepts | “Irregular margins: yes”, “calcification: no” |
| Concepts → result | “Malignant: 0.82” |
The advantage: the physician can correct a wrong concept and the prediction changes. The drawback: it needs concept labels in training, and additional information may leak through the concepts.
Mechanistic interpretability
- It tries to identify “circuits” inside the network that carry out specific functions, such as curve detectors in convolutional networks or attention heads with particular functions in transformers.
- Recent tools such as sparse autoencoders extract more interpretable features from the activations of language models.
- The current state: an active and exciting research field, but its results are partial, and there is not yet an established methodology for using it to assure the safety of critical systems.
Lesson terms
- Mechanistic interpretability
- An attempt to reverse-engineer the network's internal computations into understandable components and algorithms.
- Concept activation vector
- A direction in a layer's activation space that separates examples of a concept from random examples.
- Concept bottleneck model
- A model that first predicts a set of understandable concepts and then uses them alone to predict the outcome.
Abstract
Concept-based explanations ask whether the model uses a human concept such as "striped" or "calcification". TCAV learns the concept vector from concept examples and random examples in activation space, then measures the sensitivity of the class to this direction. Concept bottleneck models predict the concepts first and then the class, allowing human intervention. Mechanistic interpretability tries to understand the computational circuits inside the network; it is an active research field whose tools are not yet mature for critical applications.
Review questions
-
What is needed to apply TCAV?
A set of examples representing the concept, random examples, and access to the activations of an internal layer and their gradients.
-
What is the advantage of concept bottleneck models?
The expert can see the predicted concepts and correct them, and the final prediction changes accordingly.
Sources and references
Complete the lesson
You have completed all the lessons in the track! You can now request the track completion certificate.
Request the certificate