acceptodds
Under review as a conference paper at ICLR 2027

TokenGate: Write Admission and Budgeted Retrieval for Long-Term Agent Memory

Abstract

Long-term memory enables language model agents to sustain continuity across interactions, yet accumulating histories impose escalating storage demands and recurrent token expenditure during inference. The central challenge is to regulate persistent memory growth while allocating a finite context budget to useful evidence. Conventional top- retrieval imposes a cardinality constraint rather than an explicit token bound, leaving memory accumulation at write time unaddressed. We introduce TokenGate, a modular memory controller that couples learned admission control with query-conditioned evidence selection under a hard token budget. The admission model is trained on twelve structured views of each source candidate, while retrieval ranking combines question–memory relevance, semantic similarity, and a length penalty. On two LoCoMo test conversations with corrected inputs, filtering and learned admission reduce stored memory-body tokens by 41.7% relative to retaining all candidates, before offline maintenance. Compared with the store-all baseline (BASE), the full configuration with offline maintenance (FULL) has lower ordinary-question F1 in A-MEM and Letta and higher total counted LLM input and output tokens in Mem0 and Letta. In a separate comparison limited to Mem0 and Letta, with admitted stores and candidate pools fixed, reranking with speaker and observation-date metadata (RST) improves ordinary-question F1 over native ranking by 5.21 and 2.66 percentage points, respectively, within a 512-token memory budget. On 5,000 teacher-labelled admission examples derived from LongMemEval, twelve-view training achieves an AUROC of .823, compared with .811 for a matched native-example repetition control. The results support separate control of stored text and evidence selection within a fixed retrieval budget, with backend-dependent effects on answer quality and counted LLM-token cost.

Then back it, or bet against it.

Related papers

Open the market on this paper to see 7 more related papers.