TL;DR
This paper introduces a novel approach to adapt large language models (LLMs) to specific domains by enhancing reading comprehension. By combining LLM-powered question-answer generation with document clustering to extend context, and employing parameter-efficient fine-tuning, they achieve significant performance improvements on domain-specific tasks, outperforming existing methods.
What Problem Does This Paper Address?
Large Language Models (LLMs) are powerful, but their general knowledge doesn't always translate well to specialized domains like medicine or finance. A common way to adapt them is through continued pre-training on domain-specific data. While previous work showed that formatting this data into question-answer (QA) pairs for reading comprehension tasks can boost performance, existing methods (like AdaptLLM) rely on rigid, regex-based patterns. These patterns struggle with complex domain knowledge and produce limited question diversity. Furthermore, the QA pairs generated this way often lack sufficient context for the LLM to truly grasp the nuances of the domain. This paper aims to overcome these limitations by creating richer, more context-aware reading comprehension data for domain adaptation.
Methods
The authors propose a three-pronged approach:
- LLM-based Data Preprocessing: Instead of regex, they leverage LLMs (initially ChatGPT, then a distilled 7B parameter LLM) to generate question-answer pairs from domain-specific documents. This allows for more nuanced extraction of domain knowledge and a wider variety of question types.
- Length-based Clustering: To address the issue of limited context in individual documents, they employ document similarity (using text embeddings) to cluster related documents. These clusters are then concatenated to form longer, more contextually rich inputs for the LLM. A 0/1 knapsack algorithm is used to fit these extended contexts within the LLM's maximum context length.
- Parameter-Efficient Fine-Tuning (PEFT): To make the domain adaptation process more efficient, they utilize PEFT methods like LoRA. They argue that for domain adaptation, a higher LoRA rank (e.g., 256) is necessary to match the performance of full fine-tuning, but still offers significant efficiency gains.
Datasets
The paper uses the following datasets for training and evaluation:
- Domain-Specific Corpora: PubMed abstracts (for biomedicine) and financial news (for finance).
- Domain-Specific Tasks:
- Biomedicine: BioMMLU, PubMedQA, MQP, RCT, USMLE.
- Finance: FIQA SA, ConvFinQA, FPB, NER, Headline.
- General Instruction Datasets: LIMA, WizardLM, and Orca datasets are used for augmenting the domain corpus with general instructions.
The paper does not introduce new benchmarks but rather re-evaluates existing methods on these established datasets.
Key Insights and Ideas
- LLMs are better than regex for QA generation: Directly using LLMs for QA pair generation captures domain-specific knowledge more effectively than rigid regex patterns, leading to better comprehension.
- Context is king (even for LLMs): Simply providing individual documents as context isn't enough. Clustering similar documents to create extended contexts significantly boosts performance, especially for domains where individual documents are short (like biomedical abstracts).
- PEFT needs careful tuning for domain adaptation: While PEFT methods like LoRA are generally efficient, achieving comparable performance to full fine-tuning on domain adaptation requires a higher rank and potentially targeting more layers than typically used for standard tasks.
Key Results
The proposed method, referred to as "Our" in the tables, consistently outperforms AdaptLLM and its variant ReadCompre.
- Biomedicine: Achieved an average improvement of 6.8% over AdaptLLM.
- Finance: Achieved an average improvement of 5.6% over AdaptLLM.
- Retrieval Augmented Generation (RAG): The integration of clustering also enhanced performance on RAG tasks.
The paper also shows that with a LoRA rank of 256 and around 610M trainable parameters, parameter-efficient fine-tuning can match the performance of full fine-tuning on domain adaptation tasks.
Limitations and Future Work
- Computational Cost of LLM Preprocessing: While they use a distilled LLM to mitigate costs, generating QA pairs for entire large corpora can still be computationally intensive.
- Clustering Thresholds: The effectiveness of length-based clustering might depend on the chosen similarity thresholds and maximum document counts per cluster.
- Future Work: The authors suggest that their method is effective for leveraging unsupervised domain-specific corpora. Further exploration into optimizing PEFT settings for domain adaptation and investigating other clustering strategies could be fruitful.
Summary updated