arXiv:2610.24187cs.CLOct 2026

Manuscript Offprint

arXiv:2610.24187

Reasoning with Context Management and External Memory

Man-Ling Sung, William Hartmann, Jiangying Zhou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Reasoning models maintain information about the status of their reasoning process through in-context memory. Complex problems require larger context windows and memory requirements. In this scenario, context management without caching risks discarding useful information for reasoning. We propose RCMEM, an approach that extends context management with an external memory to maintain additional information without burdening the reasoning model with additional context. RCMEM significantly reduces computation time on problems that require repeated computation of intermediate steps, while achieving better performance on complex problems. We demonstrate our approach on a few mathematics problems using model sizes ranging from 0.4 to 25 million parameters, and GPT-2.

1 Introduction

Current work in reasoning models arose from Chain-of-Thought (CoT) style approaches (Wei et al., 2022; Zhang et al., 2024). By iteratively appending generated output to the context, a reasoning model can work through the steps to solve the problem. A limitation of this approach is that the required memory grows linearly with the computation. Longer context windows also come with attention limitations in terms of both efficiency (Keles et al., 2023) and accuracy (Liu et al., 2023). More sophisticated approaches use an agentic paradigm where information is passed between different models and tools (Lei et al., 2026). Even with agentic approaches, it still remains a challenge to determine how much information to retain in the contextual memory of any one model.

Context memory management has recently become a topic of interest for LLMs (Yan et al., 2025; Yang et al., 2025; Lu et al., 2025). As an LLM reasons by adding additional information to the context window, it will eventually run out of memory. At that point information begins to be removed from the context based on age, that can cause important information, e.g., instructions, to no longer be available and lead to catastrophic failures in the reasoning process. Approaches to contextual memory management address the problem by proactively compress, summarize, and remove information in the context before memory issues arise.

A major limitation in contextual memory management alone is that the information disappears after summarization. This presents two key challenges. The first is in the case of a mistake or contradiction. If the model reaches a faulty conclusion, it is impossible to backtrack its reasoning process to discover and recover from the issue. The second case is related to repeated subproblems. In order to solve some complex problems, it is required to solve subproblems multiple times (e.g., the recursive solution to the Fibonacci sequence). The worst-case time complexity without caching those intermediate solutions could increase exponentially. To overcome these problems, recent works extend contextual memory management with external memory, providing theoretical proofs and applications to reinforcement learning.

We specifically address the challenge of repeated computation of subproblems by extending contextual memory management with an external memory to supervised training. Starting from the PENCIL proposed by Yang et al. (2025) that applies reduction rules on the reasoning traces, we introduce special tokens that allow the model to read and write to an external memory. Our contributions are as follows: (1) We introduce RCMEM that integrates context management and external memory with reduction rules. (2) We show that the computation required for a model with external memory scales significantly slower for problems that require repeated computation. (3) We verify our model's performance experimentally on several mathematical problems on supervised and fine-tuned models.