Files
myWiki/concepts/marginal-utility.md

56 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: "Marginal Utility (KV Cache)"
created: 2026-06-18
updated: 2026-06-18
type: concept
tags: ["kv-cache", "optimization", "economics-analogy"]
sources: ["https://arxiv.org/abs/2602.08585"]
---
# Marginal Utility in KV Cache Eviction
## 定义
Marginal Utility边际效用在 KV Cache 驱逐语境中指:**为一个 attention head 增加一单位预算(保留一个额外 token所带来的长期语义信息保存增量**。这是 LU-KV 框架的核心分配准则,借鉴了经济学中"边际收益"的概念。
## 形式化
在 LU-KV 的 [[convex-hull-relaxation]] 下head (l, h) 分配第 i 个 token 的有效边际增益为:
```
g_{l,h}(i) = L̆(M^π(i-1)) - L̆(M^π(i)) >= 0
```
其中 L̆ 是经过 PAVA 保序回归凸化后的损失函数。g_{l,h}(i) 单调不增——每多保留一个 token额外收益递减边际效用递减规律
## 分配策略
LU-KV 的贪心求解器基于边际效用比较:
1. 对所有 head 计算其边际增益序列 g_{l,h}(1), g_{l,h}(2), ...
2. 每次迭代:选择当前边际增益最大的 (head, token) 对
3. 分配该 token更新边际增益
4. 重复直到全局预算 B_total 耗尽
贪心解的最优性由凸松弛保证:凸化后的损失函数使边际增益满足递减性质,贪心即全局最优。
## 经济学类比
| 经济学概念 | LU-KV 对应 |
|-----------|-----------|
| 投资预算 | 全局 KV Cache 预算 B_total |
| 投资项目 | 不同的 attention heads |
| 边际收益 | g_{l,h}(i) — 保留额外 token 的效用增益 |
| 最优分配 | 各 head 边际收益相等时达到均衡 |
## 相关概念
- [[global-combinatorial-optimization]] — 边际效用驱动的全局分配形式化
- [[convex-hull-relaxation]] — 确保边际效用单调递减的前提
- [[oracle-importance]] — 边际效用的 ground truth 来源
- [[optimality-gap]] — 低边际效用的 head 意味着更大的 optimality gap
## 参考
- [[tang-lukv|LU-KV]] (Tang et al., ICML 2026)