TL;DR
Standard adversarial domain adaptation fails when the balance of classes changes between the source and target domains. This paper introduces Generalized Label Shift (GLS) and a reweighting framework that allows models to align distributions correctly even when class proportions are wildly different, leading to significant performance gains on imbalanced datasets.
What Problem Does This Paper Address?
Unsupervised Domain Adaptation (UDA) aims to take a model trained on a labeled "source" domain (e.g., synthetic images) and make it work on an unlabeled "target" domain (e.g., real-world photos). The dominant approach, Adversarial Domain Adaptation (ADA), tries to learn a feature representation that is "domain-invariant"—meaning a discriminator cannot tell if a feature came from the source or the target.
However, there is a catch: most ADA methods assume the class distributions ($P(Y)$) are the same in both domains. If the source domain has 50% cats and 50% dogs, but the target domain has 90% cats, forcing the global feature distributions to match actually hurts the model. The authors prove that in such cases, the better you align the features, the worse your joint error becomes. This "alignment paradox" is a fundamental flaw in many state-of-the-art algorithms.
Methods
The authors propose a new assumption called Generalized Label Shift (GLS). Instead of requiring the raw inputs to have the same conditional distribution, GLS assumes there exists some latent representation $Z$ where the conditional distributions match: $P_S(Z|Y) = P_T(Z|Y)$.
To implement this, they introduce three key components:
- Importance Weight Estimation: Since we don't have labels for the target domain, we can't directly calculate the class ratios. The authors use a "method of moments" approach, solving a Quadratic Program (QP) based on the model's own predictions to estimate the relative weights ($w$) of each class between domains.
- Reweighted Adversarial Loss: They modify the standard adversarial objective. Instead of matching $P_S(Z)$ to $P_T(Z)$, they match a weighted version of the source distribution to the target.
- Balanced Classifier Loss: They reweight the classification loss on the source domain to minimize the "Balanced Error Rate," ensuring the model doesn't become biased toward majority classes in the source.
They apply these modifications to three popular algorithms, creating: IWDAN (from DANN), IWJAN (from JAN), and IWCDAN (from CDAN).
Datasets
The authors evaluated their methods on several standard DA benchmarks:
- Digits: MNIST $\leftrightarrow$ USPS.
- VisDA-2017: A large-scale synthetic-to-real object classification dataset.
- Office-31 & Office-Home: Common benchmarks featuring images from office environments and various art styles.
Crucially, they introduced subsampled versions (prefixed with 's', e.g., sDigits) where they artificially skewed the source class distributions to simulate severe label shift, providing a much tougher test for robustness.
Key Insights and Ideas
- The Invariance Trap: The paper provides a theoretical lower bound showing that if label distributions differ, forcing feature invariance creates a mandatory error floor. You literally cannot reach high accuracy without accounting for the label shift.
- Latent vs. Input Space: Unlike traditional "Label Shift" which assumes $P(X|Y)$ is invariant in the raw input space (often unrealistic), GLS only requires invariance in the learned representation space. This makes the assumption much more practical for deep learning.
- Scaling with Shift Severity: The benefits of the proposed reweighting become more pronounced as the discrepancy between source and target label distributions grows.
- Minimal Overhead: The weight estimation happens "on the fly" during training. It adds almost zero computational cost compared to the base algorithms but provides a massive safety net against distribution shifts.
Key Results
The "Importance-Weighted" (IW) versions consistently outperformed their base counterparts, especially when class imbalances were present.
As highlighted in the results above:
- Massive Gains on Skewed Data: On sDigits, IWDAN achieved 92.54% accuracy, compared to just 83.24% for the standard DANN—a nearly 10% improvement. On sVisDA, IWDAN reached 60.18% vs. DANN's 52.85%.
- Training Stability: In skewed scenarios, standard DANN's performance often decreased as training progressed because the alignment objective was fighting the classification objective (visible in the blue curve of the accuracy plot). The IW versions showed much more stable, monotonic improvement.
- Oracle Comparison: The estimated weights were close enough to the "Oracle" weights (the true, hidden class ratios, denoted as IWDAN-O) that the practical algorithms performed nearly as well as if they had known the target labels all along.
Limitations and Future Work
- Weight Convergence: While the method works well in practice, the authors note that the weight estimation doesn't always converge perfectly to the true values, suggesting that fine-tuning the update frequency or the moving average factor could be beneficial.
- Extreme Shifts: The method assumes all classes present in the target are also present in the source. It does not explicitly handle "Partial Domain Adaptation" where the target only contains a subset of source classes.
- Future Directions: The authors suggest extending this framework to Domain Generalization, where the model must generalize to a target domain without seeing any of its data (even unlabeled) during training.
Summary updated