arXiv:2610.22714cs.CLOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.22714

First Passage Attention

Yuxuan Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

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 8×8\times the training length, even with its key–value cache compressed to about 25%.

1 Introduction

Transformers power most modern large language models, with softmax attention serving as their central operation (Vaswani et al., 2017; Jiang et al., 2023). Standard attention scores each earlier token by matching its key against the current query, typically incorporating relative positional encodings such as rotary embeddings or distance penalties (Press et al., 2022; Su et al., 2024). Intervening tokens between a key and a query do not directly enter this score. In many sequences, however, a subsequent event renders earlier information obsolete. A backspace deletes the last typed character, a closing bracket terminates an enclosed scope, and a reassignment overwrites a variable's value. Crucially, such events often invalidate a newer key while leaving older keys intact.

Several recent mechanisms modulate attention logits via sums, products, or transformations accumulated along the key–query path (Csordás et al., 2022; Golovneva et al., 2024; Tan et al., 2025; Yang et al., 2025; Zhang et al., 2026). The Forgetting Transformer (FoX) integrates recurrent forget gates into softmax attention to improve long-context modelling and length extrapolation (Lin et al., 2025a). Selective Attention allows tokens to mark earlier keys as obsolete (Leviathan et al., 2025), and Dynamic Context Pruning (DCP) drops keys to reduce inference memory (Anagnostidis et al., 2023). However, because these mechanisms aggregate path contributions via summation or multiplication, they face two structural limitations. First, token-level forget gates (as in FoX) attenuate keys monotonically with age, which makes it impossible to erase a recent token without simultaneously suppressing all older ones. Second, pairwise accumulation (as in Selective Attention and DCP) causes suppression to grow with the number of intervening steps (confounding the depth of an event with its duration) while incurring pairwise computation overhead.

We introduce First Passage Attention (FPA), which aggregates the key–query path by its minimum rather than its sum. Each head computes a scalar field at every position and a scalar level for every key. A key’s logit remains unattenuated (the key is alive) as long as the subsequent field stays at or above its level. Otherwise, FPA lowers the logit in proportion to the depth of the deepest dip below that level, regardless of how long that dip lasts. We show that a single linear parameterisation encompasses FoX, a bottleneck bias, and learned expiry (Sukhbaatar et al., 2021) as special cases. Most notably, when the field and levels share a learned walk (a prefix sum of per-token increments), any drop in the walk selectively eliminates only those alive keys whose levels lie above the new value. The alive keys naturally evolve as a stack, which allows a later token to erase a newer key while preserving older ones (Figure 1).

We prove that in one layer a single constant-dimension FPA head realises every dip-induced alive set, whereas softmax heads with positional biases or token-level forget gates need a head dimension linear in the number of keys. We also input

Figure

c

a

t

←

r

?

walk W

0

1

2

3

2

3

3

typed text car

query ? should read c, a, r

(a) Softmax attention

ℓts=qt⊤ks\ell_{ts}=q_{t}^{\top}k_{s}
key scatr
bias0000

c

24.7%

a

24.7%

t

24.7%

r

24.7%

rest

11.4%

The deleted t keeps its weight.

(b) Forgetting Transformer

ℓts=qt⊤ks+∑s<u≤tlog⁡fu\ell_{ts}=q_{t}^{\top}k_{s}+\sum_{s<u\leq t}\log f_{u}
key scatr
bias-4-4-40

c

11.7%

a

11.7%

t

11.7%

r

91.6%

rest

3.4%

Removing t also removes c and a.

(c) First Passage Attention

ℓts=qt⊤ks+βmin⁡(0,min⁡s<u≤tϕu−ψs)\ell_{ts}=q_{t}^{\top}k_{s}+\beta\min\left(0,\min_{s<u\leq t}\phi_{u}-\psi_{s}\right)
key scatr
level ψs\psi_{s}1233
$\min_{s2223
bias00-40

c

32.5%

a

32.5%

t

10.6%

r

32.5%

rest

11.8%

Only t is removed.

The bias of key s depends on (a) nothing after s (b) every forget gate after s (c) only the deepest dip of the field below the level of s

Figure 1: Three heads read the same typed word. A user types c, a and t, deletes t with the backspace key (←) and types r, so the query ? should attend to c, a and r. Every character has the content score qt⊤ks=2q_t^\top k_s = 2 and every other token -2. (a) Softmax attention has no term that a later token can change. (b) The Forgetting Transformer (FoX) can remove t only through a small forget gate fuf_u at ←, and that gate lowers c and a as well. (c) First Passage Attention (FPA) in its stack form uses the walk W as the field ϕ\phi and as the level ψ\psi, with strength β=4\beta = 4. Only t has a level above the lowest later value of W, so only t loses its weight.

prove that range extrema uniquely achieve duration-invariant suppression, so FPA fits variable-duration dips where additive selection fails, and that head-specific fields overcome the dimension bottleneck of layer-shared masks. We implement FPA in a deterministic Triton kernel that runs about as fast as PyTorch’s scaled dot-product attention (SDPA) in training. In preregistered one-layer probes, FPA learns our theoretical target families on most seeds, whereas the baselines that our lower bounds cover fail on every seed. We train a 110M-parameter FPA language model that matches FoX in perplexity and uniquely achieves 100% passkey retrieval at 4× and 8× its training length, even with about a quarter of its key–value cache.