OasisKV: Scaling In-Decode KV Cache Beyond HBM with Lookahead Sparse Prefetching
OasisKV把大模型生成文字时用的键值缓存大部分移出GPU,靠提前预测下一步真正需要的部分来预取,让解码吞吐量提升了近一倍
大语言模型逐词生成文本时,每一步都要回顾之前所有词元留下的键值缓存(KV cache),而这个缓存会迅速占满GPU容量有限的高速显存(HBM),尤其在长上下文场景下更为严重。OasisKV利用投机解码(speculative decoding)本来就会生成的草稿词元,不需要额外训练就能提前一步准确预测下一步真正会用到的KV块,再通过后台流水线从主机内存或远程内存把这些块预取到GPU显存中。基于vLLM实现后,在保持与全量注意力相比精度损失不超过0.7分的同时,把解码吞吐量最多提升了约2倍。
METAL LAB 解读图
OasisKV的提前预测与KV预取流程
证据状态已报告实测结果
- 问题所在长上下文解码需要把不断增长的KV缓存全部留在GPU显存中,限制了批处理规模和吞吐量
- 提前预测利用投机解码产生的草稿词元,在不训练专门预测器的情况下预测下一步会用到的KV块
- 筛选与限量传输将预测结果与GPU上已有的块比较,只拉取缺失的块,并按步骤设置上限以保证传输量在PCIe带宽预算之内
- 异步后台流水线预测、筛选、传输三个阶段在各层之间重叠执行,让数据传输隐藏在GPU计算过程之后
- 结果基于vLLM实现后,吞吐量最高提升约2.1倍,精度损失控制在0.7分以内,预填充解码分离场景下达到约2倍吞吐量
他们做了什么
- 问题背景:随着智能体类任务把上下文长度和推理长度都推得更长,KV缓存成为占用GPU高速显存(HBM)最多的部分,限制了批处理规模和吞吐量。
- 方法:OasisKV复用投机解码本就产生的草稿词元作为无需训练的信号,提前一步准确预测下一个解码步骤真正需要的KV块,再通过预测、筛选、传输三阶段的后台流水线,把这些块从主机内存或远程内存预取到GPU显存中。
- 实现:基于vLLM搭建原型,新增按注意力头的逻辑到逻辑映射机制管理分页KV池,并用限额淘汰策略控制每步允许拉取的KV块数量,使传输能被计算时间掩盖。
- 结果:在2048词元的KV预算下,精度与全量注意力(保留全部KV)相比差距不超过0.7分,在一个推理类工作负载上吞吐量比原生vLLM提升1.69倍(精度损失0.1分),在多GPU长上下文场景下最高提升2.1倍。
- 扩展:在预填充与解码分离的服务架构下,OasisKV相比传输全部KV的方式,每个请求所需传输的KV量减少6.5至9.7倍,吞吐量达到约2倍,解码节点主机内存占用减少2.2至2.6倍。

| HuggingFace Transformers stack | vLLM stack | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Dataset / Subset | Metric | Full | Quest | Δ | FreeKV | Δ | Full | Ours | Δ |
| Long input — Llama-3.1-8B-Instruct, LongBench v2 | |||||||||
| Overall | 29.62 | 29.42 | −0.20 | 29.03 | −0.59 | 30.23 | 29.62 | −0.61 | |
| Short | 34.44 | 34.44 | 0.00 | 35.00 | +0.56 | 35.56 | 33.89 | −1.67 | |
| Medium | 28.37 | 28.84 | +0.47 | 26.51 | −1.86 | 27.44 | 27.44 | 0.00 | |
| Long | 24.07 | 22.22 | −1.85 | 24.07 | 0.00 | 26.85 | 26.85 | 0.00 | |
| Long input — Qwen3-8B, LongBench v2 | |||||||||
| Overall | 32.21 | 31.61 | −0.60 | 31.01 | −1.20 | 33.60 | 33.20 | −0.40 | |
| Short | 36.67 | 37.22 | +0.55 | 36.67 | 0.00 | 39.44 | 38.33 | −1.11 | |
| Medium | 29.30 | 26.98 | −2.32 | 27.44 | −1.86 | 29.30 | 30.70 | +1.40 | |
| Long | 30.56 | 31.48 | +0.92 | 28.70 | −1.86 | 32.41 | 29.63 | −2.78 | |
| Long output — Qwen3-8B, reasoning | |||||||||
| Overall | pass@k | 81.41 | 78.86 | −2.56 | 77.91 | −3.50 | 78.84 | 78.18 | −0.66 |
| avg@k | 69.48 | 66.65 | −2.83 | 66.85 | −2.63 | 67.63 | 67.28 | −0.35 | |
| AIME24 | pass@8 | 86.67 | 86.67 | 0.00 | 80.00 | −6.67 | 83.33 | 83.33 | 0.00 |
| avg@8 | 77.50 | 75.42 | −2.08 | 72.08 | −5.42 | 79.17 | 76.67 | −2.50 | |
| AIME25 | pass@8 | 83.33 | 76.67 | −6.66 | 80.00 | −3.33 | 80.00 | 80.00 | 0.00 |
| avg@8 | 70.83 | 64.17 | −6.66 | 68.75 | −2.08 | 65.42 | 67.97 | +2.55 | |
| GPQA-Diamond | pass@4 | 74.24 | 73.23 | −1.01 | 73.74 | −0.50 | 73.20 | 71.21 | −1.99 |
| avg@4 | 60.10 | 60.36 | +0.26 | 59.72 | −0.38 | 58.30 | 57.20 | −1.10 |
| Fetch Ratio | Fetch | BW | TPS | AIME24 | |
|---|---|---|---|---|---|
| (GB/step) | (GB/s) | (tok/s) | avg@32 | pass@32 | |
| 0.01 | 0.30 | 5.0 | 2,178 | 74.90 | 90.00 |
| 0.02 | 0.60 | 9.8 | 2,066 | 75.10 | 90.00 |
| 0.05 | 1.49 | 23.8 | 2,083 | 75.94 | 86.67 |
| 0.10 | 2.87 | 31.4 | 1,421 | 76.77 | 86.67 |
| 0.20 | 4.34 | 34.0 | 1,035 | 77.40 | 93.33 |
| Fetch all | 5.05 | 33.5 | 824 | 76.46 | 86.67 |

研究结果
- 在2048词元的KV预算下,精度与全量注意力相比差距保持在0.7分以内。
- 在一个推理类工作负载上,吞吐量比原生vLLM提升1.69倍,精度损失为0.1分。
- 在多GPU长上下文服务场景下,吞吐量最高提升2.1倍。
- 在预填充解码分离服务中,相比全量KV传输,每个请求所需KV减少6.5至9.7倍,吞吐量达到约2倍,解码节点主机内存占用减少2.2至2.6倍。
- 在Qwen3-8B上,将每步拉取上限设为0.05时,精度与稠密方式相比差距仅0.1分(75.94对76.04),吞吐量达到全量拉取方式的2.5倍(2083 tok/s)。
可应用场景
- 为需要处理长上下文或长推理链的聊天机器人、编程智能体、网页操作智能体等服务降低GPU显存压力,提升并发请求处理能力
- 提升多GPU部署下长上下文大模型服务的吞吐量
- 在采用预填充与解码分离架构的大规模服务集群中,降低网络传输量和解码节点的主机内存占用

局限与待验证事项
- 评估仅限于特定模型(Qwen3-8B、Qwen3-32B、Qwen3-235B)和特定基准测试(AIME24/25、GPQA-Diamond、LongBench v2、GSM8K),能否推广到其他模型或任务尚待验证。
- 原型系统尚不支持前缀缓存,其在启用前缀缓存后对首字延迟(TTFT)的改善效果是基于分析建模估算的,并非实测结果。
- 已报告的数值是在特定硬件条件(H100 GPU、PCIe带宽等)下测得的,在其他互联方式或内存层级配置下结果可能不同。
- 预测仍会出现失误,需要额外的补偿性拉取,这会部分抵消解码阶段的网络流量节省效果。
为什么重要
GPU高速显存稀缺且昂贵,长上下文负载会迅速耗尽这部分资源,严重限制服务能同时处理的请求数量;这项工作展示了一种在几乎不损失精度的前提下,用同样硬件服务更多请求的路径。这对多GPU部署和预填充解码分离的大规模服务架构尤其重要,因为它直接关系到显存与内存成本能否被有效控制。
本文术语
- KV缓存 · 语言模型保存之前处理过的词元信息的缓存,每生成新词元时都需要参考它
- HBM · GPU上速度很快但容量有限的高带宽显存
- 投机解码 · 用一个小的草稿模型提前猜测未来几个词元,以加快生成速度的技术
- 预填充解码分离 · 把处理提示词的阶段(预填充)和逐词生成的阶段(解码)分别放在不同服务器上运行的服务方式
- 限额淘汰策略 · 限制每个解码步骤能新拉取多少KV块,以保证传输时间不超过可用的计算时间窗口
论文原文摘要(英文)
Large language model (LLM) inference serving is increasingly constrained by memory rather than compute. As long-context and long-form reasoning workloads become more prevalent, the key-value (KV) cache dominates both memory footprint and memory traffic during LLM token generation, i.e., decode. In particular, HBM capacity has become a scarce and costly resource that heavily limits inference batch size and system throughput. This paper presents OasisKV, a memory-centric LLM inference system design that alleviates HBM capacity pressure by decoupling full KV-cache storage from HBM during LLM decoding. Because decode-time attention is naturally sparse, OasisKV keeps only the KV entries of the most relevant tokens in HBMs for attention computation. We observe that future important tokens can be predicted accurately in advance using lookahead tokens drafted by speculative decoding (SD). OasisKV employs an efficient attention background pipeline to identify important KV blocks. They are then prefetched from higher-capacity memory tiers (e.g., host or remote memory) and staged in HBMs before being used in the next decode step. We implement OasisKV based on vLLM. The lookahead prediction is accurate enough to keep accuracy within 0.7 points of full attention under a 2,048-token KV budget. This lets OasisKV turn sparsity into throughput gain: 1.69times over dense vLLM on the reasoning workload at 0.1 points of accuracy loss, and up to 2.1times on multi-GPU long-context serving. Under prefill--decode disaggregation, OasisKV reaches about 2times dense throughput while admitting each request with 6.5--9.7times less KV and holding 2.2-2.6 less decode-node host memory than full KV transfer.
在 arXiv 阅读最新论文
- SWE-bench Science: Can Coding Agents Resolve Engineering Tasks in Science?让AI编程助手去修复真实科学软件,连最强的那个也有一半以上任务没做对
- FlashPrefill V2: Block-Sparse Prefill Attention for Long-Context LLM Serving把稀疏注意力从论文原型变成能真正上线服务的加速方案
- PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agents让客服AI坐席不只是拦住一个危险动作,而是把整个流程走对
- EXIMO: VLM Guided Exploration of VLA Policies不用人工遥控演示,让会说话的AI来教机械臂做新家务
- EnvHarness: Awakening Static Worlds for Agent Learning不重新搭建训练环境,而是给现有环境套一层可插拔组件,针对每个智能体的具体弱点重新塑形
- Remember, Verify, or Ask? Cross-Family Evaluation of Memory Commitment in LLM AgentsAI助手在该向你提问的时候,却更愿意自己去核实事实
- SynFlow: A Multidimensional Diachronic Semantic Analysis Toolkit一款把单词意义变化拆解到语法细节的开源分析工具
- Automated Summarization of Financial News Using Large Language Models and Retrieval-Augmented Generation: An Early Empirical Study (Fall 2023)用AI总结股市新闻发现:简单的摘要方法反而比时髦的检索增强技术更靠谱
METAL LAB 最新报道
图片来源: Can Xiao et al., arXiv:2608.08097, arxiv-nonexclusive