Controlled Training Data Generation with Diffusion Models

Teresa Yeo, Andrei Atanov, Harold Benoit, Aleksandr Alekseev, Ruchira Ray, Pooya Esmaeil Akhoondi, Amir Zamir

Abstract

Deep learning models often struggle with distribution shifts between training and test environments. This paper presents a novel "closed-loop" framework for generating synthetic training data using diffusion models. By integrating feedback from a target model to identify vulnerabilities and guidance toward a specific test distribution via CLIP, the proposed Guided Adversarial Prompts (GAP) generate highly efficient, "hard" training examples. Experimental results across classification and regression tasks, including Waterbirds and iWildCam, demonstrate that GAP significantly improves model robustness and data efficiency compared to traditional open-loop synthetic data generation.

Introduction

The brittleness of deep learning models under distribution shift remains a significant challenge. While generative models like Stable Diffusion offer a path to augment training sets, current "open-loop" approaches rely on pre-defined prompts that may not address a model's specific weaknesses. This research introduces an adaptive system that "interrogates" a model to find its blind spots and generates targeted images to mitigate them, moving beyond static data collection.

Methods: Guided Adversarial Prompts (GAP)

The core of the framework is the use of two feedback mechanisms to steer a text-to-image diffusion model:

  1. Adversarial Prompts (AP): This model-informed feedback optimizes the text embedding space of the diffusion model to find prompts that maximize the loss of the supervised model. It identifies specific visual features that cause the model to fail.
  2. Target Distribution Feedback: This steers generation toward a specific style or environment (e.g., fog, nighttime) using CLIP guidance, matching generated images to textual descriptions or unlabeled target images.
The GAP framework combines model feedback and target distribution guidance to generate images that are both adversarial and relevant to the test domain.

By combining these into Guided Adversarial Prompts (GAP), the system creates images that are both difficult for the model and representative of the target domain. To maintain label faithfulness, the authors utilize SDEdit and inpainting techniques.

Experimental Evaluation

The authors evaluated GAP on several benchmarks:

  • Classification: Waterbirds (spurious correlations) and iWildCam (domain generalization).
  • Regression: Taskonomy and Omnidata for depth estimation.
  • Robustness: Common Corruptions (CC & 3DCC) and the Replica dataset.

Key Results and Insights

  • Discovery of Counterfactuals: In the Waterbirds dataset, GAP automatically generated "counterfactual" images (e.g., waterbirds on land), forcing the model to ignore spurious background correlations.
  • Performance Gains: On iWildCam, GAP achieved 81.2% accuracy, outperforming Agnostic Prompts (69.8%) and standard augmentations like CutMix (69.6%).
  • Data Efficiency: GAP proved more effective in low-data regimes, requiring fewer generated images to reach peak performance compared to open-loop methods.
  • Robustness in Regression: For depth estimation under defocus blur, GAP reduced $\ell_1$ error from 4.93 to 3.88.
Example of a scene used in depth estimation tasks, where GAP was shown to reduce error under distribution shifts like blur.

Conclusion

The GAP framework demonstrates that "hard" adversarial examples, when guided by target distribution feedback, are superior to large volumes of random synthetic data. While computational costs and label shift remain areas for future exploration, this closed-loop approach provides a powerful tool for building robust machine learning systems.

Summary updated

BibTeX
@article{yeo2025controlled,
  author = {Teresa Yeo and Andrei Atanov and Harold Benoit and Aleksandr Alekseev and Ruchira Ray and Pooya Esmaeil Akhoondi and Amir Zamir},
  title = {{Controlled Training Data Generation with Diffusion Models}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
  url = {https://openreview.net/forum?id=kZR3qXy12u},
}
Figure