Skip to main content
QUICK REVIEW

[Paper Review] Linear Transformers Are Secretly Fast Weight Programmers

Imanol Schlag, Kazuki Irie|arXiv (Cornell University)|Feb 22, 2021
Neural Networks and ApplicationsComputer Science24 citations
TL;DR

This paper establishes a formal equivalence between linearised self-attention mechanisms and Fast Weight Programmers (FWPs) from the 1990s, revealing that linear Transformers implicitly learn to program fast weight memories via additive outer products of keys and values. It proposes a delta-rule-inspired update mechanism that enables dynamic memory editing and improved learning in overcapacity regimes, demonstrating state-of-the-art performance on language modeling and machine translation tasks with minimal computational overhead.

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.

Motivation & Objective

  • To reveal the formal equivalence between linearised self-attention and Fast Weight Programmers (FWPs), a class of models from the early 1990s.
  • To identify and address the memory capacity limitation in linear Transformers caused by purely additive outer product updates.
  • To propose a novel, differentiable programming instruction inspired by the delta rule, enabling the FWP to learn to correct key-value mappings dynamically.
  • To introduce a new, simple, and effective kernel function for linearising attention that balances computational efficiency and model performance.
  • To empirically validate the proposed method on synthetic retrieval tasks and standard NLP benchmarks, including machine translation and language modeling.

Proposed method

  • The paper establishes that linear self-attention mechanisms are formally equivalent to Fast Weight Programmers (FWPs), where a slow network learns to program fast weights via sequences of additive outer products of self-invented keys and values.
  • It introduces a delta-rule-like update rule as an alternative to purely additive outer products, allowing the FWP to learn to correct current mappings from keys to values through gradient descent.
  • The method replaces the standard additive update with a differentiable instruction that resembles the error-correcting delta rule, enabling adaptive memory editing.
  • A new kernel function is proposed to linearise the softmax attention mechanism, balancing simplicity and effectiveness for efficient sequence modeling.
  • The model is trained with truncated backpropagation through time, carrying forward fast weight memory across segments while limiting gradient computation to within-segment spans.
  • Experiments are conducted using custom CUDA kernels to ensure efficiency, with comparisons to standard Linear Transformers, Performer, and Transformer-XL on synthetic and real-world tasks.

Experimental results

Research questions

  • RQ1Is there a formal equivalence between linearised self-attention mechanisms and Fast Weight Programmers (FWPs) from the 1990s?
  • RQ2What are the limitations of purely additive outer product updates in linear Transformers, particularly regarding memory capacity?
  • RQ3Can a delta-rule-inspired update rule improve the FWP’s ability to dynamically edit memory contents in overcapacity regimes?
  • RQ4How does the proposed kernel function for linearising attention compare in simplicity and effectiveness to existing methods?
  • RQ5Can the improved FWP mechanism achieve state-of-the-art performance on standard language modeling and machine translation benchmarks?

Key findings

  • The Delta Network, using the proposed delta-rule update, achieves a test perplexity of 27.4 on Wikitext-103, outperforming the baseline Linear Transformer and matching Transformer-XL with a much smaller state size.
  • The Delta Network maintains stable performance even with unlimited context length, unlike the baseline Linear Transformer, which breaks under overcapacity conditions due to the naive sum update rule.
  • The model achieves 63 K words/sec inference speed with 13 GB memory usage, outperforming standard PyTorch Transformers (33 K words/sec, 17 GB) and being comparable to Performer (57 K words/sec).
  • The proposed kernel function enables linear attention with improved effectiveness and simplicity, balancing computational efficiency and model performance.
  • The FWP perspective enables the model to learn dynamic learning rates and selectively manage key-value associations, improving robustness in long-context scenarios.
  • The method demonstrates strong generalization on synthetic retrieval tasks and real-world NLP benchmarks, confirming the benefits of dynamic memory editing via gradient-learned programming instructions.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.