about
Language Models Use Trigonometry to Do Addition (arxiv.org)
1 point by fofoz on Feb 4, 2025 | hide | past | pdf | 3 comments on HN

In plain words: Inside three language models, each number is stored as a spiral, and addition works like clock hands: the two spirals are twisted into the answer's spiral, which the model reads out. Altering those spirals confirmed this, the first complete account of how a model adds.

Abstract

Mathematical reasoning is an increasingly important indicator of large language model (LLM) capabilities, yet we lack understanding of how LLMs process even simple mathematical tasks. To address this, we reverse engineer how three mid-sized LLMs compute addition. We first discover that numbers are represented in these LLMs as a generalized helix, which is strongly causally implicated for the tasks of addition and subtraction, and is also causally relevant for integer division, multiplication, and modular arithmetic. We then propose that LLMs compute addition by manipulating this generalized helix using the "Clock" algorithm: to solve $a+b$, the helices for $a$ and $b$ are manipulated to produce the $a+b$ answer helix which is then read out to model logits. We model influential MLP outputs, attention head outputs, and even individual neuron preactivations with these helices and verify our understanding with causal interventions. By demonstrating that LLMs represent numbers on a helix and manipulate this helix to perform addition, we present the first representation-level explanation of an LLM's mathematical capability.

Subhash Kantamneni, Max Tegmark
arXiv:2502.00873 · cs.AI, cs.CL, cs.LG · submitted Feb 2, 2025
abstract · pdf · html

add comment on HN

Something is seriously wrong when the world easily accepts usage of AI but basic questions like “how does AI compute ‘1+2’” require this level of research…
Do we know how the human brain performs addition?

I know how it's taught. Internally it has aspects of long addition, and caching, but I don't do perform that algorithmically.

How then does that map to the physical structure of the brain? Do we know that?

You're correct but this isn't a good counterargument. We don't have the opportunity to change how human brains work, so we have to accept them as they are. That's not true of LLMs and there's no necessity that we deploy them immediately.