Source-linked AI summary
Function Vectors in Large Language Models
Eric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller, Byron C. Wallace, David Bau
TL;DR
The paper asks how transformers represent and execute complex in-context-learning tasks. Using causal mediation analysis, it extracts function vectors from attention heads and finds that they robustly trigger task execution across contexts, while sometimes composing into new complex functions.
Problem
How large language models causally represent and execute demonstrated in-context-learning functions remains incompletely understood.
Source: §1 · p. 1, §2.1 · p. 2Method
The paper uses causal mediation analysis to extract function vectors by summing outputs from a small set of task-influential attention heads.
Source: §2.3 · p. 4Results
Function vectors robustly trigger task execution across diverse contexts, contain information beyond output vocabularies, and can sometimes compose into new complex functions.
Source: §1 · p. 2Takeaways & Limitations
Function vectors provide a compact, causal representation of task abstractions within transformer hidden states across tasks and context shifts.
Source: §5 · p. 9FV composition may depend on decomposable tasks whose word-selection and word-transformation components engage complementary mechanisms.
Source: §3.3 · p. 8
Abstract
from arXiv · showhide
We report the presence of a simple neural mechanism that represents an input-output function as a vector within autoregressive transformer language models (LMs). Using causal mediation analysis on a diverse range of in-context-learning (ICL) tasks, we find that a small number attention heads transport a compact representation of the demonstrated task, which we call a function vector (FV). FVs are robust to changes in context, i.e., they trigger execution of the task on inputs such as zero-shot and natural text settings that do not resemble the ICL contexts from which they are collected. We test FVs across a range of tasks, models, and layers and find strong causal effects across settings in middle layers. We investigate the internal structure of FVs and find while that they often contain information that encodes the output space of the function, this information alone is not sufficient to reconstruct an FV. Finally, we test semantic vector composition in FVs, and find that to some extent they can be summed to create vectors that trigger new complex tasks. Our findings show that compact, causal internal vector representations of function abstractions can be explicitly extracted from LLMs. Our code and data are available at https://functions.baulab.info.
1 INTRODUCTION
The paper identifies function vectors (FVs) as compact representations of input-output tasks in autoregressive transformers, where they trigger procedure execution rather than directly performing tasks. FVs are transported by a small set of attention heads, remain effective across unrelated contexts, and support partial vector composition across functions.
- Function vectors are compact hidden-state representations of input-output tasks that trigger a language model to execute a specific procedure during in-context learning (ICL; Brown et al., 2020).The paper presents these vectors as a rudimentary form of function references in autoregressive transformers trained on natural text.Source: §1 · p. 1
- Causal mediation analysis identifies a handful of attention heads that jointly transport each function vector, which can be formed by summing their outputs.The mechanism is examined through activation patching to determine how information flows during ICL.Source: §1 · p. 2
- Across over 40 diverse ICL tasks and language models scaling from 6B to 70B parameters, the study tests whether function vectors generalize as a broad mechanism.The task set varies in function complexity, and the vectors’ effects are measured across multiple model scales.Source: §1 · p. 2
- Function vectors typically trigger task execution in differently formatted, zero-shot, and natural-text contexts that do not resemble their extraction contexts.This portability indicates that FV effects are not limited to contexts similar to the demonstrations used to derive them.Source: §1 · p. 2
- Function vectors often encode a task’s output vocabulary, but that vocabulary alone does not fully identify the vector or suffice to invoke the function.The findings therefore distinguish FV representations from simple word-embedding arithmetic.Source: §1 · p. 2
- To some extent, composing function vectors produces new vectors that execute complex tasks combining their constituent functions.This function-level vector algebra differs from semantic word-embedding algebra and can specify nonlinear tasks such as calculating a word’s antonym.Source: §1 · p. 2
2 METHOD
The method tests whether task information can be causally extracted from in-context examples and transferred to new prompts. It formalizes function-vector extraction by identifying influential attention heads with causal mediation and aggregating their task-conditioned outputs.
2.1 A MOTIVATING OBSERVATION
- Adding the average activation from antonym demonstrations at GPT-J layer 12 induces zero-shot antonym prediction with 24.3% accuracy.This motivating intervention suggests that the averaged activation encodes the demonstrated task, while function vectors are introduced as a stronger representation.Source: §2.1 · p. 2, Figure 2 · p. 2
2.2 FORMULATION
- Successful ICL prompts contain exemplar input-output pairs and a query whose correct answer is ranked highest, while shuffled-label prompts provide uninformative controls.The formulation represents transformer computation through last-token hidden states and attention-head outputs across layers.Source: §2.2 · p. 3
2.3 CAUSAL MEDIATION TO EXTRACT FUNCTION VECTORS FROM ATTENTION HEADS
- Causal mediation replaces attention-head activations in uninformative prompts with task-conditioned means and measures recovery of the correct target response.Heads are ranked by average indirect effect across tasks; larger effects indicate greater influence on promoting the correct response.Source: §2.3 · p. 3
- The most causally influential heads cluster in early-middle layers and primarily attend to exemplar output tokens, although not all reproduce induction-head patterns across contexts.These findings motivate treating a small head set as transporting information about the demonstrated task.Source: §2.3 · p. 4, Figure 3 · p. 4
- A function vector sums the average outputs of the selected high-effect heads for a task and can be added to hidden states to test causal task execution.The selected set is obtained by ranking every attention head by average indirect effect across layers and indices.Source: §2.3 · p. 4
3 EXPERIMENTS
Experiments test function-vector portability across models, tasks, and input forms, then examine what FVs encode and whether they can be composed into new functions. FVs recover task behavior in altered contexts, contain information beyond decoded output tokens, and sometimes compose algebraically.
3 EXPERIMENTS
- The study evaluates decoder-only autoregressive models on over 40 simple tasks, emphasizing six representative tasks spanning semantic relations, translation, capitalization, and inflection.The representative tasks are Antonym, Capitalize, Country-Capital, English-French, Present-Past, and Singular-Plural.Source: §3 · p. 4, Table 1 · p. 5
3.1 PORTABILITY OF FUNCTION VECTORS
- FVs recover task performance in shuffled-label and zero-shot contexts across models, with causal-mediation FVs outperforming layer-averaged vectors for GPT-J.On 20 additional GPT-J templates, FVs achieve 76.2±13.8% with shuffled labels and 40.0±16.7% zero-shot, versus 32.3 ± 12.8% and 6.2 ± 4.3% for the base model; middle-layer effects decline sharply in late layers across tasks, architectures, and sizes.Source: Table 2 · p. 5, §3.1 · pp. 5–6, Figure 4 · p. 6
- FVs remain effective across diverse ICL templates and natural text, where antonym completions significantly exceed original completions and resemble zero-shot portability across all six tasks.The FV is added at the original prompt’s final token and subsequent token predictions; qualitative results indicate some vectors capture more than the demonstrated one-word task.Source: §3.1 · p. 6, Table 3 · p. 6
3.2 THE DECODED VOCABULARY OF FUNCTION VECTORS
- Decoded FV tokens usually occupy the task’s output space, but reconstructing functionality from top decoded tokens typically requires more than 100 vocabulary tokens.English-French decodes to nonsense and Antonym to reversal-related words, while Singular-Plural and Present-Past decode to plural nouns and past-tense verbs; the remaining functionality lies beyond top-token information.Source: §3.2 · pp. 7–8, Table 6 · p. 7
3.3 VECTOR ALGEBRA ON FUNCTION VECTORS
- Algebraic FV composition sometimes creates new task vectors that outperform both directly extracted FVs and ICL, although other well-performing tasks resist composition.The experiments compose First-Copy, First-Capital, and Last-Copy into tasks such as Last-Capital; the authors suggest composition may combine complementary mechanisms for selecting words and transforming them.Source: §3.3 · p. 8, Table 7 · p. 8
4 RELATED WORK
This work distinguishes function vectors from prior task representations by showing that compact, causal FVs already exist within LLMs and can be extracted and inserted. It also situates FVs within research on ICL behavior, task-performance mechanisms, mechanistic interpretability, and attention analysis.
Related work
- A concurrent study independently observed a related phenomenon on different models and tasks.The supplied passage identifies Hendel et al. (2023) as concurrent related work, but does not provide further comparison details.Source: §4 · p. 9
Task Representations
- Unlike prior constructed task encodings, FVs already exist within LLMs, have causal effects, and can be explicitly extracted and inserted.Earlier approaches used metamappings, codebooks, soft-prompts, or parameter perturbations; prior hidden-state analyses were correlational rather than causal.Source: §4 · p. 9
In-Context Learning
- Unlike studies of externally observable ICL behavior, this work focuses on mechanisms within transformers.Related work examines prompt forms, inference-time metalearning, Bayesian task inference, and robustness under scaling.Source: §4 · p. 9
Mechanisms of task performance in LMs
- Across diverse tasks, the authors measure causal mediators to identify a generic function-invocation mechanism that distinguishes tasks.This relates to analyses of ICL execution, false statements, activation steering, label-token salience, task-correlated neurons, and middle-layer task processing.Source: §4 · p. 9
Mechanistic Interpretability
- The study builds on mechanistic-interpretability work on in-context copying and uses causal mediation analysis and the logit lens to examine function vectors.The cited foundations include Pearl (2001), Vig et al. (2020), Meng et al. (2022), Wang et al. (2022a), Geva et al. (2023), and Nostalgebraist (2020).Source: §4 · p. 9
Analyzing the Attention Mechanism
- Rather than analyzing only where attention points, the paper investigates what information attention heads transport during ICL.Prior attention-weight studies linked weights to linguistic structures, while other work argued that attention weights alone do not fully explain outputs.Source: §4 · p. 9
5 DISCUSSION
The discussion concludes that function vectors provide a simple, robust mechanism for representing tasks within transformer LLM hidden states, while clarifying only one level of ICL mediation.
5 DISCUSSION
- Function vectors represent diverse tasks through a simple mechanism common across transformer LLMs and robust to context shifts.They can be extracted from a small, fixed set of easily identified attention heads and represent tasks analogously to word vectors (Mikolov et al., 2013).Source: §5 · p. 9
- FVs clarify one level of in-context-learning mediation but do not yet fully explain how ICL works.The discussion presents them as a path toward future research on function execution within LLMs, while noting they are distinct from word vectors (Appendix A).Source: §5 · p. 9
ETHICS
The work aims to make large language models more transparent, auditable, understandable, and controllable, but warns that this transparency could also facilitate abuse.
ETHICS
- Greater transparency may help audit, understand, and control large language models, yet could enable bad actors to inject or amplify functions causing undesirable behavior.The authors frame this as a dual-use risk of clarifying function representation and execution mechanisms.Source: ETHICS · p. 10
A DISCUSSION: FUNCTION VECTORS VS SEMANTIC VECTOR ARITHMETIC … B.2 ADDING FUNCTION VECTORS TO A LAYER
The evidence distinguishes function vectors from semantic embedding offsets: they trigger nonlinear, cyclic, task-level behavior and contain information beyond output vocabularies. The appendices formalize additive attention outputs and define layer intervention by adding function vectors in the residual stream.
A DISCUSSION: FUNCTION VECTORS VS SEMANTIC VECTOR ARITHMETIC
- A constant antonym function vector produces cyclic behavior, although no constant semantic offset can implement a cyclic mapping.The contradiction arises because an offset mapping antonyms in both directions would require the same vector to equal both opposing differences.Source: A DISCUSSION: FUNCTION VECTORS VS… · p. 16
- Matching a function vector’s output vocabulary does not recover its performance, showing that essential task information lies beyond the words it promotes.Reconstructions matching the top 100 words perform poorly, while full-vocabulary reconstructions recover only a fraction of performance in some cases.Source: A DISCUSSION: FUNCTION VECTORS VS… · pp. 16–17
- Function-vector causal effects are strongest at early and middle layers but fall near zero at late layers, indicating mediation by nonlinear middle-layer computations.The late-layer collapse contrasts with the layer-independent behavior expected from a linear word-embedding offset.Source: A DISCUSSION: FUNCTION VECTORS VS… · pp. 16–17
- Function vectors trigger nonlinear execution of abstract functions rather than acting as simple word-embedding offsets or vocabulary-based probability adjustments.This conclusion follows from cyclic-task behavior, irreducible information beyond output vocabularies, and near-zero effects at late layers.Source: A DISCUSSION: FUNCTION VECTORS VS… · p. 17
B.1 EXPRESSING ATTENTION aℓj IN THE RESIDUAL STREAM SPACE
- The appendix rewrites each attention head’s output directly in the residual stream, relating the notation to the transformer formulation of Vaswani et al. (2017) and Elhage et al. (2021).Each head initially occupies a lower-dimensional space, but its output is projected into the shared residual space.Source: §B.1 · p. 18
B ATTENTION OUTPUTS ARE INDEPENDENT AND ADDITIVE
- Attention outputs are independently additive in the residual-stream space, making individual head contributions directly inspectable.The formulation is computationally equivalent to concatenated multihead attention while exposing each head’s contribution separately.Source: §B.1 · p. 18
B.2 ADDING FUNCTION VECTORS TO A LAYER
- Function vectors are averaged attention-head outputs in a shared residual space, enabling them to be added to a transformer hidden state at a chosen layer.The recursive residual structure supports collecting, averaging, and summing outputs across nearby layers; the intervention targets the final-token hidden state.Source: §B.2 · p. 18
C EXPERIMENTAL DETAILS
The experiments extract function vectors by summing task-conditioned mean outputs from causally identified attention heads, then evaluate them through hidden-state interventions. GPT-J typically uses 10 heads, with evaluation centered around one-third-depth layers and varied prompt contexts.
Function Vector Extraction
- Function vectors are computed by summing the task-conditioned mean activations of selected attention heads over prompts from the target task.The causal heads are ranked by average indirect effect, using 100 clean 10-shot prompts for extraction.Source: C EXPERIMENTAL DETAILS · p. 19
- Average indirect effects are computed from 25 corrupted 10-shot prompts per task, including only 18 GPT-J tasks whose 10-shot ICL accuracy exceeds majority-label performance.This selection restricts head identification to tasks the model can successfully perform through ICL.Source: C EXPERIMENTAL DETAILS · p. 19
- GPT-J performance begins plateauing around 10 causal attention heads for most tasks, so the experiments use |A| = 10.The plateau is shown across 18 tasks, although some tasks improve with additional heads.Source: Figure 6 · p. 19, C EXPERIMENTAL DETAILS · p. 19
Evaluating Function Vectors
- Evaluation adds the function vector to a layer’s last-token hidden state and measures top-1 accuracy against the expected answer, targeting the first token when answers contain multiple tokens.Unless otherwise stated, vectors are added at approximately one-third network depth: layers 9, 15, 11, 14, and 26 for GPT-J, GPT-NeoX, and Llama 2 models respectively.Source: C EXPERIMENTAL DETAILS · pp. 19–20
Prompt Templates
- Function vectors extracted with the default Q/A template are tested across shuffled-label, zero-shot, and other prompt templates.Shuffled-label prompts retain ten corrupted demonstrations, whereas zero-shot prompts contain only the query and answer cue; template generalization is summarized in Table 8.Source: C EXPERIMENTAL DETAILS · p. 20, Table 8 · p. 20
D RESULTS INCLUDING INCORRECT ICL … F PORTABILITY
Across incorrect-ICL cases, datasets, extractive and few-shot evaluations, additional tasks, and natural-text settings, function vectors remain effective across varied task types, models, layers, and contexts. The results show broadly stable causal effects, especially when FVs are added in early-middle layers, while documenting task and model exceptions.
D RESULTS INCLUDING INCORRECT ICL
- Without filtering for correct 10-shot ICL answers, function-vector causal effects remain essentially unchanged, with only slight performance drops on a few tasks.Figure 7 compares filtered and unfiltered GPT-J zero-shot results; both settings show very similar performance.Source: D RESULTS INCLUDING INCORRECT ICL · p. 21, Figure 7 · p. 21
E DATASETS
- The evaluation suite combines sourced NLP tasks, including antonym, synonym, translation, sentiment, CommonsenseQA, and AG News, with constructed transformations and knowledge-relation tasks.Constructed tasks include capitalization, lowercasing, country-capital, country-currency, national parks, tense conversion, landmark and person relations, product-company, and next/previous-item mappings.Source: E DATASETS · p. 22
E.1 EXTRACTIVE TASKS.
- Extractive evaluations test retrieval from CoNLL-2003 named-entity sentences and list-selection tasks, with filtering used to reduce ambiguity and controlled list sizes of 3 or 5.The extractive suite includes person, location, and organization NER, choosing indexed list items, and choosing category-matching items.Source: §E.1 · pp. 23–24
E.2 FEW-SHOT ICL PERFORMANCE
- Few-shot GPT-J performance generally improves with more demonstrations on both abstractive and extractive tasks, although gains often plateau and some tasks remain at random-level performance.Baselines use majority-label accuracy for most tasks and 1/list-size accuracy for list-based extractive tasks.Source: Figure 8 · p. 25, §E.2 · p. 25, Figure 9 · p. 26
E.3 EVALUATING FUNCTION VECTORS ON ADDITIONAL TASKS
- Across additional GPT-J tasks, adding FVs generally has the strongest zero-shot effect in early-middle layers, while several tasks show little effect or cannot be evaluated reliably after poor ICL performance.Exceptions include lowercase first letter, person-sport, synonym, and sentiment; extractive tasks also show frequent middle-layer peaks and improved entity extraction over the zero-shot base model.Source: Figure 12 · p. 29, Figure 13 · p. 30
- On Llama 2, FVs improve abstractive and extractive zero-shot task performance most at earlier or early-middle layers, followed by performance dips at later layers, including around layer 20–25 for 13B and after layer 48 for 70B.The same layer-dependent pattern appears across both abstractive and extractive task collections.Source: Figure 14 · p. 31, Figure 15 · p. 32, Figure 16 · p. 33
F PORTABILITY
- Portability evaluations extend FV testing to natural-text completions using qualitative examples and quantitative results averaged over 5 seeds for capitalization, tense, number, translation, and country-capital tasks.Accuracy is measured by whether the target output appears within 5 generated tokens for most tasks, within 10 tokens for country-capital, and within 5 tokens for English-French.Source: F PORTABILITY · p. 35, Table 12 · p. 36, Table 15 · p. 38
G CAUSAL MEDIATION ANALYSIS
Causal mediation analysis finds that attention heads with the strongest average indirect effects (AIE) are generally concentrated in middle layers across models and tasks. The peak AIE decreases slightly with model size, while GPT-NeoX places its strongest heads in earlier middle layers.
Task-specific causal effects
- In GPT-J, the set of heads with higher causal effect is fairly consistent across tasks.Figure 18 reports task-split AIE values for attention heads.Source: Figure 18 · p. 40, G CAUSAL MEDIATION ANALYSIS · p. 40
Cross-model causal effects
- ≈0.047 maximum AIE in Llama 2 (7B) versus ≈0.037 in Llama 2 (70B), indicating a slight decline as model size increases despite more attention heads.AIE is computed across abstractive tasks that outperform the majority-label baseline with 10 ICL examples.Source: G CAUSAL MEDIATION ANALYSIS · p. 40, Figure 19 · p. 41
- The highest-AIE heads are typically clustered in middle layers across Llama 2, GPT-J, and related evaluated models.In Llama 2 (7B), the strongest heads have ≈0.047 AIE compared with ≈0.053 in GPT-J, while Llama 2 has more than twice as many attention heads.Source: G CAUSAL MEDIATION ANALYSIS · p. 40, Figure 18 · p. 40, Figure 19 · p. 41
- GPT-NeoX differs by concentrating its highest-AIE heads in earlier middle layers, specifically layers 10–20.Other models place their strongest heads more toward the network’s middle.Source: G CAUSAL MEDIATION ANALYSIS · p. 40, Figure 21 · p. 42
H ATTENTION PATTERNS AND PREFIX-MATCHING SCORE … K COMPOSITION ON OTHER MODELS
Across tasks and model sizes, function-vector mechanisms are associated with output-focused attention, partly overlap with induction heads, and generally work best in early-to-middle layers. Additional evaluations show that FVs often encode output spaces, while composition results extend to larger Llama 2 models.
H ATTENTION PATTERNS AND PREFIX-MATCHING SCORE
- Across four additional GPT-J tasks, high-causal-effect heads attend most strongly to the output tokens of each in-context exemplar.This attention pattern matches the main-paper observations and resembles the behavior expected of induction heads.Source: H ATTENTION PATTERNS AND… · p. 43, Figure 23 · p. 43, Figure 24 · p. 43
- Three top-AIE GPT-J heads—8-1, 12-10, and 24-6—also have high prefix-matching scores of 0.49, 0.56, and 0.31, respectively.Prefix matching is measured as attention to token B in repeated-token sequences of the form [A, B, ..., A].Source: H ATTENTION PATTERNS AND… · pp. 43–44, Figure 25 · p. 44
- Induction heads contribute to resolving few-shot ICL prompts, but other high-causal-effect heads share the ICL attention pattern without showing induction behavior on repeated random-token sequences.Thus, function-vector formation involves induction heads alongside additional relevant heads.Source: H ATTENTION PATTERNS AND… · p. 44
I DECODING VOCABULARY EVALUATION
- Across additional datasets, decoded FVs frequently encode task output spaces, especially for rigid-pattern sentiment, whereas translation output spaces are not well encoded.The accompanying evaluation reports the top five vocabulary tokens decoded from additional-task FVs.Source: I DECODING VOCABULARY EVALUATION · p. 45, Table 19 · p. 45
J SCALING EFFECTS
- Across Llama 2 models from 7B to 70B parameters, FVs generally produce the highest zero-shot accuracies when added to early-to-middle layers.This layer preference remains consistent regardless of the model’s total number of layers.Source: J SCALING EFFECTS · p. 46, Figure 26 · p. 46
K COMPOSITION ON OTHER MODELS
- Additional composition results are reported for Llama 2 13B and 70B models, including ICL, calculated FV v_BD zero-shot interventions, and vector-composed v* accuracies.Tables 20 and 21 cover these composition evaluations, with Table 20 addressing list-oriented tasks on Llama 2 13B and Table 21 identifying Llama 2 70B.Source: K COMPOSITION ON OTHER MODELS · p. 47, Table 20 · p. 47, Table 21 · p. 47
L EVALUATING FUNCTION VECTORS ON CYCLIC TASKS
Function vectors significantly improve zero-shot performance on next-item and previous-item cyclic tasks, with peak effects in early-middle layers. Their ability to induce boundary-case cyclic behavior supports interpreting FVs as triggers of nontrivial functions rather than simple semantic offsets.
Task construction
- The next-item and previous-item tasks reverse the direction of heterogeneous sequential pairs, spanning cyclic types such as days and months and non-cyclic types such as numbers.A previous-item prompt can require answering August after September, illustrating the reversed relation.Source: L EVALUATING FUNCTION VECTORS ON… · p. 48
In-context performance
- With 10 in-context examples, GPT-J and Llama 2 models perform both tasks fairly well, with next-item accuracy generally exceeding previous-item accuracy and improving with more examples.The reported comparison covers GPT-J and all models in the Llama 2 family.Source: Figure 28 · p. 48, L EVALUATING FUNCTION VECTORS ON… · p. 49
Zero-shot evaluation
- Function vectors significantly improve zero-shot accuracy on both cyclic tasks, peaking in early-middle layers before sharply declining about two-thirds through the network.This pattern generally matches previously reported results on cyclic and non-cyclic tasks.Source: L EVALUATING FUNCTION VECTORS ON… · p. 49, Figure 29 · p. 49
Boundary-case behavior
- Adding next-item or previous-item function vectors enables GPT-J to induce the corresponding cyclic behavior on boundary cases, whereas the base model usually copies the query.Examples include correctly producing cyclic successors or predecessors when the input lies at a sequence boundary.Source: Table 22 · p. 49, L EVALUATING FUNCTION VECTORS ON… · p. 49
Interpretation
- Because repeated function-vector additions can produce longer cyclic returns, these results provide evidence that FVs trigger nontrivial functions rather than implementing simple word-vector offsets.For a cycle of length 7, applying an offset seven times is expected to return to the starting item.Source: L EVALUATING FUNCTION VECTORS ON… · pp. 48–49
M AN ALTERNATIVE EVALUATION OF FUNCTION VECTORS · N INVESTIGATING FUNCTION VECTOR EFFECTS IN VOCABULARY SPACE
Across GPT-J tasks, distributing function-vector components across their original layers usually matches concentrated FV interventions, while vocabulary-space analysis shows FVs promote query-specific plausible answers rather than generic output tokens. These effects remain visible beyond top-1 accuracy, including when the model’s predicted answer is incorrect.
M AN ALTERNATIVE EVALUATION OF FUNCTION VECTORS
- The alternative intervention adds each task-conditioned head activation to its corresponding layer, unlike an FV, which sums these components and adds them to one hidden state.The update is applied at every layer represented by the selected attention heads.Source: M AN ALTERNATIVE EVALUATION OF… · p. 50
- Across six GPT-J tasks, the alternative intervention matches FV performance on most zero-shot tasks and all shuffled-label tasks, but misses English-French and exceeds FV on Present-Past.The comparison appears in Figure 30 for both settings.Source: Figure 30 · p. 50, M AN ALTERNATIVE EVALUATION OF… · p. 50
- The alternative approach typically reaches the same peak performance as FVs, but cannot reveal the performance dropoff occurring around two-thirds through the network.This limitation follows because the alternative distributes activations across the implicated layers rather than concentrating them at one layer.Source: M AN ALTERNATIVE EVALUATION OF… · p. 50
N INVESTIGATING FUNCTION VECTOR EFFECTS IN VOCABULARY SPACE
- Vocabulary-space analysis measures how adding an FV at layer ℓ changes token log probabilities relative to the baseline, testing whether effects reflect encoded or query-promoted words.The analysis examines tokens with the largest increase in log probability for Country-Capital, Antonym, and English-French tasks.Source: N INVESTIGATING FUNCTION VECTOR… · p. 51
- Table 23 shows that FV intervention promotes query-specific candidate answers with much larger Δlogprob than tokens decoded directly from the FV, rather than generic output-space words.For South Africa, the FV promotes Pretoria and other South African cities; for antonyms, it promotes valid antonyms of the queried word.Source: Table 23 · p. 51, N INVESTIGATING FUNCTION VECTOR… · p. 51
- For English-French, FV effects still promote valid translations such as ‘loup’ and ‘annonce’ prefixes even when top-1 output is incorrect or differs from the dataset target.The ‘wolf’ query is answered incorrectly, but ‘loup’ remains promoted; ‘advertisement’ also promotes ‘ann’ and ‘annon’ for ‘annonce’.Source: N INVESTIGATING FUNCTION VECTOR… · p. 51, Table 23 · p. 51
- Overall, FVs exert strong causal effects that top-1 accuracy can miss, promoting plausible answers for each query instead of merely boosting words from the task’s output space.This conclusion is supported across the examined Country-Capital, Antonym, and English-French behaviors.Source: Table 23 · p. 51, N INVESTIGATING FUNCTION VECTOR… · p. 52
Related papers
This paper cites
- Attention Is All You Need2017
- Language Models are Few-Shot Learners2020
- Distributed Representations of Words and Phrases and their Compositionality2013
- Editing Models with Task Arithmetic2022
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?2022
- Transformer Feed-Forward Layers Are Key-Value Memories2020
Cited by
- Causal Localization of Evidence Effects in Transformers2026
- How Depth Growth and Looping Shape In-Context Learning in Language Models2026
- Watch and Learn: Teaching Visual In-Context Learning by Removing Textual Shortcuts2026
- Visual Grounding First, Multimodal In-context Learning Follows2026
- Augment the Cache, Replace the Activation: A 2x2 Study of Internal-State Sharing2026
- Learning to Read Out: Unembedding Dynamics in Language Model Pretraining2026