OOD-Probe: A Neural Interpretation of Out-of-Domain Generalization

Zining Zhu, Soroosh Shahtalebi, Frank Rudzicz

TL;DR

Most out-of-domain (OOD) generalization algorithms aim to learn representations that are invariant across environments, but they are typically evaluated as black boxes using end-to-end task accuracy. By attaching linear diagnostic "probes" to intermediate network layers across 22 domain generalization algorithms, OOD-Probe reveals that none of these models actually eliminate domain-specific information. Instead, models preserve domain attributes in characteristic layerwise patterns—and counterintuitively, retaining easily decodable domain information often correlates positively with better generalization.

What Problem Does This Paper Address?

Deep learning models frequently fail when deployed in new environments where data distributions shift (e.g., medical imaging across different hospital scanners). The prevailing theoretical solution—the invariance principle—posits that neural networks should learn data representations that discard environment-specific quirks and preserve only invariant, causal features.

However, existing OOD benchmarks evaluate models strictly by downstream accuracy on unseen domains. This black-box approach leaves crucial mechanistic questions unanswered:

  1. Do neural networks ever actually achieve invariant representations, and if so, at which layers?
  2. How do different domain generalization (DG) algorithms alter intermediate representations?

Methods

The authors introduce OOD-Probe, adapting the diagnostic probing paradigm from NLP and interpretability research to domain generalization:

  • Architecture: The model backbone is split into a featurizer (a 4-layer CNN or ResNet-18) and a task classifier. Diagnostic probes—simple linear classifiers—are attached to intermediate representations (after each convolutional layer in CNNs, or after each residual block in ResNets, plus the final featurizer output).
  • Probing Task: After training the primary network on training environments $\mathcal{E}_{tr}$ under a leave-one-domain-out protocol, weights are frozen. Linear probes are then trained to predict the domain/environment label $E \in \{1, \dots, M\}$ from the frozen hidden representations.
  • Selectivity & Metric: Probing performance is measured via classification accuracy, benchmarked against a uniform random baseline ("dummy accuracy" $= 1 / n_{\text{classes}}$). Linear probes are intentionally chosen for high selectivity (they only succeed if domain features are linearly readable).

Datasets

The authors evaluated 22 domain generalization algorithms from the DomainBed benchmark on four standard image datasets:

  • RotatedMNIST: Digits rotated by specific angles (domain corresponds to the rotation angle).
  • ColoredMNIST: Digits colored red or green with varying spurious correlation ratios across environments.
  • VLCS: Natural images from four photographic datasets (PASCAL VOC 2007, LabelMe, Caltech101, SUN09) representing diverse capture styles.
  • PACS: Images across four visual styles: Photo, Art painting, Cartoon, and Sketch.

No new datasets were introduced.

Key Insights and Ideas

  • Invariant representations are a myth in practice: Across all 22 algorithms, probing accuracy for the domain label was significantly higher than the dummy baseline across all intermediate layers. Models never completely purge environment-specific information.
  • Layerwise representations depend on dataset semantics, not algorithms: The encoding pattern across depth is remarkably consistent across diverse algorithms, but varies by dataset:
  • Spatial/Geometric shifts (RotatedMNIST): Domain information is most readable in early convolutional layers and decreases toward deeper layers.
  • Style/Abstract shifts (PACS & VLCS): Probing follows an "increase-then-decrease" trajectory. By the data processing inequality, mutual information cannot increase down the pipeline, meaning middle ResNet blocks specifically linearize and organize style information before the final classifier compresses it.
  • Domain information can help, not hurt: Probing accuracy at specific layers correlates significantly (often positively) with downstream OOD generalization accuracy. For instance, on RotatedMNIST and PACS, models that represent domain attributes more linearly in intermediate layers generalize better. Rather than blindly eliminating environment information, effective models often organize and disentangle it.

Key Results

  • Failure to purge domain labels: On RotatedMNIST (dummy baseline: $1/6 \approx 16.7\%$), early layers achieved $98\text{--}99\%$ probe accuracy; even the deepest featurizer layer retained $26\text{--}61\%$ domain accuracy.
  • Model discrepancy: Algorithms with virtually identical target generalization accuracy can exhibit vastly different internal representations. On RotatedMNIST, CDANN and CORAL both achieve $\sim 97\text{--}98\%$ target test accuracy, yet their probe accuracy on the final hidden representation is $55\%$ vs. $26\%$.
  • Generalization correlations:
  • On RotatedMNIST, early probe accuracy strongly correlated with generalization (Probe 0: $r = 0.7955, p < 0.01$; Probe 1: $r = 0.8982, p < 0.01$).
  • On PACS, intermediate block probe accuracy showed an extremely strong positive correlation with final OOD test accuracy (Probe 3: $r = 0.9703, p < 0.01$).
  • On VLCS, the relationship was primarily negative (e.g., individual algorithm correlations were largely negative across probes).

Limitations and Future Work

  • Choice of Probing Target: The environment index $E$ is an aggregate proxy. If specific shift attributes (e.g., illumination, texture, camera bias) were known and isolated, probing for concrete factors might yield deeper mechanistic insights.
  • Linear Probe Constraints: While linear probes test for explicit, readily accessible features, they do not quantify non-linear mutual information.
  • Architectural Scope: The study evaluated standard vision models (4-layer CNNs and ResNet-18); extending OOD-Probe to Vision Transformers (ViTs) or large multimodal models remains unexplored.
  • Actionable Regularization: The authors suggest using probing signals as a diagnostic dashboard or directly designing auxiliary objectives (e.g., encouraging linear representation of target features at specific network depths), which remains open for future implementation.

Summary updated

BibTeX
@inproceedings{zhu2022ood,
  author = {Zining Zhu and Soroosh Shahtalebi and Frank Rudzicz},
  title = {{OOD-Probe: A Neural Interpretation of Out-of-Domain Generalization}},
  booktitle = {SCIS @ ICML},
  year = {2022},
  url = {https://openreview.net/forum?id=pofbRo9STT-},
}
Figure