Abstract
We show the formal equivalence of linearised self-attention mechanisms and fast weight controllers from the early '90s, where a "slow" neural net learns by gradient descent to program the "fast weights" of another net through sequences of elementary programming instructions which are additive outer products of self-invented activation patterns (today called keys and values). Such Fast Weight Programmers (FWPs) learn to manipulate the contents of a finite memory and dynamically interact with it. We infer a memory capacity limitation of recent linearised softmax attention variants, and replace the purely additive outer products by a delta rule-like programming instruction, such that the FWP can more easily learn to correct the current mapping from keys to values. The FWP also learns to compute dynamically changing learning rates. We also propose a new kernel function to linearise attention which balances simplicity and effectiveness. We conduct experiments on synthetic retrieval problems as well as standard machine translation and language modelling tasks which demonstrate the benefits of our methods.
Introduction
Standard Transformers have revolutionized sequence modeling, yet they suffer from a fundamental efficiency bottleneck: the self-attention mechanism scales quadratically ($O(L^2)$) with sequence length. While "Linear Transformers" were introduced to reduce this complexity to $O(L)$ via kernel-based approximations, they often struggle with long-range dependencies and memory capacity.
This paper reveals that these modern Linear Transformers are mathematically equivalent to "Fast Weight Programmers" (FWPs) developed in the early 1990s. In this framework, the model's weights act as a dynamic associative memory. By identifying this connection, we can address the two primary flaws of current linear attention: the inability to "edit" stored information and strict capacity limits.
Methods
The Delta Rule Update
In standard linear attention, the internal memory matrix is updated using a simple "sum rule," where new key-value pairs are cumulatively added. This treats memory like a bucket that eventually overflows, causing interference between old and new data.
We propose replacing this with a delta rule update. Before storing a new association, the model "queries" its current memory to determine the existing value for a given key. It then calculates the error between this prediction and the new target value, updating the memory matrix only by the amount necessary to correct the error. This allows the model to effectively overwrite or refine internal associations.
Deterministic Parameter-Free Projection (DPFP)
To improve memory capacity, keys and queries must be projected into a high-dimensional space. While existing methods like FAVOR+ rely on random sampling, we introduce DPFP. This deterministic approach uses a specific arrangement of rectified linear units (ReLUs) to ensure that different regions of the input space map to orthogonal dimensions in memory, minimizing crosstalk and maximizing the number of independent associations the model can store.
Key Results
The proposed methods were evaluated on synthetic retrieval tasks, WMT14 English-to-German translation, and WikiText-103 language modeling.
Memory Capacity and Retrieval
In synthetic tasks requiring the model to update associations when keys are reused mid-sequence, standard linear models failed. However, the Delta Network maintained near-perfect accuracy. Furthermore, our capacity analysis shows that DPFP variants scale much better than standard linear attention as the number of unique keys increases.
Language Modeling and Translation
On WikiText-103, the Delta Network significantly outperformed standard Linear Transformers, particularly on long-range dependencies. In translation tasks, DPFP matched the performance of more complex models like the Performer while remaining simpler to implement and more deterministic in its behavior.
Conclusion
By framing linear attention as a Fast Weight Memory system, we unlock new ways to improve Transformer efficiency. The Delta Rule provides a mechanism for dynamic memory editing, while DPFP offers a robust path to increased capacity. Future work will continue to explore even more sophisticated "programming instructions" to further bridge the gap between efficient linear models and standard Transformers.
Summary updated