Full text not available for this paper

ParaTTT: Parallelizing Test-Time Training Layers with Deep Memories

Summary (Overview)

  • Novel parallelization algorithm: The paper introduces ParaTTT (PTTT), an algorithm that parallelizes test-time training (TTT) layers with arbitrarily deep nonlinear memories by iteratively refining estimates of the inner-loop gradient trajectory.

  • Fixed-point formulation: The exact online gradient descent recurrence is shown to be a fixed point of the ParaTTT iteration, with a proven geometric convergence rate for a two-layer variant under sufficient contraction conditions.

  • Dramatic speedup over prior work: At 4K context, two PTTT refinement steps evaluate the inner-loop trajectory 32× faster than TTT-MLP's block approximation at matched error, and full 340M models train 4.9× faster than TTT-MLP.

  • Competitive language modeling performance: Models trained at 340M and 1.3B parameters match or exceed Gated DeltaNet and Mamba-2 baselines, with better recall on SWDE and FDA tasks, remaining competitive with same-size Transformers.

  • Practical convergence: Only 2 refinement iterations are needed in practice, with trained models achieving ~94% top-1 agreement with the exact sequential recurrence at N=2, saturating near 98% at the bf16 noise floor.

Introduction and Theoretical Foundation

Background: The Expressivity–Parallelism Tradeoff

Softmax attention scales poorly to long contexts due to quadratic compute and linear key–value cache growth. Recurrent language models address both problems by processing sequences in linear time with fixed-size states. Modern recurrent architectures (Gated DeltaNet, Mamba-2, gated linear attention) admit chunkwise-parallel evaluation: tokens within chunks are processed in parallel via dense matrix multiplications, while only the recurrent state propagates sequentially across chunks.

The central question: How can we make recurrent memory more expressive without sacrificing parallel evaluation?

Test-Time Training (TTT)

TTT treats the recurrent state as the weights of a small neural network trained online via gradient descent:

ℓt(W)=12∥fW(kt)−vt∥2\ell_t(W) = \frac{1}{2}\|f_W(k_t) - v_t\|^2

With a linear memory (fW(k)=Wkf_W(k) = Wk), this recovers the delta rule of DeltaNet/Gated DeltaNet. A nonlinear memory can adapt its features as well as its readout, but creates a sequential dependency: each token changes the weights at which the next token's gradient must be evaluated.

The Block Approximation Problem

Existing methods (TTT-MLP, Titans) use a block-wise approximation:

exact: Wj=Wj−1−ηj∇ℓj(Wj−1),block: Wtblk=Ws−∑j=s+1tηj∇ℓj(Ws)\text{exact: } W_j = W_{j-1} - \eta_j \nabla \ell_j(W_{j-1}), \quad \text{block: } W^{\text{blk}}_t = W_s - \sum_{j=s+1}^{t} \eta_j \nabla \ell_j(W_s)

This creates a fidelity–speed tradeoff: larger blocks reduce sequential depth but more coarsely approximate token-by-token learning.

Theoretical Foundation

The key insight is that the gradient step at each token is an outer product of the pre-activation gradient and the layer input:

ΔWt(l)=αtΔWt−1(l)−ηt(l)δzt(l)ht(l−1)⊤\Delta W^{(l)}_t = \alpha_t \Delta W^{(l)}_{t-1} - \eta^{(l)}_t \delta z^{(l)}_t h^{(l-1)\top}_t

Given a guess of the hidden-layer gradients D=(δz1:T(l))l<LD = (\delta z^{(l)}_{1:T})_{l<L}, this recurrence becomes linear in its state with known coefficients, reducing to a collection of linear recurrences (gated linear attention or Gated DeltaNet) that admit exact chunkwise-parallel kernels.

Methodology

Memory Architecture

The recurrent state is the set of weights W=(W(1),…,W(L))W = (W^{(1)}, \ldots, W^{(L)}) of an LL-layer MLP:

z(l)=W(l)h(l−1)+b(l),h(l)=σ(z(l))(1≤l<L),h(0)=k,fW(k)=W(L)h(L−1)z^{(l)} = W^{(l)} h^{(l-1)} + b^{(l)}, \quad h^{(l)} = \sigma(z^{(l)}) \quad (1 \le l < L), \quad h^{(0)} = k, \quad f_W(k) = W^{(L)} h^{(L-1)}

Each weight decomposes as Wt(l)=W0(l)+ΔWt(l)W^{(l)}_t = W^{(l)}_0 + \Delta W^{(l)}_t, where W0(l)W^{(l)}_0 is trained by backpropagation and ΔWt(l)\Delta W^{(l)}_t is the recurrent state.

Sequential Recurrence (the Target)

Wˉt−1(l)=W0(l)+αtΔWt−1(l)(decay),Wt(l)=Wˉt−1(l)−ηt(l)∂ℓt∂W(l)∣Wˉt−1(gradient step)\bar{W}^{(l)}_{t-1} = W^{(l)}_0 + \alpha_t \Delta W^{(l)}_{t-1} \quad \text{(decay)}, \quad W^{(l)}_t = \bar{W}^{(l)}_{t-1} - \eta^{(l)}_t \frac{\partial \ell_t}{\partial W^{(l)}}\bigg|_{\bar{W}_{t-1}} \quad \text{(gradient step)}

The ParaTTT Iteration

Each refinement consists of three chunkwise-parallel passes:

Step 1: Parallel forward pass. Given the current estimate DD, unroll the hidden-layer recurrence:

αtΔWt−1(l)ht(l−1)=−∑j<t(∏i=j+1tαi)ηj(l)δzj(l)(hj(l−1)⊤ht(l−1))\alpha_t \Delta W^{(l)}_{t-1} h^{(l-1)}_t = -\sum_{j<t} \left(\prod_{i=j+1}^{t} \alpha_i\right) \eta^{(l)}_j \delta z^{(l)}_j \left(h^{(l-1)\top}_j h^{(l-1)}_t\right)

This is gated linear attention with keys hj(l−1)h^{(l-1)}_j, values −ηj(l)δzj(l)-\eta^{(l)}_j \delta z^{(l)}_j, and gates αj\alpha_j. A "shifted" scan reads the state before the token's own write.

Step 2: Readout trajectory and its gradient. The readout runs exactly as a Gated DeltaNet on the features. The feature gradient is computed via:

et=ηt(L)Wˉt−1(L)⊤(Wˉt−1(L)ϕt−vt)=−Wˉt−1(L)⊤ute_t = \eta^{(L)}_t \bar{W}^{(L)\top}_{t-1}\left(\bar{W}^{(L)}_{t-1}\phi_t - v_t\right) = -\bar{W}^{(L)\top}_{t-1} u_t

where ut=ηt(L)(vt−Wˉt−1(L)ϕt)u_t = \eta^{(L)}_t(v_t - \bar{W}^{(L)}_{t-1}\phi_t) is the update token tt writes to the readout.

Step 3: Parallel backward pass. Propagate feature gradients through hidden layers via transposed reads:

(αtΔWt−1(l))⊤δzt=−∑j<t(∏i=j+1tαi)ηj(l)(δzj(l)⊤δzt)hj(l−1)\left(\alpha_t \Delta W^{(l)}_{t-1}\right)^{\top} \delta z_t = -\sum_{j<t} \left(\prod_{i=j+1}^{t} \alpha_i\right) \eta^{(l)}_j \left(\delta z^{(l)\top}_j \delta z_t\right) h^{(l-1)}_j

The estimate is updated by a damped Picard step:

D[n]=D[n−1]+λ(D^−D[n−1]),λ=0.8D^{[n]} = D^{[n-1]} + \lambda\left(\hat{D} - D^{[n-1]}\right), \quad \lambda = 0.8

Convergence Guarantees

Proposition 1 (Fixed point): The gradient sequence D⋆D^\star of the sequential recurrence is a fixed point of the iteration. Without damping, every iteration makes the estimate at one more token exact, so N≥TN \geq T iterations reproduce the sequential recurrence exactly.

Theorem 1 (Geometric convergence for L=2 with soft clipping): With soft clip nsoft(x)=x/1+∥x∥2n_{\text{soft}}(x) = x/\sqrt{1+\|x\|^2}, the iteration map FF is globally Lipschitz with constant:

ρ=ϵ(1+ϵ)Q2[cσ2(1+ϵ)(5+4ϵ)+hσ(2+ϵ)]≤(10cσ2+3hσ)ϵQ2for ϵ≤14\rho = \epsilon(1+\epsilon)Q^2\left[c^2_\sigma(1+\epsilon)(5+4\epsilon) + h_\sigma(2+\epsilon)\right] \leq (10c^2_\sigma + 3h_\sigma)\epsilon Q^2 \quad \text{for } \epsilon \leq \frac{1}{4}

where ϵ=ηˉ/(1−αˉ)\epsilon = \bar{\eta}/(1-\bar{\alpha}) and Q=V+w0Q = V + w_0. If ρ<1\rho < 1, the iteration converges geometrically:

∥D[n]−D⋆∥∞≤(1−λ(1−ρ))n∥D[0]−D⋆∥∞\|D^{[n]} - D^\star\|_\infty \leq (1 - \lambda(1-\rho))^n \|D^{[0]} - D^\star\|_\infty

Practical Design Choices

  1. Delta rule for hidden layers: Replaces gated linear attention with a gated delta rule that erases stale writes, giving substantially better recall.
  2. Centering: fW(kt)=W(L)ϕt−W0(L)ϕ0,tf_W(k_t) = W^{(L)}\phi_t - W^{(L)}_0\phi_{0,t} provides a nonzero readout Jacobian at initialization while keeping the initial output zero.
  3. Hyperparameters: L=2L=2 with hidden width dd, SiLU activation, per-head gain, λ=0.8\lambda = 0.8, N=2N=2 iterations during training.

Empirical Validation / Results

Language Modeling Performance (Table 1)

340M parameters, 24 layers, 15.7B tokens:

ModelWiki↓Lamb↓PIQA↑Hella↑ARC-e↑Wino↑ARC-c↑BoolQ↑SciQ↑SWDE↑FDA↑TQA↑DROP↑4K↑8K↑16K↑32K↑
GDN26.5729.6665.236.547.151.524.156.678.432.517.835.715.325.917.013.79.3
Mamba226.9945.8765.735.145.551.923.457.875.225.85.730.612.68.13.01.11.2
Transformer25.3439.2564.335.846.352.822.460.876.754.628.440.514.538.623.216.310.5
TTT-MLP26.1240.3565.235.146.350.823.358.577.233.116.235.213.931.520.413.012.4
PTTT (ours)25.4626.9365.337.748.651.224.159.879.041.920.339.614.432.620.715.616.0

1.3B parameters, 24 layers, 100B tokens:

ModelWiki↓Lamb↓PIQA↑Hella↑ARC-e↑Wino↑ARC-c↑BoolQ↑SciQ↑SWDE↑FDA↑TQA↑DROP↑4K↑8K↑16K↑32K↑
GDN15.7810.5672.254.960.058.928.153.986.759.027.052.915.250.834.118.817.5
Mamba215.4211.6273.653.558.054.128.253.987.756.721.554.514.833.419.611.34.9
Transformer15.0410.9171.553.558.056.429.957.788.375.331.953.715.278.156.743.417.4
PTTT (ours)15.219.0071.956.061.058.629.961.389.262.828.153.715.053.837.117.514.7

Efficiency Results

  • ParaTTT scales linearly in TT: one layer at N=2N=2 costs 4.7× a GDN layer
  • TTT-MLP's block-sequential form is 5.5× slower than ParaTTT at T=4096T=4096 and 8.5× at T=16,384T=16{,}384
  • Full 340M model trains at 37.9k tokens/s per node vs 7.8k for TTT-MLP (a 4.9× speedup)

Convergence Analysis

  • At T=4096T=4096, N=2N=2 matches the error of TTT-MLP at block size b≈5b \approx 5 in 32× less time
  • N=8N=8 approaches the bf16 noise floor
  • Trained models: ~60% top-1 agreement without iteration, ~90% at N=1N=1, ~94% at N=2N=2, saturating near 98%

Synthetic Tasks

  • Cumulative parity: ParaTTT reaches 96–100% at lengths up to 256, 79–90% at 512, 78–80% at 1024, while GDN/Mamba-2 fall to 52–55% at 1024
  • k-hop: ParaTTT and GDN solve every kk; Mamba-2 breaks at k=4k=4
  • MQAR: ParaTTT and GDN solve up to 32 pairs; only attention solves 64 pairs

Theoretical and Practical Implications

Theoretical Contributions

  1. Fixed-point formulation: Establishes that the exact online gradient descent recurrence is a fixed point of the ParaTTT iteration, with no contraction assumption needed for this result.

  2. Geometric convergence guarantee: Provides explicit Lipschitz bounds and convergence rates under sufficient contraction conditions (ρ<1\rho < 1), independent of sequence length.

  3. Finite-step exactness: Without damping, N≥TN \geq T iterations reproduce the sequential recurrence exactly in exact arithmetic.

Practical Implications

  1. Resolving the expressivity–efficiency tradeoff: ParaTTT narrows the long-standing gap between the expressivity of nonlinear recurrence and the efficiency of parallel sequence processing.

  2. No attention branch needed: Prior TTT architectures (LaCT, Titans) rely on sliding-window attention branches; ParaTTT is a pure recurrence updated at every token.

  3. Exact decoding: Decoding requires no iteration—one exact gradient step from cached weights—so NN affects only prefill cost.

  4. Centering is crucial: The centered readout is necessary to unlock gains from refinement; without it, models perform well without iteration but gain little from additional refinement.

  5. Training-iteration adaptation: Models adapt to the finite-NN prefill used during training, though exact recurrent decoding remains strong on recall tasks.

Conclusion

ParaTTT (PTTT) introduces a principled algorithm for parallelizing test-time training layers with arbitrarily deep memories through iterative refinement of the inner-loop gradient trajectory. The key contributions are:

  1. Algorithm: Three chunkwise-parallel passes per refinement (forward, readout+gradient, backward) that compose modified instances of existing parallel recurrences.

  2. Theory: Proof that the exact online recurrence is a fixed point, with geometric convergence for a two-layer variant under contraction conditions.

  3. Empirical results: 32× faster than TTT-MLP at matched error, 4.9× faster full-model training, competitive or superior language modeling performance versus linear recurrent baselines, and stronger recall on most tasks.

  4. Practical efficiency: Only 2 refinement iterations suffice in practice; decoding requires no iteration.

Future directions include extending the readout to other linear recurrent updates (momentum, preconditioning), deeper memories, and further analysis of the expressivity of the converged fixed point.

Related papers