From Textbooks to Data: Generating High-Quality Domain-Specific QA Data with Large Language Models
摘要
Large language models (LLMs) have exhibited exceptional capabilities in both knowledge representation and generation. However, their training and fine-tuning remain heavily reliant on large-scale, high-quality supervised datasets, which are often expensive and time-consuming to acquire due to the need for manual annotation. Although prior research has explored using LLMs themselves to synthesize training data, such approaches typically presume the availability of a sizable set of domain-relevant questions—an assumption that does not hold in many specialized fields. In this paper, we propose a novel two-stage LLM-driven framework for domain-specific data augmentation in low-resource settings. In the first stage, GPT-4 is utilized to automatically generate high-quality questions directly from unstructured textbook content, eliminating the dependency on pre-existing question pool. In the second stage, Qwen-Max, guided by chain-of-thought (CoT) prompting, generates detailed explanations in response to the generated questions, resulting in a comprehensive synthetic dataset. This dataset is then used to fine-tune Qwen1.5-7B-Chat for domain adaptation. Experimental results demonstrate that our approach significantly outperforms baseline models, especially under data-scarce conditions. Furthermore, we conduct an in-depth analysis comparing teacher-generated versus student-generated explanations, and explore various fine-tuning strategies. Our findings offer practical insights into efficient domain adaptation of smaller LLMs using synthetic data.