TL;DR
LLM agents often struggle to balance the high cost of processing long-term memory with the need for accurate, query-specific information. BudgetMem solves this by introducing a modular runtime memory framework where a reinforcement learning-based router dynamically selects between "Low," "Mid," and "High" compute tiers for different stages of memory extraction. This allows the system to provide a controllable "performance-cost frontier," outperforming static baselines by delivering higher accuracy at a fraction of the cost.
What Problem Does This Paper Address?
As LLM agents move toward long-horizon tasks—like managing weeks of dialogue or navigating massive document stores—memory becomes the bottleneck. Most current systems use "offline" memory construction, where the entire history is summarized or indexed before a query even arrives. This is often wasteful (processing data that isn't needed) or brittle (discarding details that might be critical for a specific future question).
The alternative is "on-demand" memory extraction at runtime, but this is computationally expensive and lacks a "volume knob." Developers usually have to choose between a cheap, low-quality heuristic or an expensive, high-quality LLM call for every single query. There hasn't been a systematic way to navigate the trade-off between performance and cost in real-time based on the complexity of the user's request.
Methods
The authors propose BudgetMem, which treats memory extraction as a multi-stage modular pipeline:
- Filtering: Narrowing down retrieved raw chunks.
- Parallel Extraction: Three specialized modules (Entity, Temporal, and Topic) extract different types of context.
- Summarization: Aggregating the extracted info into a final, compact memory.
The "secret sauce" is that every module in this pipeline is offered in three Budget Tiers (Low, Mid, High). To decide which tier to use, a Shared Budget-Tier Router (a lightweight neural policy) is trained via Reinforcement Learning (PPO). The router looks at the query and the current state of the pipeline to decide if a module needs "High" effort or if a "Low" tier will suffice.
The authors explored three ways to realize these tiers:
- Implementation Tiering: Moving from simple regex/heuristics (Low) to BERT-style models (Mid) to full LLMs (High).
- Reasoning Tiering: Keeping the model the same but changing the prompt strategy—from direct generation (Low) to Chain-of-Thought (Mid) to multi-step reflection (High).
- Capacity Tiering: Swapping the underlying model size (e.g., Llama-3B vs. 8B vs. 70B).
Datasets
The framework was evaluated on three benchmarks that test long-context and long-horizon memory:
- LoCoMo: A dataset focused on long-term dialogue memory.
- LongMemEval: A benchmark for chat assistants requiring long-term interactive memory.
- HotpotQA: Used here as a representative task for multi-hop reasoning over long contexts.
Key Insights and Ideas
- The "Compute Knob" is Real: The RL router successfully learned to "downgrade" its effort when the cost penalty was high, shifting from High-tier LLM calls to Low-tier heuristics without a total collapse in performance.
- Not All Tiering is Equal: Implementation and Capacity tiering are best for widening the "budget coverage" (exploring very cheap or very expensive regimes). Reasoning tiering, however, acts more like a fine-tuning knob; it provides quality improvements within a relatively narrow cost band.
- Retrieval Sweet Spots: More data isn't always better. The authors found that retrieving 5 chunks was the optimal balance; retrieving more (e.g., 9 chunks) actually decreased performance because the extra noise distracted the LLM.
- Reward Alignment Matters: Training a router to balance accuracy (0 to 1) and cost (which can be huge) is tricky. The authors used a "variance-based alignment factor" to ensure that one signal didn't drown out the other during training.
Key Results
- Superior Frontiers: BudgetMem consistently advanced the Pareto frontier. On LongMemEval, the Capacity-tiered version achieved a "Judge Score" of 60.50, significantly higher than the strongest baseline, LightMem (48.51).
- Cost Efficiency: On HotpotQA, BudgetMem-CAP achieved its best performance at a cost of $0.22, while many baselines cost significantly more for lower accuracy.
- Generalization: A router trained on a Llama backbone could be transferred to a Qwen backbone without retraining, maintaining its ability to make smart budget decisions.
Limitations and Future Work
- Pipeline Latency: While the paper focuses on monetary cost (tokens), the multi-stage modular nature of BudgetMem can increase latency. While batching helps, the sequential dependencies in the pipeline remain a challenge for real-time applications.
- Fixed Structure: The current pipeline structure (Filter -> Extract -> Summarize) is fixed. Future work could involve "structural routing," where the router decides to skip certain modules entirely if they aren't relevant to the query.
- System-Level Optimization: The authors acknowledge that their work is algorithmic; combining this with system-level optimizations (like KV-cache management or speculative decoding) could further drive down costs.
Summary updated