MILES: Modular Instruction Memory with Learnable
Selection for Self-Improving LLM Reasoning

A framework that incrementally constructs step-wise memory and learns correctness-oriented memory composition for frozen LLM reasoning.

Ruilin Tong, Dong Gong
University of New South Wales (UNSW Sydney)
Paper Code BibTeX
Overview of MILES framework
MILES improves test-time reasoning by constructing memory and learning memory selection from confident samples, then applying the learned memory to guide reasoning on uncertain samples.

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.

Overview of the MILES framework.

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

(sub-goal embedding, sub-instruction)

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.

Confident samplesMemory constructionSelection-head learningUncertain-sample reasoning

Main Results

MILES consistently matches or outperforms prior methods across six reasoning benchmarks and four frozen backbones.

DatasetModelZS-CoTSCDCBoTOurs
MATH-500GPT-4.1-mini88.0089.4087.0086.8092.60
GPT-4.187.2088.0083.2084.8091.60
AIME 2024GPT-4.1-mini46.6756.6763.3350.0066.67
GPT-4.140.0050.0053.3350.0053.33
GPT-OSS-20B83.3393.3343.3350.0093.33
Qwen3-30B-Instruct70.0083.3323.3363.3386.67
AIME 2025GPT-4.1-mini46.6753.3360.0040.0060.00
GPT-4.133.3336.6750.0033.3340.00
GPT-OSS-20B86.6790.0036.6733.3393.33
Qwen3-30B-Instruct60.0070.0030.0053.3373.33
GPQA-DiamondGPT-4.1-mini70.2071.7263.6466.6773.23
GPT-4.168.9468.6964.6561.1170.71
GPT-OSS-20B68.1871.7261.6237.3774.24
Qwen3-30B-Instruct70.2072.2342.4267.6873.74
MMLU-Pro PhysicsGPT-4.1-mini82.0083.5083.5083.0085.00
GPT-4.181.0083.0078.0084.0084.50
GPT-OSS-20B85.5086.5079.0042.0087.00
Qwen3-30B-Instruct87.0088.5063.5086.0088.50
MMLU-Pro EngineeringGPT-4.1-mini65.5073.5067.5070.5075.00
GPT-4.175.5078.5072.0067.5080.00
GPT-OSS-20B68.5070.0066.5041.5071.00
Qwen3-30B-Instruct74.5078.0052.0075.5081.00

Final-answer accuracy (%) on six reasoning benchmarks. Per-row best results are bolded.

Accuracy–Efficiency Tradeoff

Accuracy versus response-token cost

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 2024no-auxiliary model60.00
Qwen3-30B-Instruct66.67
Qwen3-4B-Instruct63.33
GPT-4.1-mini66.67
AIME 2025no-auxiliary model50.00
Qwen3-30B-Instruct60.00
Qwen3-4B-Instruct56.67
GPT-4.1-mini60.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 2025no memory23.08
Qwen3-30B-Instruct30.77
GPT-4.1-mini38.46
GPQA-Diamondno memory48.39
Qwen3-30B-Instruct58.06
GPT-4.1-mini54.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 2024160.00
263.33
363.33
466.67
5State sim.63.33
6LLM rerank60.00
AIME 2025153.33
253.33
356.67
460.00
5State sim.56.67
6LLM rerank53.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.

Correct-answer proportion and sub-instruction correctness on uncertain samples
Correct-answer proportion and sub-instruction correctness on AIME 2024 and AIME 2025. The complete MILES design achieves the best performance on both metrics.

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},
}