Parallelizing Linear Transformers with the Delta Rule over Sequence Length

Songlin Yang, Bailin Wang, Yu Zhang, Yikang Shen, Yoon Kim

Abstract

While linear transformers offer $O(L)$ complexity, they historically suffer from a "recall gap" compared to quadratic softmax attention. The delta rule—an online regression-based update—addresses this by allowing models to selectively overwrite memory. However, the sequential nature of the delta rule has previously limited its scalability on modern hardware. This paper introduces a hardware-efficient, chunkwise parallel algorithm for DeltaNet. By reparameterizing the delta rule as a series of Householder transformations and leveraging the compact WY representation, we enable DeltaNet to scale to billions of parameters. Our results demonstrate that DeltaNet outperforms strong baselines like Mamba and GLA in both perplexity and downstream tasks while achieving up to a 30x speedup over sequential implementations.

1. Introduction

Standard Transformers rely on softmax attention, which exhibits quadratic complexity ($O(L^2)$) relative to sequence length. This scaling bottleneck has led to the development of "linear transformers," which reduce complexity to $O(L)$. Despite their efficiency, these models often struggle with associative recall—the ability to retrieve specific information from earlier in a long context.

The delta rule was proposed to bridge this gap. By treating memory updates as an online regression problem, the delta rule allows a model to "write over" old or unimportant information, effectively prioritizing relevant data. However, the original formulation of the delta rule was strictly sequential, making it computationally expensive to train on GPUs designed for massive parallelism. This work presents a mathematical framework to parallelize the delta rule across the sequence length dimension without sacrificing its superior memory capacity.

2. Methods

The primary contribution of this work is a mathematical "bridge" connecting the delta rule to hardware-efficient computation through three key innovations:

2.1 Householder Reparameterization

We demonstrate that the delta rule update—which subtracts a prediction error from the current state—is mathematically equivalent to a generalized Householder transformation. In linear algebra, a Householder transformation reflects a vector about a plane. By framing the update as a rank-one update of the state matrix, we can utilize established numerical linear algebra techniques.

2.2 Compact WY Representation

Recognizing the Householder connection allows the application of the "compact WY representation." This technique expresses a product of many Householder matrices as a single, memory-efficient update. This representation is the key to bypassing the sequential bottleneck, as it allows us to compute the cumulative effect of multiple updates in a single operation.

2.3 Chunkwise Parallelism

To balance speed and memory efficiency, we implement a "chunkwise" approach. Rather than processing the sequence one token at a time (recurrent) or all at once (parallel), the algorithm processes local blocks in parallel while passing a hidden state between them. This strikes an optimal balance for modern GPU architectures.

2.4 Hybrid Architectures

We also explore hybrid models that interleave DeltaNet layers with either sliding-window attention (SWA) or a small number of global attention layers. These hybrids aim to combine the efficient long-range modeling of DeltaNet with the precise local modeling of standard attention.

3. Experimental Evaluation

3.1 Synthetic and Recall Benchmarks

DeltaNet was first evaluated on synthetic tasks like Multi-Query Associative Recall (MQAR). In these tests, DeltaNet achieved near-perfect accuracy even at low dimensions where other linear models, such as Mamba, began to fail. Further testing on real-world retrieval tasks (FDA, SWDE, and SQuAD) confirmed its superior ability to extract key-value pairs and perform reading comprehension.

3.2 Language Modeling and Downstream Tasks

We trained DeltaNet models on the SlimPajama dataset (15B tokens for 340M models; 100B tokens for 1.3B models). The 1.3B DeltaNet model outperformed both Mamba and Gated Linear Attention (GLA) in perplexity and zero-shot accuracy across standard benchmarks including LAMBADA, PiQA, and HellaSwag.

Our 3B parameter model, DeltaNet-3B, proved competitive with state-of-the-art models like Llama-3.2-3B and RecurrentGemma-2B, outperforming other recurrent architectures of similar scale.

4. Efficiency and Scaling

The chunkwise algorithm achieved up to a 30x speedup over the sequential recurrent implementation as sequence lengths increased. This efficiency allows DeltaNet to scale to the multi-billion parameter regime, which was previously impractical for delta-rule-based models.

5. Discussion and Limitations

Despite its advantages, DeltaNet still lags slightly behind GLA in raw training throughput due to the computational overhead of modeling state-to-state dependencies. Additionally, DeltaNet currently lacks an explicit "decay" factor (common in models like RetNet), which may limit its ability to generalize to sequences significantly longer than those encountered during training. Future work will investigate adding gating terms to the recurrence and utilizing block-diagonal matrices to expand the "head dimension" of the internal memory states.

6. Conclusion

By reinterpreting the delta rule through the lens of Householder transformations, we have enabled the first hardware-efficient, large-scale implementation of DeltaNet. This work demonstrates that linear transformers can achieve high-fidelity associative recall without sacrificing the parallelization necessary for modern deep learning.

Summary updated

BibTeX
@inproceedings{yang2024parallelizing,
  author = {Songlin Yang and Bailin Wang and Yu Zhang and Yikang Shen and Yoon Kim},
  title = {{Parallelizing Linear Transformers with the Delta Rule over Sequence Length}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=y8Rm4VNRPH},
}
Figure