Abstract
Practical real-world datasets with plentiful categories introduce new challenges for unsupervised domain adaptation (UDA), such as small inter-class discriminability, which existing approaches relying on domain invariance alone cannot handle sufficiently well. In this work, we propose MemSAC, which exploits sample-level similarity across source and target domains to achieve discriminative transfer, along with architectures that scale to a large number of categories. For this purpose, we first introduce a memory augmented approach to efficiently extract pairwise similarity relations between labeled source and unlabeled target domain instances, suited to handle an arbitrary number of classes. Next, we propose and theoretically justify a novel variant of the contrastive loss to promote local consistency among within-class cross-domain samples while enforcing separation between classes, thus preserving discriminative transfer from source to target. We validate the advantages of MemSAC with significant improvements over previous state-of-the-art on multiple challenging transfer tasks designed for large-scale adaptation, such as DomainNet with 345 classes and fine-grained adaptation on Caltech-UCSD birds dataset with 200 classes.
Introduction: The Scalability Gap in Domain Adaptation
Unsupervised Domain Adaptation (UDA) is a critical technique for deploying machine learning models in the wild, where the "target" data (e.g., real-world sketches or low-quality photos) differs significantly from the "source" training data (e.g., high-quality studio images). While traditional UDA methods have shown success on small-scale benchmarks with 10–30 classes, they often struggle when applied to real-world scenarios involving hundreds of categories.
As the number of classes increases, two primary issues emerge:
- Class Confusion: Low inter-class discriminability makes it difficult for global alignment methods to distinguish between similar categories (e.g., different breeds of dogs). This often leads to "negative transfer," where the model incorrectly aligns a source class with a different target class.
- Batch Size Constraints: Contrastive learning, a popular tool for feature alignment, relies on finding positive and negative pairs within a mini-batch. In large-scale datasets like DomainNet (345 classes), a standard GPU mini-batch is too small to guarantee the presence of even one positive sample for a given anchor, rendering standard contrastive approaches ineffective.
As shown in Figure 2(a), many state-of-the-art UDA methods see their performance gains over a simple source-only baseline diminish or even turn negative as the number of classes grows. MemSAC is designed to maintain high performance across this scale by ensuring that positive pairs are always available for alignment, regardless of the current mini-batch composition.
Proposed Method: MemSAC
To address these challenges, the authors propose MemSAC (Memory Augmented Sample Consistency). The framework introduces a non-parametric memory bank and a specialized consistency loss to ensure discriminative feature transfer.
Memory Augmented Similarity Extraction
The core of MemSAC is a non-parametric Memory Bank ($M$) that stores feature representations and labels from thousands of previous source domain samples. By decoupling the available "pool" of source samples from the current mini-batch size, MemSAC ensures that for any target "anchor" image, the model can always find relevant positive and negative source samples to compare against.
Cross-Domain Sample Consistency Loss ($L_{sc}$)
Unlike standard self-supervised contrastive learning, which typically compares different augmentations of the same image, MemSAC's Sample Consistency Loss pulls together samples of the same class across different domains while pushing samples of different classes apart.
Since target data is unlabeled, MemSAC employs k-NN Pseudo-labeling. A target sample's label is estimated by looking at its $k$ nearest neighbors in the source memory bank. This non-parametric approach is more robust to noise than relying on the classifier's own predictions during early training stages.
The total objective function for MemSAC combines a supervised loss on the source domain, a global adversarial loss for domain alignment, and the proposed sample consistency loss ($L_{sc}$).
Experimental Results
The authors evaluated MemSAC on two major large-scale challenges: DomainNet (345 categories) and CUB-200 (200 fine-grained bird species).
DomainNet-345
On the massive DomainNet benchmark, MemSAC achieved an average accuracy of 47.26%, significantly outperforming previous leaders like ToAlign (45.45%) and standard adversarial methods like CDAN (43.24%). The performance gap is most pronounced in domains with high shift, such as Sketch and Painting.
Fine-Grained Adaptation (CUB-200)
In the "CUB-to-Drawings" task, where inter-class differences are minimal, MemSAC reached 67.95% accuracy. It notably outperformed PAN (62.96%), a method that requires additional hierarchical label information which MemSAC does not use.
Efficiency and Insights
MemSAC is highly efficient, adding negligible GPU memory overhead and zero latency during inference, as the memory bank is only utilized during the training phase. An interesting finding from the authors' ablation studies is that the memory bank can benefit from being larger than the dataset itself. This is because it stores "temporal views"—features of the same data point from different training epochs—which helps the model learn more robust, consistent representations.
Conclusion
MemSAC provides a scalable and theoretically grounded solution for large-scale unsupervised domain adaptation. By leveraging a memory bank to overcome batch size limitations and a sample consistency loss to prevent class confusion, it sets a new standard for performance on complex, real-world datasets. While currently focused on closed-set adaptation, future extensions could explore open-world scenarios where the target domain contains novel categories.
Summary updated