当经典缓存策略失效时:语义检索缓冲区的学习增强替换
When Classic Cache Policies Fail: Learning-Augmented Replacement for Semantic Retrieval Buffers
July 1, 2026
作者: Yushi Sun, Bowen Cao, Wai Lam
cs.AI
摘要
LLM 代理越来越依赖检索缓冲区来存储和重用过去的经验,然而管理这些缓冲区的缓存策略大多仍是临时性的。我们将此形式化为一个带有切换成本的在线语义缓存替换问题,其中条目通过嵌入相似度进行匹配,命中质量是连续的而非二元的。通过在 MemoryBench-Full 数据集(LoCoMo、DialSim)上使用 8 种替换策略进行的实验,我们揭示了一个令人惊讶的发现:经典启发式算法(LRU、LFU)在语义工作负载上始终不如简单的 FIFO 基线,原因是缺乏时间局部性和频率集中性。我们提出了 SOLAR,一个学习增强框架,它通过遗憾累积推导修改时机(实现约 17% 的修改率),并通过基于隐式检索反馈的贝叶斯在线学习选择内容。我们证明 SOLAR 实现了恒定的竞争比 ≤ 3,与缓存大小和时域无关(而 FIFO 的竞争比为 Ω(K)),并且驱逐遗憾为 O(KT log T),在对数因子内匹配下界 Ω(KT)。实验表明,在缓存大小紧张时,SOLAR 相比 FIFO 有 5–75% 的相对改进,并在工作集边界处呈现出清晰的特征相变。使用 5000 项池的合成实验进一步揭示了池大小与检索质量之间的倒 U 形关系,从而将容量限制解释为检索噪声现象而非存储限制。
English
LLM agents increasingly rely on retrieval buffers to store and reuse past experience, yet the cache management policies governing these buffers remain largely ad-hoc. We formalize this as an online semantic cache replacement problem with switching costs, where items are matched by embedding similarity and hit quality is continuous rather than binary. Through experiments on two datasets from MemoryBench-Full (LoCoMo, DialSim) with 8 replacement policies, we reveal a surprising finding: classic heuristics (LRU, LFU) consistently underperform the naive FIFO baseline on semantic workloads, due to the absence of temporal locality and frequency concentration. We propose SOLAR, a learning-augmented framework that derives modification timing from regret accumulation (achieving sim17\% modification rate) and content selection from Bayesian online learning over implicit retrieval feedback. We prove SOLAR achieves a constant competitive ratio leq 3, independent of cache size and horizon (vs.\ Ω(K) for FIFO), and eviction regret O(KTlog T), matching the Ω(KT) lower bound up to logarithmic factors. Experiments demonstrate 5--75\% relative improvement over FIFO at tight cache sizes, with a clearly characterized phase transition at the working set boundary. Synthetic experiments with 5000-item pools further reveal an inverted-U relationship between pool size and retrieval quality, justifying capacity constraints as a retrieval noise phenomenon rather than a storage limitation.