Fathom:针对卸载KV缓存上稀疏解码的逐查询读取深度

·

研究论文 · 2026/09/17

当智能体会话达到百万token且多个会话同时驻留时,KV缓存及其排序索引位于主机内存中,为top-k步骤对所有n个键进行排序的扫描成为限制解码的流量瓶颈。我们提出Fathom,一种键扫描方法,其中每个查询决定读取每个键通道的多少位。4位K缓存以通道主序存储为位平面,因此t个平面的前缀恰好是该通道的t位量化器,查询通过对其通道的方差加权重要性进行反向注水来分配其位预算。在Qwen3-8B上处理百万token时,一个解码步骤的GPU时间比Double Sparsity、Loki和SparQ r=32的136位扫描快1.67倍,并且在相同的GPU时间内,Fathom比SparQ的68位读取(r=16)少读取18%的字节,在七种模型和上下文设置中的六种上具有更低的注意力误差。在RULER风格任务上,每个逐token扫描都与精确top-k解码匹配,在真实编码智能体会话中,Fathom以92位达到最准确的136位扫描的步骤一致性。存储是量化服务栈已持有的4位K副本,当索引驻留在GPU内存中时,该方法并不更快。

Fathom通过每查询自适应位读取显著加速了长上下文稀疏解码,在保持精度的同时减少内存流量,且兼容现有量化服务栈,对高效大模型推理有实用价值。

When agentic sessions run to a million tokens with many sessions resident at once, the KV cache and the index that ranks it live in host memory, and the scan that ranks all n keys for a top-k step becomes the traffic that bounds decoding. We present Fathom, a key scan in which each query decides how many bits of each key channel to read. The 4-bit K cache is stored channel-major as bit planes, so a prefix of t planes is exactly the channel's t-bit quantizer, and the query spends its bit budget by reverse water-filling over the variance-weighted importance of its channels. At one million tokens on Qwen3-8B a decode step is 1.67x faster in GPU time than with the 136-bit scans of Double Sparsity, Loki and SparQ r=32, and in the same GPU time as SparQ's 68-bit read (r=16) Fathom reads 18% fewer bytes with lower attention error on six of seven model and context settings. On RULER-style tasks every per-token scan matches exact top-k decoding, and on real coding-agent sessions Fathom reaches the step agreement of the most accurate 136-bit scan at 92 bits. The store is the 4-bit K copy a quantized serving stack already holds, and the method is not faster when the index is resident in GPU memory.

阅读原文

参与讨论