Search

Search papers and lessons

Network Dissection: Quantifying Interpretability of Deep Visual Representations

David Bau, Bolei Zhou, Aditya Khosla et al. · 2017

Bau et al. (2017) score each hidden unit of a vision network against a labelled set of visual concepts, and show that how interpretable the units are depends on training and is not a free by-product of accuracy.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Linear algebra
  • Neural network basics
  • Architectures
  • Signal processing
  • ReadReady to readNot yet

TL;DR

Bau, Zhou, Khosla, Oliva and Torralba (2017) introduce Network Dissection, a way to measure how interpretable the hidden units of a convolutional network are. Each unit is compared, pixel by pixel, with a large set of human-labelled visual concepts (the Broden dataset) such as objects, parts, scenes, textures and colours, and is given the concept it matches best. The paper's main finding is that interpretability is not a by-product of accuracy: it depends on the basis of the representation, on training conditions, and on the architecture.

Builds on: Network Dissection, Receptive Field, Intersection over Union · Leads to: no lessons yet

Why it mattered

Before this paper, researchers had seen individual units that seemed to detect things, such as a unit that fires on table lamps or on bicycle wheels. Those observations were largely anecdotal. The paper turned them into a number that can be compared across layers, networks and training methods. It also introduced Broden, a dataset with dense labels across objects, parts, scenes, materials, textures and colours, which later interpretability work has reused as a concept benchmark. Its central argument, that interpretability and discriminative power are different properties, shapes how people in Mechanistic Interpretability think about what a good representation is.

The problem

Deep networks often seem to learn units that correspond to human concepts. The question the paper asks is whether this is a special property of the network's natural coordinate system or a loose impression. If a representation is disentangled, its variables line up with meaningful factors, and reading them out would explain the network. If not, any apparent concept is a chimera.

Two questions had no good answer. First, how do you define disentanglement for a network, when the concept list is human-made? Second, do the interpretable units reflect a special alignment of the feature space, or would a rotated version of the same layer look just as interpretable? The paper answers both by measuring alignment between single units and single concepts, and by testing what happens when the basis is rotated.

How it works

Network Dissection has three steps, in the order the paper runs them. The diagram shows the flow.

flowchart LR
  B[Broden: labelled concept masks] --> M[Score each unit against each concept]
  N[CNN unit activations on Broden images] --> T[Threshold each unit at its top 0.5 percent]
  T --> M
  M --> I[IoU for each unit and concept pair]
  I --> C[Count unique concepts per layer]
  1. Gather concepts. Broden is a dataset of images where every pixel carries concept labels. It merges several dense datasets and adds 11 colour names. Check: a pixel can carry several labels, for example a unified "cat" label, a "leg" label and the colour "black".
  2. Record responses. For each image, the paper collects the activation map of every convolutional unit. For each unit kk, it finds a threshold TkT_k so that the activation exceeds TkT_k at 0.5 percent of spatial locations across the dataset. Check: the threshold is set from the unit's own distribution, not from a fixed number.
  3. Turn the unit into a segmentation. The low-resolution activation map is scaled up to the mask resolution with bilinear interpolation, then thresholded. The pixels above threshold form the unit's predicted region for the image.
  4. Score against each concept. The predicted region is compared with each concept mask. The score is the intersection over union, summed over the whole dataset. A unit counts as a detector for a concept if this score exceeds 0.04.
  5. Count. A layer's interpretability is the number of unique concepts that some unit detects. The paper calls this the number of unique detectors.

The method needs only forward passes. It does not train or change the network, so it can be applied to any convolutional model.

The math

Let Ak(x)A_k(\mathbf{x}) be the activation map of unit kk on image x\mathbf{x}, and let Lc(x)L_c(\mathbf{x}) be the mask for concept cc. The upscaled, thresholded map is

Mk(x)=1[Sk(x)≥Tk]M_k(\mathbf{x}) = \mathbf{1}\big[S_k(\mathbf{x}) \geq T_k\big]

where SkS_k is the bilinear upscaling of AkA_k and 1[⋅]\mathbf{1}[\cdot] is 1 where the condition holds and 0 otherwise. The threshold TkT_k satisfies P(ak>Tk)=0.005P(a_k \gt T_k) = 0.005 over all spatial locations in the dataset.

Step 4 in symbols: the score

The score for unit kk as a segmenter for concept cc is the dataset-wide intersection over union:

IoUk,c=∑x∣Mk(x)∩Lc(x)∣∑x∣Mk(x)∪Lc(x)∣\mathrm{IoU}_{k,c} = \frac{\sum_{\mathbf{x}} |M_k(\mathbf{x}) \cap L_c(\mathbf{x})|}{\sum_{\mathbf{x}} |M_k(\mathbf{x}) \cup L_c(\mathbf{x})|}

The sums run over images that contain at least one label of the same category as cc. The vertical bars mean the number of pixels in a set. The unit is a detector for cc when IoUk,c>0.04\mathrm{IoU}_{k,c} \gt 0.04, and the paper keeps only the top-ranked label when a unit matches several.

Step 5 in symbols: the count

For a layer with units k=1,…,Kk = 1, \dots, K, the number of unique detectors is the size of the set of concepts cc for which at least one unit passes the threshold. Counting distinct concepts, not detecting units, means that two units detecting the same concept count once.

The rotation test

The paper's key experiment changes the basis of a layer. For a layer with f(x)f(x) as its activations and an orthogonal matrix QQ, the rotated representation is Qf(x)Qf(x). Because QQ is invertible, a downstream network can absorb it, so the discriminative power is unchanged. The test asks whether the count of unique detectors also stays the same. If it does not, interpretability depends on the basis, which is the paper's finding.

Worked examples

Example
Example 1: one unit, one concept, by hand

Setting: a unit's predicted region and a concept mask, each on one tiny image of 10 pixels. The predicted region covers 4 pixels. The concept mask covers 6 pixels. They overlap on 3 pixels.

  1. Intersection: ∣M∩L∣=3|M \cap L| = 3 pixels.
  2. Union: ∣M∪L∣=∣M∣+∣L∣−∣M∩L∣=4+6−3=7|M \cup L| = |M| + |L| - |M \cap L| = 4 + 6 - 3 = 7 pixels.
  3. IoU: 3/7≈0.433 / 7 \approx 0.43.
  4. Threshold check: 0.43>0.040.43 \gt 0.04, so this unit is a detector for the concept.

Interpretation: the score is the fraction of the combined area on which the unit and the concept agree. A 0.43 score is well above the paper's 0.04 cut-off, so the unit counts as a detector.

Example
Example 2: the share of interpretable units at each layer

Setting: Table 3 of the paper reports, for the 256 units of conv5 of AlexNet trained on Places205, 194 units that raters agreed were interpretable. For conv1, the table reports 57 interpretable units out of 96.

  1. Share at conv5: 194/256=0.758194 / 256 = 0.758, about 76 percent of units.
  2. Share at conv1: 57/96=0.59457 / 96 = 0.594, about 59 percent of units.
  3. Difference: 0.758−0.594=0.1640.758 - 0.594 = 0.164, about 16 percentage points more units are interpretable at conv5.

Interpretation: interpretability rises with depth in this network, which matches the paper's observation that higher layers contain more object and part detectors. The table also shows that human consistency, the agreement among raters on the ground-truth labels, is 91 percent at conv5, so the labels are most reliable at the top layer.

Example
Example 3: the rotation result, and a try-it

Setting: a conv5 layer of 256 units, trained on Places. The paper reports that after a random orthogonal rotation of this representation, the number of unique detectors is 80 percent smaller than before, with the same discriminative power.

  1. Suppose the original layer has 100 unique detectors.
  2. After the rotation, the count drops by 80 percent: 100×(1−0.8)=20100 \times (1 - 0.8) = 20 unique detectors.
  3. The classifier downstream is unchanged, because the rotation is undone by the next layer's weights.

Try it: a layer has 150 unique detectors. The paper's rotation reduces that count by 80 percent. How many unique detectors are left, and what does this say about the claim that interpretability follows from discriminative power? Answer: 150×0.2=30150 \times 0.2 = 30 detectors remain. The same accuracy comes with a fifth as many named units, so interpretability is a separate property that must be measured.

Common mistakes and tradeoffs

It is tempting to think that a unit which fires on a picture of a cat is a cat detector; in fact a unit can fire on many things, and the score is what decides. The paper's IoU is a measure of overlap between the thresholded region and a labelled mask, so a unit that fires on fur, grass and a cat may score low on the cat concept and higher on a texture concept.

It is tempting to think that the concept list is a neutral measuring stick; in fact the method finds only concepts that are in Broden. A unit that responds to a concept absent from Broden cannot be scored against that concept at all, so it will look uninterpretable under this method. Interpretability is therefore relative to the dataset's vocabulary, which is a real limit.

It is tempting to think that a high count of unique detectors means the network understands the images better; in fact the paper's analysis is about alignment with single units, not about understanding. Batch normalisation, for example, reduced interpretability in the paper's experiments, while its accuracy was similar.

It is tempting to think that a rotation-invariant measure would be better; in fact the rotation test shows why the natural basis matters for interpretability. A method that reads units directly is only as informative as the basis those units define.

When to use the method: to compare layers, architectures or training conditions by how well their units align with human concepts, on a vision network you can run forward. When not to use it: for a non-convolutional model, or for concepts that are not in the labelled dataset. Alternatives include visualisation of maximally activating patches, linear probes, and later work on directions in activation space rather than single units.

History

Before 2017, the idea that individual units detect human concepts came from observations. Zhou and colleagues had shown that units in a network trained to classify scenes behave as object detectors, and human judges were used to check them. The paper's contribution was to put the labelling step on an automatic footing, using a dense dataset, and to test whether the single unit is the right unit of analysis at all.

The paper was posted to arXiv in April 2017, and its source code and data were made available on the authors' project page. The rotation experiment and the training-condition experiments made it a standard reference for later work on the alignment of network features with human concepts. The question it raised, whether a network's natural basis carries meaning, is still open, and the field has since developed other ways of finding directions in activation space.

Results

The paper's findings, in the order the lesson built them:

  • Network Dissection scores each hidden unit of a vision network against labelled concepts, using intersection over union.
  • A unit is a detector for a concept when the score exceeds 0.04; a layer's interpretability is the number of unique concepts detected.
  • Rotating a layer's basis with an orthogonal matrix leaves accuracy unchanged but cuts the number of unique detectors by 80 percent in the paper's experiment, so interpretability is a separate property.
  • Interpretability rises with depth and depends on training. Batch normalisation reduced it in the paper, and Places supervision gave more detectors than ImageNet.
  • Next, read Mechanistic Interpretability for the wider programme of looking inside networks, and Network Dissection for the method as a lesson.

Reading guide

Check yourself

QuestionRecall: what are the three steps of Network Dissection, in order?Show answer
Identify a broad set of human-labelled visual concepts, gather the hidden units' responses to those concepts, and quantify the alignment between each unit and each concept. In the paper's terms these are Broden, the activation thresholding and segmentation, and the IoU scoring with counting.
QuestionComputation: a unit's predicted region covers 5 pixels, a concept mask covers 9 pixels, and they overlap on 4 pixels. What is the IoU, and does the unit count as a detector at the paper's 0.04 threshold?Show answer
The union is 5 + 9 - 4 = 10 pixels, so IoU = 4 / 10 = 0.4. Since 0.4 is greater than 0.04, the unit counts as a detector for that concept.
QuestionWhy: the rotation test keeps discriminative power the same but changes the count of unique detectors. What does that show?Show answer
Interpretability is not determined by discriminative power. Two representations with the same classification ability can differ in how many units align with single human concepts, so interpretability must be measured separately.
QuestionApplied: a team wants to use Network Dissection to check whether a new vision network has learned a concept that is not in Broden, such as a specific type of machine part. What should they expect, and what should they do?Show answer
The method can only match concepts in its labelled dataset, so a unit that responds to machine parts will not score well unless those parts are labelled. They should add labelled masks for the concept to a dataset of the same kind, or use a method that does not depend on a fixed concept list, and they should not read a low score as proof that the unit is uninterpretable.

Sources

Read the full paper

David Bau, Bolei Zhou, Aditya Khosla et al., 2017. arXiv:1704.05796