PADA: Example-based Prompt Learning for on-the-fly Adaptation to Unseen Domains

Eyal Ben-David, Nadav Oved, Roi Reichart

TL;DR

This paper introduces PADA, a novel approach for domain adaptation in NLP that can adapt to entirely new domains without any prior knowledge or examples from those domains during training. PADA achieves this by learning to generate example-specific "prompts" that capture domain-relevant features, allowing a single model to generalize across a wide range of unseen domains.

What Problem Does This Paper Address?

Modern Natural Language Processing (NLP) models, despite their impressive performance, often struggle when applied to data from domains different from those they were trained on. This is known as the domain shift problem. Traditional domain adaptation (DA) techniques typically require some form of labeled or unlabeled data from the target domain during training, or they train separate models for each potential target domain, which is inefficient. The authors tackle a more challenging scenario: "any-domain adaptation," where the model must adapt to completely unseen domains at inference time, with absolutely no prior information about these domains available during training. This is a significant challenge because it requires a model to be highly flexible and capable of inferring the necessary domain-specific knowledge on the fly.

Methods

PADA (Example-based Prompt Learning for on-the-fly Adaptation to Unseen Domains) is built upon the T5 language model. Its core innovation lies in its ability to generate example-specific prompts. Here's how it works:

  • Domain Related Features (DRFs): The model first learns to identify "Domain Related Features" (DRFs) for each of its known source domains. These are tokens that are highly characteristic of a specific domain. DRFs are extracted using a Mutual Information (MI) based method, which prioritizes features that are frequent within a domain but rare in others.
  • Prompt Generation: For a given input example, PADA first generates a prompt. This prompt can include the domain name and a set of DRFs that are semantically relevant to the example. The DRFs help to map the example into a shared semantic space that encompasses the source domains.
  • Example-based Adaptation: The generated prompt is then used to condition the T5 model's prediction for the downstream task (e.g., text classification, sequence tagging). This means the model uses the prompt as context to make a more accurate prediction for that specific example, effectively adapting to its domain on the fly.
  • Multi-task Learning: PADA is trained using a two-stage multi-task protocol. One task is to generate the prompt, and the other is to predict the task label, conditioned on the generated prompt. This joint training allows for parameter sharing and improved performance.

Datasets

The paper evaluates PADA on three tasks across multiple domains:

  • Rumour Detection: Uses the PHEME dataset, treating each real-world event as a separate domain (e.g., Charlie-Hebdo, Ferguson, Germanwings-crash, Ottawa-shooting, Sydney-siege).
  • Multi-Genre Natural Language Inference (MNLI): Uses the SNLI dataset, specifically focusing on five matched domains (Fiction, Government, Slate, Telephone, Travel).
  • Aspect Prediction: Uses corpora from four domains: Device, Laptops, Restaurant, and Service.

The experiments are conducted in a "leave-one-out" fashion, where the model is trained on all but one domain and then tested on the held-out domain.

Key Insights and Ideas

  • Prompts as Domain Signatures: The core idea is that a well-crafted prompt can act as a unique "signature" for an example, guiding the model towards the correct domain-specific interpretation.
  • Leveraging DRFs for Semantic Mapping: DRFs are crucial for bridging the gap between source and target domains. They allow the model to project an example into a semantic space that reflects the relationships between known domains.
  • On-the-fly Adaptation is Key: The ability to adapt per example at inference time, without needing to retrain or fine-tune the entire model, is what makes PADA so powerful for unseen domains.
  • Single Model for All Domains: Unlike Mixture-of-Experts (MoE) approaches that train separate models for each source domain, PADA uses a single, unified model, making it more scalable and potentially more cognitively plausible.

Key Results

PADA demonstrates strong performance across various settings:

  • Text Classification: PADA outperforms strong baselines in 7 out of 10 settings for Rumour Detection and MNLI, achieving average performance gains of 3.5% and 1.3% respectively. It significantly reduces the error rate compared to T5-NoDA (which doesn't perform DA) by 21% for Rumour Detection and 52% for MNLI.
  • Sequence Tagging: For Aspect Prediction, PADA is the best performing model in 4 out of 4 settings, outperforming the second-best model (T5-IRM) by an average of 3.5%.
  • Source Domain Integration: PADA's performance improves as the number of source domains increases, indicating its ability to effectively integrate knowledge from multiple sources.
  • Reduced Performance Gap: PADA not only performs better on target domains but also substantially reduces the performance gap between source and target domains, showing improved adaptation stability.

Limitations and Future Work

  • Prompt Generation Sub-optimality: The prompt generation mechanism is limited by the available source domains. If a target domain is semantically unrelated to any source domain, the generated DRFs might be sub-optimal. The prompt generation training also doesn't directly optimize the downstream task objective.
  • Future Directions: The authors suggest improving prompt generation by exploring more natural extensions that accommodate multiple tasks and domains within a single model. They also aim to directly optimize the prompt generation process for the downstream task.

Summary updated

BibTeX
@article{bendavid2022pada,
  author = {Eyal Ben-David and Nadav Oved and Roi Reichart},
  title = {{PADA: Example-based Prompt Learning for on-the-fly Adaptation to Unseen Domains}},
  journal = {Trans. Assoc. Comput. Linguistics},
  year = {2022},
  doi = {10.1162/tacl\_a\_00468},
}
Figure