Modular Domain Adaptation

Junshen K. Chen, Dallas Card, Dan Jurafsky

Introduction

Computational social scientists and researchers frequently rely on "off-the-shelf" models for critical tasks such as sentiment analysis or hate speech detection. However, these models often encounter domain shift: a model trained on movie reviews may perform poorly when applied to political tweets. Standard domain adaptation typically requires access to the original source data to retrain or align the model. In practice, this data is often inaccessible due to privacy, copyright, or commercial interests, leaving "model consumers" with sub-optimal tools.

The Modular Framework

This paper introduces Modular Domain Adaptation, a framework that treats domain adaptation as a collaborative effort between model producers (who train the model) and model consumers (who use it). The core conceptual shift is viewing adaptation as a two-party protocol where producers release models that expose "hooks" for consumers to tune.

The Modular Domain Adaptation framework separates the roles of model producers and consumers.

Methods: DSBIAS and DSNORM

The authors propose a "modular" approach where the producer builds a model designed for flexibility, and the consumer applies lightweight adjustments. They introduce two main techniques:

  1. Domain-Specific Bias (DSBIAS): Instead of a fixed bias term, the model utilizes the log-frequency of labels in the target domain. By injecting a "prior" (e.g., knowing that "hate speech" is rare in a specific dataset) at prediction time, users can significantly reduce false positives.
  2. Domain-Specific Normalization (DSNORM): Specifically for linear models, this technique centers feature values (like word counts) based on their average frequency in the target domain. This helps the model ignore context-specific words that are common but not predictive of the label.

Experimental Evaluation

The study evaluates these methods across four multi-domain text classification datasets: the Media Frames Corpus (MFC), arXiv abstracts, Amazon Reviews, and SENTI (a curated collection of diverse sentiment datasets). These methods were compared against standard baselines like Logistic Regression (LogReg) and RoBERTa, as well as deconfounding techniques like Deep Residualization (DR) and Gradient Reversal (GR), which are traditionally used to make models domain-agnostic.

Key Results and Insights

A primary finding is that deconfounding techniques intended to make models "domain-blind" during training do not significantly improve out-of-domain accuracy. Instead, acknowledging and adapting to the domain is more effective.

Furthermore, the research demonstrates that a small amount of labeled data is sufficient for effective adaptation. Estimating the label distribution from as few as 100–250 random samples yields performance within 1% of "oracle" (perfect) knowledge of the domain.

Performance of DSBIAS with estimated label distributions on the arXiv dataset, showing that even small samples provide significant gains over base models.

Key performance metrics include:

  • Reliable Gains: DSBIAS consistently provided a 2–4% accuracy boost across both linear and transformer models when applied to unseen domains.
  • Linear Model Robustness: For researchers requiring interpretability, the combination of DSNORM + DSBIAS provided the most robust performance, significantly outperforming standard Logistic Regression.
  • RoBERTa Superiority: RoBERTa-based models significantly outperformed adapted linear models even without adaptation, suggesting a shift toward contextual embedding models in the CSS community.

Conclusion

Modular Domain Adaptation provides a computationally cheap "middle ground" between off-the-shelf usage and full domain fine-tuning. While DSBIAS requires some labeled data for distribution estimation, it offers a practical path for researchers to validate and improve models on their specific data. Future work will explore label-free distribution estimation and extending the framework to more complex tasks like Named Entity Recognition (NER).

Summary updated

BibTeX
@inproceedings{chen2022modular,
  author = {Junshen K. Chen and Dallas Card and Dan Jurafsky},
  title = {{Modular Domain Adaptation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.findings-acl.288},
}
Figure