跳到主内容
@wquguru
精选88MarkTechPost(RSS)产品发布/更新

清华开源AKV:基于SGLang的LLM Agent KV缓存工程系统

Tsinghua AI Open-Sources AKV, a Cache Engineering Server for LLM Agents on SGLang

原文
发到 X
推荐理由

Agent长上下文推理是刚需,AKV提供了不改动文本轨迹即可降本增效的工程化方案,实测数据扎实且开源可复现,做Agent部署的同学值得参考。

Tsinghua University and CUHK researchers open-sourced AKV, a serving system for KV cache engineering in LLM agents. Instead of summarizing old history, agents drop selected KV cache entries and keep reusing the rest. Across 3 models and 4 agent benchmarks, average cost falls 27.7%. Average task score rises 1.7 points. The code is Apache-2.0 licensed and builds on SGLang.

清华大学与香港中文大学研究人员开源了 AKV,这是一个面向大语言模型智能体 KV 缓存工程的 Serving 系统。智能体不再对旧历史进行摘要,而是丢弃选定的 KV 缓存条目并重复使用其余部分。在 3 个模型和 4 个智能体基准测试中,平均成本降低 27.7%。平均任务得分提升 1.7 分。代码采用 Apache-2.0 许可证,基于 SGLang 构建。

TL;DR

TL;DR(太长不看)

  • What it is: Serving system plus policy library, no weights. Tested on GPT-OSS-120B (5.1B active), MiniMax-M2.7 (230B total, 10B active) and MiroThinker-1.7-Mini (30B total, 3B active).
  • Runs on: NVIDIA GPUs via SGLang. Paper used 8 A800-80GB GPUs in BF16. Quick start serves GPT-OSS-120B on 2 GPUs (tensor parallel 2).
  • Performance: 27.7% lower average cost and +1.7 points average score versus threshold summarization.
  • Best: GPT-OSS-120B on SWE-bench Verified: cost per task 20.0 to 9.7 cents, score 40.0 to 43.2.
  • Worst: MiniMax-M2.7 on BrowseComp-Plus scores 58.9, 3.4 points below Text Engineering’s 62.3.
  • 它是什么:Serving 系统加策略库,不含权重。已在 GPT-OSS-120B(5.1B 激活参数)、MiniMax-M2.7(总计 230B,激活 10B)和 MiroThinker-1.7-Mini(总计 30B,激活 3B)上测试。
  • 运行环境:通过 SGLang 在 NVIDIA GPU 上运行。论文使用 8 块 A800-80GB GPU 以 BF16 精度运行。快速启动可在 2 块 GPU 上服务 GPT-OSS-120B(张量并行度为 2)。
  • 性能:与阈值摘要法相比,平均成本降低 27.7%,平均得分提升 1.7 分。
  • 最佳表现:GPT-OSS-120B 在 SWE-bench Verified 上的表现:每项任务成本从 20.0 美分降至 9.7 美分,得分从 40.0 升至 43.2。
  • 最差表现:MiniMax-M2.7 在 BrowseComp-Plus 上得分为 58.9,比 Text Engineering 的 62.3 低 3.4 分。

What is cache engineering, and how is it different from context engineering?

什么是缓存工程,它与上下文工程有何不同?

AKV is a Tsinghua serving system that lets LLM agents drop and reposition their own KV cache.

AKV 是清华大学的一个 Serving 系统,允许大语言模型智能体丢弃并重新定位其自身的 KV 缓存。

Context engineering trims or summarizes the text history. Editing that prefix invalidates every later KV state. The retained suffix must then be re-prefilled. Harnesses therefore summarize late and aggressively, which can lose details from middle rounds.

上下文工程会修剪或摘要文本历史。编辑该前缀会使所有后续的 KV 状态失效。因此必须对保留的后缀重新进行预填充。Harnesses 因此倾向于晚期且激进地进行摘要,这可能会丢失中间轮次的细节。

Cache engineering leaves the text trajectory untouched. It only changes which KV entries stay visible to attention. Retained entries are reused without recomputation. They can still carry information from dropped messages. In the research paper’s cost analysis, KV cache reads made up 82.4% of total API cost.

缓存工程保持文本轨迹不变。它仅改变哪些 KV 条目对注意力机制可见。保留的条目无需重新计算即可被重复使用。它们仍可携带已丢弃消息中的信息。在研究论文的成本分析中,KV 缓存读取占总 API 成本的 82.4%。

How does AKV work?

AKV 是如何工作的?

AKV defines 3 cache operations. Append is the standard update for new tokens. Drop removes selected entries from future attention without changing positions. Repos rewrites retained keys to positions 0 through r-1 using a RoPE rotation. Values stay unchanged, so no hidden states are recomputed. In ablations, adding Repos raised GPT-OSS-120B’s BrowseComp-Plus pass rate from 55% to 62%.

AKV 定义了三种缓存操作。Append 是新标记的标准更新方式。Drop 从未来的注意力计算中移除选定条目,但不改变其位置。Repos 使用 RoPE 旋转将保留的键重写至位置 0 到 r-1。值保持不变,因此无需重新计算隐藏状态。在消融实验中,加入 Repos 使 GPT-OSS-120B 在 BrowseComp-Plus 上的通过率从 55% 提升至 62%。

The hard part is serving. Identical tokens can produce different cache states under different operation histories. Plain prefix matching could reuse the wrong states. AKV extends SGLang’s radix tree with drop and reposition nodes. It frees dropped KV only when no active request still needs it. Segment-batch attention restores evicted states in 1 prefill pass.

难点在于 Serving。相同的 token 在不同的操作历史下可能产生不同的缓存状态。简单的匹配前缀方法可能会复用错误的状态。AKV 扩展了 SGLang 的基数树,增加了 drop 和 reposition 节点。它仅在没有任何活跃请求仍需要时才会释放被丢弃的 KV。分段批处理注意力机制在一次预填充过程中恢复被驱逐的状态。

What does the AKV API look like?

AKV API 是什么样的?

The interface is stateless and OpenAI-compatible. Clients send the full message history and two optional fields. drop_message maps a trigger message index to the messages to drop. reposition lists the indices after which positions get compacted.

该接口是无状态的,且与 OpenAI 兼容。客户端发送完整的历史消息以及两个可选字段。drop_message 将触发消息的索引映射到要丢弃的消息。reposition 列出在哪些索引之后进行位置压缩。

A CachePolicy builds those fields from a trigger, a selector and a reposition rule. Built-in policies are turn-based, token-based or model-based. A CacheTool lets the model call drop_context itself.

CachePolicy 根据触发器、选择器和重定位规则构建这些字段。内置策略包括基于回合、基于令牌或基于模型的策略。CacheTool 允许模型自行调用 drop_context。

How does AKV perform on agent benchmarks?

AKV 在智能体基准测试中的表现如何?

The main policy is a tool-response rolling drop that keeps the latest 12 tool responses. The Standard baseline summarizes at 96K tokens (192K for MiroThinker). Text Engineering summarizes at 48K. Benchmarks are BrowseComp-Plus, GAIA-Text, SWE-bench Verified and xbench-DeepSearch-2510.

主要策略是一种工具响应滚动丢弃机制,保留最新的 12 条工具响应。Standard 基线方案在 96K 令牌处进行摘要(MiroThinker 为 192K)。Text Engineering 在 48K 处进行摘要。基准测试包括 BrowseComp-Plus、GAIA-Text、SWE-bench Verified 和 xbench-DeepSearch-2510。

ModelStandard score / costText Eng. score / costAKV score / cost
MiniMax-M2.752.4 / 5.052.8 / 5.753.7 / 4.4
GPT-OSS-120B51.0 / 11.248.3 / 10.253.1 / 7.3
MiroThinker-1.7-Mini44.1 / 20.437.1 / 18.145.8 / 14.8
模型Standard 得分/成本Text Eng. 得分/成本AKV 得分/成本
MiniMax-M2.752.4 / 5.052.8 / 5.753.7 / 4.4
GPT-OSS-120B51.0 / 11.248.3 / 10.253.1 / 7.3
MiroThinker-1.7-Mini44.1 / 20.437.1 / 18.145.8 / 14.8

Average pass rate (%) and cost (US cents per task) across 4 benchmarks. Source: Table 1 of the paper.

4 项基准测试的平均通过率 (%) 和成本(每项任务的美分)。来源:论文表 1。

AKV also cuts cost 21.9% versus Text Engineering. The accuracy gap opens on long runs. On BrowseComp-Plus at 96K tokens and above, GPT-OSS-120B scores 37% with AKV. Standard scores 24% and Text Engineering 32%, per the project page.

与 Text Engineering 相比,AKV 还将成本降低了 21.9%。在长序列运行中,准确率差距逐渐显现。在 96K 令牌及以上的 BrowseComp-Plus 上,GPT-OSS-120B 使用 AKV 得分为 37%。根据项目页面数据,Standard 得分为 24%,Text Engineering 得分为 32%。

Costs are API-equivalent estimates from published rates. Repositioned tokens are charged at the cache-hit rate, a deliberately conservative choice.

成本是基于已公布费率的 API 等效估算值。重定位后的令牌按缓存命中费率计费,这是一种故意保守的选择。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件