Concept Activation Vectors (TCAV)
A zebra classifier may rely on stripes, zigzags, shape, or background. TCAV lets us ask about those human-defined concepts directly.
We collect concept examples and random examples, train a linear classifier between their activations, and use its normal vector as the concept direction.
Step 1: Curate datasets
Assemble a concept dataset of examples that represent concept (for example, images of stripes) and a random dataset of examples that do not reflect the concept in particular.
Step 2: Train a linear classifier on activations
Target a hidden layer and train a binary classifier — an SVM or logistic regression model — that separates the model's activations for the concept set from its activations for the random set. The vector normal to the resulting decision boundary is the concept activation vector (CAV), .
Directional sensitivity
Given an image input , we measure its conceptual sensitivity as the directional derivative of the prediction in the direction of the unit CAV:
This tells us how much a small step toward concept at layer would change the model's score for class .
TCAV score
The TCAV score is the ratio of inputs with positive conceptual sensitivity to the total number of inputs for a class :
A score near 1 means the concept consistently pushes the prediction toward class ; a score near 0 means it consistently pushes away.
Test a Concept Against a Class
Pick a class, then click through concepts to see how strongly each one drives the classifier's score. The TCAV score is the fraction of class examples whose activations move toward the class when nudged along that concept's direction.
Class
Concept
TCAV score: Stripes on Zebra
0.91
Stripes is a strong, consistent driver of the "Zebra" prediction — most class examples have positive sensitivity along this concept's direction.
Step 3: Test robustness with statistical significance
How do we know a CAV is meaningful rather than an artifact of one arbitrary random set? Instead of training a single CAV, train multiple CAVs using different random datasets while keeping the concept dataset fixed. A meaningful concept produces CAVs with consistent TCAV scores across those random sets.
- Collect random datasets (recommendation: ).
- Fix the concept dataset and calculate a TCAV score using each of the random datasets, producing TCAV scores.
- Apply a two-sided t-test comparing those TCAV scores against TCAV scores generated by a random CAV — obtained by treating a random dataset as if it were the concept dataset.
- Apply a multiple-hypothesis correction, such as the Bonferroni correction, across the hypothesis tests.
A concept only survives as a credible explanation if its TCAV scores are both consistent across random sets and statistically distinguishable from a random direction.
The concept dataset is the explanation's foundation. “Striped” examples that all contain fabric may produce a fabric direction. Repeat the analysis with several random sets and test statistical consistency.
Start with a hypothesis. TCAV is better at testing “does stripe matter?” than discovering every concept the model uses.
What would make a stripe TCAV result unconvincing?
