Targeted Retrieval, Compact Representations: How CoT Reasoning Improves Long-Context Counting
On the map: LLM reasoning → Prompting and chain-of-thought reasoning also fits: Reasoning benchmarks and evaluation
Abstract (arXiv)
Large language models (LLMs) have been rapidly improving in long-context tasks, powered by Chain-of-Thought (CoT) reasoning. However, the internal mechanisms underlying this improvement remain unclear. We investigate these mechanisms through a needle-in-a-haystack (NIAH) counting task, where an LLM is asked to count the number of records dispersed in a long text. Across twelve model comparison groups, Thinking (or reasoning) improves counting accuracy over Non-thinking, with pronounced gains at larger counts. This motivates our mechanistic analysis, which identifies two contrasting mechanisms: (i) broad retrieval, where Non-thinking models broadly attend to multiple needles; (ii) targeted retrieval, where Thinking models use enumeration in CoT traces to successively retrieve needles. Targeted retrieval concentrates attention on individual needles and is accompanied by more compact internal representations. Moreover, causal intervention analysis suggests that Thinking models use the CoT trace to maintain and update an internal counter as needles are successively retrieved, even without explicit numbering. In small controlled experiments, both retrieval mechanisms and counter states emerge under standard autoregressive training. Together, our results connect long-context retrieval with representation geometry of counting, supporting a state-tracking account of CoT reasoning.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Prompting and chain-of-thought reasoning, one of 17 directions in LLM reasoning. Builds on 18 of its 59 references that are in the map. First posted on arXiv 30 Sep 2026.
Builds on
18 of 59 references.
Closest ancestors · 1
Same direction, newest first
- 2026How Does Unfaithful Reasoning Emerge from Autoregressive Training? A Study of Synthetic Experiments1 Feb
Other references · 17
- 2025Qwen3 Technical Reportcited by 8,820
- 2020Scaling Laws for Neural Language Modelscited by 6,586
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,389
- 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,121
- 2023Steering Language Models With Activation Engineeringcited by 922
- 2026Gemma 4 Technical Reportcited by 259
- 2024How to use and interpret activation patchingcited by 214
- 2023The Hydra Effect: Emergent Self-repair in Language Model Computationscited by 156
- 2026Ministral 3cited by 114
- 2025NVIDIA Nemotron Nano 2: An Accurate and Efficient Hybrid Mamba-Transformer Reasoning Modelcited by 108
- 2025Language Models Use Trigonometry to Do Additioncited by 70
- 2025NVIDIA Nemotron 3: Efficient and Open Intelligencecited by 65
5 more
- 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steeringcited by 29
- 2026Symmetry in language statistics shapes the geometry of model representationscited by 24
- 2025Nemotron Elastic: Towards Efficient Many-in-One Reasoning LLMscited by 6
- 2026The Right Answer, the Wrong Direction: Why Transformers Fail at Counting and How to Fix Itcited by 1
- 2026Task Vector Geometry Underlies Dual Modes of Task Inference in Transformerscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Reasoning on Multiple Needles In A Haystack
- 2025Attention Reveals More Than Tokens: Training-Free Long-Context Reasoning with Attention-guided Retrieval
- 2025Beyond Isolated Capabilities: Bridging Long CoT Reasoning and Long-Context Understanding
- 2024NeedleBench: Evaluating LLM Retrieval and Reasoning Across Varying Information Densities
- 2026RecaLLM: Addressing the Lost-in-Thought Phenomenon with Explicit In-Context Retrieval
- 2024The Impact of Reasoning Step Length on Large Language Models
- 2025Reasoning or Retrieval? A Study of Answer Attribution on Large Reasoning Models
- 2025Early Stopping Chain-of-thoughts in Large Language Models