SIO: Synthetic In-Distribution Data Benefits Out-of-Distribution Detection

Jingyang Zhang, Nathan Inkawhich, Randolph Linderman, Ryan Luley, Yiran Chen, Hai Helen Li

TL;DR

Instead of hunting for external out-of-distribution (OOD) data to train safer models, the SIO framework leverages generative models to create synthetic in-distribution (ID) data. By training classifiers on a carefully weighted mix of real and synthetic ID data, SIO acts as a plug-and-play booster that consistently improves OOD detection across a wide variety of existing algorithms without adding online computational overhead.

What Problem Does This Paper Address?

Deep learning models are notoriously overconfident. When a standard image classifier encounters an object from a class it has never seen before—known as out-of-distribution (OOD) data—it will often assign it a high-confidence label from its known in-distribution (ID) classes.

To fix this, many state-of-the-art data-driven methods expose the model to external outlier datasets during training. However, sourcing clean, relevant external OOD data is challenging and often impossible in data-scarce domains. The authors of this paper flip the script and ask: Can we better exploit our internal ID data to improve OOD detection?

Methods

The authors introduce SIO (Synthetic ID data for OOD detection), a simple two-step framework:

  1. Offline Generation: Train a generative model (such as StyleGAN2, BigGAN, or a diffusion model) on the real ID training set ($D_{in}^{real}$) to generate a large pool of synthetic ID images ($D_{in}^{syn}$).
  2. Weighted Training: Train the classifier using a weighted loss function that balances real and synthetic ID data using a ratio parameter, $\alpha$.
Figure 2. Overview of the proposed SIO framework. First, a large number of synthetic ID samples are generated (offline) using a generative model that is trained with real ID images. Then, we combine the real and synthetic ID samples to train the classifier in a weighted fashion described in Equation 4. The specific loss function can be selected from any existing OOD training methods. External OOD samples can also be incorporated into the training depending on their availability (Equation 5).

To ensure a fair comparison and zero additional training overhead, SIO is implemented inside each mini-batch by replacing a fraction ($1-\alpha$) of real ID samples with synthetic ones. This means the model undergoes the exact same number of gradient steps as standard training.

Datasets

  • In-Distribution (ID): CIFAR-10, CIFAR-100, and two high-resolution ImageNet subsets tailored for clean generative modeling: ImageNet-10 and ImageNet-dogs (100 distinct dog breeds).
  • Out-of-Distribution (OOD): Evaluated using the standardized OpenOOD benchmark.
  • Near-OOD (semantically similar): CIFAR-100 (when ID is CIFAR-10) and non-dog ImageNet samples (when ID is ImageNet-dogs).
  • Far-OOD (semantically distinct): MNIST, SVHN, Texture, and Places365.

Key Insights and Ideas

  • The Weighting Scheme is Make-or-Break: Prior work suggested that adding synthetic images to a training set actually lowers classification accuracy. SIO succeeds because of its weighted objective. Setting $\alpha \approx 0.8$ or $0.9$ (keeping 80-90% of the batch real) acts as a powerful regularizer. Naively dumping synthetic data without this weighting degrades performance.
  • Decoupling OOD Performance from ID Accuracy: Conventional wisdom dictates that OOD detection performance correlates tightly with standard ID classification accuracy. SIO challenges this: it consistently boosts OOD detection metrics even in hyperparameter configurations where ID accuracy remains completely flat.
  • Combating Spurious Features: Why does synthetic ID data help detect OOD data? The authors hypothesize that neural networks naturally latch onto "shortcut" or spurious features. Generative models introduce diverse variations in these non-essential features, forcing the network to learn more robust, core representations that don't falsely activate when presented with OOD samples.
  • Generative Quality Correlates to Detection Success: The authors found a strong correlation between the Fréchet Inception Distance (FID) of the generative model and OOD detection performance. Simply put: better generative models yield better OOD detectors.
OOD detection results using different generative models

Key Results

SIO was evaluated alongside 18 different OOD detection methods spanning post-hoc inference techniques, specialized training algorithms, and data-driven approaches.

Figure 1. Results on CIFAR-10. SIO is able to yield improvements on top of multiple methods against both near- and far-OOD. See full results in Section 4.1 Table 1.
  • CIFAR-10/100: SIO achieved noticeable improvements in 35 out of 36 evaluation cases on CIFAR-10. On the challenging CIFAR-10 vs. CIFAR-100 near-OOD task, SIO pushed the average AUROC of the baseline methods from 86.25% to 89.04%.
  • New State-of-the-Art: Combined with PixMix (a data-driven baseline), SIO achieved a new SOTA near-OOD AUROC of 92.94% on the OpenOOD benchmark.
  • High-Resolution Scaling: On ImageNet-10, SIO improved the average near-OOD / far-OOD AUROC from 85.35% / 91.76% to 87.47% / 93.63%.

Limitations and Future Work

The primary limitation of SIO is its dependence on the quality of the underlying generative model. For highly complex or poorly defined ImageNet categories (e.g., categories where the target object is frequently occluded or co-occurs with humans), current generators struggle to produce plausible images. Introducing highly unrealistic synthetic images during training can introduce harmful noise.

However, the authors note that SIO is uniquely positioned to ride the coattails of generative AI. As diffusion models and GANs continue to improve at generating high-fidelity, diverse images for complex datasets, SIO will naturally become an even more potent tool for building reliable machine learning systems.

Summary updated

BibTeX
@misc{zhang2023sio,
  author = {Jingyang Zhang and Nathan Inkawhich and Randolph Linderman and Ryan Luley and Yiran Chen and Hai Helen Li},
  title = {{SIO: Synthetic In-Distribution Data Benefits Out-of-Distribution Detection}},
  year = {2023},
  eprint = {2303.14531},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.14531},
}
Figure