From Fake to Real: Pretraining on Balanced Synthetic Images to Prevent Spurious Correlations in Image Recognition

Maan Qraitem, Kate Saenko, Bryan A. Plummer

Abstract

Visual recognition models are prone to learning spurious correlations induced by a biased training set where certain conditions B (e.g., Indoors) are over-represented in certain classes Y (e.g., Big Dogs). Synthetic data from off-the-shelf large-scale generative models offers a promising direction to mitigate this issue by augmenting underrepresented subgroups in the real dataset. However, by using a mixed distribution of real and synthetic data, we introduce another source of bias due to distributional differences between synthetic and real data (e.g. synthetic artifacts). As we will show, prior work’s approach for using synthetic data to resolve the model’s bias toward B do not correct the model’s bias toward the pair (B, G), where G denotes whether the sample is real or synthetic. Thus, the model could simply learn signals based on the pair (B, G) (e.g., Synthetic Indoors) to make predictions about Y (e.g., Big Dogs). To address this issue, we propose a simple, easy-to-implement, two-step training pipeline that we call From Fake to Real (FFR). The first step of FFR pre-trains a model on balanced synthetic data to learn robust representations across subgroups. In the second step, FFR fine-tunes the model on real data using ERM or common loss-based bias mitigation methods. By training on real and synthetic data separately, FFR does not expose the model to the statistical differences between real and synthetic data and thus avoids the issue of bias toward the pair (B, G). Our experiments show that FFR improves worst group accuracy over the state-of-the-art by up to 20% over three datasets.

Introduction: The Challenge of Spurious Correlations

Machine learning models often act as "shortcut learners," latching onto spurious correlations within biased training sets. For instance, if a dataset primarily features smiling women and non-smiling men, a model might incorrectly learn to associate gender features with the concept of a "smile." This dataset bias leads to poor performance on underrepresented subgroups, such as smiling men.

While synthetic data generation (e.g., using Stable Diffusion) offers a way to balance these datasets, simply mixing real and synthetic data introduces a new problem: distributional shift. Synthetic images contain subtle artifacts or "fingerprints." When mixed, models often learn to distinguish between data sources rather than the target concept, effectively learning a new bias: "Synthetic + Man = Smiling."

Methodology: From Fake to Real (FFR)

To overcome the pitfalls of mixing real and synthetic data, we propose From Fake to Real (FFR). FFR is a two-stage training pipeline designed to isolate the model from the statistical differences between data sources.

Comparison of prior synthetic augmentation methods (mixed distribution) versus the proposed FFR method (two-stage training). FFR prevents the model from learning source-specific artifacts, leading to correct classification and better saliency map alignment.
  1. Stage 1: Pre-training on Balanced Synthetic Data. The model is trained on a purely synthetic dataset where all subgroups are represented equally. Since no real data is present, the model is forced to learn robust, generalizable features across all synthetic subgroups without being distracted by "real vs. fake" distinctions.
  2. Stage 2: Fine-tuning on Real Data. The model is then fine-tuned on the original, biased real-world dataset. The robust representations learned in Stage 1 serve as an "anchor," preventing the model from collapsing into biased shortcuts during the fine-tuning phase.

FFR is method-agnostic and can be integrated with existing bias-mitigation techniques like GroupDRO or Resampling during the second stage.

Experimental Evaluation

We evaluated FFR across three benchmark datasets with bias ratios ranging from 90% to 99.9%:

  • CelebA-HQ: Predicting "Smiling" with "Gender" as the biasing variable.
  • UTK-Face: Predicting "Age" with "Gender" as the biasing variable.
  • SpuCo Animals: Predicting "Dogs" vs. "Birds" where backgrounds (Indoors, Outdoors, Land, Water) act as spurious correlates.

Synthetic images were generated using Stable Diffusion V1.4 with simple class-and-bias prompts.

Key Insights and Results

  • Theoretical Grounding: The paper provides a theoretical analysis (Theorem 1) proving that mixing synthetic data to balance a real dataset inevitably introduces a new bias toward the (Bias, Data Source) pair.
  • Improved Worst Group Accuracy (WA): FFR achieved up to a 20% improvement in accuracy for the most underrepresented groups compared to current state-of-the-art methods.
  • Feature Alignment: t-SNE visualizations confirm that FFR aligns real and synthetic embeddings more effectively than prior methods, indicating the learning of "core" features rather than source artifacts.
  • Qualitative Success: Saliency maps (RISE) show that FFR-trained models focus on relevant object features (e.g., a dog's face) rather than background elements or synthetic artifacts.

Conclusion

FFR demonstrates that the way synthetic data is used is just as important as the data itself. By separating synthetic pre-training from real-world fine-tuning, we can leverage the balancing power of generative models without falling victim to distributional artifacts. As generative models continue to improve, FFR provides a robust framework for building fairer and more reliable vision systems.

Summary updated

BibTeX
@inproceedings{qraitem2024from,
  author = {Maan Qraitem and Kate Saenko and Bryan A. Plummer},
  title = {{From Fake to Real: Pretraining on Balanced Synthetic Images to Prevent Spurious Correlations in Image Recognition}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=YeLUPJe0am},
}
Figure