Princeton University / Research talk
Linear Attention,
State Spaces, and RLT
Memory updates and computation across tokens
Based on A Note on Linear Attention and State Space Models
and Recurrent Looped Transformer
Arrow keys to navigate / O overview / N speaker notes
01 / A common language
The state-space view
| Object | Meaning | Question to ask |
|---|---|---|
| State \(h_t\) | Information carried into the next update | What must persist? |
| Input \(u_t\) | New data and conditioning features | What is available before the update? |
| Transition \(\mathcal F_\theta\) | The rule that transforms the state | Affine or nonlinear in the old state? |
The recurrence index can represent token position or network depth.
Note: Yifan Zhang and Sun-Yuan Kung
RLT: Yifan Zhang, Jichen Feng, Shihan Qin, Sun-Yuan Kung, and Mengdi Wang
Note / State-space representations / RLT / Sequence and state
02 / 1402 / Linear attention
Linear attention as recurrent memory
Key features \(a_t=\phi(k_t)\), query features \(b_t=\phi(q_t)\). Read after writing the current token.
State size \(O(md_v)\) stays fixed as the sequence grows. The vector \(z_t\) supplies the normalizer.
Note / Linear attention and original figure / Katharopoulos et al., 2020
03 / 1403 / Exact dual views
The same computation in attention form
Same outputs, different evaluation: a running state or a causal \(T\times T\) score matrix.
Unnormalized outputs shown. Normalized attention also divides each row by its kernel sum.
Note / Original recurrent and parallel views / Katharopoulos et al., 2020
04 / 1404 / Decay and selectivity
Selective SSMs and state-space duality
The SSM core
Mamba selects \(\Delta_t,B_t,C_t\) from layer inputs.
\(\bar A_t=\exp(\Delta_t A)\).
Scalar-transition SSD, with zero initial state
\(C\): queries, \(B\): keys, \(X\): values. Setting \(\rho_t=1\) recovers causal linear attention.
Note / Selective SSMs and SSD / Gu and Dao / Mamba, Fig. 1 / Dao and Gu / SSD
05 / 1405 / Corrective memory
DeltaNet writes the retrieval error
Write the retrieval error. The update is affine in the old state when the inputs are fixed.
Green arrows: writes. Dashed red arrows: key-dependent edits to the old memory.
Note / Delta Networks and original figure / Yang et al., 2024
06 / 1406 / The algebra of parallel evaluation
Why affine updates admit a scan
Fix a layer’s input sequence. Represent one transition by \((A_t,c_t)\):
Closed under composition
A segment of updates is still one affine map. Prefix composition is associative.
Structure controls cost
Additive, diagonal, scalar, and low-rank forms support efficient implementations.
A general nonlinear recurrence has no comparable fixed-size affine summary.
Note / Structured transitions / Mamba / Parallel scan / DeltaNet / Parallelization
07 / 1407 / Recurrent Looped Transformer
RLT: a Transformer decoder as the recurrent cell
Causal encoder
Known tokens produce \(e_t\) and prefix memory \(M_{\le t}\).
Gated feedback
Merge \(e_t\) with the previous final decoder output \(s_{t-1}\).
Full decoder update
SWA, cross-attention, and an FFN transform the merged input.
SWA = sliding-window attention.
Every output predicts the next token.
RLT / Encoder, gated merge, and decoder blocks
08 / 1408 / A nonlinear state-space system
RLT’s explicit state-transition function
Complete decoder state: \(H=(s,C^D)\), including the feedback vector and local KV cache.
One transition updates both \(s_t\) and \(C_t^D\), conditioned on encoder features and memory.
RLT / Method, with the current manuscript’s explicit state-space notation
09 / 1409 / RNN interpretation
Feedback extends the computation across tokens
Per token
\(L_E+L_D\) Transformer blocks.
The merge connects successive updates.
Across \(T\) tokens
The feedback path traverses \(T L_D\) decoder blocks with parameters reused.
Known-token encoding is parallel. RLT-1 decoder updates follow token order.
RLT / Prompt-state composition and depth accounting
10 / 1410 / RLT evidence
Length generalization depends on the depth split
Eight-layer models. Test accuracy at length 256, mean ± sample SD over three seeds.
| Task | RLT-1 allocation | GPT Layer 8 | RLT-1 |
|---|---|---|---|
| Parity Train: 3–40 bits | Layer 5 + 3 or Layer 7 + 1 | 50.07 ± 1.63% | 100.00 ± 0.00% |
| Swaps-\(S_5\) Train: 32 operations | Layer 4 + 4 | 0.85 ± 0.30% | 97.30 ± 2.76% |
Parity favors a shallow decoder. Swap tracking benefits from more decoder layers.
2,000 training steps, seeds 42–44, 1,024 shared test examples per length.
Each run selects its checkpoint using minimum in-distribution validation loss.
Layer counts match. Parameters and compute differ: RLT-1 has 26.10–28.73M parameters, versus GPT’s 25.31M.
RLT / Algorithmic experiments and length extrapolation
11 / 1411 / RLT-1 and RLT-2
Feedback frequency and parallelism
| At Layer 4 + 4 | Feedback interval | Parity / 64 bits | Swaps-\(S_5\) / 64 ops |
|---|---|---|---|
| RLT-1 | 1 token | 100.00 ± 0.00% | 100.00 ± 0.00% |
| RLT-2 | 4 tokens | 98.99 ± 1.66% | 19.60 ± 6.54% |
RLT-2 shares the previous boundary state within each chunk.
Known positions in a chunk run in parallel, then its last output updates feedback.
Final-answer/state accuracy, mean ± sample SD, seeds 42–44. Same checkpoint protocol as the previous slide.
RLT / Feedback frequency / RLT-2 / Chunk semantics
12 / 1412 / Comparing the mechanisms
State size and parallel evaluation
| Model core | Update in the previous state | Persistent memory* | Known-token evaluation |
|---|---|---|---|
| Linear attention | Additive / affine | Fixed matrix and normalizer | Prefix sums or chunked contraction |
| Selective SSM | Input-conditioned affine | Fixed state | Structured scan or SSD |
| DeltaNet | Affine rank-one edit | Fixed matrix | Structured chunk algorithm |
| RLT-1 | Nonlinear decoder cell | Bounded decoder state, growing encoder memory | Parallel encoder, sequential decoder |
*At fixed width, depth, and local window. State sizes refer to inference, excluding training activations.
Note / Linear attention, SSD, and Delta Networks / RLT / State and execution
13 / 1413 / Connection to RLT
The transition determines the computation
Structured recurrent memory
Linear attention, SSMs, and DeltaNet compress history through structured affine updates.
Nonlinear recurrent computation
RLT reuses a complete decoder cell across tokens and retains explicit context memory.
The state-space view connects the models.
The transition’s structure determines what can be composed efficiently.
Open question: can a structured transition retain RLT’s state-tracking gains?
Zhang and Kung / Linear Attention and SSMs / Zhang et al. / RLT
14 / 14