Algorithmic Primitives and Compositional Geometry of Reasoning in Language Models

📅 2025-10-13
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work investigates the interpretable computational mechanisms underlying multi-step reasoning in large language models (LLMs). Addressing the opacity and lack of structured modeling in LLM reasoning processes, we propose an “algorithmic primitives” framework: (1) identifying reasoning trajectories via neural activation clustering; (2) extracting task- and model-agnostic primitive vectors using function vector analysis; and (3) injecting these primitives into the residual stream to intervene in reasoning behavior. We find that primitives exhibit a compositional geometric structure in activation space, enabling combinatorial generalization under vector addition and subtraction. The framework is validated on TSP, 3SAT, AIME, and graph navigation tasks. Fine-tuned models deploy primitives more systematically, and primitive injection enables base models to emulate reasoning-augmented behavior. This study provides the first evidence of geometric logic and modular algorithmic structure underlying LLM reasoning.

Technology Category

Application Category

📝 Abstract
How do latent and inference time computations enable large language models (LLMs) to solve multi-step reasoning? We introduce a framework for tracing and steering algorithmic primitives that underlie model reasoning. Our approach links reasoning traces to internal activation patterns and evaluates algorithmic primitives by injecting them into residual streams and measuring their effect on reasoning steps and task performance. We consider four benchmarks: Traveling Salesperson Problem (TSP), 3SAT, AIME, and graph navigation. We operationalize primitives by clustering neural activations and labeling their matched reasoning traces. We then apply function vector methods to derive primitive vectors as reusable compositional building blocks of reasoning. Primitive vectors can be combined through addition, subtraction, and scalar operations, revealing a geometric logic in activation space. Cross-task and cross-model evaluations (Phi-4, Phi-4-Reasoning, Llama-3-8B) show both shared and task-specific primitives. Notably, comparing Phi-4 with its reasoning-finetuned variant highlights compositional generalization after finetuning: Phi-4-Reasoning exhibits more systematic use of verification and path-generation primitives. Injecting the associated primitive vectors in Phi-4-Base induces behavioral hallmarks associated with Phi-4-Reasoning. Together, these findings demonstrate that reasoning in LLMs may be supported by a compositional geometry of algorithmic primitives, that primitives transfer cross-task and cross-model, and that reasoning finetuning strengthens algorithmic generalization across domains.
Problem

Research questions and friction points this paper is trying to address.

Analyzing latent computations enabling multi-step reasoning in language models
Developing framework to trace and steer algorithmic primitives in reasoning
Investigating compositional geometry of reusable reasoning building blocks
Innovation

Methods, ideas, or system contributions that make the work stand out.

Clustering neural activations to identify reasoning primitives
Deriving reusable primitive vectors via function vector methods
Injecting primitive vectors to steer model reasoning behavior
🔎 Similar Papers
No similar papers found.
S
Samuel Lippl
Center for Theoretical Neuroscience, Columbia University, New York, USA
T
Thomas McGee
Department of Psychology, University of California Los Angeles, Los Angeles, USA
K
Kimberly Lopez
Harvey Mudd College
Ziwen Pan
Ziwen Pan
University of Arizona
Quantum information
P
Pierce Zhang
Rice University
S
Salma Ziadi
Mount Holyoke College
Oliver Eberle
Oliver Eberle
TU Berlin
Explainable AIInterpretabilityDeep LearningMachine LearningNLP
Ida Momennejad
Ida Momennejad
Microsoft Research
Reinforcement LearningMemory and Planningmulti-agent learninghippocampusPrefrontal Cortex