20260617:目前有914 页

This commit is contained in:
2026-06-17 15:02:40 +08:00
parent e96b955fda
commit 91fac5b6fc
423 changed files with 20687 additions and 34 deletions

View 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~tV 向量参与几乎所有后续输出 → 需要更大的 k 来保护信号完整性
- **叶 token**(位置 >tV 向量仅影响局部 → 可以承受更高的稀疏率
均匀稀疏化将茎和叶同等对待 → 茎 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+ 层)效果尤佳——递归误差积累在深层更严重