首段注意力

·

研究论文 · 2026/10/21

First Passage Attention (FPA) 通过将键的 logit 按学习标量场在中间跨度上低于该键水平的最深下探成比例降低,从而用路径极值替代路径求和来增强 softmax 注意力。FPA 将 Forgetting Transformer (FoX) 作为特例包含在内,并且当标量场和水平遵循共享学习游走时,未受惩罚 logit 的存活键自然形成栈。理论表明,恒定维度的 FPA 头能实现后续下探留下的任意键子集,而带位置偏置或 token 级遗忘门的 softmax 头需要与键数成线性关系的头维度。合成实验中,单层 FPA 头收敛到目标集合,而可比的 softmax 和 FoX 基线在每个随机种子上都失败。扩展到 110M 参数语言模型时,FPA 在困惑度上与 FoX 相当,并独特地在 8 倍训练长度上实现完美 passkey 检索,即使键值缓存压缩到约 25%。

FPA 在保持困惑度与 FoX 相当的同时,显著提升了长上下文检索能力,并大幅压缩键值缓存,为高效长序列建模提供了新思路。

Augmenting softmax attention with forget gates typically relies on summing decay contributions along the key--query path. Because such accumulation is monotonic, these mechanisms cannot selectively erase intermediate context while preserving older, structurally relevant tokens. We propose First Passage Attention (FPA), which shifts from path summation to path extrema by lowering a key's logit proportionally to the deepest dip of a learned scalar field below that key's level over the intervening span. FPA encompasses the Forgetting Transformer (FoX) as a special case, and when the field and levels follow a shared learned walk, the alive keys with unpenalised logits naturally form a stack. We show that a constant-dimension FPA head realises any subset of keys left alive by subsequent dips, whereas softmax heads with positional biases or token-level forget gates require a head dimension linear in the number of keys. In synthetic experiments, one-layer FPA heads converge to these target sets while comparable softmax and FoX baselines fail on every seed. Scaling to a 110M-parameter language model, FPA matches FoX in perplexity and uniquely achieves perfect passkey retrieval at 8times the training length, even with its key--value cache compressed to about 25%.

阅读原文

参与讨论