While large language models (LLMs) like GPT-4 have recently demonstrated astonishing zero-shot capabilities in general domain tasks, they often generate content with hallucinations in specific domains such as Chinese law, hindering their application in these areas. This is typically due to the absence of training data that encompasses such a specific domain, preventing GPT-4 from acquiring in-domain knowledge. A pressing challenge is that it's not plausible to continue training LLMs of such scale on in-domain data. This paper introduces a simple and effective domain adaptation framework for GPT-4 by reformulating generation as an \textbf{adapt-retrieve-revise} process. The initial step is to \textbf{adapt} an affordable 7B LLM to the target domain by continuing learning on in-domain data. When solving a task, we leverage the adapted LLM to generate a draft answer given a task query. Then, the draft answer will be used to \textbf{retrieve} supporting evidence candidates from an external in-domain knowledge base. Finally, the draft answer and retrieved evidence are concatenated into a whole prompt to let GPT-4 assess the evidence and \textbf{revise} the draft answer to generate the final answer. Our proposal combines the advantages of the efficiency of adapting a smaller 7B model with the evidence-assessing capability of GPT-4 and effectively prevents GPT-4 from generating hallucinatory content. In the zero-shot setting of four Chinese legal tasks, our method improves accuracy by 33.3\% compared to the direct generation by GPT-4. When compared to two stronger retrieval-based baselines, our method outperforms them by 15.4\% and 23.9\%. Our code will be released
翻译:尽管GPT-4等大语言模型在通用领域任务中展现出惊人的零样本能力,但在中文法律等特定领域常产生包含幻觉的内容,阻碍了其在该领域的应用。这通常是由于缺乏涵盖特定领域的训练数据,导致GPT-4无法获取领域内知识。当前亟需解决的挑战是,无法在领域数据上继续训练如此规模的大模型。本文提出一种简单有效的GPT-4领域自适应框架,通过将生成过程重构为**自适应-检索-修正**流程。首先,通过持续学习领域数据,将可负担的7B大模型**自适应**到目标领域。处理任务时,利用自适应模型根据查询生成草稿答案。随后,基于该草稿答案从外部领域知识库中**检索**支撑证据候选。最后,将草稿答案与检索证据拼接为完整提示,使GPT-4评估证据并**修正**草稿答案以生成最终输出。该方法结合了小模型(7B)高效自适应与GPT-4证据评估能力的双重优势,有效防止GPT-4产生幻觉内容。在四个中文法律任务的零样本设置中,相比GPT-4直接生成,准确率提升33.3%;与两个更强检索基线相比,分别超越15.4%和23.9%。相关代码将公开。