Управление Llama 2 с помощью контрастного добавления активаций
Steering Llama 2 via Contrastive Activation Addition
December 9, 2023
Авторы: Nina Rimsky, Nick Gabrieli, Julian Schulz, Meg Tong, Evan Hubinger, Alexander Matt Turner
cs.AI
Аннотация
Мы представляем Contrastive Activation Addition (CAA) — инновационный метод управления языковыми моделями путем модификации активаций в процессе их прямого прохода. CAA вычисляет «векторы управления», усредняя разницу в активациях остаточного потока между парами положительных и отрицательных примеров определенного поведения, таких как фактические и галлюцинированные ответы. Во время вывода эти векторы добавляются на всех позициях токенов после пользовательского запроса с положительным или отрицательным коэффициентом, что позволяет точно контролировать степень целевого поведения. Мы оцениваем эффективность CAA на модели Llama 2 Chat, используя как наборы данных с поведенческими вопросами с множественным выбором, так и задачи открытой генерации. Мы демонстрируем, что CAA значительно изменяет поведение модели, превосходит традиционные методы, такие как дообучение и few-shot prompting, и минимально снижает возможности модели. Более того, применяя различные методы интерпретации пространства активаций, мы получаем более глубокое понимание механизмов CAA. CAA не только точно управляет выходами модели, но и проливает свет на то, как высокоуровневые концепции представлены в крупных языковых моделях (LLM).
English
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).