TL;DR
The Feedback Transformer introduces a recurrent mechanism to the Transformer architecture by allowing every layer to access high-level representations from all previous time steps via a shared "feedback memory." This architectural shift enables smaller, shallower models to outperform much deeper standard Transformers on sequential tasks while providing significant speedups during inference.
What Problem Does This Paper Address?
Standard Transformers are fundamentally feedforward. While they use attention to look at the past, the architecture imposes a strict hierarchy: at any given time step $t$, a specific layer $l$ can only "see" representations from lower layers ($< l$) at previous time steps. This means the most abstract, high-level information computed in the past isn't immediately available to the lower layers processing the current input.
Furthermore, Transformers lack a natural mechanism for recursive computation. The number of transformations applied to an input is strictly bounded by the model's depth. This makes them struggle with tasks requiring state tracking, counting, or complex logical recursion—areas where traditional Recurrent Neural Networks (RNNs) typically excel, albeit with their own limitations regarding memory capacity and vanishing gradients.
Methods
The authors propose the Feedback Transformer, which replaces standard self-attention with a mechanism that attends to a consolidated memory of the past.
- Feedback Memory: At each time step $t$, the hidden states from all $L$ layers are aggregated into a single memory vector $m_t$. This is done by taking a weighted sum of the layers, where the weights are learnable scalar parameters normalized via softmax.
- Recurrent Attention: Instead of attending to layer-specific keys and values from the past, every layer at the current time step attends to the sequence of these aggregated memory vectors $\{m_{t-\tau}, \dots, m_{t-1}\}$.
- Shared Projections: To offset the loss of parallelization during training (since $m_t$ depends on all layers at $t$), the authors share the key ($W_k$) and value ($W_v$) projections across all layers. This reduces the memory footprint and speeds up the attention computation.
Datasets
The model was evaluated across a diverse set of benchmarks:
- Illustrative/Toy Tasks: A "Corridor" reinforcement learning task, Copy/Reverse sequences, Counting, and a Random Walk grid task.
- Algorithmic Tasks: Executing simple code-like statements (assignments, increments, conditionals).
- Language Modeling: WikiText-103 (word-level), Enwiki8 (character-level), and char-PTB.
- Machine Translation: WMT14 En-De and IWSLT De-En.
- Reinforcement Learning: Maze Navigation and a modified Morris Water Maze.
- Summarization: CNN-Dailymail.
Key Insights and Ideas
- Recursive Power: By feeding the highest-level abstractions back into the lowest layers, the model can perform recursive logic. A 2-layer Feedback Transformer can effectively act like a much deeper model by "re-processing" information through its feedback loop.
- Immediate Access to Abstraction: In a standard Transformer, it takes $L$ time steps for information from the top layer to influence the top layer's processing of a future token. In the Feedback model, that influence is immediate (1 time step).
- Efficiency through Compression: Storing one shared memory vector per time step instead of $L$ layer-specific vectors reduces the memory requirement for the KV cache from $O(L \times T)$ to $O(T)$, where $T$ is the context length.
- Shallow is the New Deep: The authors found that shallow Feedback models (e.g., 2 layers) often match or beat 6-layer standard Transformers. This is a huge win for deployment, as shallower decoders lead to much faster inference speeds.
Key Results
- Algorithmic Superiority: On the Random Walk task, the Feedback Transformer achieved 100% accuracy, while the standard Transformer struggled at 68%. On complex algorithmic code execution, it reached ~99% accuracy compared to the Transformer's ~33-37%.
- Robustness to Memory Constraints: In the Corridor RL task, the Feedback Transformer maintained high success rates even as the memory size was drastically reduced, whereas the standard Transformer's performance collapsed.
- Language Modeling SOTA: On Enwiki8, a relatively small 12-layer Feedback model (77M parameters) achieved a new state-of-the-art of 0.96 bits-per-byte, outperforming the much larger Transformer-XL (277M parameters).
- Translation Speedup: For WMT14 En-De, a Feedback model with a 2-layer decoder matched the BLEU score of a 6-layer standard Transformer while being significantly faster. Overall, the architecture allowed for up to 4x faster decoding in some configurations.
Limitations and Future Work
- Training Parallelism: The primary drawback is that the Feedback Transformer is inherently sequential. Unlike standard Transformers, which can process an entire training sequence in parallel, the Feedback model must compute $m_t$ before moving to $t+1$. While shared projections and larger batch sizes help, training remains slower (e.g., 3.5 days vs 1.2 days for WikiText-103).
- BPTT Constraints: Like RNNs, the model is still bound by the Backpropagation Through Time (BPTT) length during training, which can limit the learning of extremely long-term dependencies.
- Future Directions: The authors suggest exploring more sophisticated ways to compress or manage the feedback memory beyond simple weighted sums, and investigating how this architecture scales to massive "foundation model" sizes.
Summary updated