Understanding intermediate layers using linear classifier probes

Guillaume Alain, Yoshua Bengio

Deep learning models are notoriously difficult to interpret, often described as "black boxes." While we can easily observe a model's final output, understanding the intermediate transformations happening within the hidden layers remains a significant challenge.

Traditional Information Theory (like Shannon's entropy) doesn't fully resolve this. According to the Data Processing Inequality, information about an input can only be lost or preserved as it passes through successive layers; it never increases. Yet, we intuitively know that deeper layers are "better" at solving the target task. The discrepancy lies in the difference between total information and usable information. For instance, a raw "hex dump" of an image file contains more raw data than the rendered image itself, but a simple classifier (or a human) can only make sense of the latter.

To measure this "computational convenience" or "readiness" of features across a network's depth, researchers have introduced a diagnostic tool: linear classifier probes.

Methodology: Inserting Linear Probes

The core method involves attaching simple linear classifiers—referred to as "probes"—to the intermediate layers of a neural network.

  • The Probe: A simple softmax layer (linear classifier) that takes the hidden units of a specific intermediate layer as its sole input.
  • Non-Intrusive Design: Crucially, these probes act strictly as observational tools and do not affect the training of the main model. They utilize a "stop gradient" operation to ensure that the gradients calculated from the probe's loss do not backpropagate into the main network.
  • Training: Probes can be trained concurrently with the main model as a separate diagnostic thread, or post-hoc after the main model has finished training.
Diagram illustrating linear probes attached to intermediate layers with stop-gradients.

By monitoring the prediction error of these probes, researchers can pinpoint exactly where in the network's pipeline the data becomes linearly separable.

Key Insights and Applications

Using these probes, the authors uncovered several insights into how neural networks learn and process data:

1. Information vs. Usability The primary goal of deep layers isn't to "create" new information, but to untangle and transform existing information into a format that is immediately suitable for a linear classifier.

2. The Domino Effect By plotting probe errors over time, researchers observed a "ripple" or "domino effect" during training. Early layers tend to reach their peak predictive power before later layers do, showing that learning propagates through the network like a wave.

3. Redundancy Checks in Branching Architectures In models with branching paths, probes can determine if a specific branch contributes unique information. If the probe error of a concatenated layer is lower than the errors of its individual incoming branches, it indicates that both branches are providing non-redundant, valuable features.

Key Results: Inception v3 and Pathological Models

The paper evaluates this probing technique on both complex, high-performing models and custom "pathological" architectures designed to test specific behaviors.

Inception v3 Analysis

When applied to the Inception v3 architecture, probes provided a clear visual heatmap of learning progress. Interestingly, the probes revealed that the model's auxiliary head (a secondary classifier used to assist training) actually achieved a slightly lower prediction error than the main head at certain points during the training process, empirically justifying its inclusion in the architecture.

Heatmap of probe training errors across the Inception v3 architecture.

Identifying "Dead" Layers

Probes also serve as an excellent diagnostic tool for architectural flaws. The authors tested a custom 128-layer deep network featuring a massive skip connection that bypassed the first half of the model. The linear probes revealed that the error in those bypassed middle layers remained high (near random) even as the final output of the network improved. This proved that the skip connection allowed the model to completely "give up" on training the intermediate layers, rendering them "dead" segments that the network simply ignored.

Limitations and Future Work

The primary limitation of this technique is that the probes are strictly linear. If an intermediate layer contains highly useful but non-linear features, a linear probe will report a high error, which might lead a researcher to incorrectly conclude that the layer is "useless." Therefore, this method should be viewed as a powerful heuristic rather than an absolute rule.

Future work could explore using slightly more complex (yet still restricted) probes, or applying this technique to Recurrent Neural Networks (RNNs) to visualize how internal representations evolve over time steps rather than just across spatial layers.

Summary updated

BibTeX
@inproceedings{alain2017understanding,
  author = {Guillaume Alain and Yoshua Bengio},
  title = {{Understanding intermediate layers using linear classifier probes}},
  booktitle = {Workshops @ ICLR},
  year = {2017},
  url = {https://openreview.net/forum?id=rn4MzQJ8Sgq},
}
Figure