TensorX
返回文献探索

Paper · arXiv 2312.06681

Steering Llama 2 via Contrastive Activation Addition

Nina Rimsky, Nick Gabrieli, Julian Schulz, Meg Tong, Evan Hubinger, Alexander Matt Turner

12 upvotesDecember 9, 2023arXiv 预印本
AI 摘要

Contrastive Activation Addition (CAA) modifies model activations to steer language model behavior with high precision and insight into high-level concept representation.

Contrastive Activation AdditionCAAsteering vectorsresidual streamtoken positionsbehavioral question datasetsopen-ended generationlarge language modelsLLMs

Abstract

We introduce Contrastive Activation Addition (CAA), an innovative method for steering language models by modifying activations during their 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 both multiple-choice behavioral question datasets and open-ended generation tasks. We demonstrate that CAA significantly alters model behavior, outperforms traditional methods like finetuning and few-shot prompting, and minimally reduces capabilities. Moreover, by employing various activation space interpretation methods, we gain deeper insights into CAA's mechanisms. CAA both accurately steers model outputs and also sheds light on how high-level concepts are represented in Large Language Models (LLMs).

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
Steering Llama 2 via Contrastive Activation Addition | TensorX