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.
Figures & tables
Figure 1: Illustration of how memory access is introduced on top of reduction rule in RCMEM
Figure 2: (a) Average number of tokens and (b) special tokens for the Knapsack problem training sets. Note the number of tokens and [CALL] (iterations) of PENCIL exceed RCMEM at N=7 and N=6 respectively.
Figure 3: (a) Average number of tokens and (b) special tokens for LCS problem training sets. The number of tokens and iterations are much larger on PENCIL.
Figure 5: Accuracy of PENCIL and RCMEM on Knapsack across 3 model sizes.
Figure 6: Average generation time for a sample at inference, on 256 and 512 context lengths.
Figure 7: Knapsack - Accuracy of 0.4M, 3.17M, 25.2M and GPT-2 on 25k, 50k, 75k and 100k training samples.
Figure 8: Accuracy and sample generation time of PENCIL and RCMEM on LCS tasks. The accuracy are broken down to accuracy per batch of training samples to understand how fast the models are trained.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
# of Item
No memory
Memory
Fix READ
Fix READ b.p.
Fix R&W b.p.
Accuracy
4
0.816
0.74
0.86
0.824
0.832
5
0.742
0.546
0.732
0.758
0.702
6
0.584
0.284
0.68
0.7
0.55
Memory Correct Rate
4
0.762
0.891
0.975
0.976
0.967
Appendix
Table 1: Knapsack - Average accuracy and actual memory correct rate on 0.4M model with 512 content length, with different memory handle methods. R&W - READ and WRITE, b.p. - bypass invalid memory access
Model Size 3.17M
Context 512
# items
CoT
PENCIL
RCMEM
4
0.776
0.984
0.988
5
0.354
0.984
0.976
6
0.222
0.976
0.974
7
0.086
0.956
0.956
Appendix
Table 2: Knapsack - Accuracy of 3.17M on CoT, PENCIL and RCMEM, with 512 and 256 context tokens.
PENCIL
RCMEM
Items
Acc
Time
Trace Rate
Acc
Time
Trace Rate
4
0.984
1.124
0.932
0.988
0.896
0.938
5
0.966
2.303
0.839
0.976
1.322
0.833
6
0.938
2.267
0.734
0.974
2.438
0.670
7
0.844
3.296
0.587
0.956
2.980
0.578
8
0.794
4.238
0.550
0.956
5.986
0.462
Appendix
Table 3: Knapsack - Accuracy, time (in seconds) and trace rate of PENCIL and RCMEM, trained on the same RCMEM data.
Table 4: Pseudocode of generating training traces for Knapsack problem
Long-context reasoning is essential for complex and long-horizon tasks, yet the performance of large language models (LLMs) degrades as context length increases. Recent approaches address this by processing input chunk by chunk while maintaining a bounded textual memory in model context. However, premature information compression can discard critical details essential for subsequent reasoning. In this paper, we introduce Commit-on-Evidence Memory (CoEM), which learns when to convert source evidence into compact memory facts. Specifically, under a fixed context-memory budget, CoEM preserves potentially useful source excerpts verbatim in a pending set, allowing subsequent context to clarify their relevance before irreversible compression. As new context arrives, a learned policy revisits each pending excerpt and decides whether to promote it to the committed memory, retain it for further consideration, or discard it. A frozen verifier ensures proposed facts are accepted only if supported by retained excerpts and current context. To further guide effective memory management, we train this policy using reinforcement learning by combining fine-grained, step-level evidence rewards with final answer rewards. Extensive experiments demonstrate that CoEM consistently improves long-context reasoning. When evaluated on 6,400 documents long-context input, CoEM outperforms the strongest memory baseline by 10.4-11.4 F1 points on Qwen3.5-9B. Code repository: https://github.com/benmagnifico/CoEM.
Jingguang Li, Yebo Wu, Zuyi Guo +7
Korea Advanced Institute of Science & Technology · University of Macau · Massachusetts Institute of Technology
Reasoning models think in long, unstructured streams with no mechanism for compressing or organizing their own intermediate state. We introduce MEMENTO: a method that teaches models to segment reasoning into blocks, compress each block into a memento, i.e., a dense state summary, and reason forward by attending only to mementos, reducing context, KV cache, and compute. To train MEMENTO models, we release OpenMementos, a public dataset of 228K reasoning traces derived from OpenThoughts-v3, segmented and annotated with intermediate summaries. We show that a two-stage SFT recipe on OpenMementos is effective across different model families (Qwen3, Phi-4, Olmo 3) and scales (8B--32B parameters). Trained models maintain strong accuracy on math, science, and coding benchmarks while achieving ∼2.5× peak KV cache reduction. We extend vLLM to support our inference method, achieving ∼1.75× throughput improvement while also enabling us to perform RL and further improve accuracy. Finally, we identify a dual information stream: information from each reasoning block is carried both by the memento text and by the corresponding KV states, which retain implicit information from the original block. Removing this channel drops accuracy by 15,pp on AIME24.
Test-time scaling has emerged as an effective way to improve language models on challenging reasoning tasks. However, most existing methods treat each problem in isolation and do not systematically reuse knowledge from prior reasoning trajectories. In particular, they underutilize procedural knowledge: how to reframe a problem, choose an approach, and verify or backtrack when needed. We introduce Reasoning Memory, a retrieval-augmented generation (RAG) framework for reasoning models that explicitly retrieves and reuses procedural knowledge at scale. Starting from existing corpora of step-by-step reasoning trajectories, we decompose each trajectory into self-contained subquestion-subroutine pairs, yielding a datastore of 32 million compact procedural knowledge entries. At inference time, a lightweight in-thought prompt lets the model verbalize the core subquestion, retrieve relevant subroutines within its reasoning trace, and reason under diverse retrieved subroutines as implicit procedural priors. Across six math, science, and coding benchmarks, Reasoning Memory consistently outperforms RAG with document, trajectory, and template knowledge, as well as a compute-matched test-time scaling baseline. With a higher inference budget, averaged across models and tasks, it improves over no retrieval by 19.5% and over the compute-matched baseline by 8.9%. Ablation studies show that these gains come from two key factors: the broad procedural coverage of the source trajectories and our decomposition and retrieval design, which together enable effective extraction and reuse of procedural knowledge. Our experiment code is available at https://github.com/facebookresearch/reasoning-memory.