Sparse Attentive Backtracking: Long-Range Credit Assignment in Recurrent Networks

Nan Rosemary Ke, Anirudh Goyal, Olexa Bilaniuk, Jonathan Binas, Laurent Charlin, Chris Pal, Yoshua BengioarXiv 2017

Abstract

Recurrent Neural Networks (RNNs) struggle to learn long-term dependencies due to the vanishing gradient problem and the high computational cost of full Backpropagation Through Time (BPTT). We present Sparse Attentive Backtracking (SAB), a novel architecture that utilizes a sparse attention mechanism to create dynamic skip connections to relevant past states. By performing credit assignment only to a small subset of past microstates, SAB achieves the performance of full BPTT while remaining computationally efficient and biologically plausible. Our results on synthetic and real-world benchmarks demonstrate that SAB significantly outperforms standard truncated BPTT and even full BPTT on tasks requiring extremely long-range memory.

Introduction

Training RNNs to maintain information over long sequences is a fundamental challenge in deep learning. The standard training method, BPTT, requires gradients to flow backward through every intermediate time step, leading to vanishing or exploding gradients. While Truncated BPTT (TBPTT) mitigates computational costs, it is inherently limited by its truncation window, making it "blind" to dependencies that exceed that window. Sparse Attentive Backtracking (SAB) addresses this by allowing the model to "jump" back to relevant past states, effectively bypassing irrelevant intermediate steps during both the forward and backward passes.

Methodology

SAB introduces a semi-parametric RNN architecture where the model maintains a macrostate—a memory bank of past hidden states (microstates).

Sparse Attention and Dynamic Skip Connections

At each time step, the model employs an attention mechanism to compare the current state with all stored microstates in the macrostate. To ensure efficiency and decisiveness, a "sparsifier" (typically a ReLU-based function) selects only the top-$k$ most relevant past states. These selected states are then weighted and integrated into the current hidden state through dynamic skip connections.

The forward pass of SAB, illustrating how sparse attention selects specific past microstates to create dynamic skip connections.

Selective Backtracking

During the backward pass, gradients are propagated through the standard sequential chain (within a short truncation window) and directly through the high-attention skip connections. This allows for global credit assignment that is asynchronous with respect to the linear flow of time, replaying only the most salient memories to update the model weights.

Experimental Evaluation

The model was evaluated on several tasks designed to test long-term memory:

  1. Copying Memory Task: Remembering a sequence across long blank intervals.
  2. Adding Task: Summing specific numbers hidden within noise.
  3. Sequential MNIST: Classifying digits from a pixel-by-pixel stream (784 steps).
  4. Language Modeling: Character-level Penn Treebank (PTB) and Text8 datasets.

Results and Discussion

SAB demonstrated remarkable performance on synthetic benchmarks. In the Copying Memory Task with a sequence length of $T=300$, standard TBPTT failed to learn the task, while full BPTT achieved only ~36% accuracy due to gradient degradation. In contrast, SAB achieved 98.9% accuracy, proving its ability to bridge long temporal gaps.

Performance comparison on the Copying Memory Task (T=300), showing SAB's significant advantage over both TBPTT and full BPTT.

On real-world language modeling tasks (PTB and Text8), SAB matched or slightly exceeded the performance of full BPTT while maintaining the computational advantages of a truncated approach. This suggests that the sparse attention mechanism successfully identifies relevant context in natural language.

Conclusion and Future Work

Sparse Attentive Backtracking provides a scalable solution for long-range credit assignment in RNNs. By leveraging sparsity, the model avoids the "smearing" of gradients across irrelevant time steps. Future research will focus on optimizing the memory scaling of the macrostate—currently linear with sequence length—using techniques like Maximum Inner Product Search (MIPS) and exploring learned rather than hard-coded sparsity levels.

Summary updated

BibTeX
@misc{ke2017sparse,
  author = {Nan Rosemary Ke and Anirudh Goyal and Olexa Bilaniuk and Jonathan Binas and Laurent Charlin and Chris Pal and Yoshua Bengio},
  title = {{Sparse Attentive Backtracking: Long-Range Credit Assignment in Recurrent Networks}},
  year = {2017},
  eprint = {1711.02326},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.02326},
}
Figure