arXiv:2605.18825cs.LGcs.DC2026-05被引 2

根据提示语语义差异智能淘汰缓存,显著提升大模型推理速度。

Not All Tokens Are Worth Caching: Learning Semantic-Aware Eviction for LLM Prefix Caches

论文配图:Not All Tokens Are Worth Caching: Learning Semantic-Aware Eviction for LLM Prefix Caches
图 1 · 摘自论文原文
  • 按任务类型分队列管理缓存,不同内容用不同优先级。
  • 在线学习各词元重用价值,最高差756倍,精准决定留或删。
  • 自动适应部署环境,无需调参,避免传统方法失效风险。

前缀缓存是大语言模型服务中的关键优化技术,通过复用具有共享提示前缀的请求之间的注意力键值(KV)状态,减少昂贵的预填充计算开销。然而其效果高度依赖于缓存淘汰策略,而现有策略如LRU对缓存块一视同仁,忽略了提示语中不同词元类型(包括系统提示、用户查询、工具输出、模型回复及思维链推理)在重用率上高达756倍的差异。本文提出SAECache(语义自适应前缀缓存淘汰策略),通过三项创新解决该问题:(1) 多队列架构将KV块路由至任务特异性队列,使用定制化优先级指标,同时捕捉多轮对话中的会话重用与模板化单轮请求中的结构重用;(2) 语义感知词元加权机制,通过淘汰反馈在线学习不同词元类型的重用价值;(3) 完全自适应的在线学习框架,实现所有参数(包括对数正态时间参数、位置衰减幂、队列权重和元参数)的自动更新,无需人工调参,可自动适应特定部署负载特征。在多种异构工作负载上的广泛评估表明,SAECache相比生产级基线实现1.4x–2.7x的首次令牌延迟(TTFT)提升,而固定参数方案在负载不匹配时性能下降达2.7x——这一失败模式被我们的自适应方法完全规避。

原文摘要 · Abstract (English)

Prefix caching is a key optimization in Large Language Model (LLM) serving, reusing attention Key-Value (KV) states across requests with shared prompt prefixes to reduce expensive prefill computation. However, its benefit depends critically on the eviction policy as GPU memory is scarce, and existing policies such as LRU largely treat cached blocks uniformly. This view ignores a fundamental property of LLM prompts: not all tokens are equally worth caching. We show that different token types within a prompt, including system prompts, user queries, tool outputs, model responses, and chain-of-thought reasoning, exhibit up to 756x variation in reuse rates, yet no existing eviction policy exploits this signal. In this paper, we present SAECache (Semantic-Adaptive Eviction for prefix caches), a semantic-adaptive prefix cache eviction policy that addresses this gap through three innovations: (1) a multi-queue architecture that routes KV blocks to task-specific queues with tailored priority metrics, capturing both session reuse in multi-turn requests and structural reuse in templated single-turn requests; (2) a semantic-aware token weighting mechanism that learns the reuse value of different token types online through eviction feedback; and (3) a fully adaptive online learning schema for all parameter updates, including log-normal timing parameters, position decay power, queue weights, and meta-parameters, which eliminates manual tuning and enables automatic adaptation to deployment-specific workload characteristics. Through extensive evaluation across heterogeneous workloads, we demonstrate that SAECache achieves 1.4x-2.7x TTFT improvement over production-style baselines, while fixed-parameter alternatives can degrade by up to 2.7x under workload mismatch -- a failure mode our adaptive approach avoids entirely.

大模型推理缓存优化自适应系统

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。