The Reasoning-Memorization Interplay in Language Models Is Mediated by a Single Direction

Yihuai Hong, Dian Zhou, Meng Cao, Lei Yu, Zhijing Jin · DOI

Introduction

Large language models (LLMs) often appear to possess remarkable logic, yet they frequently stumble when familiar problems are slightly modified. This "generalization gap" suggests that models may act as "reasoning parrots," relying on memorized patterns rather than genuine logical deduction. This paper investigates the internal mechanisms governing this behavior, discovering a single linear direction in an LLM's activation space—the Linear Reasoning Feature (LiReF)—that mediates the choice between memorization and reasoning.

Identifying the Reasoning Toggle

The researchers utilized mechanistic interpretability to isolate the LiReF. By comparing internal activations (the residual stream of the last token) from reasoning-intensive prompts (e.g., complex mathematics) against memory-intensive prompts (e.g., factual recall), they identified a specific vector using a difference-in-means approach.

Conceptual overview of Linear Reasoning Features (LiReFs) acting as a toggle between memory and reasoning modes.

This LiReF acts as a causal switch. By adding or subtracting this vector from the model's hidden states during inference, the authors could steer the model toward a "thinking mode" or a "memory mode" without altering the model's weights.

The Reasoning-Memory Spectrum

A key finding is that reasoning and memorization are not discrete modules but exist on a continuous spectrum. Tasks requiring both—such as coding (MBPP, HumanEval)—naturally cluster between the extremes of pure factual recall (PopQA) and abstract reasoning (GSM8k).

Projection of hidden states onto the reasoning-memory boundary across four model families, showing distinct clustering of task types.

This linear relationship is remarkably consistent across different model families (LLaMA3, Gemma2, Mistral, OLMo2) and persists across languages. Furthermore, the consistency between base models and instruction-tuned variants suggests that the capacity for reasoning emerges during the initial pre-training phase.

Performance and Generalization

Intervening on the LiReF direction yielded significant performance gains. For instance, Gemma2-9B saw a 15.5% accuracy increase on reasoning tasks within the MMLU-Pro benchmark.

Crucially, the LiReF appears to control genuine reasoning. When the feature was suppressed, performance on GSM-Symbolic (a variant of math problems designed to thwart memorization) dropped much more sharply than on the standard GSM8k. This indicates that the LiReF specifically mediates the model's ability to generalize beyond its training data. Additionally, the researchers found that many common errors occur when a model "misapplies" a mode—such as attempting to reason through a simple fact or relying on memory for a logic puzzle. Shifting the LiReF to the correct subspace corrected these errors in 21% of tested cases.

Conclusion and Future Directions

The discovery of a single linear direction governing the reasoning-memorization trade-off provides a powerful tool for understanding and improving LLM reliability. While this study focused on models up to 9B parameters, future work will explore whether these dynamics scale to frontier models and how they interact with explicit prompting strategies like Chain-of-Thought. Understanding these internal "switches" is a vital step toward building models that reason robustly rather than simply reciting.

Summary updated

BibTeX
@inproceedings{hong2025reasoning,
  author = {Yihuai Hong and Dian Zhou and Meng Cao and Lei Yu and Zhijing Jin},
  title = {{The Reasoning-Memorization Interplay in Language Models Is Mediated by a Single Direction}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure