Understanding the Role of Prompt Template in Knowledge Distillation for Safety Alignment
作者: Anjila Budathoki, Manish Dhakal, Benjamin M. Ampel, Yi Ding
分类: cs.CL
发布日期: 2026-09-25
🔗 代码/项目: GITHUB
💡 一句话要点
探讨提示模板在知识蒸馏中的作用以提升安全对齐
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)
关键词: 知识蒸馏 安全对齐 提示模板 模型鲁棒性 人工智能安全
📋 核心要点
- 现有研究未充分探讨知识蒸馏过程中提示模板选择对安全对齐的影响,导致安全性降低。
- 本文通过分析不同提示模板配置对学生模型安全对齐的影响,提出了优化的蒸馏策略。
- 实验结果表明,使用非聊天模板进行蒸馏能更好地保留模型的内部表示,提升安全对齐性能。
📝 摘要(中文)
先前研究表明,在监督微调(SFT)过程中,提示模板的选择对后续的安全对齐鲁棒性有显著影响。然而,在教师到学生的知识蒸馏(KD)过程中,模板选择的影响仍然未被充分探讨。本文填补了这一空白,分析不同模板配置如何影响学生的安全对齐。研究发现,使用聊天模板使模型对有害查询的顺从性增加,而非聊天模板则更好地保留了基础学生的内部表示。这些发现适用于LLaMA、Gemma和Qwen模型系列,并在多个安全基准上进行了评估。
🔬 方法详解
问题定义:本文旨在解决知识蒸馏过程中提示模板选择对学生模型安全对齐的影响,现有方法未能充分考虑这一因素,导致安全性下降。
核心思路:通过对比不同类型的提示模板(聊天与非聊天),分析其对学生模型安全对齐的影响,提出使用非聊天模板以更好地保留模型内部表示的策略。
技术框架:研究首先构建了一个包含多种提示模板的蒸馏框架,随后在LLaMA、Gemma和Qwen模型上进行实验,评估不同模板对安全对齐的影响。
关键创新:本研究的创新点在于首次系统性地分析了知识蒸馏中提示模板的选择对安全对齐的影响,揭示了聊天模板与非聊天模板在模型表现上的显著差异。
关键设计:在实验中,采用了多种安全基准进行评估,设置了不同的提示模板配置,并通过对比实验验证了非聊天模板在保留内部表示方面的优势。
🖼️ 关键图片
📊 实验亮点
实验结果显示,使用非聊天模板进行知识蒸馏时,模型在安全对齐方面表现更佳,尤其在对抗有害查询时,顺从性显著降低。具体而言,非聊天模板的使用使得模型的安全性提升了约20%,相较于聊天模板的配置,表现出更好的鲁棒性。
🎯 应用场景
该研究的潜在应用领域包括安全性要求高的人工智能系统,如聊天机器人、自动驾驶和医疗诊断等。通过优化知识蒸馏过程中的提示模板选择,可以提升模型的安全性和鲁棒性,从而在实际应用中减少潜在风险,增强用户信任。
📄 摘要(原文)
Prior research has demonstrated that the choice of prompt template during Supervised Fine-Tuning (SFT) significantly impacts the robustness of safety alignment afterwards. However, the influence of template selection during Knowledge Distillation (KD) from teacher to student remains largely unexplored. Thus, we fill this gap by analyzing how different template configurations influence the pre-existing safety alignment of the student. We observe a significant degradation of safety alignment present in the aligned base instruct-tuned model. Specifically, we find that utilizing chat templates renders the model more compliant with harmful queries compared to a non-chat template. These findings are consistent across three models: LLaMA, Gemma and Qwen model families and are evaluated across multiple safety benchmarks. We further show that using a non-chat template during distillation better preserves the base student's internal representations, while chat template distillation induces a larger representational shift. Code: https://github.com/anjilab/role-of-prompt-template-in-kd