Manuscript Offprint

arXiv:2609.04915

Compact-Memory LLM Agents via Online Max-Member Clustering and Atom-Aware Packing

Jiahe Geng, Jinpeng Wang, Kun Yuan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Many practical long-horizon LLM deployments face tight prompt budgets because latency, cost, and context limits make full-context prompting impractical as interaction length grows. In that setting, the key question is not raw recall alone, but which memory design gives the best quality-token trade-off in the compact-memory regime. To answer this question, we present RSM-full, an online clustered-memory pipeline designed for a strong quality-token Pareto operating point.

RSM-full combines two simple design choices: a cosine-gated max-member merge write rule and an atom-aware grouped context packer. On AMA-Bench, our primary compact-memory benchmark, it reaches 83% of Full-Context quality at 32% of the token cost at a 4k prompt budget; under matched four-seed averaging it outperforms the closest streaming-clustered baseline (Online K-Means) by +3.5–6.0 pp (p<.001p<.001) across the entire ∼\sim2.6k-∼\sim5k regime. Matched three-seed ablations show that most of this advantage comes from the merge rule (+5.7 pp over Online K-Means and matched-τ\tau DP-means) and the grouped packer (+5.0 pp over flat concatenation).

The same compact-memory pattern reproduces on RealMem, an independent long-horizon persona-memory benchmark: RSM-full improves on Budget-RAG (+0.69 pp, p=.006p=.006), is on par with BM25-RAG (paired Δ=+0.27\Delta=+0.27 pp, p=.47p=.47, no significant difference; we do not claim BM25 equivalence in the equivalence-test sense), and significantly outperforms Streaming-Proto (+2.97 pp) and the closest reproduced 2025 agentic-memory baseline A-MEM (+1.65 pp, p<.001p<.001). Across benchmarks, the main empirical message is consistent: under tight prompt budgets, compact-memory performance is driven mainly by how streaming memories are merged and how retrieved content is assembled.

Overall, RSM-full is most useful when answer quality must be preserved under roughly 2k–5k prompt tokens, where it defines a strong compact-memory Pareto point. Higher-token baselines remain stronger outside this regime.

1 Introduction

Many practical long-horizon LLM deployments must retain past interaction while meeting latency, cost, and context-window constraints. Full-context prompting preserves answer quality, but its token cost grows linearly with interaction length. Fixed-window or top-KK retrieval controls prompt length, but often discards the latent structure that makes prior experience reusable [4, 11, 19]. The central question is therefore not raw recall in isolation, but which memory operating point yields the best quality-token trade-off in the compact-memory regime (≤5k\leq 5k prompt tokens)?

We answer this question with RSM-full, an online clustered-memory pipeline built around two simple design choices: a cosine-threshold max-member merge write rule and an atom-aware grouped context packer. The paper's main claim is that these choices define a strong compact-memory Pareto point under tight prompt budgets. The empirical spine is two positive end-to-end benchmarks: AMA-Bench as the primary compact-memory benchmark, and RealMem as an independent replication on long-horizon persona memory.

On AMA-Bench, RSM-full reaches 83% of Full-Context quality at 32% of the token cost at a 4k prompt budget and outperforms the closest compact-memory baselines in the ∼\sim2.6k-∼\sim5k regime. Matched multi-seed ablations show that most of this advantage comes from the merge rule (+5.7 pp over Online K-Means and matched-τ\tau DP-means) and the grouped packer (+5.02 ±\pm 1.00 pp over flat concatenation). On RealMem, the same compact-memory pattern reproduces under matched evaluation. Throughout the paper, we treat the merge rule and grouped packer as the main explanation for AMA-Bench, and the v1v_{1} retrieval rule only as benchmark-conditional supporting evidence: on BGE-normalized AMA-Bench the retrieval contrast is null once clustering and packing are fixed (Table 3, A–D cell, p=0.40), whereas on LoCoMo-Plus grouped Cognitive it improves results on 2/4 relation families.

Related work. Recent agent-memory systems attack long-horizon behavior through compression, selective context construction, or structured memory management [2, 6, 8, 17, 18, 22]. Related compact-memory systems such as ACON, Latent Context Compilation, Active Context Compression, and Memori focus mainly on what to compress or summarize [1, 9, 12, 16]. Our question is narrower: under a tight prompt budget, which design choices at the vector-index-and-assembly layer actually determine answer quality? This makes our closest neighbors online vector-index methods such as threshold-based clustering, Online K-Means, Streaming PCA, and FIFO prototype memories [3, 10, 14, 15]. RSM is complementary to higher-level prompt-management systems [7, 13, 21]; selective forgetting is outside scope.

References (20)