Files
myWiki/concepts/global-combinatorial-optimization.md

61 lines
2.1 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: "Global Combinatorial Optimization (KV Cache)"
created: 2026-06-18
updated: 2026-06-18
type: concept
tags: ["kv-cache", "combinatorial-optimization", "budget-allocation"]
sources: ["https://arxiv.org/abs/2602.08585"]
---
# Global Combinatorial Optimization for KV Cache
## 定义
Global Combinatorial Optimization全局组合优化是 LU-KV 将 head 级 KV Cache 预算分配形式化的数学框架。它将跨所有层、所有注意力头的预算分配问题建模为一个约束下的**全局优化目标**。
## 形式化
目标函数:最小化所有 head 的聚合驱逐损失
```
min Σ_{l=1}^{L} Σ_{h=1}^{H} L(M^π(b_{l,h}))
subject to Σ b_{l,h} = B_total
```
其中 L(M^π(b)) 是 head (l, h) 在预算 b 下使用指标 π 的驱逐损失。
## 问题性质
- **非凸**:每个 head 的离散损失序列 L(M^π(0)), L(M^π(1)), ..., L(M^π(T)) 对整数预算不满足凸性
- **高维**L × H 个变量(如 Llama-8B32 × 32 = 1024 个 head
- **离散**:预算 b 只能取整数值
精确 DP 求解在 profiling 规模下计算代价过高。
## LU-KV 的求解方法
1. **[[convex-hull-relaxation]]**:对每个 head 的离散损失序列做 PAVA 保序回归,得到凸代用序列
2. **边际增益计算**:从凸化损失计算 g_{l,h}(i)——分配的边际效用
3. **全局贪心**:每次将 token 分配给边际增益最大的 head
4. **最优性保证**:凸松弛后贪心解 = DP 最优解
## 与已有方法的对比
| 方法 | 分配策略 | 是否全局 |
|------|---------|---------|
| Uniform | 所有 head 等预算 | 否 |
| [[pyramidkv]] | 静态金字塔形 | 否(启发式) |
| [[adkv]] | 全局 Top-K 贪心 | 是(但基于原始分数,非边际效用) |
| LU-KV | 边际效用贪心 | 是(基于凸松弛 + 长视界效用) |
## 相关概念
- [[head-level-budget-allocation]] — 全局优化的具体对象
- [[marginal-utility]] — 驱动优化过程的边际增益
- [[oracle-importance]] — 损失函数的 ground truth
- [[cross-head-budget-allocation]] — 该优化问题的应用场景
## 参考
- [[tang-lukv|LU-KV]] (Tang et al., ICML 2026)