DeltaNet · Gated DeltaNet · GatedDeltaProduct · Trellis

Linear attention and bounded memory

Standard causal attention keeps past keys and values in a KV cache, so the stored history grows with context length. The models studied here replace that growing history with a fixed-size recurrent matrix state. Each token modifies the state and later tokens query it.

Across the matched experiments reported here, Gated DeltaNet is the strongest bounded-state baseline. Trellis beats the matched dense Transformer on long-document experiments, but does not beat Gated DeltaNet at the scales tested. Trellis results published at 125M parameters and above were not reproduced here.

1. Memory model

Growing KV cache versus fixed recurrent state

In causal attention, a token produces a key and a value. Future queries may attend to them, so inference retains those vectors. If the context doubles, the number of stored key/value vectors also doubles.

A bounded-memory model instead compresses prior tokens into a state whose dimensions are fixed by the architecture. The state can change indefinitely without becoming larger.

Dense causal attention

Retain one key/value record for every cached token.

KV memory ∝ context length
Bounded recurrent memory

Fold token history into a fixed matrix and query that matrix.

state dimensions = fixed

The trade-off is compression. Dense attention retains token-level history explicitly. A bounded state must decide what to preserve, overwrite, or forget.

2. Delta rule

DeltaNet stores key-value associations in a matrix

Let S ∈ Rdᵥ×dₖ be the recurrent memory. For one token:

S ← S + β(v − Sk)kᵀ
o = Sq

Sk is the value currently associated with k. The error v − Sk measures how far that association is from the desired value. The outer product with kᵀ writes a correction back into the state.

Least-squares lineage. This correction is the matrix-valued Widrow–Hoff delta rule: minimize squared retrieval error, then move the memory weights along its gradient. The same least-squares objective also has a batch numerical branch through Householder QR. The least-squares lineage page traces those two branches and shows where they reunite in DeltaNet.

When the current token updates the state before its query reads it, the implementation is write-before-read.

The update can also be written as:

S ← S(I − βkkᵀ) + βvkᵀ

This form exposes the identity-minus-rank-one transition that connects DeltaNet to the WY/UT blocking machinery.

3. Model differences

Four ways to update a bounded state

DeltaNet

Uses the delta-rule update above. After k, v, and β are known, the old state appears only linearly.

Gated DeltaNet

Adds a learned retention factor α so old state can decay:

S ← αS + β(v − αSk)kᵀ

The update remains affine in S.

GatedDeltaProduct

Uses several structured Householder-like updates per token. This increases overwrite capacity while keeping the transition affine in the recurrent state.

Trellis

Uses a learned nonlinear compression objective inside the memory update. Let M ∈ Rm×d be memory, k ∈ Rd an input key, and a ∈ Rm the target memory code:

L = ‖φ(Mk) − a‖²

With z = Mk and u = Jφ(z)ᵀ(φ(z) − a), one write has the form:

M ← βM − γukᵀ

φ is the compression nonlinearity, its Jacobian, β the retention gate, and γ the inner step size. Because u depends nonlinearly on M, this update is not affine in the state.

Affine in the state means that, after token-derived coefficients are fixed, the old state is only multiplied, scaled, and added to other terms. No nonlinear function of the current state appears in those coefficients.

4. Datasets, library, and metrics

Terms used in the results

TermMeaning
C4Colossal Clean Crawled Corpus, a large cleaned web-text dataset derived from Common Crawl and widely used for language-model training.
PG19A long-document language-modeling dataset built from Project Gutenberg books. It is useful here because documents are much longer than ordinary short web samples.
FLAFlash Linear Attention, the library supplying the reference DeltaNet, Gated DeltaNet, and GatedDeltaProduct implementations used in the matched comparisons.
PPLPerplexity. Lower is better. It is the exponential of the mean token negative log-likelihood.
NLLNegative log-likelihood. Here it is reported in natural-log units, or nats, per token. Lower is better.
5. Matched A100 anchor

Gated DeltaNet leads the first-order Trellis comparison

The A100 anchor used C4, model width 256, four layers, sequence length 2048, about 352M training tokens, fp32 master weights with bf16 autocast, FLA reference linear-attention layers, and the fused Trellis Triton kernel.

The Trellis arm used a chunk-start-stale forward: within each chunk, the nonlinear inner gradient is evaluated from the state at the start of the chunk rather than from the running token-by-token state. Its outer gradient was first-order, meaning it did not differentiate through the inner gradient computation. The FLA affine baselines use their exact chunked recurrences.

ModelVal PPL ↓Approx. non-embedding paramsTraining semantics
Gated DeltaNet78.494.48Mexact affine recurrence
DeltaNet89.774.21Mexact affine recurrence
Trellis152.544.74Mchunk-start-stale forward, first-order outer gradient
dense Transformer224.894.72Mdense causal attention

This run establishes the ordering for those implementations and semantics. It does not compare Gated DeltaNet against full-bilevel Trellis at a 352M-token budget.

6. Trellis training semantics

The forward approximation and the outer gradient are independent choices

Chunk-start forward

The Trellis paper divides the sequence into chunks and evaluates all nonlinear inner gradients in a chunk using the state at the beginning of that chunk. The paper explicitly presents this as an approximation that locally linearizes the nonlinear recurrence and enables a parallel scan.

The exact running-state recurrence instead recomputes each token's nonlinear write from the state produced by all earlier tokens. That path is sequential inside the chunk.

First-order versus full bilevel outer gradient

Trellis writes memory by taking a gradient of an inner objective. Training the surrounding language model can either differentiate through that inner gradient or treat the inner correction as a fixed value.

First-order

Detach the state used to form the inner gradient. The forward memory update is unchanged, but the higher-order derivative path is removed.

Full bilevel

Differentiate through the inner gradient. This introduces second-derivative terms, commonly evaluated as Hessian-vector products.

The two modes can therefore produce identical forward values and different parameter gradients.

7. Semantics-controlled C4 result

Gated DeltaNet and identity-bilevel Trellis tie at 20M tokens; Gated DeltaNet leads at 40M

These runs use model width 256, four layers, sequence length 2048, three paired seeds, the same packed C4 stream, and explicit Trellis forward/gradient semantics. For the Trellis write comparison, the inter-pass activation is held fixed while the compression write changes.

Write nonlinearity depends on gradient semantics

Trellis writeOuter gradient20M resultStability
identity / linearfirst-order~253.2 PPL across clean completions3 clean completions / 4 attempted seeds
SiLU nonlinearfirst-order251.6 PPL3/3
identity / linearfull bilevel244.5 PPL3/3
SiLU nonlinearfull bilevelno stable three-seed mean1/3 completed healthily

Under first-order training, SiLU is slightly better than the identity write. Under full-bilevel training, the identity write improves substantially while full-strength SiLU becomes unstable. The write cannot be ranked without stating the outer-gradient semantics.

Budget extension

Arm20M mean NLL ↓40M mean NLL ↓40M PPL ↓
Gated DeltaNet5.49655.1033164.6
identity-bilevel Trellis5.49815.1132166.2
SiLU first-order Trellis5.53005.1596174.1

At 20M tokens, Gated DeltaNet and identity-bilevel Trellis differ by only 0.0016 nat/token on mean NLL. At 40M, the Gated DeltaNet lead grows to 0.0099 nat/token. One seed still slightly favors identity-bilevel, but all three paired seed gaps move toward Gated DeltaNet as the budget increases.

Tempering the higher-order gradient

A tempered Trellis variant scales only the higher-order gradient path:

u = u_detached + ρ(u_live − u_detached)

The forward value of u is unchanged. With ρ = 0.5, all three seeds completed, where full-strength ρ = 1 SiLU lost two of three seeds. The tempered arm beat its paired first-order SiLU run in all three seeds by about 0.006 nat/token on average. The gain is small; the main result is the stability recovery.

8. Long-document result

PG19 shows a long-context advantage over the matched dense baseline

The PG19 comparison uses three seeds and held-out perplexity. These runs predate the later bilevel study: Trellis uses a first-order outer gradient. The operator column states whether the forward uses the exact running state or the chunk-start approximation.

ContextTrellis forwardTrellis PPLDense PPLRead
512running-state1542 ± 311581 ± 131tie; dense variance is large
1024chunk-start, C=161359 ± 61665 ± 114Trellis lower
1024running-state confirmation1517 ± 911635 ± 69win holds, high variance
2048chunk-start, C=16534 ± 31616 ± 11clean non-overlap
2048running-state confirmation585 ± 9621 ± 11win holds
4096chunk-start, C=16546 ± 1.5622 ± 5clean non-overlap

The 512-token cell is not evidence for a short-context win. The clear signal appears at longer contexts, especially 2048 and 4096. Running-state confirmations at 1024 and 2048 show that the dense-beating direction is not created solely by the chunk-start approximation.

On the same PG19 harness, Gated DeltaNet remains substantially stronger than Trellis: at context 1024, Gated DeltaNet reaches 1188 PPL versus Trellis 1517 and dense 1635; at 2048, it reaches 423 versus Trellis 585 and dense 621.

9. Why affine updates chunk exactly

DeltaNet composes exact state maps; Trellis linearizes its nonlinear write

For a token whose state update has the form

S' = SA + B

with A and B fixed after the token quantities are known, the update is affine in S. Composing two such updates gives another affine update, and the same remains true for an entire chunk.

DeltaNet and Gated DeltaNet have this property. Their rank-one transitions can be collected into compact factors and a triangular dependency solve, then applied with matrix multiplications. The historical route from Householder reflectors to this WY/UT representation is described separately.

Trellis does not satisfy the same condition because u = Jφ(Mk)ᵀ(φ(Mk) − a) changes nonlinearly with the running memory M. The paper therefore evaluates those nonlinear gradients from the state at the beginning of each chunk, making the within-chunk recurrence locally linear and parallelizable by scan.

Scope of the claim: the standard fixed finite WY/UT factorization applies exactly to the affine-state recurrence and does not represent Trellis's running-state nonlinear recurrence exactly. This is not a theorem that every nonlinear recurrence lacks every possible exact parallel algorithm.
10. Training throughput

The fused Trellis kernel removes launch overhead but remains slower than the affine kernels

Mixer-level forward-plus-backward throughput on an NVIDIA A100 with batch 8, sequence length 2048, model width 256, and four heads:

MixerTokens/sInterpretation
FLA Gated DeltaNet3.891Mfastest measured
FLA DeltaNet3.315Mfaster than dense attention in this mixer benchmark
dense multi-head attention2.941Mdense reference
Trellis fused Triton0.770Mabout 4× below Gated DeltaNet
Trellis Python0.121Mlaunch-bound implementation

The fused kernel raises Trellis from about 0.121M to 0.770M tokens/s, a 6.4× gain. The remaining gap is a measurement of these implementations, not a lower bound on nonlinear recurrent memory.

Decode has a different trade-off. A bounded state does not grow with context, but it is still a dense read-modify-write object every generated token. Its crossover against a grouped-query-attention KV cache depends on state size, precision, batch, context length, and hardware.

11. GatedDeltaProduct

Extra overwrite machinery does not improve the 20M-token C4 pilot

GatedDeltaProduct-2 uses two structured state micro-steps per token. On the synthetic overwrite/binding test it reaches 1.000 while Gated DeltaNet reaches 0.996, so both solve the intended overwrite task.

The language-model pilot uses C4, model width 512, ten layers, sequence length 2048, 20M tokens, and three seeds. It is width-matched rather than parameter-matched: GatedDeltaProduct-2 has about 49.9M parameters versus 44.7M for Gated DeltaNet and performs more recurrent work per token.

ModelVal PPL ↓Notes
Gated DeltaNet215.7244.7M params
GatedDeltaProduct-2224.3949.9M params; two micro-steps/token
DeltaNet254.50FLA reference
dense Transformer377.91dense reference

Gated DeltaNet leads GatedDeltaProduct-2 by about 0.039 nat/token in this early-training pilot. This result is specific to this scale and training budget.

12. Published Trellis results

The paper reports Trellis wins at larger scales

The Trellis paper reports results well above the model and token budgets used in this study.

Published settingTrellisGated DeltaNetResult
125M / 2.4B tokens, The Pile, 2K context10.87 PPL11.31 PPLTrellis lower
large C4 LM, 30B tokens20.28 PPL21.40 PPLTrellis lower
1B, RULER S-NIAH79.8 average75.8 averageTrellis higher

RULER is a synthetic long-context evaluation suite. S-NIAH denotes its single-needle-in-a-haystack retrieval tasks.

There is a small parameter-count inconsistency inside the paper: Table 1 labels the large language-model comparison 790M parameters / 30B tokens, while the appendix architecture table lists the corresponding large model as 780M / 30B. The values above are the Table 1 language-model results.

The 125M ablation also reports a linear compression write with the inter-pass activation held at LN-SiLU: 11.65 PPL versus 10.87 for full Trellis. At that published scale, the nonlinear write improves language-model perplexity by 0.78.

None of the 125M-and-larger published scale claims were reproduced in this study.

13. Result

Gated DeltaNet is the practical baseline for the measured regime

The experiments support four separate conclusions: