TL;DR
Unsupervised Model Adaptation (UMA) adapts a pre-trained source model to an unlabeled target domain without accessing the original source dataset, preserving privacy and saving bandwidth. This paper introduces Historical Contrastive Learning (HCL), a framework that uses past model checkpoints as an implicit memory mechanism to prevent catastrophic forgetting. By combining instance-level historical contrastive learning with consistency-weighted self-training, HCL sets new state-of-the-art results across semantic segmentation, object detection, and image classification.
What Problem Does This Paper Address?
Standard Unsupervised Domain Adaptation (UDA) aligns distributions between a labeled source domain and an unlabeled target domain. However, standard UDA requires concurrent access to raw source data, which is often problematic due to:
- Transmission bottlenecks: Datasets like GTA5 are dozens of gigabytes, whereas the trained model weights are only a few hundred megabytes.
- Privacy and IP concerns: Medical records, biometric data, or proprietary datasets cannot be freely shared or stored on edge devices.
Unsupervised Model Adaptation (UMA)—also known as source-free domain adaptation—attempts adaptation using only the pre-trained source model and unlabeled target data. Without source supervision acting as an anchor, models adaptively trained on target distributions are highly prone to representation collapse and catastrophic forgetting.
Methods
The authors propose Historical Contrastive Learning (HCL), which treats previous model states ($G^{t-m}$, such as the initial source model $G^0$ or recent epoch checkpoints) as a memory bank to constrain adaptation. HCL consists of two complementary components:
┌──────────────────────────────────────────────┐
│ Target Image │
└──────────────┬────────────────┬──────────────┘
│ │
(Current View) (Augmented View)
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│Current Model │ │Past Model(s) │
│ (Eᵗ) │ │ (Eᵗ⁻ᵐ) │
└───────┬──────┘ └───────┬──────┘
│ │
┌────────────────────┴────────┐ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────────────┐
│ Current Pred. │ │ Historical Keys & │
│ (pᵗ) │ │ Predictions (pᵗ⁻ᵐ) │
└───────┬───────┘ └───────────┬───────────┘
│ │
▼ ▼
┌───────────────────────┐ ┌───────────────────────┐
│ HCCD │ │ HCID │
│ Category Self-Training│ │ Contrastive Instance │
│ (Consistency-Weighted│ │ Discrimination │
│ Cross-Entropy) │ │ (Entropy-Weighted NCE)│
└───────────────────────┘ └───────────────────────┘
- Historical Contrastive Instance Discrimination (HCID):
- Operates in feature space at the instance level using an adapted InfoNCE objective ($L_{\text{HisNCE}}$).
- The query embedding is generated by the current encoder ($E^t$), while positive and negative keys are generated by historical encoders ($E^{t-m}$).
- Key similarities are re-weighted by an entropy-based reliability score ($r^{t-m}$), ensuring that the model prioritizes well-learned historical representations rather than memorizing uncertain features.
- Historical Contrastive Category Discrimination (HCCD):
- Operates in output probability space at the semantic class level via self-training.
- Re-weights standard cross-entropy pseudo-label loss with a historical consistency weight: $$h_{\text{con}} = 1 - \text{Sigmoid}(\|p^t - p^{t-m}\|_1)$$
- If the current model's predictions agree with historical predictions, the sample's weight is scaled up; diverging or unstable predictions are downweighted.
Datasets
The authors evaluate HCL across multiple vision benchmarks:
- Semantic Segmentation: Synthetic-to-real benchmarks GTA5 $\rightarrow$ Cityscapes (19 classes) and SYNTHIA $\rightarrow$ Cityscapes (16 classes).
- Object Detection: Weather adaptation on Cityscapes $\rightarrow$ Foggy Cityscapes (8 classes) and cross-dataset urban driving on Cityscapes $\rightarrow$ BDD100k daytime subset (7 classes).
- Image Classification: Large-scale synthetic-to-real VisDA17 (12 classes) and standard domain shift benchmark Office-31 (3 domains, 6 transfer tasks).
- Alternative Setups: Evaluated on Office-Home under both partial-set and open-set domain adaptation scenarios.
No new datasets were introduced.
Key Insights and Ideas
- Historical checkpoints serve as data-free anchors: Rather than synthesizing source data with GANs or relying strictly on entropy minimization, past network states preserve the source hypothesis directly in parameter/representation space.
- Two-level orthogonality: HCID acts on the latent feature space to maintain general instance discrimination (preventing feature collapse), while HCCD works on the output probability space to maintain semantic class boundaries. Ablations show both contribute equally and combine synergistically (e.g., on GTA5 $\rightarrow$ Cityscapes: HCID gives 45.6 mIoU, HCCD gives 46.7 mIoU, and both combined achieve 48.1 mIoU).
- Sample reliability weighting prevents confirmation bias: Standard pseudo-labeling often reinforces erroneous predictions over time. Explicitly checking prediction drift ($\|p^t - p^{t-m}\|_1$) and predictive entropy provides an effective, unsupervised filter against noisy labels.
Key Results
- Semantic Segmentation: On GTA5 $\rightarrow$ Cityscapes, standalone HCL achieves 48.1 mIoU, outperforming prior source-free methods like SFDA (45.8) and UR (45.1), and even beating several source-dependent UDA methods (e.g., CRST at 47.1). When paired with SFDA (
SFDA + HCL), it achieves 49.3 mIoU. - Object Detection: On Foggy Cityscapes, HCL achieves 39.7 mAP (and 40.3 mAP when added to SFOD), substantially outperforming baseline SFOD (33.5 mAP) and matching source-present UDA methods.
- Image Classification: On VisDA17, HCL achieves 83.5% mean accuracy (rising to 83.9% atop SHOT). On Office-31, HCL achieves 89.8% average accuracy.
- Open-Set & Partial-Set DA: On Office-Home, HCL improves open-set performance to 72.6% (vs. SHOT's 71.5%) and partial-set performance to 79.6% (vs. SHOT's 76.8%).
Limitations and Future Work
- Computational and memory overhead: Storing historical encoders/classifiers and calculating multi-view forward passes through historical checkpoints incurs additional compute and memory during training (though inference remains unaffected).
- Sensitivity to historical anchor intervals: The paper notes using models from epoch $t-m$, but exploring optimal memory schedules or moving averages across extended training runs remains an open question.
- Scope: The authors suggest extending this historical contrastive memory mechanism to broader transfer learning scenarios, such as continual learning and test-time adaptation.
Summary updated