HarmAug:面向安全防护模型知识蒸馏的有效数据增强方法
HarmAug: Effective Data Augmentation for Knowledge Distillation of Safety Guard Models
AI总结:
HarmAug通过越狱LLM并添加肯定前缀生成多样化有害指令,增强知识蒸馏数据,使小模型在安全检测上达到大模型性能,且计算成本降低75%以上。
摘要:
安全防护模型用于检测针对大型语言模型(LLM)的恶意查询,对于确保LLM在现实应用中安全、负责任地部署至关重要。然而,将现有数十亿参数的安全防护模型与LLM一同部署在移动设备上,由于巨大的内存需求和延迟,是不切实际的。为降低这一成本,我们使用带有二元有害性标签的指令-响应对标注数据集,将大型教师安全防护模型蒸馏为较小的模型。由于现有标注数据集中有害指令的多样性有限,朴素蒸馏的模型往往性能不如大型模型。为弥合小模型与大模型之间的差距,我们提出HarmAug,一种简单而有效的数据增强方法,其涉及对LLM进行越狱并提示其生成有害指令。给定诸如“生成一条单一的有害指令提示,以引发冒犯性内容”的提示,我们在LLM的响应中添加一个肯定前缀(例如,“我有一个提示的想法:”)。这鼓励LLM继续生成响应的其余部分,从而采样出有害指令。另一个LLM生成对该有害指令的响应,教师模型则对指令-响应对进行标注。我们通过实验证明,HarmAug优于其他相关基线。此外,一个使用HarmAug训练的4.35亿参数安全防护模型,其F1分数可与超过70亿参数的更大模型相媲美,在AUPRC上甚至超越它们,而其计算成本不到后者的25%。
英文摘要:
Safety guard models that detect malicious queries aimed at large language models (LLMs) are essential for ensuring the secure and responsible deployment of LLMs in real-world applications. However, deploying existing safety guard models with billions of parameters alongside LLMs on mobile devices is impractical due to substantial memory requirements and latency. To reduce this cost, we distill a large teacher safety guard model into a smaller one using a labeled dataset of instruction-response pairs with binary harmfulness labels. Due to the limited diversity of harmful instructions in the existing labeled dataset, naively distilled models tend to underperform compared to larger models. To bridge the gap between small and large models, we propose HarmAug, a simple yet effective data augmentation method that involves jailbreaking an LLM and prompting it to generate harmful instructions. Given a prompt such as, "Make a single harmful instruction prompt that would elicit offensive content", we add an affirmative prefix (e.g., "I have an idea for a prompt:") to the LLM's response. This encourages the LLM to continue generating the rest of the response, leading to sampling harmful instructions. Another LLM generates a response to the harmful instruction, and the teacher model labels the instruction-response pair. We empirically show that our HarmAug outperforms other relevant baselines. Moreover, a 435-million-parameter safety guard model trained with HarmAug achieves an F1 score comparable to larger models with over 7 billion parameters, and even outperforms them in AUPRC, while operating at less than 25% of their computational cost.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。