Single Domain Generalization with Model-aware Parametric Batch-wise Mixup

Marzi Heidari, Yuhong GuoarXiv 2025

Abstract

Single Domain Generalization (SDG) remains a formidable challenge in the field of machine learning, particularly when models are deployed in environments that differ significantly from their training domains. In this paper, we propose a novel data augmentation approach, named as Model-aware Parametric Batch-wise Mixup (MPBM), to tackle the challenge of SDG. MPBM deploys adversarial queries generated with stochastic gradient Langevin dynamics, and produces model-aware augmenting instances with a parametric batch-wise mixup generator network that is carefully designed through an innovative attention mechanism. By exploiting inter-feature correlations, the parameterized mixup generator introduces additional versatility in combining features across a batch of instances, thereby enhancing the capacity to generate highly adaptive and informative synthetic instances for specific queries. The synthetic data produced by this adaptable generator network, guided by informative queries, is expected to significantly enrich the representation space covered by the original training dataset and subsequently enhance the prediction model's generalizability across diverse and previously unseen domains. To prevent excessive deviation from the training data, we further incorporate a real-data alignment-based adversarial loss into the learning process of MPBM, regularizing any tendencies toward undesirable expansions. We conduct extensive experiments on several benchmark datasets. The empirical results demonstrate that by augmenting the training set with informative synthesis data, our proposed MPBM method achieves the state-of-the-art performance for single domain generalization.

Introduction

In the field of Domain Generalization (DG), the primary objective is to develop models capable of performing accurately on data from unseen environments. Single Domain Generalization (SDG) represents a particularly rigorous subset of this challenge, where a model is restricted to training on only one source domain. This constraint often leads to models that overfit the specific "style" of the source domain, failing to capture the underlying invariant "content" necessary for broader application.

Existing data augmentation techniques, such as Mixup, attempt to mitigate this by linearly blending pairs of training images. However, standard Mixup is often limited by its "model-blind" nature—it does not account for the specific weaknesses of the current model—and its simplistic approach of mixing only two samples with a uniform scalar weight. This paper introduces Model-aware Parametric Batch-wise Mixup (MPBM), a sophisticated strategy that evolves Mixup into a targeted, attention-driven synthesis mechanism.

The MPBM Framework

MPBM enhances the data augmentation pipeline through three primary innovations:

  1. Batch-wise Attention-based Mixing: Unlike traditional Mixup, MPBM utilizes an attention mechanism to synthesize features from an entire batch of instances. By employing a feature correlation matrix, the generator allows for heterogeneous mixing weights across different features, enabling the creation of more complex and coherent synthetic samples.
  2. Model-aware Adversarial Queries: To ensure the augmentation is informative, the system generates "queries" using Stochastic Gradient Langevin Dynamics (SGLD). These queries represent adversarial versions of training images that maximize the model's current loss, effectively identifying "weak spots" for the generator to target.
  3. Adversarial Regularization: To prevent the generator from producing unrealistic or "noisy" data, a discriminator is integrated into the training process. This creates a minimax game where the generator expands the distribution to challenge the model, while the discriminator ensures synthetic features remain aligned with the real data distribution.
Overview of the MPBM architecture including Query Generation, Adversarial Regularization, and Feature-wise Data Synthesis

Experimental Evaluation

The effectiveness of MPBM was evaluated across three major benchmarks: Digits (MNIST, SVHN, etc.), PACS (Art, Cartoon, Photo, Sketch), and the high-complexity DomainNet dataset.

Key Results

MPBM achieved state-of-the-art (SOTA) performance across all benchmarks:

  • Digits: The method reached an average accuracy of 81.3%, a significant improvement over the previous best method, MCL (78.8%). Notably, it showed a 6.7% gain on the challenging MNIST-M domain.
  • PACS: MPBM achieved an average accuracy of 54.5%, outperforming the previous SOTA (L2D) by 2%, with particularly strong results in the "Cartoon" and "Sketch" domains.
  • DomainNet: On this massive dataset, MPBM reached 27.9% average accuracy, surpassing all competitors across five target domains.
Performance comparison of MPBM against state-of-the-art methods on the Digits benchmark

Discussion and Insights

Ablation studies confirmed that the "model-aware" and "regularized" components are critical. Removing SGLD queries or adversarial regularization led to substantial performance drops. The "Aha" moment of the research lies in the use of the feature correlation matrix; by recognizing that different features require different mixing strategies, MPBM performs "precise feature mixups" that create a more effective curriculum for the model. The adversarial loss acts as a necessary "leash," preventing the generator from drifting into "negative expansion" where synthetic data becomes irrelevant to the task.

Conclusion

MPBM demonstrates that targeted, model-aware data synthesis can significantly bridge the gap in Single Domain Generalization. By combining attention-based batch mixing with adversarial query generation, the framework creates a dynamic training environment that continuously challenges and improves the model's robustness. Future work may focus on reducing the computational overhead associated with SGLD and extending this parametric mixing logic to non-visual modalities such as audio or sensor data.

Summary updated

BibTeX
@misc{heidari2025single,
  author = {Marzi Heidari and Yuhong Guo},
  title = {{Single Domain Generalization with Model-aware Parametric Batch-wise Mixup}},
  year = {2025},
  eprint = {2502.16064},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.16064},
}
Figure