Abstract
Deep learning models often struggle with domain shift, where test data distributions differ significantly from training data. We present LatentDR, a novel latent space augmentation technique that enhances generalization by intentionally "degrading" and then "restoring" feature representations. By utilizing attention mechanisms to leverage relationships between samples in a mini-batch, LatentDR generates diverse, non-linear augmentations. Our method achieves state-of-the-art results on the DomainBed benchmark and shows substantial gains in medical imaging and long-tail recognition tasks.
Introduction
The brittleness of deep learning models under domain shift—such as transitioning from real-world photos to sketches—remains a critical challenge. Traditional data augmentations like rotation or color jittering often fail to capture high-level semantic variations across domains. While latent space augmentations like Mixup offer some relief, they typically rely on simple linear interpolations that cannot model the complexity of diverse datasets. LatentDR addresses this by introducing a "sample-aware" approach to diversify the feature space without the need for complex generative models.
Methodology: Degradation and Restoration
LatentDR operates during the training phase through a two-step process applied to feature vectors within a mini-batch.
- Latent Degradation (D): A "query" feature vector is corrupted using information from other samples in the same mini-batch via Self-Attention or Pooling. This degraded feature is assigned a "soft label" (the batch average), which intentionally confuses the classifier. This forces the model to navigate ambiguous, noisy representations.
- Latent Restoration (R): The model subsequently attempts to "fix" the degraded feature. Using Cross-Attention, the degraded feature acts as a query to retrieve relevant class information from the original, uncorrupted features in the batch. This process teaches the model to isolate core semantic features from domain-specific noise.
The final loss function combines classification losses from original, degraded, and restored features. During inference, the degradation and restoration modules are discarded, leaving a robust backbone.
Key Insights: Alignment and Uniformity
A significant finding of this work is that LatentDR simultaneously improves two critical metrics of feature quality: Alignment (the proximity of same-class features) and Uniformity (the distribution of features to preserve information). While most methods force a trade-off between these two, LatentDR's sample-aware perturbations guide the model toward a more discriminative and well-distributed latent space. Furthermore, because the degradation is tied to classification loss, it acts as a form of "hard" data augmentation that is inherently challenging for the model.
Experimental Results
The authors evaluated LatentDR across several benchmarks, including the DomainBed suite, medical imaging datasets, and long-tail recognition tasks.
On the DomainBed benchmark, LatentDR achieved a 2.7% average improvement over the Empirical Risk Minimization (ERM) baseline, outperforming established methods like Mixup and MixStyle. Notably, the performance gains were most pronounced on DomainNet, the largest and most complex dataset in the suite.
In Medical Imaging, the impact was even more significant. On the Camelyon17 histopathology dataset, LatentDR improved accuracy from 72.3% to 81.3%. The method also showed consistent benefits in Long-tail Recognition, providing a boost for "Medium" and "Few" shot classes when integrated with existing algorithms like BALMS.
Conclusion and Future Work
LatentDR provides a powerful, domain-agnostic framework for improving model robustness. By moving beyond pairwise linear mixing to batch-wide non-linear perturbations, it effectively simulates complex domain variations. While the use of attention mechanisms introduces some computational overhead during training, the resulting models are significantly more resilient to unseen domains. Future research may explore the integration of LatentDR with generative diffusion models to further enhance the realism of latent augmentations.
Summary updated