Skip to main content
QUICK REVIEW

[论文解读] Steering Llama 2 via Contrastive Activation Addition

Nina Rimsky, Nick Gabrieli|arXiv (Cornell University)|Dec 9, 2023
Interactive and Immersive Displays被引用 4
一句话总结

本文提出对比激活添加(Contrastive Activation Addition, CAA),一种通过计算正样本与负样本对在相同标记位置的激活差异来生成引导向量,从而在推理过程中引导 Llama 2 模型行为的方法。CAA 能够有效引导模型输出朝向期望行为(如减少幻觉或迎合倾向),在保持模型能力的同时,优于微调和少样本提示方法。

ABSTRACT

We introduce Contrastive Activation Addition (CAA), an innovative method for steering language models by modifying their activations during forward passes. CAA computes "steering vectors" by averaging the difference in residual stream activations between pairs of positive and negative examples of a particular behavior, such as factual versus hallucinatory responses. During inference, these steering vectors are added at all token positions after the user's prompt with either a positive or negative coefficient, allowing precise control over the degree of the targeted behavior. We evaluate CAA's effectiveness on Llama 2 Chat using multiple-choice behavioral question datasets and open-ended generation tasks. We demonstrate that CAA significantly alters model behavior, is effective over and on top of traditional methods like finetuning and system prompt design, and minimally reduces capabilities. Moreover, we gain deeper insights into CAA's mechanisms by employing various activation space interpretation methods. CAA accurately steers model outputs and sheds light on how high-level concepts are represented in Large Language Models (LLMs).

研究动机与目标

  • 开发一种稳健且可泛化的无微调方法,用于引导大语言模型朝向期望行为。
  • 探究激活工程如何精确调节 LLM(如 Llama 2)中与对齐相关的重要高层行为。
  • 理解引导向量在 RLHF 微调模型中的工作机制及其可解释性。
  • 在多种行为(如幻觉、迎合倾向和事实一致性)上评估 CAA 的有效性。
  • 将 CAA 的性能与鲁棒性与传统对齐技术(如少样本提示和微调)进行对比。

提出的方法

  • 通过计算正样本与负样本对在相同标记位置的残差流激活差异,构建引导向量。
  • 使用数百至数千对对比样本(如正确答案 vs. 幻觉答案)以降低噪声并提高向量精度。
  • 在推理过程中通过将学习到的引导向量添加到用户提示之后的所有标记位置的激活中,实现引导。
  • 通过正或负系数控制引导强度,实现对行为的细粒度调节。
  • 利用主成分分析(PCA)和注意力头分析等解释技术,探究引导向量在几何与表征上的特性。
  • 通过 Claude 2 的自动评分和人类标注的多选题与开放性任务基准,评估引导效果。
(a) Sycophancy CAA example for Llama 2 13B Chat
(a) Sycophancy CAA example for Llama 2 13B Chat

实验结果

研究问题

  • RQ1CAA 是否能有效引导 Llama 2 减少幻觉,同时保持事实准确性?
  • RQ2在行为控制方面,CAA 与少样本提示和微调相比,在性能和鲁棒性上表现如何?
  • RQ3引导向量在不同主题和提示结构之间具有多大程度的泛化能力?
  • RQ4引导向量在模型激活空间中的几何与表征结构是怎样的?
  • RQ5引导向量如何与 RLHF 微调模型相互作用?CAA 是否保持了模型能力?

主要发现

  • 当使用正系数添加引导向量时,CAA 显著提升了目标行为(如真实性、拒绝幻觉)的出现频率。
  • 在多选题基准测试中,CAA 在诱发期望行为方面优于少样本提示和微调,部分类别准确率提升高达 25%。
  • 在幻觉引导任务中,与未引导模型相比,CAA 将有效问题的拒绝率降低了 40%,同时正确回答率提升了 30%。
  • 该方法展现出强大的零样本泛化能力:在某一主题(如历史)上训练的引导向量,能有效泛化到无关主题(如物理或政治)。
  • 主成分分析(PCA)显示,不同行为的引导向量在各层中沿不同方向聚集,表明潜在空间中高层概念具有结构化表征。
  • CAA 导致的模型能力退化极小,整体流畅性与连贯性指标仅下降 2–3%,表明其具有高度的分布内鲁棒性。
(b) CAA effect on behaviors for Llama 2 13B Chat
(b) CAA effect on behaviors for Llama 2 13B Chat

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。