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 natural language processing, models trained on a specific source domain (e.g., movie reviews) often suffer from significant performance degradation when applied to a different target domain (e.g., electronics reviews). This phenomenon, known as domain shift, occurs because the underlying data distributions differ. While supervised adaptation can mitigate this, it requires expensive labeled data for every new target domain.

This research addresses Unsupervised Domain Adaptation (UDA), where labeled data is available for one or more source domains, but only unlabeled data exists for the target. The authors investigate two core challenges: accurately measuring the "distance" between domains to learn domain-agnostic features and effectively prioritizing multiple source domains during the training process.

Methodology: DistanceNet and Bandit Control

DistanceNet

The core architecture, DistanceNet, augments a standard Bi-LSTM text classifier with an auxiliary loss term. This term penalizes the distance between the feature representations of the source and target domains, forcing the model to learn features that are invariant across domains. The authors evaluated five distinct distance measures:

  • $L_2$ and Cosine Distance: Simple geometric measures of mean vectors.
  • Maximum Mean Discrepancy (MMD): A kernel-based method comparing all moments of two distributions.
  • Fisher Linear Discriminant (FLD): Measures the linear separability of the two domains.
  • Correlation Alignment (CORAL): Minimizes differences in second-order statistics (covariances).

Since no single measure is universally optimal, the authors proposed a Mixture of Distances, using an unsupervised "informativeness" criterion to prune redundant metrics.

DistanceNet-Bandit

To handle multi-source scenarios, the researchers introduced a Multi-Armed Bandit (MAB) controller using the Upper Confidence Bound (UCB) algorithm. Each "arm" represents a different source domain. At each training step, the controller selects a source domain, receives a reward based on the model's performance on a small target validation set, and updates its selection strategy.

The DistanceNet-Bandit architecture uses a bandit controller to dynamically select source inputs for the DistanceNet model based on validation performance.

This mechanism allows the model to learn a dynamic curriculum, switching between source domains as internal representations evolve, effectively masking unhelpful sources that might provide noisy gradients.

Analysis of Distance Measures

A key insight of the study is that separability does not equal correlation. While some measures like $L_2$ are excellent at distinguishing whether samples come from different domains, they do not necessarily correlate with how well a model will perform during transfer. In contrast, FLD and MMD proved more robust for actual adaptation tasks.

Heatmaps showing the pairwise distances between 16 domains using different metrics ($L_2$, Cosine, MMD, Fisher, CORAL). The variation across metrics highlights the "No Free Lunch" nature of domain distance.

As shown in the heatmaps above, different measures capture different aspects of distribution shift. This supports the use of a mixture of distances to provide a more holistic signal for learning domain-agnostic features.

Experimental Results

Experiments were conducted on a sentiment analysis benchmark containing 16 diverse product review domains.

  • DistanceNet Performance: In single-source adaptation, the Mixture model achieved an average accuracy of 71.32%, outperforming the standard Bi-LSTM baseline of 70.08% and competitive methods like Domain-Adversarial Neural Networks (DANN).
  • Bandit Superiority: In multi-source setups, the DistanceNet-Bandit reached 79.30% accuracy, significantly outperforming a static round-robin mixture baseline (78.20%).

Conclusion

DistanceNet-Bandits provide a robust framework for unsupervised domain adaptation by combining a mixture of statistical distance measures with a dynamic source selection strategy. While the current bandit controller requires a small labeled validation set for rewards, future work could explore purely unsupervised proxies. Additionally, scaling these techniques to large Transformer-based models like BERT remains a promising avenue for exploration.

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