Scalable Ensemble Diversification for OOD Generalization and Detection

Alexander Rubinstein, Luca Scimeca, Damien Teney, Seong Joon Oh · DOI

Introduction

Deep learning models frequently struggle with "spurious correlations"—patterns that appear reliable in training data but fail to generalize to the real world. For instance, a model might identify a cow based on a grassy background rather than the animal's features. While ensembles of models can mitigate this by providing multiple perspectives, they are only effective if the individual models are truly diverse. If every model in an ensemble learns the same shortcut, the entire system fails simultaneously.

The Challenge of Diversity

Existing methods to encourage diversity, such as "Agree to Disagree" (A2D), typically force models to produce different predictions on unlabeled out-of-distribution (OOD) data. However, these approaches face two significant bottlenecks:

  1. Data Dependency: They require access to a separate, well-defined OOD dataset during the training phase, which is often unavailable.
  2. Computational Complexity: They usually perform pairwise comparisons between every model in the ensemble. For an ensemble of size $M$, this results in $O(M^2)$ complexity, making it impossible to scale to large datasets like ImageNet or massive ensemble sizes.

Scalable Ensemble Diversification (SED)

This paper introduces Scalable Ensemble Diversification (SED), a framework designed to achieve state-of-the-art OOD generalization and detection without the traditional overhead. SED shifts the paradigm by using in-distribution data more effectively and optimizing the training process for speed.

Comparison between traditional ensemble diversification (top), which requires OOD data, and SED (bottom), which identifies OOD proxies within the ID dataset.

Core Methodological Shifts

SED implements three key innovations to make diversification practical at scale:

  • Dynamic Hard Sample Selection: Instead of relying on external OOD data, SED identifies "hard" samples within the standard training set in real-time. By using a weighting mechanism ($\alpha_n$) that prioritizes samples where the ensemble struggles, the method treats these difficult images as proxies for OOD data. This forces models to explore diverse hypotheses to explain the same complex inputs.
  • Stochastic Pairing: To solve the $O(M^2)$ scaling problem, SED randomly selects just one pair of models per mini-batch for disagreement. This reduces the complexity to $O(1)$ relative to the ensemble size, enabling the training of much larger ensembles.
  • Partial Layer Diversification: To minimize computational costs, the diversification loss is applied only to the final two layers of the network (e.g., a Vision Transformer like DeiT-III), while the rest of the backbone remains frozen.

Predictive Diversity Score (PDS)

The authors also propose a new metric for OOD detection. Unlike standard Bayesian Model Averaging, which averages outputs, the Predictive Diversity Score (PDS) counts the number of unique classes predicted across the ensemble. A high count of unique predictions serves as a strong signal that a sample is OOD, as diverse models are more likely to disagree on unfamiliar data.

Experimental Results

The researchers evaluated SED on large-scale benchmarks, including ImageNet-1K for in-distribution training and various OOD sets such as ImageNet-R (renditions), ImageNet-C (corruptions), and iNaturalist (semantic shifts).

  • Superior Generalization: On ImageNet-R, an ensemble of 50 models trained with SED achieved 53.8% accuracy, significantly outperforming standard deep ensembles and previous diversification methods.
  • State-of-the-Art Detection: Using the PDS metric, SED reached an AUROC of 0.977 on iNaturalist and 0.941 on OpenImages, surpassing established baselines.
  • Efficiency Gains: Stochastic pairing makes SED dramatically faster than A2D. Training a 5-model ensemble with SED took approximately 53 seconds per epoch, compared to nearly 10 minutes for the standard A2D approach.

Discussion and Limitations

SED demonstrates that "hard" in-distribution samples can effectively substitute for real OOD data, and that stochasticity in model pairing can actually improve diversity. However, the method involves a clear trade-off: to achieve massive gains in OOD detection, practitioners may see a decrease in top-1 accuracy on the standard training set. This balance is controlled by a single hyperparameter ($\lambda$).

Future work remains to provide a deeper theoretical grounding for why hard ID samples serve as such effective OOD proxies and to test the framework across a broader range of architectures beyond Vision Transformers, such as Mamba or ConvNeXt.

Summary updated

BibTeX
@misc{rubinstein2024scalable,
  author = {Alexander Rubinstein and Luca Scimeca and Damien Teney and Seong Joon Oh},
  title = {{Scalable Ensemble Diversification for OOD Generalization and Detection}},
  year = {2024},
  eprint = {2409.16797},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.16797},
}
Figure