Learning Query-Aware Budget-Tier Routing for Runtime Agent Memory
MemoryAgentReinforcement LearningICML 2026CCF-A南洋理工大学清华大学伊利诺伊大学厄巴纳-香槟分校伊利诺伊大学芝加哥分校中山大学香港科技大学(广州)https://github.com/ViktorAxelsen/BudgetMem
原文采用 CC BY 4.0 许可;本页基于 arXiv v3 进行中文翻译与双语重排。
BudgetMem:学习面向运行时智能体记忆的查询感知预算档位路由
Abstract
Memory is increasingly central to Large Language Model (LLM) agents operating beyond a single context window, yet most existing systems rely on offline, query-agnostic memory construction that can be inefficient and may discard query-critical information. Although runtime memory utilization is a natural alternative, prior work often incurs substantial overhead and offers limited explicit control over the performance-cost trade-off. In this work, we present BudgetMem, a runtime agent memory framework for explicit, query-aware performance–cost control. BudgetMem structures memory processing as a set of memory modules, each offered in three budget tiers (i.e., Low/Mid/High). A lightweight router performs budget-tier routing across modules to balance task performance and memory construction cost, which is implemented as a compact neural policy trained with reinforcement learning.
对于需要超越单个上下文窗口运行的大语言模型(LLM)智能体而言,记忆正变得越来越重要,但大多数现有系统依赖离线、与查询无关的记忆构建,这种方式可能效率低下,还可能丢弃对查询至关重要的信息。 虽然运行时记忆利用是一种自然的替代方案,但已有工作往往带来显著开销,并且对性能与成本权衡的显式控制有限。 在本文中,我们提出 BudgetMem,一种支持显式、查询感知的性能—成本控制的运行时智能体记忆框架。 BudgetMem 将记忆处理组织为一组记忆模块,每个模块均提供三个预算档位,即 Low/Mid/High(低/中/高)。 一个轻量级路由器在各模块中执行预算档位路由,以平衡任务性能与记忆构建成本;该路由器由一个通过强化学习训练的紧凑神经网络策略实现。
Using BudgetMem as a unified testbed, we study three complementary strategies for realizing budget tiers: implementation (method complexity), reasoning (inference behavior), and capacity (module model size). Across LoCoMo, LongMemEval, and HotpotQA, BudgetMem surpasses strong baselines when performance is prioritized (i.e., high-budget setting), and delivers better accuracy–cost frontiers under tighter budgets. Moreover, our analysis disentangles the strengths and weaknesses of different tiering strategies, clarifying when each axis delivers the most favorable trade-offs under varying budget regimes.
以 BudgetMem 为统一试验平台,我们研究了三种实现预算档位的互补策略:实现(方法复杂度)、推理(推理时的行为)和容量(模块的模型规模)。 在 LoCoMo、LongMemEval 和 HotpotQA 上,当优先考虑性能时(即高预算设置),BudgetMem 超越了强基线;在预算更紧张时,它则取得了更优的准确率—成本前沿。 此外,我们的分析厘清了不同分档策略的优势与不足,明确了在不同预算条件下,各个维度何时能够带来最有利的权衡。
1. Introduction
Memory has become a core component of modern Large Language Model (LLM) agents, enabling them to retain and reuse information beyond a single context window for long-horizon interaction, personalization, and knowledge-intensive reasoning. Nevertheless, most prior work centers on offline, query-agnostic memory construction, where past context is preprocessed, compressed, or indexed in a fixed manner without conditioning on the downstream query. This “build once, use always” paradigm can be wasteful and brittle: it spends computation regardless of what a particular query needs, while potentially omitting crucial information for specific queries.
记忆已成为现代大语言模型(LLM)智能体的核心组件,使其能够在单个上下文窗口之外保留和复用信息,从而支持长程交互、个性化和知识密集型推理。 然而,大多数已有工作聚焦于离线、与查询无关的记忆构建,即以固定方式预处理、压缩或索引过去的上下文,而不以下游查询为条件。 这种“构建一次,始终使用”的范式可能既浪费资源又脆弱:无论某个具体查询需要什么,它都会消耗计算资源,同时还可能遗漏特定查询所需的关键信息。
Instead, an intuitive alternative is on-demand memory extraction, where computation is triggered at runtime based on the current query. This flexibility comes at a cost: it pushes memory processing to runtime, making cost and latency first-class concerns. In practice, industrial LLM systems increasingly provide explicit, often tiered compute controls (e.g., “thinking” modes, reasoning levels, or heavier-model options), reflecting the need to balance quality against runtime cost. This motivates a key question for agent memory: how can we enable explicit and controllable performance–cost trade-offs for runtime memory extraction?
相应地,一种直观的替代方案是按需记忆抽取,即在运行时根据当前查询触发计算。 这种灵活性也有代价:它将记忆处理推迟到运行时,使成本与延迟成为首要考虑因素。 在实践中,工业界的 LLM 系统越来越多地提供显式且通常是 分档的 计算控制,例如“思考”模式、推理等级或更大模型选项,体现出在质量与运行时成本之间取得平衡的需求。 这引出了智能体记忆的一个关键问题:如何为运行时记忆抽取提供显式且可控的性能—成本权衡?
Unfortunately, enabling performance-cost trade-offs for runtime agent memory is fundamentally challenging. Most existing trade-off mechanisms operate offline, while on-demand memory pushes these decisions to runtime, where each query raises a quality-cost choice. This exposes two core questions.
遗憾的是,为运行时智能体记忆提供性能与成本之间的权衡,本身就具有根本性挑战。 大多数现有权衡机制在离线阶段运行,而按需记忆将这些决策推至运行时,此时每个查询都会带来一次质量与成本之间的选择。 这暴露出两个核心问题。
First, where should budgets be applied? Existing systems often treat memory as a monolithic pipeline with a fixed compute setting, making trade-offs coarse and difficult to control. This motivates defining an appropriate budgeting unit for runtime settings, i.e., which modular part(s) of the memory extraction process should be assigned budgets, so that computation can be controlled in a targeted and effective way.
首先,应将预算施加于何处? 现有系统往往将记忆视为采用固定计算配置的整体式流水线,使权衡粒度粗糙且难以控制。 这促使我们为运行时场景定义恰当的预算分配单元,即应为记忆抽取过程中的哪些模块化部分分配预算,从而有针对性且有效地控制计算。
Second, how should budgets be realized? Prior work provides little systematic guidance on trade-offs for runtime memory, often resorting to ad hoc cost reduction or simply increasing compute. As a result, even after a budgeting scheme is specified, it remains unclear how to operationalize budget control, which design axes best capture meaningful trade-offs, and how these choices behave across different budget regimes. Addressing these questions requires moving beyond one-off heuristics or compute-heavy escalation toward a more systematic view of performance–cost control for runtime agent memory.
其次,应如何实现预算? 已有工作很少为运行时记忆的权衡提供系统性指导,往往采用临时性的成本削减方法,或只是增加计算量。 因此,即使已经确定预算方案,仍不清楚如何落实预算控制、哪些设计维度最能体现有意义的权衡,以及这些选择在不同预算条件下会如何表现。 要解决这些问题,需要超越一次性的启发式方法或计算密集的升级方式,以更系统的视角审视运行时智能体记忆的性能—成本控制。
To address the above challenges, we propose BudgetMem, a runtime agent memory framework that enables explicit, controllable performance–cost trade-offs for on-demand memory extraction. BudgetMem views runtime memory extraction as a multi-stage modular pipeline and makes computation controllable at the module level. Specifically, BudgetMem standardizes how each module is invoked by exposing a common budget-tier interface, so that a learned router can select among budget tiers within modules while keeping the overall extraction structure fixed.
为应对上述挑战,我们提出 BudgetMem,一种运行时智能体记忆框架,为按需记忆抽取提供显式、可控的性能—成本权衡。 BudgetMem 将运行时记忆抽取视为多阶段模块化流水线,并在模块层面实现计算可控。 具体而言,BudgetMem 通过提供统一的预算档位接口来规范各模块的调用方式,使学习得到的路由器能够在模块内部选择预算档位,同时保持整体抽取结构不变。
Building on this modular backbone, BudgetMem provides three budget tiers (i.e., Low/Mid/High) for each module, offering different quality-cost trade-offs. We instantiate budget tiers through three complementary tiering strategies: implementation tiering (varying the module implementation), reasoning tiering (varying inference behavior), and capacity tiering (varying the module's model capacity). To navigate these tiered choices, BudgetMem employs a shared lightweight router that performs budget-tier routing as the query is processed: at each module, it selects a tier based on the available context (i.e., the query and intermediate module states). We train the router with reinforcement learning under a cost-aware reward that trades off task performance against memory extraction cost, forming controllable performance–cost behavior. This design yields a practical and controllable runtime memory system, while also enabling a unified comparison of different budget realization strategies.
基于这一模块化骨架,BudgetMem 为每个模块提供三个预算档位,即 Low/Mid/High,对应不同的质量与成本权衡。 我们通过三种互补的分档策略来实例化预算档位:实现 分档(改变模块实现)、推理 分档(改变推理时的行为)和 容量 分档(改变模块的模型容量)。 为在这些分档选项中进行选择,BudgetMem 使用一个共享的轻量级路由器,在处理查询的过程中执行预算档位路由:对于每个模块,它根据可用上下文,即查询与模块中间状态,选择一个档位。 我们使用强化学习训练路由器,并采用权衡任务性能与记忆抽取成本的成本感知奖励,从而形成可控的性能—成本行为。 这一设计得到了一套实用且可控的运行时记忆系统,同时也支持在统一条件下比较不同预算实现策略。
In experiments on LoCoMo, LongMemEval, and HotpotQA, BudgetMem delivers strong gains over competitive baselines in performance-first (high-budget) settings, and exhibits clear performance–cost trade-off curves as budgets tighten. Moreover, our analyses disentangle the relative strengths of different budget tiering strategies, offering insights into which mechanisms provide the best returns under different budget regimes.
在 LoCoMo、LongMemEval 和 HotpotQA 的实验中,BudgetMem 在性能优先(高预算)设置下相较有竞争力的基线取得显著提升,并在预算收紧时呈现出清晰的性能—成本权衡曲线。 此外,我们的分析厘清了不同预算分档策略的相对优势,揭示了在不同预算条件下,哪些机制能够带来最佳收益。
Our contributions are summarized as follows:
我们的贡献总结如下:
- We introduce BudgetMem, a modular runtime agent memory framework that enables explicit performance–cost control for on-demand memory extraction via budget-tiered modules.
- We propose budget-tier routing, learning a shared lightweight router with reinforcement learning to select budget tiers during extraction and further instantiate three complementary budget realization strategies (i.e., implementation, reasoning, and capacity tiering) within a unified framework.
- Experiments on LoCoMo, LongMemEval, and HotpotQA demonstrate strong performance and clear performance–cost trade-offs, and our further analyses provide valuable insights into when different strategies deliver the best returns across budget regimes.
- 我们提出 BudgetMem,一种模块化的运行时智能体记忆框架,通过具有预算档位的模块,为按需记忆抽取提供显式的性能—成本控制。
- 我们提出预算档位路由,通过强化学习训练一个共享的轻量级路由器,在抽取过程中选择预算档位,并在统一框架中进一步实例化三种互补的预算实现策略,即 实现、推理 和 容量 分档。
- 在 LoCoMo、LongMemEval 和 HotpotQA 上的实验展现了较强性能与清晰的性能—成本权衡;进一步分析则为理解不同策略在各类预算条件下何时能够带来最佳收益提供了有价值的见解。
2. Related Work
2.1. Memory-Augmented LLM Agents
Memory-augmented LLM agents typically maintain an external memory store to overcome finite context windows and support long-horizon use. A large portion of prior work emphasizes offline or ahead-of-time memory construction, where past interactions are periodically summarized/compressed and indexed, and later accessed via retrieval at query time. Representative designs organize memories chronologically and hierarchically (e.g., event summaries and persona profiles) with information retrieval and heuristic update rules such as recency-based decay. More recent work enriches memory with agentic updates and structure, e.g., constructing metadata-rich notes and linking them into graphs for scalable retrieval and evolution, or using LLM-based memory managers to retrieve similar entries and apply discrete operations (i.e., add, update, delete, and no-op), with variants that build structured memories such as knowledge graphs. Several methods further introduce learning-based memory management (often via reinforcement learning) to optimize memory operations using downstream task signals. On-demand utilization approaches also push beyond “retrieve-then-answer” by invoking deeper planning over memories.
记忆增强的 LLM 智能体通常维护一个外部记忆存储,以克服上下文窗口有限的问题并支持长程使用。 大量已有工作强调离线或预先构建记忆,即定期对过去的交互进行摘要/压缩和索引,随后在查询时通过检索访问这些记忆。 代表性设计按时间顺序和层级组织记忆,例如事件摘要和人物画像,并结合信息检索与基于近期性的衰减等启发式更新规则。 较新的工作通过智能体自主更新和结构化组织丰富记忆,例如构建包含丰富元数据的笔记,并将其链接成图,以支持可扩展的检索与演化;或使用基于 LLM 的记忆管理器检索相似条目并执行离散操作,即添加、更新、删除和不操作,其中一些变体还构建知识图谱等结构化记忆。 一些方法进一步引入基于学习的记忆管理,通常采用强化学习,利用下游任务信号优化记忆操作。 按需利用方法也通过围绕记忆开展更深入的规划,超越了“先检索、再回答”的模式。
Despite these advances, runtime memory remains costly and is rarely framed as explicit performance–cost control: most work relies on fixed pipelines or studies efficiency mainly in offline construction. In contrast, we focus on runtime memory extraction and systematically compare controllable performance–cost trade-offs under budgets.
尽管取得了这些进展,运行时记忆仍然成本高昂,也很少被表述为显式的性能—成本控制问题:大多数工作依赖固定流水线,或主要研究离线构建阶段的效率。 相比之下,我们聚焦运行时记忆抽取,并系统比较预算约束下可控的性能—成本权衡。
2.2. Inference-Time Performance-Cost Trade-offs in LLM Systems
A growing body of work studies how to trade LLM quality against runtime cost and latency by exposing controllable “compute knobs”. Existing approaches broadly fall into three categories. (i) Algorithmic and systems-level optimizations reduce inference cost without changing the task, including faster decoding, early-exit or adaptive-depth inference, pruning/sparsity, quantization, and serving-side optimizations such as caching/batching and KV-cache efficiency for long contexts. (ii) Reasoning-level controls vary inference behavior under different budgets, e.g., direct generation vs. chain-of-thought, self-refinement and reflection loops, or bounded deliberation via limits on steps, samples, or search. (iii) Capacity-level controls vary effective model capacity, including mixture-of-experts activation and distillation-based deployments, closely related to LLM routing across backends under budget constraints.
越来越多的工作通过提供可控的“计算调节选项”,研究如何在 LLM 质量与运行时成本、延迟之间进行权衡。 现有方法大体分为三类。 (i) 算法与系统层面 的优化在不改变任务的情况下降低推理成本,包括加速解码、提前退出或自适应深度推理、剪枝/稀疏化、量化,以及缓存/批处理和长上下文 KV 缓存效率等服务端优化。 (ii) 推理层面 的控制在不同预算下改变推理时的行为,例如直接生成与思维链、自我改进和反思循环,或通过限制步骤数、样本数或搜索来约束审慎推理。 (iii) 容量层面 的控制改变有效模型容量,包括混合专家激活和基于蒸馏的部署,与预算约束下跨后端的 LLM 路由密切相关。
While these directions offer practical mechanisms for controllable trade-offs, they have been less systematically explored in runtime agent memory, where computation is spent on memory extraction rather than answer generation. In this work, we take a first step toward bringing explicit performance–cost control to runtime agent memory by introducing a budget-tiered framework and studying complementary budget realization strategies in a unified setting.
虽然这些方向为可控权衡提供了实用机制,但在运行时智能体记忆中,对它们的系统探索相对较少;在这一场景中,计算资源用于记忆抽取,而非答案生成。 在本文中,我们通过引入预算分档框架,并在统一设置下研究互补的预算实现策略,迈出了将显式性能—成本控制引入运行时智能体记忆的第一步。
3. Problem Setup and Method Overview
In this work, we study runtime agent memory extraction, where the system selectively processes raw historical records at query time to construct a compact memory for answering the current user query. Unlike offline pipelines that pre-compress or pre-structure the entire history, we keep past records intact and defer memory computation until a query arrives, avoiding irreversible information loss introduced by query-agnostic preprocessing. Before detailing the methodology, we briefly summarize the task setup from the perspectives of inputs and outputs.
在本文中,我们研究 运行时 智能体记忆抽取,即系统 在查询时 选择性地处理原始历史记录,构建用于回答当前用户查询的紧凑记忆。 不同于预先压缩或结构化整个历史的离线流水线,我们 完整保留 过去的记录,并将记忆计算推迟到查询到来之后,从而避免与查询无关的预处理造成不可逆的信息损失。 在详细介绍方法之前,我们先从输入和输出两个角度简要概述任务设置。
Inputs. Let
输入。 用
where
其中,
Outputs. The system produces (i) an extracted memory
输出。 系统生成 (i) 对查询有用的紧凑抽取记忆
Here
这里,
Budgeted runtime extraction. A key challenge is that runtime extraction occurs online and can be expensive; thus we seek explicit and controllable performance–cost trade-offs. To this end, we design a modular memory pipeline in which each module exposes a small set of budget tiers (Low/Mid/High). A shared lightweight router makes budget-tier routing decisions as the query is processed, selecting which tier to use for each module based on the available context (the query and intermediate signals). The extracted memory produced by the final module is then used to answer the query, and the end-to-end process yields a task-level performance signal and an extraction cost signal for optimizing the router in an end-to-end manner.
预算约束下的运行时抽取。 一个关键挑战是,运行时抽取在线进行,且可能成本高昂;因此,我们寻求显式且可控的性能—成本权衡。 为此,我们设计了一条模块化记忆流水线,其中每个模块都提供一小组 预算档位,即 Low/Mid/High。 在处理查询的过程中,一个共享的轻量级路由器作出 预算档位路由 决策,根据可用上下文,即查询和中间信号,为每个模块选择所用档位。 最终模块生成的抽取记忆随后用于回答查询,整个端到端过程产生任务层面的性能信号和抽取成本信号,以端到端方式优化路由器。
4. BudgetMem
In this section, we first introduce the BudgetMem modular pipeline backbone (Section 4.1), then formalize budget tiers and present three tiering strategies (Section 4.2), and finally detail how we learn budget-tier routing with a lightweight router optimized via reinforcement learning (Section 4.3).

BudgetMem 概览。 给定用户查询
4.1. Modular Runtime Memory Pipeline
As shown in Figure 1, BudgetMem implements
如 图1 所示,BudgetMem 将
Pipeline structure. Given
流水线结构。 给定
At a high level,
从整体来看,
Module interfaces and intermediate states. We represent each module invocation by a context that includes the query and the currently available signals. The filtering module produces a refined chunk set
模块接口与中间状态。 我们用一个包含查询与当前可用信号的上下文来表示每次模块调用。 过滤模块生成一个经过提炼的文本块集合:
where
其中,
where
其中,
which is then provided to the answer generator (i.e.,
随后将其提供给答案生成器,即
Budget-tier interface (conceptual). Each module
4.2. Budget Tiers and Tiering Strategies
BudgetMem equips each module
BudgetMem 为流水线中的每个模块
Tiering strategies. A key question is how to realize these tiers in practice. Motivated by common performance–cost knobs used in modern LLM systems (Section 2.2), we study three complementary tiering strategies that capture different sources of cost variation: (i) implementation tiering, which varies the module implementation (from lightweight heuristics to learned task-specific models to LLM-based processing); (ii) reasoning tiering, which varies the inference behavior while keeping the underlying model backbone fixed (e.g., direct generation vs. more deliberative inference patterns); and (iii) capacity tiering, which varies the model capacity used inside a module (e.g., smaller vs. larger LMs). These strategies are orthogonal: they trade computation through different mechanisms (algorithmic procedure, reasoning patterns, and model size), enabling direct comparison of their trade-off characteristics in a unified framework.
分档策略。 一个关键问题是如何在实践中实现这些档位。 受现代 LLM 系统中常见的性能—成本调节选项启发(第 2.2 节),我们研究了三种互补的分档策略,分别体现不同的成本变化来源:(i) 实现分档,改变 模块实现,从轻量级启发式方法,到学习得到的任务专用模型,再到基于 LLM 的处理;(ii) 推理分档,在底层模型骨干保持不变时改变 推理时的行为,例如直接生成与更审慎的推理模式;以及 (iii) 容量分档,改变模块内部使用的 模型容量,例如较小与较大的语言模型。 这些策略彼此正交:它们通过不同机制,即算法流程、推理模式和模型规模,进行计算权衡,从而能够在统一框架中直接比较各自的权衡特征。
Realizing Low/Mid/High. For implementation tiering, Low uses lightweight rule-based or pattern-based processing, Mid uses a compact learned model specialized for the module function (typically BERT-based models), and High upgrades the module to LLM-based processing for higher-quality extraction. For reasoning tiering, tiers are realized by progressively more compute-intensive inference behaviors (e.g., Low: direct; Mid: CoT-style; High: multi-step/reflection-style). For capacity tiering, tiers correspond to increasing model sizes used to implement the same module function. Concrete instantiations for each module under each strategy are provided in Appendix A.5.
实现 Low/Mid/High。 对于 实现分档,Low 使用轻量级的规则或模式处理,Mid 使用专门针对模块功能的紧凑学习模型,通常是基于 BERT 的模型,而 High 将模块升级为基于 LLM 的处理,以获得更高质量的抽取结果。 对于 推理分档,通过计算强度逐渐增加的推理行为实现不同档位,例如 Low:直接推理;Mid:思维链风格;High:多步/反思风格。 对于 容量分档,各档位对应实现同一模块功能时采用的逐渐增大的模型规模。 各模块在不同策略下的具体实例化方式见 附录 A.5。
4.3. Learning Module-Wise Budget-Tier Routing
Given tiered modules, BudgetMem learns a shared lightweight router that performs budget-tier routing throughout the modular pipeline. As the query is processed stage-by-stage, the router selects a budget tier for each module invocation, yielding a sequence of tier decisions for a single query. Since the memory extraction process can involve non-differentiable components, we formulate routing as a sequential decision problem and optimize the router with reinforcement learning.
在模块已具备不同档位的前提下,BudgetMem 学习一个共享的轻量级路由器,在整个模块化流水线中执行 预算档位路由。 随着查询逐阶段得到处理,路由器为每次模块调用选择一个预算档位,从而为单个查询产生一系列档位决策。 由于记忆抽取过程可能包含不可微组件,我们将路由建模为序列决策问题,并使用强化学习优化路由器。
Policy, state, and action. Let
策略、状态与动作。 令
Episode and objective. A complete run of the modular pipeline for one query constitutes an episode. After executing all routed modules, we obtain an extracted memory
回合与目标。 针对一个查询完整运行一次模块化流水线,构成一个回合。 在执行完所有经过路由的模块后,我们得到抽取记忆
where
其中,
Cost modeling. We define the raw extraction cost as the sum of per-module costs along the routed pipeline:
成本建模。 我们将原始抽取成本定义为沿经过路由的流水线各模块成本之和:
For LLM-based tiers, we measure
对于基于 LLM 的档位,我们用 token 用量乘以相应的输入/输出 token 价格来衡量
where
其中,
Reward-scale alignment. In practice, we observe that
奖励尺度对齐。 在实践中,我们观察到
where
其中,
5. Experimental Setup
| Methods | LoCoMo | LongMemEval | HotpotQA | Avg. | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F1 | Judge | Cost↓ | F1 | Judge | Cost↓ | F1 | Judge | Cost↓ | F1 | Judge | Cost↓ | |
| LLaMA-3.3-70B-Instruct | ||||||||||||
| ReadAgent | 22.48 | 31.05 | 0.57 | 20.75 | 27.72 | 13.68 | 15.33 | 30.08 | 4.19 | 19.52 | 29.62 | 6.14 |
| MemoryBank | 22.27 | 28.98 | 0.73 | 26.74 | 32.67 | 3.94 | 22.25 | 23.75 | 7.75 | 23.75 | 28.47 | 4.14 |
| A-MEM | 26.43 | 32.96 | 2.88 | 21.74 | 33.17 | 80.02 | 43.25 | 54.69 | 26.74 | 30.47 | 40.27 | 32.07 |
| LangMem | 22.31 | 25.96 | 0.48 | 12.00 | 17.00 | 16.60 | 22.78 | 22.66 | 10.95 | 19.03 | 21.87 | 9.34 |
| Mem0 | 11.04 | 28.18 | 2.89 | 27.70 | 42.08 | 13.57 | 28.03 | 36.72 | 4.30 | 22.26 | 35.66 | 6.92 |
| MemoryOS | 30.62 | 34.55 | 1.97 | 12.97 | 33.50 | 38.83 | 34.50 | 43.36 | 13.32 | 26.03 | 37.14 | 18.04 |
| LightMem | 33.88 | 40.76 | 1.50 | 26.74 | 48.51 | 5.28 | 45.73 | 58.37 | 10.10 | 35.45 | 49.21 | 5.63 |
| BudgetMem-IMP | 38.75 | 50.32 | 1.80 | 37.47 | 56.00 | 0.71 | 49.31 | 65.77 | 1.35 | 41.84 | 57.36 | 1.29 |
| BudgetMem-REA | 40.92 | 52.23 | 2.90 | 40.53 | 58.00 | 0.67 | 51.12 | 61.93 | 0.99 | 44.19 | 57.39 | 1.52 |
| BudgetMem-CAP | 43.05 | 54.62 | 2.40 | 40.24 | 60.50 | 0.80 | 53.87 | 64.85 | 0.93 | 45.72 | 59.99 | 1.38 |
| Qwen3-Next-80B-A3B-Instruct† | ||||||||||||
| ReadAgent | 22.45 | 31.37 | 0.24 | 27.72 | 20.75 | 4.97 | 18.05 | 25.78 | 1.75 | 22.74 | 25.97 | 2.32 |
| MemoryBank | 23.53 | 34.71 | 0.25 | 10.56 | 28.22 | 3.45 | 18.64 | 31.25 | 1.79 | 17.58 | 31.39 | 1.83 |
| A-MEM | 27.65 | 38.54 | 2.88 | 10.82 | 31.19 | 21.00 | 40.54 | 50.39 | 8.34 | 26.34 | 40.04 | 10.74 |
| LangMem | 20.89 | 23.40 | 0.14 | 11.01 | 14.00 | 3.99 | 20.77 | 21.09 | 17.56 | 17.56 | 19.50 | 2.82 |
| Mem0 | 10.77 | 25.32 | 1.15 | 25.71 | 36.14 | 4.96 | 24.72 | 37.89 | 2.02 | 20.40 | 33.12 | 2.71 |
| MemoryOS | 35.43 | 38.85 | 0.75 | 13.35 | 33.00 | 15.84 | 41.21 | 53.52 | 11.68 | 30.00 | 41.79 | 9.42 |
| LightMem | 32.85 | 42.83 | 0.70 | 27.70 | 47.52 | 3.39 | 41.29 | 55.42 | 8.56 | 33.95 | 48.59 | 4.21 |
| BudgetMem-IMP | 40.14 | 54.38 | 0.80 | 29.18 | 52.00 | 0.30 | 46.67 | 57.42 | 0.63 | 38.66 | 54.60 | 0.58 |
| BudgetMem-REA | 40.19 | 53.34 | 1.11 | 35.84 | 59.00 | 0.26 | 57.67 | 70.83 | 0.17 | 44.57 | 61.06 | 0.51 |
| BudgetMem-CAP | 41.22 | 53.18 | 0.61 | 31.01 | 56.00 | 0.17 | 58.70 | 72.08 | 0.22 | 43.64 | 60.42 | 0.33 |
Cost 通过汇总全部模型调用的 token 用量,并应用各模型相应的输入与输出 token 价格计算。
† 表示未使用该基础模型进行训练,仅进行迁移评估。
性能优先设置下,LoCoMo、LongMemEval 和 HotpotQA 数据集上的实验结果,指标包括 F1 分数(F1)、LLM 评判(Judge)与成本(Cost)。
5.1. Datasets, Metrics, and Baselines
Datasets. We evaluate BudgetMem on three benchmarks that stress long-horizon memory and long-context question answering (QA): LoCoMo and LongMemEval, which are widely used for agent memory evaluation, and HotpotQA as a representative long-context QA task.
数据集。 我们在三个强调长程记忆与长上下文问答(QA)的基准上评估 BudgetMem:广泛用于智能体记忆评估的 LoCoMo 和 LongMemEval,以及作为代表性长上下文问答任务的 HotpotQA。
Metrics. We report both task performance and cost to characterize performance–cost trade-offs. For task performance, we use F1-score (F1) and LLM-as-a-judge (Judge) to assess the correctness of a model prediction against the ground-truth answer. For cost, we measure memory extraction cost by aggregating API usage (input & output tokens) for all model calls made by BudgetMem during extraction, and converting token counts into monetary cost using the corresponding service pricing.
指标。 我们同时报告任务性能与成本,以刻画性能—成本权衡。 对于任务性能,我们使用 F1 分数(F1)和 LLM 评判(Judge),对照真实答案评估模型预测的正确性。 对于成本,我们汇总 BudgetMem 在抽取过程中所有模型调用的 API 用量,即输入与输出 token,随后使用相应服务价格将 token 数量转换为货币成本,从而衡量记忆抽取成本。
Baselines. We compare BudgetMem against a diverse set of strong memory-augmented baselines: (1) ReadAgent, (2) MemoryBank, (3) A-MEM, (4) LangMem, (5) Mem0, (6) MemoryOS, and (7) LightMem. These baselines cover a broad range of memory architectures, providing a comprehensive comparison against prior agent memory systems. More details are provided in Appendix A.
基线。 我们将 BudgetMem 与一组多样化的强记忆增强基线比较:(1) ReadAgent、(2) MemoryBank、(3) A-MEM、(4) LangMem、(5) Mem0、(6) MemoryOS 和 (7) LightMem。 这些基线涵盖广泛的记忆架构,支持与已有智能体记忆系统进行全面比较。 更多细节见 附录 A。
5.2. Implementation Details
We use LLaMA-3.3-70B-Instruct and Qwen3-Next-80B-A3B-Instruct as the base LLMs, accessed via an API service. We train the budget-tier router with LLaMA as the memory-extraction backbone, then directly test the same trained router with Qwen as the backbone without retraining. For the retrieval and chunking, we split each history or document into fixed-length text chunks (with a default chunk size of 256 for LoCoMo and LongMemEval; 1024 for HotpotQA) and use Contriever as the default retriever. For each query, we retrieve a candidate set of chunks and then apply the same top-
我们使用 LLaMA-3.3-70B-Instruct 和 Qwen3-Next-80B-A3B-Instruct 作为基础 LLM,并通过 API 服务访问它们。 我们以 LLaMA 作为记忆抽取骨干训练预算档位路由器,然后将骨干替换为 Qwen,直接测试同一个已训练路由器,而不重新训练。 在检索与分块方面,我们将每段历史或每篇文档切分为固定长度的文本块,LoCoMo 和 LongMemEval 的默认块大小为 256,HotpotQA 为 1024,并使用 Contriever 作为默认检索器。 对于每个查询,我们先检索一组候选文本块,再为下游记忆处理采用相同的 top-
As for training, we follow a

LoCoMo 上不同分档策略的性能—成本权衡。 通过改变成本权重
6. Experimental Analysis
We organize experiments as follows. In Section 6.1, we report performance-first results (
6.1. Main Results
As shown in Table 1, we evaluate BudgetMem under the performance-first setting on LoCoMo, LongMemEval, and HotpotQA, comparing against a diverse set of representative memory systems. The results support three key findings.
如 表1 所示,我们在性能优先设置下,在 LoCoMo、LongMemEval 和 HotpotQA 上评估 BudgetMem,并与多种具有代表性的记忆系统比较。 结果支持三个关键发现。
Effectiveness. BudgetMem delivers substantial improvements across all three datasets, consistently outperforming prior methods in both F1 and LLM-Judge. For example, on LongMemEval with the LLaMA-3.3-70B backbone, BudgetMem-Cap achieves a Judge score of 60.50, surpassing the strongest baseline LightMem (48.51) by a large margin, demonstrating stronger long-context evidence utilization and higher answer quality.
有效性。 BudgetMem 在全部三个数据集上均带来显著提升,并在 F1 与 LLM-Judge 两项指标上持续优于已有方法。 例如,在以 LLaMA-3.3-70B 为骨干的 LongMemEval 评估中,BudgetMem-Cap 的 Judge 分数达到 60.50,大幅超过最强基线 LightMem 的 48.51,展现出更强的长上下文证据利用能力和更高的答案质量。
Strong performance under controlled cost. Even in the performance-first regime, BudgetMem remains cost-efficient, achieving higher quality without incurring excessive overhead. Notably, on HotpotQA with Qwen3-Next-80B-A3B, BudgetMem-Cap achieves the best Judge score (72.08) at a cost of 0.22, while BudgetMem-Rea reaches a comparable Judge score (70.83) at an even lower cost (0.17). This efficiency stems from BudgetMem's runtime, on-demand design: rather than processing the entire history offline, it retrieves query-relevant raw chunks and spends extraction compute only when needed. We note an exception on LoCoMo, where histories are shorter and offline pipelines incur less overhead, so cost differences across methods become less pronounced.
成本可控时仍有较强性能。 即使在性能优先条件下,BudgetMem 仍保持成本效率,能够在不引入过高开销的情况下取得更高质量。 值得关注的是,在采用 Qwen3-Next-80B-A3B 的 HotpotQA 评估中,BudgetMem-Cap 以 0.22 的成本取得最高 Judge 分数 72.08,而 BudgetMem-Rea 以更低的 0.17 成本取得相近的 Judge 分数 70.83。 这种效率源于 BudgetMem 在运行时按需处理的设计:它检索与查询相关的原始文本块,仅在需要时才消耗抽取计算,而不是离线处理整个历史。 我们注意到 LoCoMo 是一个例外:其历史较短,离线流水线产生的开销较低,因此各方法之间的成本差异不那么明显。
Strongest overall performance on aggregate. When aggregating results across datasets, BudgetMem variants consistently rank at the top within each backbone block, indicating strong overall effectiveness rather than gains limited to a single benchmark. This trend holds for both LLaMA and Qwen, showing that BudgetMem delivers broadly strong performance across diverse evaluation settings under the performance-first regime.
汇总结果中的最强整体性能。 将各数据集结果汇总后,BudgetMem 的各个变体在每个骨干模型分组中都持续位居前列,表明其整体有效性较强,而非收益仅局限于某个单一基准。 这一趋势在 LLaMA 与 Qwen 上均成立,说明在性能优先条件下,BudgetMem 能够在多样化评估设置中普遍取得较强性能。
6.2. Exploring Trade-off Across Tiering Strategies
As shown in Figure 2, we systematically compare the performance–cost distributions on LoCoMo across the three tiering axes. As the budget is relaxed (smaller
如 图2 所示,我们在 LoCoMo 上系统比较了三个分档维度的性能—成本分布。 随着预算放宽,即
In contrast, reasoning tiering exhibits pronounced cost concentration: because it primarily adjusts inference behaviors (e.g., direct/reflection) while holding the underlying model capacity fixed, the additional cost is dominated by a relatively stable token overhead, leading to a narrower spread in cost. This pattern suggests that the reasoning axis acts more like a fine-grained quality knob within a limited cost bandwidth, providing meaningful improvements at similar cost, but offering less room for exploring extremely low-budget settings or extrapolating to very high-budget performance than implementation/capacity tiering. Overall, BudgetMem consistently advances the Pareto frontier from budget-constrained to performance-first regimes, and the differences among tiering axes further indicate that implementation/capacity tiering is better suited for widening budget coverage and extrapolating the boundary, whereas reasoning tiering is most effective for refining quality within a relatively concentrated cost region.
相比之下,推理 分档呈现明显的成本集中现象:由于它主要调整推理时的行为,例如直接推理/反思,同时保持底层模型容量不变,额外成本主要来自相对稳定的 token 开销,因此成本分布范围较窄。 这一模式表明,推理维度更像是在有限成本带宽内进行细粒度质量调节的选项,能够以相近成本带来有意义的提升,但与实现/容量分档相比,在探索极低预算设置或向极高预算性能外推方面的空间更小。 总体而言,BudgetMem 在预算受限到性能优先的各类条件下持续推进帕累托前沿;各分档维度的差异进一步表明,实现/容量分档更适合扩大预算覆盖范围并向外拓展边界,而推理分档最适合在相对集中的成本区域内改善质量。
6.3. Ablating Reward-scale Alignment
As shown in Figure 3, we ablate the reward-scale alignment (Section 4.3) under the capacity tiering strategy on LoCoMo. Because the task reward and cost reward can differ markedly in scale and variability, removing alignment makes optimization unstable and can bias learning toward the cost term, yielding a degenerate low-cost policy. Empirically, without reward-scale alignment (and with a cost weight
如 图3 所示,我们在 LoCoMo 上采用容量分档策略,对奖励尺度对齐(第 4.3 节)进行消融。 由于任务奖励与成本奖励在尺度和变异程度上可能有明显差异,移除对齐会使优化不稳定,还可能使学习偏向成本项,得到退化的低成本策略。 实验发现,在不使用奖励尺度对齐且成本权重

LoCoMo 上采用容量分档策略时的 奖励尺度对齐消融实验。
6.4. Discussion
Budget tier selection ratio. Figure 4 analyzes module-level routing behavior on LongMemEval using the capacity tiering strategy by reporting the selection ratios of Low/Mid/High tiers under different cost weights
预算档位选择比例。 图4 通过报告不同成本权重
More concretely, with a small
更具体地说,当

预算档位选择比例。 在 LongMemEval 上采用容量分档策略时,不同成本权重
Retrieval-size sensitivity analysis. Figure 5 shows cost and Judge score as we vary the number of retrieved raw chunks on LoCoMo, evaluated under all three tiering strategies. Increasing the retrieval size predictably raises cost due to longer inputs and additional processing, and it often improves Judge score by providing more supporting evidence, reflecting the standard trade-off between evidence coverage and computational overhead.
检索规模敏感性分析。 图5 展示了在 LoCoMo 上改变检索到的原始文本块数量时,三种分档策略各自的成本与 Judge 分数。 增加检索规模会因输入更长及处理量增加而可预期地提高成本,同时也往往因提供更多支撑证据而提高 Judge 分数,体现出证据覆盖范围与计算开销之间的常见权衡。
However, the benefit is not monotonic. In our setting, retrieving 5 chunks provides the best balance between cost and quality. Retrieving too many chunks can degrade performance: additional chunks introduce more redundant or weakly relevant content, increasing noise and potentially distracting the LLM, which lowers Judge score. Conversely, retrieving too few chunks provides insufficient evidence and limits downstream gains. Overall, these results highlight retrieval size as an important practical knob for balancing evidence sufficiency against context noise and cost.
然而,这种收益并非单调增加。 在我们的设置中,检索 5 个文本块能在成本与质量之间取得最佳平衡。 检索过多文本块可能降低性能:额外文本块会引入更多冗余或相关性较弱的内容,增加噪声,并可能分散 LLM 的注意力,从而降低 Judge 分数。 反之,检索过少文本块会导致证据不足,限制下游收益。 总体而言,这些结果表明,检索规模是一个重要的实用调节选项,可用于平衡证据充分性、上下文噪声与成本。

LoCoMo 上的检索规模敏感性。 在全部三种分档策略下,成本和 Judge 分数随检索到的原始文本块数量的变化。
Latency analysis. Although our main cost metric focuses on monetary cost, latency is also important for practical deployment. We therefore additionally measure latency under a controlled local deployment, using Qwen as the shared backbone and the same hardware and inference stack for all methods. We avoid API latency in this comparison because it can be strongly affected by network conditions and provider-side scheduling, making it less suitable for fair relative comparison. Table 2 and Table 3 report absolute latency in this setting, while we mainly use them to compare relative pipeline overhead across methods.
延迟分析。 虽然我们的主要成本指标关注货币成本,但延迟对于实际部署也很重要。 因此,我们还在受控的本地部署条件下测量延迟,使用 Qwen 作为共享骨干,并为所有方法采用相同硬件和推理软件栈。 这一比较不使用 API 延迟,因为它可能受到网络状况和提供方调度的显著影响,不太适合进行公平的相对比较。 表2 和 表3 报告了这一设置下的绝对延迟,而我们主要用它们来比较不同方法的相对流水线开销。
As shown in Table 2, BudgetMem exhibits the expected latency trade-off under different budget settings. For implementation tiering, increasing the cost weight reduces total inference latency from 3881 ms at
如 表2 所示,BudgetMem 在不同预算设置下呈现出预期的延迟权衡。 对于实现分档,提高成本权重使总推理延迟从
| Method | Off. | Total | Filt. | GPU |
|---|---|---|---|---|
| MemoryOS | 40657 | 2842 | 1488 | N/A |
| A-MEM | 26842 | 1449 | 49 | N/A |
| LightMem | 9740 | 1662 | 62 | N/A |
| Ours-IMP (λ = 0) | N/A | 3881 | 1176 | 46 |
| Ours-IMP (λ = 0.3) | N/A | 2432 | 556 | 46 |
| Ours-IMP (λ = 0.9) | N/A | 1167 | 46 | 46 |
| Ours-REA (λ = 0) | N/A | 3678 | 1274 | 47 |
| Ours-REA (λ = 0.3) | N/A | 3429 | 1216 | 45 |
| Ours-REA (λ = 0.9) | N/A | 3318 | 1209 | 48 |
| Ours-CAP (λ = 0) | N/A | 3461 | 1228 | 44 |
| Ours-CAP (λ = 0.3) | N/A | 3058 | 1079 | 46 |
| Ours-CAP (λ = 0.9) | N/A | 2853 | 976 | 52 |
受控本地部署条件下 LoCoMo 的详细延迟。 批大小为 1,所有数值的单位均为毫秒。Off. 表示平均离线记忆构建时间,Total 表示平均总推理延迟,Filt. 表示检索/过滤模块的平均延迟,GPU 表示平均 GPU 时间。N/A 表示不适用或未测量。
| BS | MemoryOS | A-MEM | LightMem | Ours-REA |
|---|---|---|---|---|
| 1 | 2842 | 1449 | 1662 | 3678 |
| 2 | 1633 | 845 | 1059 | 2295 |
| 4 | 974 | 518 | 775 | 1327 |
| 8 | 604 | 296 | 438 | 858 |
| 16 | 387 | 154 | 269 | 547 |
| 32 | 203 | 96 | 163 | 326 |
LoCoMo 上的批大小扩展。 我们报告不同批大小下的平均总推理延迟,所有数值的单位均为毫秒。BS 表示批大小。对于 BudgetMem,我们报告 λ = 0 时 Ours-REA 的结果。
7. Conclusion
We present BudgetMem, a runtime agent memory framework for explicit performance–cost control in on-demand memory extraction. BudgetMem equips each module in a modular memory pipeline with Low/Mid/High budget tiers and learns a lightweight router to select tiers under a cost-aware objective. Using BudgetMem as a unified testbed, we compare three complementary tiering strategies—implementation, reasoning, and capacity—and characterize their trade-off behaviors across budgets. Experiments on LoCoMo, LongMemEval, and HotpotQA show strong performance in performance-first settings and improved performance–cost frontiers under tighter budgets, together with insights on when each strategy provides the best returns.
我们提出 BudgetMem,一种运行时智能体记忆框架,为按需记忆抽取提供显式的性能—成本控制。 BudgetMem 为模块化记忆流水线中的每个模块配备 Low/Mid/High 预算档位,并学习一个轻量级路由器,在成本感知目标下选择档位。 以 BudgetMem 为统一试验平台,我们比较了三种互补的分档策略,即 实现、推理 和 容量,并刻画了它们在不同预算下的权衡行为。 在 LoCoMo、LongMemEval 和 HotpotQA 上的实验表明,BudgetMem 在性能优先设置下取得较强性能,并在预算更紧张时改善性能—成本前沿,同时揭示了各策略何时能够带来最佳收益。
Impact Statement
BudgetMem targets practical deployment challenges for memory-augmented agents by making memory computation explicitly controllable under budget constraints. This can benefit applications that require predictable latency or cost, and can lower barriers to using agent memory in resource-limited settings.
BudgetMem 通过使预算约束下的记忆计算显式可控,应对记忆增强智能体在实际部署中的挑战。 这能够惠及需要可预测延迟或成本的应用,并降低在资源受限场景中使用智能体记忆的门槛。
BudgetMem is an architectural and training framework and does not introduce new data sources beyond what memory-augmented agents already use. Potential risks are therefore similar to existing memory systems, such as occasional retrieval of irrelevant context or exposure of benign but unintended historical details. In practice, standard safeguards—e.g., sensible retention policies, basic access control, and routine evaluation of failure cases—can mitigate these issues. Overall, we expect BudgetMem’s primary impact to be improving the usability and controllability of agent memory under real-world budget constraints.
BudgetMem 是一个架构与训练框架,除了记忆增强智能体已使用的数据外,并未引入新的数据来源。 因此,其潜在风险与现有记忆系统相似,例如偶尔检索到无关上下文,或暴露本身无害但并非预期要呈现的历史细节。 在实践中,合理的保留策略、基本访问控制和对失败案例的常规评估等标准保障措施可以缓解这些问题。 总体而言,我们预计 BudgetMem 的主要影响是提升真实预算约束下智能体记忆的可用性与可控性。