MemoryWalker: Stop Training Agents on Contexts They Never Saw
Not on the map. Why?
Abstract (arXiv)
Production agent harnesses such as Claude Code and Qwen-Agent compress context during rollout, but training under compression creates a conditioning problem: every eviction branches the effective history, so the learning object is a tree rather than a sequence. Existing linearizations either retain the rightmost path, causing time-travel leakage, or replay a depth-first traversal, causing train-inference mismatch. We introduce two exact, gradient-equivalent corrections: LogitTree, a segmented K-forward traversal, and a packed 4D attention mask. LogitTree requires K+1 backward passes; the 4D mask requires a custom kernel and white-box eviction records. We also propose SDCC (Self-Distillation for Conditioning Consistency), a single-backward-pass variational relaxation. At each eviction, it minimizes forward KL between the compressed student and a stop-gradient teacher on the reconstructed pre-eviction prefix. A residual per-junction KL of epsilon_KL gives an O(sqrt(epsilon_KL)) bound on the train-deployment total-variation gap. SDCC also applies to black-box harnesses. On seven web-search benchmarks with TC-RAG, AgentFold, MemexRL, Claude Code, and OpenCode, naive training inflates the train-rollout log-probability gap, especially on eviction-heavy batches. The exact methods stay at the no-compression floor, and SDCC substantially closes the gap, with lower logit drift and higher rollout rewards.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 36 of its 49 references that are in the map. First posted on arXiv 1 Sep 2026.
Builds on
36 of 49 references.
References · 36
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,175
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2019Generating Diverse High-Fidelity Images with VQ-VAE-2cited by 1,376
- 2025Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learningcited by 1,371
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,295
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
24 more
- 2020Constructing A Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Stepscited by 1,259
- 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,054
- 2021MuSiQue: Multihop Questions via Single-hop Question Compositioncited by 893
- 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 848
- 2025Group Sequence Policy Optimizationcited by 788
- 2013Stochastic First- and Zeroth-order Methods for Nonconvex Stochastic Programmingcited by 716
- 2018Reinforcement Learning and Control as Probabilistic Inference: Tutorial and Reviewcited by 466
- 2024Understanding the planning of LLM agents: A surveycited by 414
- 2023LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Modelscited by 279
- 2025MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agentscited by 226
- 2025Memory-R1: Enhancing Large Language Model Agents to Manage and Utilize Memories via Reinforcement Learningcited by 220
- 2024Fact, Fetch, and Reason: A Unified Evaluation of Retrieval-Augmented Generationcited by 158
- 2025ReSearch: Learning to Reason with Search for LLMs via Reinforcement Learningcited by 152
- 2025AgentFold: Long-Horizon Web Agents with Proactive Context Managementcited by 95
- 2014Reweighted Wake-Sleepcited by 66
- 2025WideSearch: Benchmarking Agentic Broad Info-Seekingcited by 66
- 2025A Survey of LLM-based Deep Search Agents: Paradigm, Optimization, Evaluation, and Challengescited by 58
- 2026REDSearcher: A Scalable and Cost-Efficient Framework for Long-Horizon Search Agentscited by 43
- 2024Fewer Truncations Improve Language Modelingcited by 33
- 2024TC-RAG:Turing-Complete RAG's Case study on Medical LLM Systemscited by 28
- 2026StackPlanner: A Centralized Hierarchical Multi-Agent System with Task-Experience Memory Managementcited by 13
- 2026Beyond Precision: Training-Inference Mismatch is an Optimization Problem and Simple LR Scheduling Fixes Itcited by 8
- 2026AgenticRag-R1: Agentic Reinforcement Learning with Stack Memory for Multi-Step Reasoning, Retrieval and Memorizingcited by 2
- 2026AWM: Answerable Working Memory for Long-Document VQA Agentscited by 1
Built on by
Not cited yet.