HackerPapers

arXiv:2502.00873cs.AI

Language Models Use Trigonometry to Do Addition

Subhash Kantamneni, Max Tegmark

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.

arXiv comments
Journal reference
DOI
Subjects
cs.AIArtificial Intelligence cs.CLComputation and Language cs.LGMachine Learning

On Hacker News

Linked by 6 identifiable commenters in 6 comments across 6 threads, from Feb 2025 to Oct 2026. Found in 1 HN submission from Feb 2025 to Feb 2025. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments6 threads

    • > So Jev does actually know which distributions are correct, it just fails to produce them Claims like this needs to be deeply analyized. Models do have some emergent capabilities[1], and I think there's a lot of evidence to show that semantics is actually learned (Word2Vec)…

      dvtView on HNParent context

    • > If you look at the field of mechanistic interpretability, compared to “GOFAI” like learned decision trees, an LLM is completely opaque. I think the field deserves more credit than that, there are plenty of interpretability tools like * natural language autoencoders for…

      strangecastsView on HNParent context

    • There have been multiple studies on how LLMs add numbers. They use the "Clock" algorithm, the "Pizza" algorithm, a few other ones. > All networks we study implement the same simple neuron model in their first-layer MLPs: degree-1 sinusoidal fits in layer 1, with deeper layers…

      dist-epochView on HNParent context

    • > The LLM can't describe it, it doesn't see inside itself, however, it has many textbooks in its training dataset, so it will grab an answer from these textbooks because that's how people answer. EDIT: I see now that you were referring to the answers it uses to justify the…

      EMIRELADEROView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.