TL;DR
MEMCON introduces a novel framework that treats LLM agent memory management as a controlled Markov Decision Process (MDP) rather than a static pipeline. By learning an online policy via a lightweight contextual bandit, it adaptively decides when, what, and how much to retrieve, consolidate, or forget without adding any extra LLM calls. Across multiple benchmarks, frameworks, and backbones, it boosts task success by up to 15.2 points while slashing token costs by 5–20%.
What Problem Does This Paper Address?
External memory systems are crucial for allowing Large Language Model (LLM) agents to accumulate experience across tasks. However, nearly all existing approaches treat memory access as a static pipeline with fixed, hand-designed heuristics (e.g., always retrieving a hard-coded top-$k$ number of items).
This static view creates a major bottleneck: optimal memory behavior is fundamentally context-dependent. For instance, retrieving aggressively during early task stages clutters the context window with irrelevant data because memory is sparse. Conversely, conservative retrieval misses crucial macro-level plans for recurring goals. While some advanced systems use the LLM itself as a memory controller to achieve adaptivity, doing so introduces substantial latency and prohibitive token overhead. MEMCON addresses this gap by introducing a learned, lightweight, and adaptive control layer that sits on top of any memory storage backend with zero extra LLM calls.
Methods
The authors formalize agent memory management as a Memory MDP ($M_{\text{mem}} = \langle S, A, T, R, \gamma \rangle$). Instead of invoking memory endpoints with static hyperparameters, MEMCON dynamically selects memory operations based on the current task and memory state.
- State Space ($S$): Fuses task progress signals (goal type, step phase, a "stuck" indicator, and locations visited) with memory status signals (memory size, plan availability, and learning phase). This state is discretized into a compact, hashable key ($\phi(s)$) to enable rapid online convergence.
- Action Space ($A$): Includes operations such as
RETRIEVE(with policy-chosen parameters for top-$k$, insight-$k$, and graph hop depth),PLANINJECT(prepending a generalized macro-plan),RE-RETRIEVE(re-issuing retrieval with alternative query suffixes to escape action loops),CONSOLIDATE,FORGET, andNOOP. - Online Policy Learning: MEMCON learns its policy online during deployment using a tabular contextual bandit with Upper Confidence Bound (UCB) exploration. It requires zero pretraining, initializing instead with intuitive, human-readable warm-start priors. Q-values are updated at the end of each task via reverse-discounted Monte Carlo credit assignment based on binary environment success.
- Backend-Agnostic Wrapper: MEMCON acts as a thin wrapper that intercepts the abstract retrieve and store entry points of any underlying memory implementation (e.g., flat vector stores, graph-structured memories, or skill libraries), cleanly separating the storage layer from the control layer.
Datasets
MEMCON was comprehensively evaluated across 6 benchmarks covering two distinct operational regimes:
- Interactive Decision-Making (Long-horizon, multi-step): ALFWorld (household tasks), PDDL Planning (classical logic puzzles), and ScienceWorld (elementary science experiments).
- Knowledge / Web / Tool-Use QA: TriviaQA (open-domain QA), WebWalkerQA (multi-hop web traversal), and GAIA (general AI assistant questions).
Evaluations were conducted across 3 architecturally distinct agent frameworks (Lobster, LangGraph, and Microsoft Agent-Framework) using 3 different LLM backbones (GPT-4.1-mini, Claude Sonnet-4, and DeepSeek-V3.2).
Key Insights and Ideas
- Memory Access as a Control Problem: Memory management shouldn't be a static engineering choice. An agent's optimal memory operation changes dynamically based on its learning phase, task progress, and whether it has encountered a specific failure mode (like getting stuck).
- Less is More: Aggressive retrieval often hurts performance on simple or novel tasks by diluting the prompt context. MEMCON successfully learns to suppress retrieval (
NOOP) when memory is sparse or irrelevant. - The Power of Macro-Plans: For recurring goal types, replaying an object-generalized template of a prior success (
PLANINJECT) prevents the agent from getting lost in low-level step details, outperforming generic nearest-neighbor trajectory lookups. - Table Lookups over LLM Calls: Adaptive memory control does not require heavy deep reinforcement learning or secondary LLM orchestrators. A lightweight tabular bandit can converge within tens of tasks, executing via millisecond-scale table lookups.
Key Results
- State-of-the-Art Performance: MEMCON consistently achieved the highest or near-highest task success rates across all 54 evaluated configurations, outperforming 9 strong memory baselines (including G-Memory, Voyager, and LatentMem). For example, it achieved 67.9% success on ALFWorld using GPT-4.1-mini (Lobster), delivering a substantial leap over the baseline.
- Simultaneous Token Savings: While standard retrieval-augmented generation (RAG) methods trade higher token consumption for accuracy, MEMCON simultaneously reduced average input token consumption per task by 5–20% by actively choosing shallow retrievals or
NOOPactions when deep context was unnecessary.
Limitations and Future Work
- Coarse State Discretization: The state space relies on hand-crafted binning thresholds (e.g., specific cutoffs for memory size or step count). Future work could explore automated or continuous state representations to handle more complex environmental signals.
- Opaque Intra-Episode Transitions: Because environment transitions are driven by the black-box LLM agent, the authors treat the system as a contextual bandit with episode-level feedback. Developing a fully sequential intra-episode MDP model could unlock even finer control.
- Regex-Based Generalization: The generalized plan injection mechanism utilizes a regex rewriter to replace instance-specific identifiers. This approach might struggle or degrade when encountering highly novel vocabularies or unstructured action spaces.
Summary updated