Language Models Encode the Value of Numbers Linearly
Fangwei Zhu, Damai Dai, Zhifang Sui

TL;DR
This paper demonstrates that large language models encode numerical values linearly within their hidden states, enabling extraction and manipulation of numeric information through simple linear probes and vector operations.
Contribution
The study reveals that LLMs encode number values linearly, providing a new understanding of their internal numeric representations and potential for improved numeric reasoning.
Findings
Number values can be linearly extracted from LLM hidden states.
LLMs store calculation results in a similar linear manner.
Vector operations can intervene and alter LLM outputs based on encoded numbers.
Abstract
Large language models (LLMs) have exhibited impressive competence in various tasks, but their internal mechanisms on mathematical problems are still under-explored. In this paper, we study a fundamental question: how language models encode the value of numbers, a basic element in math. To study the question, we construct a synthetic dataset comprising addition problems and utilize linear probes to read out input numbers from the hidden states. Experimental results support the existence of encoded number values in LLMs on different layers, and these values can be extracted via linear probes. Further experiments show that LLMs store their calculation results in a similar manner, and we can intervene the output via simple vector additions, proving the causal connection between encoded numbers and language model outputs. Our research provides evidence that LLMs encode the value of numbers…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Topic Modeling · Text Readability and Simplification
