TCAV

Also known as: Testing with Concept Activation Vectors · concept activation vector

On this page 7

TCAV, short for Testing with Concept Activation Vectors, is an interpretability method that measures how sensitive a neural network’s prediction for a class is to a human-defined concept, such as “striped” for the class zebra. In Explainable AI, it belongs to the family of concept-based explanations: instead of attributing a decision to individual pixels or features, it asks whether a high-level idea that people understand plays a role in the model’s reasoning.

TCAV was introduced by researchers at Google in 2018 and produces a global explanation for a whole class rather than a single input. Its central object, the concept activation vector (CAV), is a direction in the activation space of a chosen layer that separates examples of the concept from random examples.

How TCAV builds and tests a concept activation vector

TCAV works in four steps. First, the analyst collects a small set of images or inputs that show the concept, typically 30 to 200 examples, plus a set of random counterexamples. Second, both sets are passed through the trained network and the activations of one internal layer are recorded. Third, a linear classifier is trained to separate concept activations from random ones; the vector orthogonal to its decision boundary is the CAV.

Fourth, TCAV computes the directional derivative of the class logit along the CAV for every input of the target class. A positive derivative means that moving the activation toward the concept increases the class score. The TCAV score is the fraction of class inputs with a positive directional derivative, so it ranges from 0 to 1.

The table below lists the main components of the method and what each one controls.

ComponentRoleTypical choice
Concept setDefines the human idea30 to 200 curated examples
Random setProvides the contrast classRandom images from a broad dataset
Bottleneck layerActivation space for the CAVA mid or late convolutional layer
Linear classifierFinds the concept directionLogistic regression or linear SVM
TCAV scoreMeasures class sensitivityFraction of positive derivatives, 0 to 1
Components of a TCAV analysis

Statistical testing and score interpretation

A single TCAV score is not meaningful on its own, because even a random direction can yield a score far from 0.5. The original method therefore trains many CAVs against different random sets, often 10 to 500 runs, and compares the resulting score distribution with scores from random-versus-random CAVs using a two-sided t-test, with a correction for multiple comparisons.

Only concepts that pass this significance test are reported. Analysts also check the accuracy of the linear classifier: if the concept cannot be separated from random examples at a chosen layer, the layer does not encode the concept linearly and any score there is unreliable.

The following table shows how practitioners usually read the outcomes.

ObservationInterpretationRecommended action
Score near 1, significantConcept strongly supports the classInspect for shortcut learning
Score near 0, significantConcept pushes against the classCheck for negative correlation in data
Score near 0.5, not significantNo reliable influenceDo not report the concept
Low CAV classifier accuracyLayer does not encode the conceptTry another layer or better examples
Reading TCAV results

TCAV compared with other explanation methods

TCAV differs from feature attribution methods such as SHAP, Grad-CAM or integrated gradients in the vocabulary of its answers. Attribution maps highlight which input regions mattered for one prediction, while TCAV tests which concepts matter for a whole class, using examples chosen by the analyst rather than raw input features.

It also differs from a concept bottleneck model, which builds concepts into the architecture and requires concept labels during training. TCAV is post hoc: it explains an already trained network without changing it. A probing classifier is a close relative, but probing asks only whether information is present, whereas TCAV asks whether the class output is sensitive to it.

MethodUnit of explanationScopeRequires retraining
TCAVUser-defined conceptsGlobal, per classNo
Grad-CAMImage regionsLocal, per inputNo
KernelSHAPInput featuresLocal, aggregableNo
Concept bottleneck modelPredefined conceptsBuilt into modelYes
Probing classifierEncoded informationPer layerNo
TCAV and related interpretability approaches

Practical uses of TCAV

TCAV is most valuable for auditing models for unwanted concepts. Teams use it to test whether an image classifier relies on skin tone, gender cues, watermarks, hospital rulers in medical images or background scenery. A significant score for such a concept indicates shortcut learning or bias that standard accuracy metrics hide.

  • Medical imaging: verifying that a diagnostic model responds to clinically relevant patterns rather than scanner artifacts.
  • Fairness audits: testing sensitivity to demographic concepts in vision models.
  • Model comparison: checking whether a new architecture relies on the same concepts as the current one.
  • Scientific discovery: identifying which known features a model associates with an outcome.

Extensions include automated concept extraction, which clusters image segments to discover concepts without manual curation, and work on concept completeness, which measures how much of a model’s behavior a set of concepts can explain. Libraries such as Captum offer TCAV implementations for PyTorch models.

Limitations of concept activation vectors

TCAV is only as good as its concept examples. Concepts that are correlated in the curated set, such as “stripes” and “grass”, can produce entangled CAVs, and different random sets or layers may give inconsistent scores. The method also assumes that concepts are linearly represented, an assumption related to the linear representation hypothesis that holds for many concepts but not all.

Finally, a significant TCAV score shows correlation-based sensitivity, not proof of causal use in every input. Faithfulness studies have found that CAVs can be sensitive to small changes in the probe dataset. Responsible reports therefore state the layer, the number of runs, the classifier accuracy and the significance threshold used.

Put simply

TCAV checks whether a model thinks in ideas that people understand. You show the model pictures of an idea, such as stripes. Then you show it random pictures. The method finds the direction inside the model that points toward stripes.

Next, it asks a simple question. If the model sees a little more stripe, does it become more sure it is a zebra? If the answer is yes for most zebra pictures, stripes matter to the model. It is a bit like asking a judge which arguments actually moved the verdict.

In practice

A research team at a university hospital trains a convolutional network to detect melanoma in dermoscopic images. Accuracy on the test set is high, but clinicians suspect the model may rely on surgical skin markings, because suspicious lesions are often marked with ink before excision.

The team collects 80 images showing ink markings, 80 showing irregular pigment networks and several random sets of skin images. They train CAVs at three late convolutional layers, repeating each analysis 50 times. The ink marking concept receives a TCAV score of about 0.85 for the melanoma class and passes the t-test, while the CAV classifier reaches high separation accuracy.

The result confirms a shortcut. The team removes or crops markings, adds augmented images and retrains. In the new model, the ink marking concept becomes insignificant, while the pigment network concept stays significant, giving clinicians evidence of more trustworthy behavior before a prospective evaluation.