Sparse Attentive Backtracking: Temporal Credit Assignment Through Reminding

Nan Rosemary Ke, Anirudh Goyal, Olexa Bilaniuk, Jonathan Binas, Michael C. Mozer, Chris Pal, Yoshua Bengio

Introduction

Sparse Attentive Backtracking (SAB) is a novel Recurrent Neural Network (RNN) training mechanism that mimics human "reminding" to solve the credit assignment problem in long sequences. By using a sparse attention mechanism to jump directly to relevant past states during both the forward and backward passes, SAB captures long-term dependencies more effectively and generalizes to longer sequences than standard Backpropagation Through Time (BPTT).

The Credit Assignment Problem

Training RNNs to learn dependencies over long time spans is notoriously difficult. The standard method, Backpropagation Through Time (BPTT), requires the model to "unroll" and propagate gradients through every single intermediate step. For a sequence of thousands of steps, this is computationally grueling and highly prone to vanishing or exploding gradients.

To cope, researchers often use Truncated BPTT (TBPTT), which only looks back a fixed number of steps (e.g., 20). However, TBPTT is fundamentally blind to any relationship longer than its truncation window.

The authors argue that BPTT is also biologically implausible. Humans don't mentally replay every millisecond of the last month to understand why their car tire is flat today; instead, we are "reminded" of a specific event—like hitting a pothole two weeks ago. SAB aims to bring this "associative reminding" to machine learning.

How SAB Works

SAB augments a standard LSTM with a Sparse Attentive mechanism. The process consists of two main components:

1. Sparse Retrieval (Forward Pass)

As the RNN processes a sequence, it stores a subset of its past hidden states in a memory buffer. At each new timestep, the model uses a small neural network (an MLP) to compare the current state to all stored memories. Crucially, it uses a "hard" attention mechanism to select only the top $k$ most relevant memories, ignoring the rest. These selected memories are weighted and fused into the current hidden state.

SAB Forward Pass Architecture

2. Sparse Replay (Backward Pass)

During training, gradients don't just flow back one step at a time. They "teleport" through the attention links directly to the $k$ selected past states. When the gradient reaches a past state, the model performs a local TBPTT around that specific memory (looking back a few steps from that point). This allows the model to update the context of that specific memory without replaying the entire history in between.

SAB Backward Pass Gradient Flow

Key Insights and Ideas

  • Sparsity is a Feature, Not a Bug: Unlike standard Transformers that attend to everything in the past, SAB's sparsity forces the model to be selective. This competition for "attention budget" ensures that only the most informative landmarks in time receive gradients, preventing the signal from being washed out by noise.
  • Breaking the Truncation Barrier: SAB allows gradients to reach back thousands of steps even if the truncation length is very small. It effectively turns a long, linear sequence into a "small-world" graph with short-cuts.
  • Superior Generalization: One of the most striking findings is that SAB learns the logic of a task rather than just the timing. Because it learns to "look for" relevant triggers, a model trained on sequences of length 100 can still perform well on sequences of length 5000—a feat where vanilla LSTMs and even LSTMs with full self-attention fail completely.

Experimental Highlights

The authors evaluated SAB on a variety of tasks known for challenging long-term dependencies, including synthetic tasks (Copying and Adding), language modeling (PTB and Text8), and sequential image classification (pixel-by-pixel MNIST and CIFAR-10).

  • Copy Task: On a sequence length of $T=300$, SAB achieved ~99% accuracy, while vanilla LSTMs trained with BPTT struggled at ~35%.
  • CIFAR-10: SAB outperformed both LSTMs and the Transformer architecture on pixel-by-pixel classification, achieving 64.5% accuracy (compared to 62.2% for Transformers).
  • Transfer Learning: In the copying task, a model trained on length $T=100$ was tested on $T=5000$. SAB maintained 41% accuracy, whereas all other baselines dropped to random guessing (~12%).
  • Efficiency: SAB matched the performance of "Full Self-Attention" models but with significantly less computational overhead during the backward pass due to its sparse updates.

Limitations and Future Directions

  • Memory Selection: Currently, the model simply stores every $k$-th hidden state. The authors suggest that a more "intelligent" storage policy—based on surprise, saliency, or novelty—would be more biologically realistic and potentially more powerful.
  • Computational Complexity: While the backward pass is efficient, the forward pass still involves comparing the current state to all past memories ($O(t^2)$ complexity over time). To scale to truly massive sequences (millions of steps), a more efficient retrieval mechanism (like hierarchical memory or hashing) would be needed.
  • Inductive Biases: Adding stronger inductive biases to the retrieval mechanism could help the model identify "landmarks" even faster during training.

Summary updated

BibTeX
@inproceedings{ke2018sparse,
  author = {Nan Rosemary Ke and Anirudh Goyal and Olexa Bilaniuk and Jonathan Binas and Michael C. Mozer and Chris Pal and Yoshua Bengio},
  title = {{Sparse Attentive Backtracking: Temporal Credit Assignment Through Reminding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
}
Figure