Skip to main content
archive Search
Submit Donate Log in

Press Enter to search · Advanced search

Computer Science > Computation and Language

arXiv:2310.15213 (cs)
[Submitted on 23 Oct 2023 (v1), last revised 25 Feb 2024 (this version, v2)]

Title:Function Vectors in Large Language Models

Authors:Eric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller, Byron C. Wallace, David Bau
View a PDF of the paper titled Function Vectors in Large Language Models, by Eric Todd and 5 other authors
View PDF HTML (experimental)
Abstract: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 this https URL.
Comments: ICLR 2024. 52 pages, 30 figures, 23 tables. Code and data at this https URL
Subjects: Computation and Language (cs.CL); Machine Learning (cs.LG)
Cite as: arXiv:2310.15213 [cs.CL]
  (or arXiv:2310.15213v2 [cs.CL] for this version)
  https://doi.org/10.48550/arXiv.2310.15213
arXiv-issued DOI via DataCite

Submission history

From: Eric Todd [view email]
[v1] Mon, 23 Oct 2023 17:55:24 UTC (1,407 KB)
[v2] Sun, 25 Feb 2024 18:32:18 UTC (1,716 KB)
Full-text links:

Access Paper:

    View a PDF of the paper titled Function Vectors in Large Language Models, by Eric Todd and 5 other authors
  • View PDF
  • HTML (experimental)
  • TeX Source
view license

Additional Features

  • Audio Summary

Current browse context:

cs.CL
< prev   |   next >
new | recent | 2023-10
Change to browse by:
cs
cs.LG

References & Citations

  • SciX
  • Google Scholar
  • Semantic Scholar
Loading...

BibTeX formatted citation

Data provided by:

Bookmark

BibSonomy Reddit

Bibliographic and Citation Tools

Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)

Code, Data and Media Associated with this Article

alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
ScienceCast (What is ScienceCast?)

Demos

Replicate (What is Replicate?)
Hugging Face Spaces (What is Spaces?)
TXYZ.AI (What is TXYZ.AI?)

Recommenders and Search Tools

Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)
  • Author
  • Venue
  • Institution
  • Topic

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?)
We gratefully acknowledge support from our major funders, member institutions, , and all contributors.
About · Help · Contact · Subscribe · Copyright · Privacy · Accessibility · Operational Status (opens in new tab)