NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Practical Real Time Recurrent Learning with a Sparse Approximation

Jacob Menick, Erich Elsen, Utku Evci, Simon Osindero, Karen Simonyan, Alex GravesICLR 2021

Training recurrent neural networks (RNNs) has long been a tug-of-war between memory efficiency and the ability to learn long-term dependencies. In their ICLR 2021 paper, researchers from DeepMind and UCL propose SnAp (Sparse n-step Approximation), a method that makes Real-Time Recurrent Learning (RTRL) practical by strategically sparsifying the Jacobian matrix.

The Bottleneck in RNN Training

Standard RNN training relies on Backpropagation Through Time (BPTT). BPTT requires storing the entire history of network states to compute gradients, meaning memory usage grows linearly with sequence length. For very long sequences, such as long-form text or extended reinforcement learning episodes, practitioners usually resort to "Truncated" BPTT. This saves memory but sacrifices the ability to learn dependencies longer than the truncation window.

The alternative is Real-Time Recurrent Learning (RTRL), a forward-mode differentiation method. RTRL doesn't need to store history and can update weights at every single timestep. However, it has a massive catch: its computational cost is $O(k^4)$ relative to the state size $k$. This makes it mathematically elegant but computationally impossible for any reasonably sized network.

Enter SnAp: Sparse n-step Approximation

The core idea of SnAp is to approximate the influence matrix—the Jacobian of the hidden state with respect to the parameters. In exact RTRL, this matrix eventually becomes dense because every parameter eventually influences every neuron.

Influence propagation over multiple timesteps

SnAp restricts this influence tracking to make the math tractable:

  • SnAp-n: Only tracks the influence of a parameter on hidden units that are reachable within $n$ timesteps in the computation graph.
  • SnAp-1: The most efficient version. It assumes a parameter only influences the specific neuron it is directly connected to. This makes the influence matrix effectively diagonal (or block-diagonal), reducing the cost to $O(k^2)$, which is the same complexity as a standard forward pass or BPTT.
  • Synergy with Sparsity: If the RNN itself is sparse (i.e., many weights are zero), the Jacobian stays sparse for more steps. This makes higher-order approximations like SnAp-2 or SnAp-3 tractable for large networks if they are sufficiently sparse (e.g., 95%+ sparsity).

Key Insights and Results

The authors evaluated SnAp on two primary benchmarks: WikiText103 (a large-scale language modeling dataset) and a Synthetic 'Copy' Task (measuring the "temporal horizon" or how far back in time the learning algorithm can "see").

  • Sparsity as an Enabler: While sparsity is often used to compress models, this paper uses it to make a specific learning algorithm viable. By increasing the state size while keeping the number of parameters constant (high sparsity), the authors achieve better performance for the same "FLOP budget."
  • SnAp-1 is a "Sweet Spot": Even though SnAp-1 is a crude approximation that ignores indirect influences, it performs surprisingly well. On WikiText103, SnAp-1 significantly outperformed other unbiased but noisy approximations like UORO (Unbiased Online Recurrent Optimization) and closely matched the "gold standard" BPTT.
  • Frequent Updates Beat Perfect Gradients: In the "fully online" setting (updating every step), SnAp methods could learn the Copy task where Truncated BPTT failed. This suggests that the "staleness" of the Jacobian in online learning is less damaging than the "blindness" caused by truncating history.
  • Massive Efficiency Gains: For a 1000-unit Vanilla RNN, SnAp-1 is roughly one million times cheaper than exact RTRL. When using sparse networks (98.4% sparsity), SnAp-2 becomes only ~22x more expensive than BPTT, making it a viable choice for researchers with decent GPU resources.

Limitations and Future Work

While SnAp represents a significant leap forward for RTRL, it comes with a few caveats. First, its theoretical efficiency relies heavily on sparse matrix operations. Current deep learning hardware (like GPUs and TPUs) is optimized for dense math; therefore, realizing the full "wall-clock" speedup requires specialized sparse kernels that are not yet standard in all frameworks.

Additionally, SnAp is a biased estimator. While the authors show the bias is manageable, it does increase over the course of training. Finally, the paper focuses exclusively on RNNs. While the authors mention that these ideas could apply to hybrid models or feedforward architectures with tied weights, scaling these forward-mode approximations to modern large-scale Transformers remains an open and exciting area for future research.

Summary updated

BibTeX
@inproceedings{menick2021practical,
  author = {Jacob Menick and Erich Elsen and Utku Evci and Simon Osindero and Karen Simonyan and Alex Graves},
  title = {{Practical Real Time Recurrent Learning with a Sparse Approximation}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=q3KSThy2GwB},
}
Figure