All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Mamidanna, Siddarth, Rai, Daking, Yao, Ziyu, Zhou, Yilun
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866914032646094848
author Mamidanna, Siddarth
Rai, Daking
Yao, Ziyu
Zhou, Yilun
author_facet Mamidanna, Siddarth
Rai, Daking
Yao, Ziyu
Zhou, Yilun
contents Large language models (LLMs) demonstrate proficiency across numerous computational tasks, yet their inner workings remain unclear. In theory, the combination of causal self-attention and multilayer perceptron layers allows every token to access and compute information based on all preceding tokens. In practice, to what extent are such operations present? In this paper, on mental math tasks (i.e., direct math calculation via next-token prediction without explicit reasoning), we investigate this question in three steps: inhibiting input-specific token computations in the initial layers, restricting the routes of information transfer across token positions in the next few layers, and forcing all computation to happen at the last token in the remaining layers. With two proposed techniques, Context-Aware Mean Ablation (CAMA) and Attention-Based Peeking (ABP), we identify an All-for-One subgraph (AF1) with high accuracy on a wide variety of mental math tasks, where meaningful computation occurs very late (in terms of layer depth) and only at the last token, which receives information of other tokens in few specific middle layers. Experiments on a variety of models and arithmetic expressions show that this subgraph is sufficient and necessary for high model performance, transfers across different models, and works on a variety of input styles. Ablations on different CAMA and ABP alternatives reveal their unique advantages over other methods, which may be of independent interest.
format Preprint
id arxiv_https___arxiv_org_abs_2509_09650
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens
Mamidanna, Siddarth
Rai, Daking
Yao, Ziyu
Zhou, Yilun
Computation and Language
I.2.7
Large language models (LLMs) demonstrate proficiency across numerous computational tasks, yet their inner workings remain unclear. In theory, the combination of causal self-attention and multilayer perceptron layers allows every token to access and compute information based on all preceding tokens. In practice, to what extent are such operations present? In this paper, on mental math tasks (i.e., direct math calculation via next-token prediction without explicit reasoning), we investigate this question in three steps: inhibiting input-specific token computations in the initial layers, restricting the routes of information transfer across token positions in the next few layers, and forcing all computation to happen at the last token in the remaining layers. With two proposed techniques, Context-Aware Mean Ablation (CAMA) and Attention-Based Peeking (ABP), we identify an All-for-One subgraph (AF1) with high accuracy on a wide variety of mental math tasks, where meaningful computation occurs very late (in terms of layer depth) and only at the last token, which receives information of other tokens in few specific middle layers. Experiments on a variety of models and arithmetic expressions show that this subgraph is sufficient and necessary for high model performance, transfers across different models, and works on a variety of input styles. Ablations on different CAMA and ABP alternatives reveal their unique advantages over other methods, which may be of independent interest.
title All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens
topic Computation and Language
I.2.7
url https://arxiv.org/abs/2509.09650