arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.18540cs.LGcs.AIcs.CL
收藏

微调后保持大语言模型(LLM)对齐:提示模板的关键作用

Keeping LLMs Aligned After Fine-tuning: The Crucial Role of Prompt Templates

Institute for Interdisciplinary Information Sciences, Tsinghua University(清华大学交叉信息研究院)

Kaifeng Lyu, Haoyu Zhao, Xinran Gu, Dingli Yu, Anirudh Goyal, Sanjeev Arora

AI总结:

针对公开大语言模型良性微调后易丧失安全对齐的问题,研究发现提示模板对维持对齐至关重要,提出“纯调优、安全测试”策略,经多模型多数据集验证可显著减少不安全行为。

摘要:

Llama 2-Chat等公开大语言模型经过对齐训练,被认为是安全的。近期Qi等人[2024]报告称,即便在看似安全的数据集上进行良性微调,也会导致模型产生不安全行为。本文研究缓解此类对齐丧失的方法与最佳实践。我们聚焦公开模型在面向用户提供特定用途服务前进行微调的场景,该场景下模型应在下游任务上取得提升,同时维持对齐。通过在多个聊天模型(Meta的Llama 2-Chat、Mistral AI的Mistral 7B Instruct v0.2以及OpenAI的GPT-3.5 Turbo)上开展大量实验,本文揭示微调与推理阶段使用的提示模板在维持安全对齐方面发挥关键作用,并提出“纯调优、安全测试”(Pure Tuning, Safe Testing,PTST)策略——即微调模型时不使用安全提示,但在测试阶段加入安全提示。这一看似反直觉的策略引入了有意的分布偏移,以促进对齐的保持。在GSM8K、ChatDoctor和OpenOrca上的微调实验表明,PTST显著减少了不安全行为的增多。

英文摘要:

Public LLMs such as the Llama 2-Chat underwent alignment training and were considered safe. Recently Qi et al. [2024] reported that even benign fine-tuning on seemingly safe datasets can give rise to unsafe behaviors in the models. The current paper is about methods and best practices to mitigate such loss of alignment. We focus on the setting where a public model is fine-tuned before serving users for specific usage, where the model should improve on the downstream task while maintaining alignment. Through extensive experiments on several chat models (Meta's Llama 2-Chat, Mistral AI's Mistral 7B Instruct v0.2, and OpenAI's GPT-3.5 Turbo), this paper uncovers that the prompt templates used during fine-tuning and inference play a crucial role in preserving safety alignment, and proposes the ``Pure Tuning, Safe Testing'' (PTST) strategy -- fine-tune models without a safety prompt, but include it at test time. This seemingly counterintuitive strategy incorporates an intended distribution shift to encourage alignment preservation. Fine-tuning experiments on GSM8K, ChatDoctor, and OpenOrca show that PTST significantly reduces the rise of unsafe behaviors.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑