20260617:目前有914 页
This commit is contained in:
46
concepts/token-position-decay.md
Normal file
46
concepts/token-position-decay.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: "Token Position-Decay (TPD)"
|
||||
created: 2026-06-05
|
||||
updated: 2026-06-05
|
||||
type: concept
|
||||
tags: [sparse-attention, position, budget, causal]
|
||||
sources: [[niu-stem-causal-sparse-attention]]
|
||||
---
|
||||
|
||||
# Token Position-Decay (TPD)
|
||||
|
||||
**Token Position-Decay** 是 [[stem-sparse-attention|Stem]] 框架的第一个核心组件,解决了传统稀疏注意力**统一 top-k 预算分配**的根本缺陷。
|
||||
|
||||
## 核心机制
|
||||
|
||||
传统方法:一层内所有 token 位置共享相同的稀疏预算 k。
|
||||
TPD:稀疏预算随 token 位置**指数衰减**——前面的 token 保留更多,后面的激进稀疏化。
|
||||
|
||||
```
|
||||
k_i = k_max × exp(-λ × i)
|
||||
```
|
||||
|
||||
其中 i 是 token 位置,λ 控制衰减速度。
|
||||
|
||||
## 为什么需要位置衰减
|
||||
|
||||
由 [[causal-information-flow|因果信息流]] 理论驱动:
|
||||
- **茎 token**(位置 0~t):V 向量参与几乎所有后续输出 → 需要更大的 k 来保护信号完整性
|
||||
- **叶 token**(位置 >t):V 向量仅影响局部 → 可以承受更高的稀疏率
|
||||
|
||||
均匀稀疏化将茎和叶同等对待 → 茎 token 被无差别剪枝 → 递归误差传播污染整个信号流(见 [[causal-information-flow|因果信息流]] 中的跨层递归分析)。
|
||||
|
||||
## 稀疏预算的定义
|
||||
|
||||
TPD 中的"稀疏预算"定义为 computed token pairs / full attention pairs 的比率:
|
||||
- 位置 0:预算接近 100%(几乎保留所有前序 token)
|
||||
- 位置 N:预算可能降至 10-20%(仅保留最近的关键 token)
|
||||
|
||||
Triton 的 [[block-sparse-attention|Block Sparse Attention]] 内核天然支持这种位置依赖的块级稀疏模式。
|
||||
|
||||
## 效果
|
||||
|
||||
- 总体稀疏预算与传统方法相同(总计算量不变)
|
||||
- 但预算的**分配**从"均匀"变为"前重后轻"
|
||||
- 在 RULER 和 LongBench 上以相同总体稀疏率获得显著更好的精度
|
||||
- 对深层网络(32+ 层)效果尤佳——递归误差积累在深层更严重
|
||||
Reference in New Issue
Block a user