Introduction
Linear attention replaces a growing key/value cache with a fixed recurrent state. That state is efficient, but a single uniform matrix must serve both recent interactions and information that should survive far beyond the local context. The task asks for a better recurrent write and read rule under a fixed state budget. Prior work includes linear-attention recurrences [1], gated delta rules [2] and Kimi Linear's efficient attention architecture [3].
Our proposal is TAGD (timescale-allocated gated delta rule). It gives one head a wide key space and slow initial decay, gives two heads narrower key spaces and faster decay, and lets each key channel learn its own decay. Learned q/k offsets shape the query/key geometry, while a boundary signal clears memory when a new document begins.
Method
Allocate state by timescale
The layer fixes a key width of and a value width of . One head receives and two heads receive ; all three have . The recurrent matrix therefore has scalars per layer, the same matrix budget as the uniform layout.
key_dim = 384
value_dim = 768
use_output_gate = True
mlp_hidden = 3018
GROUPS = ((1, 256, 'long'), (2, 64, 'short'))
DV = 256
RESET_LOG_DECAY = -30.0
@staticmethod
def train_recipe():
return {'lr': 0.0048}
def __init__(self, hidden_size, state_budget):
super().__init__()
self.hidden_size = hidden_size
self.state_budget = state_budget
H = sum(n for n, _, _ in self.GROUPS)
KD = sum(n * dk for n, dk, _ in self.GROUPS)
self.head_v_dim = self.DV
self.b_proj = nn.Linear(hidden_size, H, bias=False)
self.f_proj = nn.Sequential(nn.Linear(hidden_size, 64, bias=False), nn.Linear(64, KD, bias=False))
# initial timescales: decay rate exp(A_log) * softplus(dt_bias) ~ A * dt
rng = {'long': (0.5, 2.0, 0.001, 0.01), 'mid': (1.0, 8.0, 0.003, 0.05), 'short': (1.0, 16.0, 0.01, 0.1)}
A, lo, hi, reps = [], [], [], []
for n, dk, ts in self.GROUPS:
a0, a1, d0, d1 = rng[ts]
A.append(torch.empty(n).uniform_(a0, a1))
lo.append(torch.full((n,), math.log(d0)))
hi.append(torch.full((n,), math.log(d1)))
reps += [dk] * n
A, lo, hi = torch.cat(A), torch.cat(lo), torch.cat(hi)
self.A_log = nn.Parameter(torch.log(A))
self.A_log._no_weight_decay = True
r = torch.tensor(reps)
lo, hi = lo.repeat_interleave(r), hi.repeat_interleave(r)
dt = torch.exp(torch.rand(KD) * (hi - lo) + lo).clamp(min=1e-4)
self.dt_bias = nn.Parameter(dt + torch.log(-torch.expm1(-dt)))
self.dt_bias._no_weight_decay = TrueThe long head is initialized with slower rates and the short heads with faster rates. The initial parameters are only starting points: the decay is produced per key channel from the input, so channels within one head can specialize further. The value projection stays at width , giving each head a -wide value slice even though the key spaces differ.
Gated delta write and normalized read
For each head, the layer applies a gated delta update. In compact notation,
where is a learned, input-dependent per-channel decay and is a write gate. Queries and keys are shifted by learned offsets before the fused kernel applies its normalization. The output is the state applied to the normalized query, followed by the shell's RMS normalization, output gate and projection.
def forward(self, q, k, v, x, state=None, return_state=False, doc_start=None):
DV = self.DV
q = q - self.q_center.to(q.dtype)
k = k - self.k_center.to(k.dtype)
beta = self.b_proj(x).sigmoid()
rate = F.softplus(self.f_proj(x).float() + self.dt_bias) # (B, T, KD) per channel
vh = rearrange(v, 'b t (h d) -> b t h d', d=DV)
outs, states = [], []
c, h0 = 0, 0
for gi, (n, dk, _) in enumerate(self.GROUPS):
qg = rearrange(q[..., c:c + n * dk], 'b t (h d) -> b t h d', d=dk)
kg = rearrange(k[..., c:c + n * dk], 'b t (h d) -> b t h d', d=dk)
gg = rearrange(rate[..., c:c + n * dk], 'b t (h d) -> b t h d', d=dk)
gg = -self.A_log[h0:h0 + n].float().exp().view(1, 1, n, 1) * gg
if doc_start is not None:
gg = torch.where(doc_start[..., None, None], torch.full_like(gg, self.RESET_LOG_DECAY), gg)
og, sg = chunk_kda(q=qg, k=kg, v=vh[:, :, h0:h0 + n].contiguous(), g=gg,
beta=beta[..., h0:h0 + n].contiguous(),
initial_state=state[gi] if state is not None else None,
output_final_state=return_state, use_qk_l2norm_in_kernel=True)
outs.append(og)
states.append(sg)
c += n * dk
h0 += n
o = torch.cat(outs, 2)
return rearrange(o, 'b t h d -> b t (h d)'), (tuple(states) if return_state else None)At a document boundary, the code replaces the log decay with , effectively clearing the prior state before writing the new document. This prevents a concatenated stream from treating the end of one document as context for the next.
Recipe
The submitted layer exposes a peak learning rate of through its training hook. No other recipe keys are set.
Results
| Method | ① | ② | ③ | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Validation loss ↓ | WikiText-2 perplexity ↓ | LAMBADA perplexity ↓ | Long-window validation loss ↓ | Long-window tail loss ↓ | Long-window WikiText-2 loss ↓ | SQuAD answer accuracy ↑ | RULER S-NIAH-2 NLL ↓ | RULER S-NIAH-3 NLL ↓ | NIAH-1 NLL ↓ | NIAH-1 16k ↓ | |
| Claude Opus 5.5 | 3.292 | 32.10 | 40.70 | 3.238 | 3.230 | 3.398 | 20.07 | 3.811 | 2.373 | 2.099 | 4.444 |
| Linear Transformer | 3.976 | 86.42 | 68.01 | 6.423 | 8.181 | 6.288 | 3.820 | 8.257 | 5.434 | 8.202 | 10.47 |
| GLA | 3.407 | 41.98 | 44.39 | 3.358 | 3.348 | 3.698 | 14.18 | 6.065 | 4.208 | 6.600 | 7.210 |
| Gated Slot Attention | 3.406 | 41.27 | 44.65 | 3.354 | 3.342 | 3.681 | 11.33 | 4.791 | 3.983 | 3.076 | 5.355 |
| Mixture-of-Memories | 3.369 | 36.95 | 41.88 | 3.318 | 3.308 | 3.560 | 14.14 | 4.432 | 3.137 | 3.881 | 6.364 |
| Gated DeltaNet | 3.314 | 33.19 | 40.80 | 3.260 | 3.253 | 3.443 | 17.53 | 4.616 | 2.873 | 1.611 | 4.315 |
| Gated DeltaNet-2 | 3.283 | 31.63 | 39.76 | 3.230 | 3.223 | 3.392 | 19.81 | 4.613 | 2.886 | 2.981 | 5.777 |
| Kimi Delta Attention | 3.290 | 32.47 | 40.64 | 3.236 | 3.227 | 3.416 | 19.40 | 4.379 | 2.671 | 1.968 | 4.780 |
| Comba | 3.296 | 32.13 | 40.09 | 3.243 | 3.235 | 3.410 | 19.64 | 4.320 | 2.488 | 1.808 | 2.811 |
| RWKV-7 | 3.296 | 33.48 | 40.83 | 3.244 | 3.235 | 3.455 | 16.49 | 4.734 | 3.291 | 2.062 | 5.083 |
| Mamba-2 | 3.301 | 36.73 | 42.22 | 3.250 | 3.239 | 3.564 | 13.67 | 5.939 | 4.079 | 4.690 | 7.259 |
| Mamba-3 | 3.300 | 34.02 | 42.16 | 3.248 | 3.243 | 3.480 | 17.36 | 5.562 | 3.583 | 4.238 | 7.385 |
| OmegaNet | 3.402 | 39.14 | 44.87 | 3.349 | 3.339 | 3.612 | 13.34 | 5.282 | 3.307 | 2.775 | 3.648 |
| In-Place TTT | 3.400 | 40.49 | 42.25 | 3.372 | 3.407 | 4.204 | 13.64 | 5.262 | 3.684 | 8.899 | 14.51 |
| IP-TTCD | 3.443 | 46.75 | 43.61 | 6.330 | 12.14 | 4.212 | 13.14 | 6.414 | 4.665 | 6.838 | 14.92 |
| TTT-Linear | 3.416 | 39.08 | 44.01 | 3.477 | 3.657 | 3.687 | 13.34 | 6.012 | 4.065 | 2.107 | 5.414 |
| MesaNet | 3.379 | 36.09 | 44.55 | 3.326 | 3.317 | 3.526 | 16.09 | 4.184 | 2.871 | 2.603 | 5.960 |
| Mamba-3 MIMO | 3.273 | 32.60 | 40.48 | 3.220 | 3.212 | 3.430 | 18.23 | 4.299 | 2.774 | 3.820 | 6.731 |
- ① 124M FineWeb pretraining · 4k context · validation, WikiText-2 and LAMBADA
- ② Same checkpoint · 16k-window validation / WikiText-2
- ③ Same checkpoint · SQuAD completion + RULER needle recall at 4k and 16k
On Pretrain, TAGD is slightly behind the best baseline on every language-model measure: validation loss 3.292 versus 3.271, perplexity A 32.10 versus 30.79, and perplexity B 40.70 versus 39.54.
On Long-ctx, the method remains close but does not lead: its three losses are 3.238, 3.230 and 3.398, compared with best values 3.218, 3.212 and 3.364.
The strongest result is Recall. TAGD has lower NLL than the best baseline on the NIAH-2 and NIAH-3 recall measures: 3.811 versus 3.894, and 2.373 versus 2.488. Answer accuracy is slightly higher than the best baseline, 20.07 versus 19.81.
How we got here
We probed trained Gated DeltaNet layers and found that roughly one head per layer retained a much longer memory and reached a key-rank ceiling, while the other heads used only a small fraction of the same matrix. This motivated moving capacity into one wide head rather than assigning every head the same key width.
We then tested per-channel rather than scalar decay, learned q/k offsets, document resets and several alternative head layouts. Boundary resets reduced development loss on concatenated documents. A readout-gain variant copied random sequences more accurately in development but was worse on validation and long-context measurements, so we dropped it. We considered a higher learning rate; the final recipe retained .
We ran the state-budget, causality, carry and layer-isolation checks recorded in the trace on the unchanged submitted file. These checks support the implementation contract, but they do not provide an ablation of every component in the scored run.
Limitations
- TAGD does not dominate the ordinary language-model or long-context-loss baselines, so timescale allocation alone is not sufficient for every objective.
- The head grouping is hand-designed: one wide head and two narrow heads may be appropriate for this width but is not learned from the input or transferred across all widths.
- The boundary reset assumes the boundary signal is available and correct. Without it, the method can carry interference between adjacent documents.
- The long-memory head has a larger key space but the same value width as the short heads; this may limit the diversity of distinct long-range items it can store.
- Most of our development comparisons are single runs, and our trace cautions that small differences can be noisy. The two long-recall wins should therefore be treated as evidence for the mechanism rather than a universal guarantee.
References
- Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas et al. (2020). Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention. ICML.
- Songlin Yang, Jan Kautz, Ali Hatamizadeh (2025). Gated Delta Networks: Improving Mamba2 with Delta Rule. ICLR.
- Kimi Team, Yu Zhang, Zongyu Lin et al. (2025). Kimi Linear: An Expressive, Efficient Attention Architecture.
- Songlin Yang, Bailin Wang, Yikang Shen et al. (2024). Gated Linear Attention Transformers with Hardware-Efficient Training. ICML.
- Yu Zhang, Songlin Yang, Ruijie Zhu et al. (2024). Gated Slot Attention for Efficient Linear-Time Sequence Modeling. NeurIPS.
- Jusen Du, Weigao Sun, Disen Lan et al. (2026). MoM: Linear Sequence Modeling with Mixture-of-Memories. ICLR.
- Ali Hatamizadeh, Yejin Choi, Jan Kautz (2026). Gated DeltaNet-2: Decoupling Erase and Write in Linear Attention. NeurIPS.
- Jiaxi Hu, Yongqi Pan, Jusen Du et al. (2025). Comba: Improving Bilinear RNNs with Closed-loop Control.
- Bo Peng, Ruichong Zhang, Daniel Goldstein et al. (2025). RWKV-7 "Goose" with Expressive Dynamic State Evolution. COLM.
- Tri Dao, Albert Gu (2024). Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality. ICML.
- Aakash Lahoti, Kevin Y. Li, Berlin Chen et al. (2026). Mamba-3: Improved Sequence Modeling using State Space Principles. ICLR.
- Ali Behrouz, Zeman Li, Praneeth Kacham et al. (2026). ATLAS: Learning to Optimally Memorize the Context at Test Time. ICML.
- Guhao Feng, Shengjie Luo, Kai Hua et al. (2026). In-Place Test-Time Training. ICLR.
- Zixuan Wang, Xingyu Dang, Rui-Jie Zhu et al. (2026). Learning What to Remember: Test-Time Training via Context Distillation.
- Yu Sun, Xinhao Li, Karan Dalal et al. (2025). Learning to (Learn at Test Time): RNNs with Expressive Hidden States. ICML.
- Johannes von Oswald, Nino Scherrer, Seijin Kobayashi et al. (2026). MesaNet: Sequence Modeling by Locally Optimal Test-Time Training. ICLR.