Adapting Large Language Models to Domains via Reading Comprehension

Daixuan Cheng, Shaohan Huang, Furu Wei

TL;DR

Adapting Large Language Models (LLMs) to specialized domains like law or medicine usually involves continued pre-training on raw text, which paradoxically improves domain knowledge but cripples the model's ability to follow prompts. This paper introduces AdaptLLM, a method that transforms raw domain corpora into "reading comprehension" tasks—mimicking how humans learn by practicing questions after reading—to successfully infuse domain expertise while actually enhancing prompting performance.

What Problem Does This Paper Address?

When we want an LLM to become an expert in a specific field (e.g., Biomedicine), the standard approach is Domain-Adaptive Pre-Training (DAPT): simply continue the self-supervised training on a massive pile of domain-specific raw text.

However, the authors uncover a significant drawback: while DAPT helps the model learn new facts (improving fine-tuning and knowledge-probing scores), it drastically hurts the model’s "prompting ability." Because raw domain corpora lack the diverse input-output patterns found in general instruction-tuning data, the model effectively "unlearns" how to interact with users via natural language questions. The challenge is to gain domain knowledge without losing the conversational interface that makes LLMs useful.

Methods

The authors propose a "Reading Comprehension" framework. Instead of feeding the model raw text, they convert that text into a structured format where the raw content is followed by a series of mined tasks.

  1. Reading Phase: The model processes the raw domain text.
  2. Comprehension Phase: The model performs tasks derived from that text using regex-based patterns to identify intrinsic relationships. These tasks include:
  3. Summarization: Generating a title or summary.
  4. Word-to-Text: Creating sentences using specific domain keywords.
  5. Natural Language Inference (NLI): Determining if one sentence entails or contradicts another.
  6. Commonsense Reasoning: Identifying cause-and-effect relationships.
  7. Paraphrase Detection: Generating supporting or contradicting sentences.
  8. Text Completion: Predicting the end of an article.
A simplified example of transforming raw text into reading comprehension tasks.

To ensure the model remains a generalist, these domain-specific reading comprehension texts are mixed with general instructions (from datasets like LIMA and WizardLM) during training.

Datasets

The researchers tested their method across three distinct domains:

  • Biomedicine: Trained on PubMed Abstracts; evaluated on PubMedQA, ChemProt, MQP, RCT, and USMLE.
  • Finance: Trained on a new collection of stock news (via FinGPT); evaluated on ConvFinQA, FPB, FiQA SA, Headline, and NER.
  • Law: Trained on FreeLaw Opinions; evaluated on SCOTUS, CaseHOLD, and UNFAIR-ToS.

For general prompting evaluation, they used benchmarks like MNLI, BoolQ, and SQuADv1 to ensure no "catastrophic forgetting" occurred.

Key Insights and Ideas

  • The DAPT Paradox: The most striking finding is that vanilla DAPT (training on raw text) consistently lowers prompting scores across almost all domains. It turns the model into a "knowledge silo" that is harder to talk to.
  • Practice Makes Perfect: By framing learning as reading comprehension, the model maintains its functional "prompting" muscles. Figure 3 illustrates this clearly: AdaptLLM maintains or improves prompting ability while DAPT sees a sharp decline.
  • Domain Knowledge Aids General Ability: Surprisingly, training on domain-specific reading comprehension tasks improved performance on general benchmarks. This suggests that the structured reasoning required for domain tasks translates back to general language understanding.
  • Word-to-Text and NLI are Key: Ablation studies (Figure 5) revealed that tasks focusing on domain vocabulary (Word-to-Text) and logical relationships (NLI) were the most effective for boosting domain-specific performance.
Comparison of fine-tuning (knowledge) vs. prompting (ability) scores.

Key Results

AdaptLLM consistently outperformed both the base general LLMs and the DAPT versions across all three domains.

  • Efficiency: The AdaptLLM-7B model achieved competitive performance with BloombergGPT-50B, a model nearly seven times its size that was trained from scratch on financial data.
  • Biomedicine: AdaptLLM-7B reached an average score of 47.3, significantly higher than the base LLaMA-7B (44.2) and the DAPT version (41.7).
  • Finance: AdaptLLM-7B scored 63.4, beating the base model's 58.6 and rivaling the much larger BloombergGPT.
  • Law: AdaptLLM-7B improved the average score from 34.2 (base) to 38.5.
Performance comparison across Biomedicine, Finance, and Law.

Limitations and Future Work

  • Regex Limitations: The current task mining relies on regex patterns, which are scalable but might miss complex nuances. The authors suggest that using LLMs to mine more sophisticated tasks could further improve results.
  • Data Access: The authors noted limited access to historical financial news, which may have constrained the finance model's potential.
  • Generalization: While the method works for three domains, the authors envision scaling this to a "universal" model that integrates many more specialized fields using this reading comprehension paradigm.

Summary updated

BibTeX
@inproceedings{cheng2024adapting,
  author = {Daixuan Cheng and Shaohan Huang and Furu Wei},
  title = {{Adapting Large Language Models to Domains via Reading Comprehension}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=y886UXPEZ0},
}
Figure