TADA: Efficient Task-Agnostic Domain Adaptation for Transformers

Chia-Chien Hung, Lukas Lange, Jannik Strötgen

Introduction

Pre-trained language models (PTLMs) like BERT have revolutionized natural language processing by providing a general-purpose foundation for various tasks. However, these models often struggle when applied to specialized domains such as medicine, law, or finance. The primary challenge lies in the domain-specific "jargon" and context that general-purpose datasets (like Wikipedia) do not adequately cover. TADA (Task-Agnostic Domain Adaptation) introduces a lightweight, parameter-efficient method to specialize transformers without the prohibitive costs of full-model retraining or the risks of catastrophic forgetting.

The Problem: Generalization vs. Specialization

Existing solutions for domain adaptation typically fall into three categories, each with significant drawbacks:

  1. Full Pre-training: Training a model from scratch on domain data is computationally expensive.
  2. Full Domain-Adaptive Pre-training: Updating all weights on domain data can lead to "catastrophic forgetting," where the model loses its general reasoning capabilities.
  3. Adapters: Adding extra layers increases model complexity and can sometimes limit the model's expressiveness.

TADA addresses these issues by focusing domain knowledge injection at the input level, keeping the core transformer "engine" stable and unchanged.

Methodology

TADA operates on the principle that domain-specific knowledge is primarily captured in the vocabulary and initial representations. The method consists of two distinct stages:

  1. Intermediate Pre-training: The model performs Masked Language Modeling (MLM) on unlabeled domain-specific text. Crucially, the transformer encoder is frozen. Only the embedding layer and the tokenizer are updated. This forces the model to learn domain-aware input representations while preserving the general linguistic patterns stored in the encoder.
  2. Task Fine-tuning: These specialized embeddings are integrated with the frozen encoder and fine-tuned on specific downstream tasks.

For scenarios involving multiple domains, TADA utilizes Meta-Embeddings—combining embeddings from different domains via averaging or dynamic attention—and Meta-Tokenization to align disparate domain-specific tokenizers.

The TADA framework: (A) Intermediate Pre-training of embeddings with a frozen encoder, and (B) Task Fine-tuning using meta-embeddings.

Experimental Setup and Datasets

The authors evaluated TADA across 14 diverse domains and 4 core tasks:

  • Tasks: Dialog State Tracking (DST), Response Retrieval (RR), Named Entity Recognition (NER), and Natural Language Inference (NLI).
  • Domains: Included Clinical (PubMed), Financial, Science, Fiction, Government, and service-oriented domains like Taxi and Hotel.
  • Data: Unlabeled corpora such as OANC and DomainCC provided the background data for the specialization phase.

Key Results and Insights

Experimental results demonstrate that TADA achieves performance comparable to, and sometimes exceeding, full domain-adaptive pre-training while being significantly more efficient.

  • Efficiency and Performance: TADA (MLM-EMB) variants consistently outperformed standard BERT baselines. In Response Retrieval (RR), TADA actually surpassed full pre-training, suggesting that freezing the encoder prevents the loss of conversational context.
  • Low-Resource Robustness: In NLI tasks with only 1% of training data, TADA outperformed full pre-training by approximately 3%. Its reduced parameter count makes it less prone to overfitting on small datasets compared to adapter-based methods.
  • Tokenization Impact: By using domain-specific tokenizers, TADA prevents specialized terms (e.g., medical conditions) from being fragmented into meaningless subwords, resulting in higher-quality representations.
Performance comparison of TADA variants (MLM-EMB/EMBTOK) against BERT and TOD-BERT baselines across various tasks and domains.

Conclusion

TADA offers a modular and parameter-efficient alternative for domain adaptation. By freezing the encoder and focusing on the embedding layer, it provides a stable reasoning engine that can be easily swapped with different domain-specific "dictionaries." This approach not only matches the performance of more expensive methods but also excels in low-resource settings, making it a highly practical solution for real-world NLP applications.

Summary updated

BibTeX
@inproceedings{hung2023tada,
  author = {Chia-Chien Hung and Lukas Lange and Jannik Strötgen},
  title = {{TADA: Efficient Task-Agnostic Domain Adaptation for Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.31},
}
Figure