Files
myWiki/concepts/heuristic-metric.md

58 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Heuristic Metric (KV Cache)"
created: 2026-06-18
updated: 2026-06-18
type: concept
tags: ["kv-cache", "evaluation-metric", "attention"]
sources: ["https://arxiv.org/abs/2602.08585"]
---
# Heuristic Metric
## 定义
Heuristic Metric启发式指标是 LU-KV 论文中的术语,指在 KV Cache 驱逐中用于评估 token 重要性的所有**可在线计算的近似指标**如注意力分数、Key 向量几何特征等)。与 [[oracle-importance]] 不同,启发式指标可以在推理中实时计算,但无法完美预测 token 的[[long-horizon-utility]]。
## 代表性启发式指标
| 指标 π | 计算方式 | 核心假设 |
|---------|---------|---------|
| SnapKV (π_1) | 累积注意力分数 + 观察窗口 | 高注意力 token 持续重要 |
| KeyDiff (π_2) | Key 向量差分模式 | 几何异常 token 更重要 |
| CAKE | 空间分散度 + 任务先验 | 分层级联规则 |
| KVZip | 上下文重构误差 | 重构关键 token 最重要 |
## 根本局限
所有启发式指标共享一个**结构性问题**
```
π(token) ≠ π*(token) (启发式分数 ≠ Oracle 重要性)
```
且偏差程度在不同 attention head 中不同:
- 某些 headπ 与 π* 高度一致 → 驱逐高效
- 某些 headπ 与 π* 严重失配 → 大量 False Positives 和 Misses → [[optimality-gap]]
## LU-KV 的应对
LU-KV 不试图改进启发式指标本身,而是:
1. 接受 π 的不完美性
2. 通过 [[offline-profiling]] 标定每个 head 中 π 的可靠性
3. 将更多预算分配给 π 可靠性高的 head高[[marginal-utility]]
4. 减少 π 可靠性低的 head 的预算(低边际效用)
这是**指标无关Metric-Agnostic**设计:任意 π 都可以作为 LU-KV 的输入。
## 相关概念
- [[oracle-importance]] — 启发式指标的理想参考标准
- [[optimality-gap]] — π 与 π* 的差距导致的额外损失
- [[intra-head-eviction]] — 启发式指标的主要应用场景
## 参考
- [[tang-lukv|LU-KV]] (Tang et al., ICML 2026)