Abstract
Large language models increasingly improve their reasoning at test time via additional computation, yet most procedures treat each problem in isolation. When problems arrive sequentially, accumulating reusable experience across them can further improve performance. Existing memory-based methods either store whole-solution templates that generalize poorly to novel problems or use heuristic step-level selection that is not optimized for final-answer correctness.
We propose MILES (Modular Instruction Memory with LEarnable Selection for self-improving LLM reasoning), a framework that dynamically expands step-wise memory and applies correctness-optimized memory composition under realistic test-time constraints. MILES maintains modular memory units consisting of asymmetric pairs of sub-goal embeddings and sub-instructions, each associated with a learnable selection head.
This memory structure enables a coarse-to-fine retrieval mechanism: the coarse level enables memory expansion and collects supervision for training selection heads from confident samples, while the fine stage applies learned selection heads to rerank coarse-level candidates and guide reasoning for uncertain samples. Experiments across six reasoning benchmarks demonstrate the effectiveness, robustness, and transferability of MILES.
Why MILES?
Existing test-time memory methods often retrieve whole solutions or rely on heuristic step-level selection. MILES turns memory reuse into learnable, step-wise composition.
Existing memory-based reasoning
✗ Whole-solution retrieval generalizes poorly to novel problems.
✗ Step-level selection is often based on similarity or prompting.
✗ Selection is not directly optimized for final-answer correctness.
MILES
✓ Modular step-wise memory.
✓ Learnable memory selection.
✓ Incremental memory expansion.
✓ Frozen LLM, without parameter updates.
Method Overview
A short animation illustrating how MILES incrementally constructs memory and applies learned memory selection during reasoning.
Method
MILES organizes reusable reasoning experience as modular instruction memory and applies a two-layer selection mechanism to guide uncertain reasoning cases.
1. Modular memory
The sub-goal embedding acts as a retrieval key, while the sub-instruction provides natural-language guidance for generation.
2. Coarse-to-fine selection
Layer 1: similarity-based retrieval expands memory and collects data.
Layer 2: learned selection heads rerank candidate memory units by applicability.
3. Self-improvement
Confident samples provide pseudo-supervision for memory expansion and selection-head learning, which later guides uncertain samples.
Main Results
MILES consistently matches or outperforms prior methods across six reasoning benchmarks and four frozen backbones.
| Dataset | Model | ZS-CoT | SC | DC | BoT | Ours |
|---|---|---|---|---|---|---|
| MATH-500 | GPT-4.1-mini | 88.00 | 89.40 | 87.00 | 86.80 | 92.60 |
| GPT-4.1 | 87.20 | 88.00 | 83.20 | 84.80 | 91.60 | |
| AIME 2024 | GPT-4.1-mini | 46.67 | 56.67 | 63.33 | 50.00 | 66.67 |
| GPT-4.1 | 40.00 | 50.00 | 53.33 | 50.00 | 53.33 | |
| GPT-OSS-20B | 83.33 | 93.33 | 43.33 | 50.00 | 93.33 | |
| Qwen3-30B-Instruct | 70.00 | 83.33 | 23.33 | 63.33 | 86.67 | |
| AIME 2025 | GPT-4.1-mini | 46.67 | 53.33 | 60.00 | 40.00 | 60.00 |
| GPT-4.1 | 33.33 | 36.67 | 50.00 | 33.33 | 40.00 | |
| GPT-OSS-20B | 86.67 | 90.00 | 36.67 | 33.33 | 93.33 | |
| Qwen3-30B-Instruct | 60.00 | 70.00 | 30.00 | 53.33 | 73.33 | |
| GPQA-Diamond | GPT-4.1-mini | 70.20 | 71.72 | 63.64 | 66.67 | 73.23 |
| GPT-4.1 | 68.94 | 68.69 | 64.65 | 61.11 | 70.71 | |
| GPT-OSS-20B | 68.18 | 71.72 | 61.62 | 37.37 | 74.24 | |
| Qwen3-30B-Instruct | 70.20 | 72.23 | 42.42 | 67.68 | 73.74 | |
| MMLU-Pro Physics | GPT-4.1-mini | 82.00 | 83.50 | 83.50 | 83.00 | 85.00 |
| GPT-4.1 | 81.00 | 83.00 | 78.00 | 84.00 | 84.50 | |
| GPT-OSS-20B | 85.50 | 86.50 | 79.00 | 42.00 | 87.00 | |
| Qwen3-30B-Instruct | 87.00 | 88.50 | 63.50 | 86.00 | 88.50 | |
| MMLU-Pro Engineering | GPT-4.1-mini | 65.50 | 73.50 | 67.50 | 70.50 | 75.00 |
| GPT-4.1 | 75.50 | 78.50 | 72.00 | 67.50 | 80.00 | |
| GPT-OSS-20B | 68.50 | 70.00 | 66.50 | 41.50 | 71.00 | |
| Qwen3-30B-Instruct | 74.50 | 78.00 | 52.00 | 75.50 | 81.00 |
Final-answer accuracy (%) on six reasoning benchmarks. Per-row best results are bolded.
Accuracy–Efficiency Tradeoff
MILES achieves a strong accuracy-token tradeoff compared with Self-Consistency, Tree-of-Thoughts, rStar, and DORA.
MILES dominates the frontier across evaluated token budgets while baselines flatten at higher budgets.
Transferability and Reuse
MILES memory can be reused across models and can also be pre-built from separate labeled training sets, showing that the learned memory captures transferable reasoning knowledge.
Cross-model transfer
Memory built from rollouts of an auxiliary model improves GPT-4.1-mini reasoning on AIME 2024 and AIME 2025.
| Dataset | Auxiliary model | Accuracy |
|---|---|---|
| AIME 2024 | no-auxiliary model | 60.00 |
| Qwen3-30B-Instruct | 66.67 | |
| Qwen3-4B-Instruct | 63.33 | |
| GPT-4.1-mini | 66.67 | |
| AIME 2025 | no-auxiliary model | 50.00 |
| Qwen3-30B-Instruct | 60.00 | |
| Qwen3-4B-Instruct | 56.67 | |
| GPT-4.1-mini | 60.00 |
Accuracy (%) with GPT-4.1-mini as the reasoning backbone. Top row in each block is the no-auxiliary baseline.
Pre-built memory
Memory pre-built on separate training sets improves the most uncertain test samples on AIME 2025 and GPQA-Diamond.
| Dataset | Auxiliary model | Accuracy |
|---|---|---|
| AIME 2025 | no memory | 23.08 |
| Qwen3-30B-Instruct | 30.77 | |
| GPT-4.1-mini | 38.46 | |
| GPQA-Diamond | no memory | 48.39 |
| Qwen3-30B-Instruct | 58.06 | |
| GPT-4.1-mini | 54.84 |
Accuracy (%) with GPT-4.1-mini as the reasoning backbone. Memory is pre-built from AIME 2020–2024 or non-Diamond GPQA.
Ablation and Selection Quality
Table 4 verifies the contribution of the two-layer memory selection mechanism, while Figure 3 further analyzes the relation between sub-instruction correctness and final-answer accuracy.
Table 4. Ablation Study
Incorporating the learned Layer 2 selection head consistently improves performance over retrieval-only or alternative reranking strategies.
| Dataset | Exp. | Layer 1 | Layer 2 | Accuracy |
|---|---|---|---|---|
| AIME 2024 | 1 | ✗ | ✗ | 60.00 |
| 2 | ✓ | ✗ | 63.33 | |
| 3 | ✗ | ✓ | 63.33 | |
| 4 | ✓ | ✓ | 66.67 | |
| 5 | ✓ | State sim. | 63.33 | |
| 6 | ✓ | LLM rerank | 60.00 | |
| AIME 2025 | 1 | ✗ | ✗ | 53.33 |
| 2 | ✓ | ✗ | 53.33 | |
| 3 | ✗ | ✓ | 56.67 | |
| 4 | ✓ | ✓ | 60.00 | |
| 5 | ✓ | State sim. | 56.67 | |
| 6 | ✓ | LLM rerank | 53.33 |
Layer 1 retrieval and Layer 2 learned selection jointly provide the best performance.
Figure 3. Selection Quality Analysis
Higher sub-instruction correctness aligns with improved final-answer performance on uncertain samples.
Citation
@misc{tong2026milesmodularinstructionmemory,
title={MILES: Modular Instruction Memory with Learnable Selection for Self-Improving LLM Reasoning},
author={Ruilin Tong and Dong Gong},
year={2026},
eprint={2607.06974},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2607.06974},
}