Multi-Source Domain Adaptation for Text Classification via DistanceNet-Bandits

Han Guo, Ramakanth Pasunuru, Mohit Bansal

Abstract

Domain adaptation performance of a learning algorithm on a target domain is a function of its source domain error and a divergence measure between the data distribution of these two domains. We present a study of various distance-based measures in the context of NLP tasks, that characterize the dissimilarity between domains based on sample estimates. We first conduct analysis experiments to show which of these distance measures can best differentiate samples from same versus different domains, and are correlated with empirical results. Next, we develop a DistanceNet model which uses these distance measures, or a mixture of these distance measures, as an additional loss function to be minimized jointly with the task's loss function, so as to achieve better unsupervised domain adaptation. Finally, we extend this model to a novel DistanceNet-Bandit model, which employs a multi-armed bandit controller to dynamically switch between multiple source domains and allow the model to learn an optimal trajectory and mixture of domains for transfer to the low-resource target domain. We conduct experiments on popular sentiment analysis datasets with several diverse domains and show that our DistanceNet model, as well as its dynamic bandit variant, can outperform competitive baselines in the context of unsupervised domain adaptation.

Introduction

In machine learning, the assumption that training (source) and test (target) data share the same distribution is frequently violated. In NLP, a sentiment classifier trained on movie reviews often underperforms on kitchen appliance reviews due to "domain shift." Unsupervised Domain Adaptation (UDA) seeks to bridge this gap by adapting models using labeled source data and unlabeled target data. This paper addresses two critical challenges in UDA: accurately measuring domain distance and optimally selecting source domains when multiple are available.

Methodology

DistanceNet: Feature Alignment

The DistanceNet framework aims to learn domain-invariant features by jointly minimizing a task-specific classification loss and a domain distance loss. By minimizing the distance between the feature representations of source and target inputs, the model's feature extractor is forced to produce representations that are agnostic to the domain. The authors evaluated several metrics, including $L_2$, Cosine distance, Maximum Mean Discrepancy (MMD), Fisher Linear Discriminant (FLD), and CORAL.

DistanceNet-Bandits: Dynamic Source Selection

When multiple source domains are available, a uniform training strategy is often suboptimal. The authors introduce DistanceNet-Bandits, which frames source selection as a Multi-Armed Bandit (MAB) problem. A controller uses the Upper Confidence Bound (UCB) algorithm to decide which source domain to sample from at each training step, using validation performance on the target domain as the reward signal.

The DistanceNet-Bandit architecture integrates a bandit controller to dynamically select source domains for training the DistanceNet model.

Experimental Analysis and Results

Metric Complementarity

Analysis of 16 product and movie review datasets revealed that distance metrics are complementary. No single metric consistently outperformed others across all domain pairs. For instance, $L_2$ might capture shifts in mean sentiment, while MMD captures higher-order distributional differences. The authors developed a mixture model that outperforms any single metric by combining their strengths.

Comparison of domain distance heatmaps across 16 datasets using different metrics, highlighting their varying sensitivities to domain shifts.

Performance Gains

  • Single-Source: DistanceNet with a mixture of distances achieved an average accuracy of 71.32%, outperforming the DANN baseline (70.08%).
  • Multi-Source: The Bandit-controlled variant reached 79.30% accuracy, significantly higher than the 78.20% achieved by a standard round-robin multi-source approach.
  • Dynamic Curriculums: The bandit controller learned to prioritize different source domains at different stages of training, discovering an "optimal trajectory" for transfer. For example, "Books" and "Apparel" were identified as highly useful sources for adapting to "Movie Reviews."

Conclusion

DistanceNet-Bandits offers a robust framework for UDA in text classification by leveraging a mixture of distance metrics and dynamic source selection. While the bandit controller requires a small labeled validation set, the performance gains demonstrate the value of adaptive source selection and multi-metric feature alignment. Future work will explore extending these strategies to more complex generative NLP tasks like summarization.

Summary updated

Abstract

Domain adaptation performance of a learning algorithm on a target domain is a function of its source domain error and a divergence measure between the data distribution of these two domains. We present a study of various distance-based measures in the context of NLP tasks, that characterize the dissimilarity between domains based on sample estimates. We first conduct analysis experiments to show which of these distance measures can best differentiate samples from same versus different domains, and are correlated with empirical results. Next, we develop a DistanceNet model which uses these distance measures, or a mixture of these distance measures, as an additional loss function to be minimized jointly with the task's loss function, so as to achieve better unsupervised domain adaptation. Finally, we extend this model to a novel DistanceNet-Bandit model, which employs a multi-armed bandit controller to dynamically switch between multiple source domains and allow the model to learn an optimal trajectory and mixture of domains for transfer to the low-resource target domain. We conduct experiments on popular sentiment analysis datasets with several diverse domains and show that our DistanceNet model, as well as its dynamic bandit variant, can outperform competitive baselines in the context of unsupervised domain adaptation.
BibTeX
@inproceedings{guo2020multi,
  author = {Han Guo and Ramakanth Pasunuru and Mohit Bansal},
  title = {{Multi-Source Domain Adaptation for Text Classification via DistanceNet-Bandits}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  url = {https://openreview.net/forum?id=UTmwuBF-yGb},
}
Figure