KV Cache Eviction Can Hide LLM Failures in Production
Tech
AI
LLM Inference
KV Cache
Reliability

KV Cache Eviction Can Hide LLM Failures in Production

一份有研究依据的测试计划,用于在更快的推理配置进入生产环境之前,将缓存导致的回归与困难任务区分开来。

Uygar DuzgunUUygar Duzgun
Jul 26, 2026
更新於 2026年8月12日
12 min read

是的。KV cache eviction 可能隐藏 LLM 失败,因为 serving policy 可能丢弃重要的 attention state,之后仅凭保留下来的 cache 又没有足够信息来估计损失程度。

一篇于 2026 年 7 月 23 日提交的论文为这个问题划定了明确边界:确定性的、value-blind top-k eviction 无法持续地仅凭保留状态估计其引入的 attention-output error。论文提出的替代方法会保留一部分被丢弃 tail 的概率样本,并围绕估计误差构建统计证书。该方法在报告的实验中改善了失败归因,但其 prototype 更慢,实验范围仅到 16K context 和 8B parameters,而且论文没有证明端到端的答案正确性。

在 rollout 之前,将每一种候选 cache treatment 都与相同冻结请求上的 full-cache control 进行比较。统计 full cache 通过而候选方案失败的情况。分别测试 eviction、quantization、offload 和 reuse,使每次比较只隔离一个误差来源。

读者水平: 高级。本指南假设你理解 transformer inference、attention 和基础 model evaluation。

目录

为什么 KV cache eviction 可能隐藏失败

Attention output 取决于保留的 entries 以及 policy 移除的 entries。确定性 policy 丢弃 tail 后,只能看到 selected set 的 monitor 无法检查缺失的 values。

ArXiv:2607.21475 研究了这一 observability problem。其 negative result 适用于确定性的、value-blind top-k eviction:仅凭保留状态,无法一致地估计 eviction 导致的 attention-output error。该结果并不是说每一种确定性 policy 都会产生较差的 outputs,而是说,这类 policy 无法仅凭保留下来的内容可靠地证明其引入的 error。

该方法会保留被丢弃 tail 的证据。它对原本会消失的 entries 进行 Poisson sampling,应用 Hájek correction,并将该估计与 retained-set variance certificate 结合起来。

已测量: Error certificate 在 12,096 个 attention replay cells 中记录到 0.97 的 coverage。另一项 real-workload study 使用约 74,000 次 generations 来测试 failure attribution。在该研究中,该 certificate 在区分 cache-induced failures 与 inherent model failures 时达到 AUC 0.73–0.75。Output confidence 在同一 attribution task 上达到 0.47–0.54。

已测量: Output confidence 更能预测整体 failure。两个 signals 回答的是不同问题:

Output confidence 估计答案是否可能失败。
Cache certificate 估计 cache approximation 是否可能导致了 failure。

推断: Low output confidence 不能作为唯一的 cache-regression alarm。它可能标记出一个较弱的答案,却无法识别原因;而一个 confident answer 在 cache policy 移除有用状态后仍可能发生变化。

论文还报告了 negative 和 operational results。预注册的七项 claims 中有三项失败。其 prototype 每 token 耗时 0.043 秒,而 deterministic eviction 为 0.023 秒,full cache 为 0.015 秒。实验覆盖最高 16K 的 contexts、最高 8B 的 models,以及 single-turn proxy。作者没有给出将该 certificate 与端到端 task correctness 连接起来的 theorem。

实际解读: 在研究条件下,将该 certificate 视为 attribution signal。它并不能证明适合生产环境。

四种 cache treatment,四个可靠性问题

团队经常将多种 intervention 归入“KV cache optimization”。每种 intervention 都会改变 inference 的不同部分。

TreatmentWhat changesReliability question
---------
Eviction移除选定的 key-value states后续 token 是否需要被移除的 state?
Quantization以更低 precision 存储保留的 states数值误差是否改变了 attention,进而改变结果?
Offload or tiering在 GPU、CPU 或其他 storage tier 之间移动 state移动、调度或实现行为是否改变了 availability、latency 或 correctness?
Reuse or prefix caching重用来自早期匹配 prefix 的 state该 state 是否来自正确的 model、prefix、configuration 和 isolation boundary?

arXiv:2607.08057 中的 system-aware survey 通过 temporal scheduling、spatial placement and migration,以及 structural representation and retention 对该领域进行分类。这个 taxonomy 也可以作为 evaluation boundary。将 full-cache BF16 control 与 evicted FP8 candidate 比较时,同时改变了两个 structural variables。候选方案失败时,无法判断 regression 是由 eviction、quantization 还是二者的 interaction 导致的。

实际解读: 将每种 cache intervention 作为独立实验进行测试。只有在各个 treatment 单独通过后,再将它们组合起来。

保留更多有用状态的 policies

另外两篇论文表明,在相同 memory budget 下,policy design 可以保留更多 quality。两者都没有提供 universal production threshold。

VaSE, arXiv:2606.03928 在保留 stochastic diversity 的同时保护 high-magnitude value states。在 Qwen3-4B 和 Qwen3-14B 的六项 reasoning tasks 中,它实现了约 4× cache compression,并且相较最强的 eviction baseline,结果分别提升 4.4 和 4.9 points。其中一个 16K、single-A100 setup 达到 3.1× tokens per second。

这些 measurements 仅覆盖 decode、Qwen3 models,且没有 production batching。它们无法证明在其他 model family、serving engine、concurrency level 或 workload 上也能获得相同收益。

K-VEC, arXiv:2606.29563 协调 attention heads 和 layers 之间的 retention coverage。在 Llama 3.1 8B 的 16 个 LongBench subsets 上,在 `B=128` 的 budget 下,它将 scores 提高了最高 10.35 points,平均提高 1.61 points。该 evaluation 使用单一 model family 和单一 benchmark suite,而且该方法增加了 prefill work。

实际解读: Value-aware、stochastic 和 coverage-aware policies 值得在 evaluation 中获得候选名额。你的 full-cache run 仍然是本地事实来源。

为什么 quantization 需要单独的 control

FP8 KV cache quantization 降低的是 precision,而不是移除 tokens。即使 engine 没有报错,其 errors 仍可能传递到 application。

一项于 2026 年 4 月 22 日发布的 official vLLM FP8 investigation 报告称,在 two-level accumulation fix 之前,long-context needle accuracy 从使用 BF16 cache 时的 91% 降至使用 FP8 时的 13%。该 fix 将 accuracy 恢复到 89%。在报告的最佳 FP8 configuration 中,decode slope 为 BF16 的 54%。

已测量: 一条 numerical path 产生了严重 regression,而 kernel-level correction 恢复了大部分损失的 accuracy。

尚未确立: FP8 cache 并不会普遍导致该 regression,也不会普遍带来该 speedup。结果取决于 implementation、model、hardware、attention path 和 benchmark。

vLLM issue #37554 提供了一个范围较窄的 warning:一名 reporter 在 hybrid model 上发现了 silent corrupted FP8 KV scaling。该 bug report 不能支持关于 FP8 或 hybrid architectures 的一般性 claim。

一则 4 月 7 日的 LocalLLaMA discussion 包含了关于 cache formats 和 quality 的相互矛盾的 practitioner reports。这些 reports 可以帮助提出 test cases,但 rollout 必须由 controlled evaluation 决定。

vLLM v0.26.0 release 发布于 7 月 25 日,包含来自 212 位 contributors 的 411 个 commits,并扩大了对 KV tiering、offload metrics 和 cache reuse 的 visibility。Release activity 和新的 observability features 并不能证明广泛的 production adoption 或 correctness。

成对的 full-cache validation workflow

将“full cache”定义为 model 的 native attention behavior,不添加 eviction 或 cache quantization。在每一对比较中固定 model weights、tokenizer、runtime version、attention backend、sampling settings、prompt tokens 和 output validator。

1. 运行 ablation matrix

至少使用四种 treatments:

RunRetentionPrecisionComparison
------------
AFullReference precisionControl
BFullCandidate quantizationA → B isolates quantization
CCandidate evictionReference precisionA → C isolates eviction
DCandidate evictionCandidate quantizationA → D measures the combined treatment
Optional EFullReference precision, with offload or reuseA → E isolates placement or reuse

仅比较 A 与 D 可以发现 combined regression,但无法归因。Runs B 和 C 提供了缺失的 controls。

分别测试每个 supported model、runtime、kernel 和 hardware path。vLLM FP8 result 说明了为什么“FP8 enabled”这样的 label 对 reliability decision 来说信息不足。

Paired KV cache validation diagram comparing full-cache and compressed inference outcomes
Paired KV cache validation diagram comparing full-cache and compressed inference outcomes

*Caption: 成对的 full-cache validation 会在 eviction 或 quantization 进入生产环境之前,隔离仅由候选方案导致的 failures。*

2. 冻结 workload matrix

根据真实 request shapes 构建 matrix,并加入 boundary cases:

Context length:short、typical、high-percentile 和 maximum supported。
Generation length:short answers、typical completions 和 long continuations。
Task type:retrieval、multi-step reasoning、structured output、tool selection,以及每条 application-specific critical path。
Cache pressure:目标 budget,以及 load 下允许的最小 budget。
Serving mode:isolated decode,以及具有代表性的 batching 或 concurrency。
Randomness:使用 greedy decoding 进行稳定的 mechanistic pair,然后在 production 使用 sampling 时进行 fixed-seed repeats。

Long-context workloads 需要的不只是 synthetic needle test。如果产品运行 code agents 或 extended workflows,应加入具有代表性的 traces。Token volume 和 workflow shape 会影响 More Tokens, Better AI — and the Compute Bill 以及 Code Agents, 21 Billion Activity Tokens, and the Fable of GPT-5.6 中所描述的 economics。

3. 配对 requests 并隔离 cache state

使用以下 evaluation logic:

text for each frozen_case: full = run(frozen_case, treatment=A, isolated_cache=true) candidate = run(frozen_case, treatment=candidate, isolated_cache=true)

full_pass = validate(full, frozen_case.expected_behavior) candidate_pass = validate(candidate, frozen_case.expected_behavior)

record(full_pass, candidate_pass, context_length, task_type, model, runtime, hardware, treatment)

这段内容是 pseudocode,而不是 engine-specific API。当多个答案都可能正确时,应使用 task validator,而不是 text equality。合适的 validators 包括 generated code 的 unit tests、structured output 的 schema checks、exact tool-and-argument checks、retrieval assertions 或 preregistered rubric。

保持 cache namespaces 隔离。在 treatments 之间重用 prefix state 可能污染比较。

4. 测量 candidate-only failures

使用以下 primary metric:

text cache_induced_failure_rate = count(full passes and candidate fails) / count(full passes)

分母将该 rate 限定在 full-cache success 上。一对比较中两次运行都失败,并不能说明 failure 是由 cache compression 导致的。

为每个 critical slice 报告 raw numerator 和 denominator。一个 aggregate 可能隐藏 maximum context、某个 model 或某个 attention backend 上的 regression。除了 paired metric,还要跟踪 total failure rate,因为 output confidence 和 cache-attribution signals 覆盖的是不同 failure modes。

5. 预先声明 decision rule

在查看 candidate results 之前,选择最大可接受 rate `τ`。对 critical tasks 设定更严格的 rules。即使 aggregate 低于 `τ`,一个可复现的 candidate-only failure 也可能足以让 tool、safety 或 transaction path 被拒绝。

Cache configuration 属于 execution policy。应使用与 deterministic AI-agent permissions 相同的 discipline 对其进行记录和执行:明确的 configuration、可观测的 decisions,以及 enforcement 失败时的 repair path。

Rollout 决策

EvidenceDecisionNext action
---------
没有有效的 full-cache pairsBlock修复 evaluation harness
Candidate 在整体或 critical slice 上超过 `τ`Reject增加 cache budget、更改 policy 或禁用 quantization
Aggregate 通过,但某个 model、kernel 或 context slice 出现 regressionHold隔离该 path 并重复 paired test
Offline pairs 通过,但 batching 或 production hardware 尚未测试Canary only采样 paired traffic 并保留 full-cache fallback
Paired results 在所有 supported paths 上通过,且 operational gains 得到复现Gradual rollout按 slice 扩大范围,同时保留 rollback thresholds
Online candidate-only failures 超过声明的 limitRoll back恢复最近一次通过的 full-cache 或 candidate configuration

Release-note activity、anecdotal reports 和 average benchmark gains 都不能替代 paired rollout gate。

当前证据的限制

最有力的 certificate result 覆盖的是 single-turn proxy 下的 attention-output error,而不是端到端 application correctness。其实验止步于 16K 和 8B,而 production systems 可能运行更大的 models、更长的 contexts、多轮交互、tools 和 batches。报告中的 measured prototype 在该 setup 下,每 token 所需时间也高于 deterministic eviction 和 full cache。

VaSE 和 K-VEC 仍然与特定 models、tasks、budgets 和 serving setups 绑定。vLLM evidence 表明,implementation details 可能主导 cache-format result。这些 sources 都没有提供 universal safe compression ratio。

实际解读: 使用这些 research 来选择 candidate policies 和 monitoring signals。使用 paired full-cache validation 来决定你的 implementation 是否满足 workload 的 reliability limits。

Claim checks

ClaimEvidence-based wording
------
“Deterministic eviction is unsafe.”过于宽泛。Negative result 针对的是 deterministic、value-blind top-k eviction 从 retained state 中进行 consistent self-estimation 的限制。
“The certificate detects wrong answers.”它估计 cache-induced attention error,并显示出有用的 failure attribution;但不存在端到端 correctness theorem。
“FP8 KV cache destroys accuracy.”一条 vLLM path 从 91% 降至 13%,修复后恢复到 89%。该结果具有 path-specific 性。
“Stochastic eviction is production-ready.”VaSE 和 certificate prototype 展示了 measured tradeoffs,同时存在 model、context、batching 和 speed limits。
“vLLM’s new metrics prove adoption.”它们提升了 visibility。Release scope 和 contributor counts 并不能证明 production use。

Sources

arXiv:2607.21475,提交于 2026 年 7 月 23 日 — deterministic eviction limits 和 stochastic error certification。
arXiv:2606.03928 — VaSE value-aware stochastic eviction。
arXiv:2606.29563 — K-VEC cross-head 和 cross-layer coverage。
arXiv:2607.08057 — system-aware KV cache survey。
vLLM FP8 KV-cache investigation,2026 年 4 月 22 日。
vLLM v0.26.0 release,2026 年 7 月 25 日。
vLLM issue #37554 — hybrid model 上 silent FP8 scaling corruption 的报告。
LocalLLaMA practitioner discussion,2026 年 4 月 7 日 — anecdotal、相互矛盾的 reports。