Example-based Hypernetworks for Multi-source Adaptation to Unseen Domains

Tomer Volk, Eyal Ben-David, Ohad Amosy, Gal Chechik, Roi Reichart

Abstract

This paper introduces a novel framework for "any-domain adaptation" (ADA), enabling models to generalize to completely unseen target domains without any target-domain data during training. By employing Hypernetworks to generate example-specific classifier weights based on a semantic "signature" of the input, the proposed Hyper-PADA model achieves significant performance gains—up to 14.8% over standard fine-tuning—and outperforms few-shot GPT-3 on complex reasoning tasks.

Introduction: The Challenge of Any-Domain Adaptation

Deep learning models typically struggle with Out-of-Distribution (OOD) generalization. While standard Domain Adaptation (DA) techniques exist, most assume access to at least some unlabeled data from the target domain during training. In the real world, this is often impossible—the target domain might be unknown, confidential (e.g., medical records), or simply too expensive to sample.

The authors tackle the Any-domain Adaptation (ADA) setting: leveraging labeled data from multiple source domains to build a model that can handle a totally "blind" target domain at test time. Existing approaches either try to find domain-invariant features (which can discard useful information) or use a "Mixture of Experts" (which can be rigid). This paper seeks a middle ground: a model that adapts its internal logic to the specific semantics of every single input example.

Methodology

The core innovation is the use of Hypernetworks (HNs). In a standard setup, a model has fixed weights after training. In this framework, the Hypernetwork generates the weights for the task classifier on the fly based on the input's characteristics.

The basic components of the proposed framework, showing the Generator (a) and Discriminator (b) modules.

The authors propose three increasingly sophisticated models:

  1. Hyper-DN (Domain Name): The HN generates weights based on the domain name. For unseen domains, it uses a special UNK (unknown) token.
  2. Hyper-DRF (Domain Related Features): Instead of a domain name, a T5 encoder-decoder first generates a "signature"—a set of keywords (DRFs) that describe the example's semantic space (e.g., an example from a 'Government' domain might get a signature like "travel, city, reports"). This signature is fed to the HN to generate example-specific weights.
  3. Hyper-PADA: The most advanced version. The DRF signature is used twice: once to generate the classifier weights via the HN, and once as a "prompt" concatenated to the input text to enrich the representation.
The Hyper-PADA architecture, which combines example-specific weight generation with prompt-based enrichment.

By conditioning the classifier on a semantic signature, the model can "triangulate" how to handle an unseen domain by relating it to known concepts from the source domains.

Experimental Setup

The models were evaluated in a "leave-one-out" multi-source adaptation setup across 29 scenarios using two primary datasets:

  • Websis-CLS-10: A sentiment classification dataset featuring Amazon reviews in 4 languages (English, German, French, Japanese) across 3 product domains (Books, DVDs, Music).
  • MNLI (Multi-Genre Natural Language Inference): A task to determine if a premise entails or contradicts a hypothesis, using 5 distinct genres (Fiction, Government, Slate, Telephone, Travel).

Results and Discussion

Hyper-PADA demonstrated superior performance across all benchmarks:

  • Sentiment Analysis (CLCD): Hyper-PADA outperformed the best non-HN baseline by an average of 2.7% and beat standard T5 fine-tuning by 9.5%.
  • Natural Language Inference (CD): The gains were even more dramatic, with Hyper-PADA outperforming the previous state-of-the-art (PADA) by 3.4% and standard T5 by 14.8%.
  • Beating Large Language Models: In the NLI task, the fine-tuned Hyper-PADA model (based on T5-base) outperformed GPT-3 (175B) by 5.3% in a few-shot setting, proving that specialized DA architectures still hold a significant edge over massive general-purpose LLMs in complex reasoning.

Key insights include the finding that example-level adaptation is far more effective than domain-level adaptation, allowing the model to handle "fuzzy" domain boundaries. Furthermore, the authors found a strong correlation ($R^2 = 0.374$) between the diversity of the weights generated by the HN and the performance improvement, suggesting that aggressive customization is key to success.

Conclusion

While highly effective for sequence-level classification, the study notes that extending HNs to token-level tasks (like NER) or text generation remains future work. Additionally, the method relies on a strong pre-trained encoder-decoder (T5) to generate quality signatures. Despite these limitations, Hyper-PADA provides a powerful bridge to unseen domains by grounding adaptation in shared semantic concepts.

Summary updated

BibTeX
@inproceedings{volk2023example,
  author = {Tomer Volk and Eyal Ben-David and Ohad Amosy and Gal Chechik and Roi Reichart},
  title = {{Example-based Hypernetworks for Multi-source Adaptation to Unseen Domains}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.610},
}
Figure