Modularity Trumps Invariance for Compositional Robustness

Ian Mason, Anirban Sarkar, Tomotake Sasaki, Xavier BoixarXiv 2023

Standard deep learning models are notoriously brittle. A model trained on clean images might fail completely if you just add a bit of blur or noise. While researchers have developed many techniques to make models robust to these "elemental" corruptions, the real world rarely presents just one problem at a time. Think of driving in a storm: you might face rain, fog, and low light all at once.

In their paper, "Modularity Trumps Invariance for Compositional Robustness," Ian Mason and his colleagues from MIT and Fujitsu explore whether our current best ideas for robustness actually hold up when corruptions start stacking.

TL;DR

Neural networks struggle to generalize to unseen combinations of image corruptions (like blur plus noise), even when trained on each corruption individually. This paper demonstrates that the standard approach of seeking "invariant representations" fails this task, whereas a modular architecture that explicitly "undoes" individual corruptions generalizes significantly better.

What Problem Does This Paper Address?

Most research on model robustness focuses on single corruptions (e.g., the ImageNet-C benchmark). However, visual space is inherently compositional. If a model is robust to "Blur" and robust to "Noise," we expect it to be robust to "Blur + Noise."

The authors identify a gap: standard Domain Generalization (DG) methods usually try to learn invariant representations—features that look the same regardless of the corruption. The authors question if this "one-size-fits-all" invariant representation is actually sufficient for compositional tasks, or if we need architectures that better reflect the underlying structure of the data.

Figure 1: The compositional robustness task. A model is trained jointly on images corrupted with elemental corruptions (left) and evaluated on images corrupted with compositions of these corruptions (right). Shown is all 7 elemental corruptions and a subset of the 160 compositions of corruptions.

Methods

The researchers compared three distinct training strategies:

  1. Empirical Risk Minimization (ERM): The standard baseline—training on all elemental corruptions jointly.
  2. Contrastive Training (Invariance): A popular DG approach using a pairwise contrastive loss (similar to SimCLR). This forces the network to map a "blurred" image and a "noisy" version of the same image to the exact same point in latent space, theoretically building invariance.
  3. Modular Approach: Instead of one monolithic network, they used a shared backbone with specific modules for each corruption. Each module is trained to "undo" its specific corruption in the network's latent space. At test time, if an image has three corruptions, the model sequentially applies the three corresponding modules.

Datasets

The authors evaluated these methods across three diverse image classification tasks:

  • EMNIST: Handwritten characters (47 classes).
  • CIFAR-10: General objects (10 classes).
  • FACESCRUB: Face recognition (388 classes).

For each dataset, they defined 7 training domains (Identity + 6 elemental corruptions like Swirl, Invert, and Gaussian Blur) and 160 test domains consisting of compositions of 2 to 6 corruptions.

Key Insights and Ideas

  • Invariance is not a Silver Bullet: The most striking "aha moment" is that forcing a model to be invariant to elemental corruptions during training does not make it robust to their combinations.
  • The Correlation Gap: The authors found no meaningful correlation between how invariant a representation was on training data and how well it performed on out-of-distribution compositions. This challenges a central pillar of Domain Generalization theory.
  • Structure over Statistics: The modular approach wins because its architecture mirrors the compositional nature of the problem. By treating each corruption as a separate "mechanism" to be undone, the model can handle combinations it has never seen before.
Figure 3: Correlating invariance scores with compositional robustness for EMNIST. Row one shows the level of representational invariance amongst elemental corruptions fails to correlate with compositional robustness (accuracy). Row two shows the lack of dissemination of invariance between elemental corruptions and compositions. Row three plots composition invariance scores against compositional robustness. Columns show subsets of evaluation domains depending on the number of elemental corruptions making up a composition (as in Figure 2).

Key Results

The quantitative results across all datasets tell a consistent story:

  • Modularity Wins: The modular approach consistently outperformed both ERM and Contrastive training. As the number of corruptions in a composition increased (making the task harder), the performance gap between modular and monolithic models widened.
  • The "Invariance" Marginalia: Contrastive training—the industry standard for building robust representations—offered only marginal improvements over basic ERM.
  • Complexity Ceiling: For all methods, accuracy drops sharply as compositions become more complex. While models handle 2-3 corruptions relatively well, they still struggle with 5-6 simultaneous corruptions, often falling toward chance levels.
Figure 2: Accuracy vs. number of corruptions. The modular approach (green) consistently stays above the monolithic baselines (blue/orange).

Limitations and Future Work

While modularity is the clear winner here, the authors acknowledge several hurdles for real-world deployment:

  • The "Oracle" Assumption: Currently, the modular model needs to be told which corruptions are present in a test image to apply the right modules. A truly autonomous system would need to infer this on the fly.
  • Sensitivity to Order: The order in which modules are applied matters, particularly for non-commutative corruptions.
  • Module Placement: The performance of the modular approach is sensitive to where the modules are inserted in the network hierarchy.
  • Future Direction: The ultimate goal is to move toward "learning to decompose"—developing systems that can automatically discover these modular mechanisms from unstructured, real-world data without manual labels for every corruption.

Summary updated

BibTeX
@misc{mason2023modularity,
  author = {Ian Mason and Anirban Sarkar and Tomotake Sasaki and Xavier Boix},
  title = {{Modularity Trumps Invariance for Compositional Robustness}},
  year = {2023},
  eprint = {2306.09005},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.09005},
}
Figure