arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2611.02230cs.LGcs.CL
收藏

谁应该为缓存评分?KV缓存驱逐的最佳判断者是中层

Who Should Score the Cache? Mid-Depth Layers Are the Best Judges of KV-Cache Eviction

Colby College(科尔比学院)

Ekaterina Seregina

AI总结:

该研究发现KV缓存驱逐的最佳评分层为模型中层,提出通过校准提示选择评分层的方法,在18个模型中16个优于默认设置,在14B及以下模型有显著提升,且在长上下文任务中性能优于SnapKV。

摘要:

键值(KV)缓存驱逐方法通过注意力分数对token进行排序,且各层为自身缓存评分。据我们所知,尚无驱逐方法研究应由哪一层进行评分。我们在21个模型中发现,评分层的深度决定了驱逐质量。在18个具有分层缓存、参数规模从0.5B到109B的模型中,长上下文检索精度在浅层层崩溃,在深度的0.4至0.75之间达到峰值,在最后一层下降。该曲线的产生原因是,某一层只有在利用问题找到答案后才能准确判断token,这需要经过多个层。将驱逐建模为top-k切割,我们从预填充注意力计算答案存活概率,并复现了观测到的曲线。该方法通过带有已知答案的校准提示选择评分层,所选层在大多数模型上是最优层,且从未显著低于最优层。在18个模型中的16个上,它优于默认的自身层,其中7个模型(均为14B及以下规模)有显著提升;而在更大的模型上,默认层已接近最优中层。在严格预算下,从所选层对所有注意力头保留一组token的同时为各缓存评分,在5个14B及以下的模型上,比每头SnapKV高18至43个点。该增益在32K上下文的金融文件任务中也得以保持,且在相同内存预算下无需额外前向传播。相同的曲线解释了共享缓存模型中的惩罚:多个层读取一个缓存,写入该缓存的层默认进行评分。在Gemma-4-E2B模型中,写入层较浅,在10%预算下比中层读取层低28个点。我们还发现,在开卷问答任务(LongBench)中,没有中层能优于默认的自身层。

英文摘要:

Key-value (KV) cache eviction methods rank tokens by attention scores, and each layer scores its own cache. To our knowledge, no eviction method asks which layer should score. We find, across twenty-one models, that the depth of the scoring layer governs eviction quality. On the eighteen models with per-layer caches, spanning 0.5B to 109B, long-context retrieval accuracy collapses at shallow layers, peaks between 0.4 and 0.75 of depth, and degrades at the last layer. The curve arises because a layer judges tokens well only once it has used the question to find the answer, which takes several layers. Modeling eviction as a top-$k$ cut, we compute answer survival probability from prefill attention and reproduce the measured curves. This approach selects the scoring layer using calibration prompts with known answers, and the selected layer is the best layer measured on most models and never significantly below it. It improves on the own-layer default on sixteen of the eighteen models, with significant gains on seven, all at 14B or below, while on larger models the default is already close to the best mid-depth layer. Scoring every cache from the selected layer while keeping one set of tokens for all heads also beats per-head SnapKV by 18 to 43 points on five models up to 14B under tight budgets. This gain carries over to financial filings at 32K context, all at the same memory budget, with no extra forward pass. The same curve explains a penalty in shared-cache models, where several layers read one cache and the layer that writes it scores by default. On Gemma-4-E2B the writer is shallow and loses 28 points to a mid-depth reader at a 10% budget. We also find that in open-book question answering (LongBench) no mid-depth layer beats the own-layer default.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑