atlas

Research map / Large language models / Language, safety and interpretability

Function Vectors in Large Language Models

ICLR 2024 · Large language models › Language, safety and interpretability · approach: Linguistic encoding in LLM representations · 4 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Identifies function vectors: sums of mean outputs of a small set of causal attention heads that transport a compact task representation in autoregressive LMs, which can be added to a residual stream to trigger ICL tasks in zero-shot and natural-text contexts.

Problem

How in-context learning tasks are represented and executed inside autoregressive transformer LMs; whether task representations can be causally extracted as compact vectors that transfer beyond the original ICL context.

Approach

Use causal mediation analysis (activation patching of mean attention-head outputs over corrupted prompts) to find a small set of causal attention heads, and sum their task-conditioned mean outputs into a single function vector that is added to a hidden layer to trigger the task in new contexts.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add a function vector to shuffled-label inputsGPT-J · 6 representative tasks, shuffled-labelaccuracy: 39.1 ± 1.2% -> 90.8±0.9%Helped
Add a function vector to zero-shot inputsGPT-J · 6 representative tasks, zero-shotaccuracy: 5.5± 0.8% -> 57.5 ± 1.7%Helped
Use the causal-mediation function vector instead of a layer-average vectorGPT-J · 6 representative tasks, shuffled-label and zero-shotaccuracy: 79.5±3.1% -> 90.8±0.9%; 9.5±1.8% -> 57.5 ± 1.7%Helped
Add a function vector to zero-shot inputsGPT-NeoX · 6 representative tasks, zero-shotaccuracy: 6.7±0.1% -> 57.1±1.5%Helped
Add a function vector to zero-shot inputsLlama 2 (70B) · 6 representative tasks, zero-shotaccuracy: 8.2±0.7% -> 83.8±0.7%Helped
Reconstruct the function vector from only the top 100 decoded tokens instead of the original vector (ablation)GPT-J function vectors · Zero-shot; six tasksaccuracy: Antonym 48.2 ± 2.0 % -> 4.8 ± 2.0%; Capitalize 70.5 ± 2.4% -> 5.7 ± 2.2%; Country-Capital 83.2 ± 2.7% -> 58.1 ± 18.5%; EHurt
Reconstruct the function vector from all decoded tokens instead of the original vector (ablation)GPT-J function vectors · Zero-shot; six tasksaccuracy: Antonym 48.2 ± 2.0 % -> 39.6 ± 2.6%; Capitalize 70.5 ± 2.4% -> 51.5 ± 11.6%; Country-Capital 83.2 ± 2.7% -> 29.0 ± 15.1%Mixed
Compose task vectors as vBD* = vAD + vBC - vAC (ablation)GPT-J function vectors · List-oriented tasks, zero-shotaccuracy: Last-Antonym 0.02 ± 0.01 -> 0.07 ± 0.02; Last-Capitalize 0.64 ± 0.03 -> 0.76 ± 0.04; Last-Country-Capital 0.15 ± 0.03 ->Mixed

Surprising findings

Limitations

Experimental setup

Datasets: antonym and synonym word pairs (adapted from prior lexical data) English-French, English-German, English-Spanish translation pairs SST-2 sentiment subset CommonsenseQA AG News ChatGPT-generated country-capital and capitalize-first-letter lists National Parks (Wikipedia)

Benchmarks: antonym capitalize country-capital english-french present-past singular-plural 34 additional ICL tasks natural text completions list-composition tasks

Metrics: top-1 accuracy average indirect effect KL divergence

Baselines: GPT-J zero-shot layer-averaged hidden state (h-bar) shuffled-label ICL baseline

Builds on: causal mediation analysis logit lens induction heads task vectors

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy