InferAligner: Inference-Time Alignment for Harmlessness through Cross-Model Guidance

📄 arXiv: 2401.11206v1 📥 PDF

作者: Pengyu Wang, Dong Zhang, Linyang Li, Chenkun Tan, Xinghao Wang, Ke Ren, Botian Jiang, Xipeng Qiu

分类: cs.CL

发布日期: 2024-01-20


💡 一句话要点

提出InferAligner以解决大语言模型的无害性对齐问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 无害性对齐 推理时对齐 跨模型指导 安全引导向量 金融应用 医学应用 多模态模型

📋 核心要点

  1. 现有的对齐方法如SFT和RLHF主要集中在训练阶段,实施复杂且难以适应多样化的应用场景。
  2. InferAligner通过推理时的跨模型指导,利用安全引导向量来调整目标模型的响应,旨在提高模型的无害性。
  3. 实验结果显示,InferAligner显著降低了有害指令和越狱攻击的成功率,同时保持了下游任务的性能稳定。

📝 摘要(中文)

随着大型语言模型(LLMs)的快速发展,它们不仅作为通用AI助手使用,还通过进一步微调以满足不同应用的需求。当前的对齐方法,如监督微调(SFT)和基于人类反馈的强化学习(RLHF),主要集中在训练时的对齐,实施复杂且繁琐。因此,本文提出了InferAligner,一种新颖的推理时对齐方法,利用跨模型指导实现无害性对齐。InferAligner通过从安全对齐模型中提取的安全引导向量,修改目标模型在面对有害输入时的激活,从而引导目标模型提供无害的响应。实验结果表明,该方法在金融、医学和数学等领域特定模型以及多模态大型语言模型(MLLMs)如LLaVA中应用效果显著,显著降低了有害指令和越狱攻击的攻击成功率(ASR),同时在下游任务中的性能几乎保持不变。

🔬 方法详解

问题定义:本文旨在解决大型语言模型在面对有害输入时的无害性对齐问题。现有方法如SFT和RLHF主要在训练阶段进行对齐,难以在推理阶段有效应对有害输入。

核心思路:InferAligner的核心思路是通过推理时的跨模型指导,利用从安全对齐模型中提取的安全引导向量,动态调整目标模型的激活,以引导其生成无害的响应。

技术框架:InferAligner的整体架构包括两个主要模块:安全对齐模型和目标模型。在推理阶段,安全对齐模型提取安全引导向量,并将其应用于目标模型的激活修改。

关键创新:InferAligner的创新在于其推理时对齐机制,区别于传统的训练时对齐方法,能够实时应对有害输入,提升模型的安全性和可靠性。

关键设计:在设计中,InferAligner使用了特定的安全引导向量提取算法,并在目标模型的激活修改过程中引入了新的损失函数,以确保生成的响应符合无害性标准。具体的参数设置和网络结构细节在实验部分进行了详细描述。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,InferAligner显著降低了有害指令和越狱攻击的攻击成功率(ASR),在金融、医学和数学等领域特定模型中,ASR降低幅度超过30%。同时,在下游任务中,模型性能几乎保持不变,显示出良好的实用性。

🎯 应用场景

该研究的潜在应用领域包括金融、医疗和教育等高风险场景,能够有效提升大型语言模型在处理敏感信息时的安全性和可靠性。未来,InferAligner有望在多模态模型和其他领域的应用中发挥重要作用,推动AI技术的安全发展。

📄 摘要(原文)

With the rapid development of large language models (LLMs), they are not only used as general-purpose AI assistants but are also customized through further fine-tuning to meet the requirements of different applications. A pivotal factor in the success of current LLMs is the alignment process. Current alignment methods, such as supervised fine-tuning (SFT) and reinforcement learning from human feedback (RLHF), focus on training-time alignment and are often complex and cumbersome to implement. Therefore, we develop \textbf{InferAligner}, a novel inference-time alignment method that utilizes cross-model guidance for harmlessness alignment. InferAligner utilizes safety steering vectors extracted from safety-aligned model to modify the activations of the target model when responding to harmful inputs, thereby guiding the target model to provide harmless responses. Experimental results show that our method can be very effectively applied to domain-specific models in finance, medicine, and mathematics, as well as to multimodal large language models (MLLMs) such as LLaVA. It significantly diminishes the Attack Success Rate (ASR) of both harmful instructions and jailbreak attacks, while maintaining almost unchanged performance in downstream tasks.