Optimal Gradient Checkpointing for Sparse and Recurrent Architectures using Off-Chip Memory

Wadjih Bencheikh, Jan Finkbeiner, Emre NeftciarXiv 2024 · DOI

Introduction

Training Recurrent Neural Networks (RNNs) and Spiking Neural Networks (SNNs) on long temporal sequences presents a significant memory challenge. Backpropagation Through Time (BPTT) requires storing the network's state at every timestep to compute gradients during the backward pass. As sequence lengths grow, the memory requirement scales linearly, often exceeding the capacity of high-speed local memory (SRAM) on modern AI accelerators. This "memory wall" limits the complexity and temporal depth of bio-inspired models.

The Memory Wall in Recurrent Architectures

Standard BPTT stores all $T$ states locally. While gradient checkpointing—storing only a subset of states and recomputing others—reduces memory to $O(\sqrt{T})$, it introduces computational overhead. On tile-based architectures like the Graphcore Intelligence Processing Unit (IPU), which features small, fast local memory and larger, slower off-chip "streaming" memory, the trade-offs between computation and communication become critical.

Comparison of Standard and Remote Checkpointing strategies. Standard checkpointing reduces local memory to $\sqrt{T}$, while Remote checkpointing offloads these checkpoints to off-chip memory.

Proposed Methodology: Double Checkpointing

The authors introduce Double Checkpointing, a hierarchical strategy designed to exploit the multi-tier memory systems of modern hardware. This method utilizes four levels of complexity:

  1. Plain BPTT: Baseline with linear memory scaling.
  2. Standard Checkpointing: Local storage of periodic checkpoints.
  3. Remote Checkpointing: Offloading checkpoints to slower off-chip memory.
  4. Double Checkpointing: A two-tier system where "master" checkpoints are stored in remote memory. During the backward pass, a master checkpoint is fetched to recompute a local mini-batch of checkpoints, which are then used to recompute individual states.
Extracted figure from page 2 of Optimal Gradient Checkpointing for Sparse and Recurrent Architectures using Off-Chip Memory

This approach achieves sub-linear scaling, reducing local memory requirements to approximately the fourth root of the sequence length ($\sqrt[4]{T}$).

Exploiting Sparsity on Tile-Based Hardware

A key insight of this work is the synergy between SNN sparsity and recomputation. In SNNs, most neurons remain inactive, making the forward pass significantly cheaper than dense matrix multiplications. On the IPU, re-executing the forward pass to recover dropped states adds less than 10% overhead. Furthermore, Double Checkpointing minimizes communication bottlenecks by fetching data in large, infrequent chunks, avoiding the synchronization delays inherent in simpler remote offloading schemes.

Results and Scalability

The proposed method was evaluated using synthetic scaling benchmarks and reference datasets like N-MNIST. Key results include:

  • Sequence Length: Enabled training on sequences up to 10.2x longer (over 4000 timesteps) compared to standard implementations.
  • Model Capacity: Supported networks with 4.1x more parameters (up to 15 million) within the same hardware constraints.
  • Efficiency: Despite the double recomputation, the time overhead remained marginal due to optimized communication and the inherent efficiency of sparse SNN operations.

Conclusion

Double Checkpointing effectively bridges the gap between high-speed local memory and large-scale off-chip storage. By leveraging the sparsity of SNNs and a hierarchical checkpointing strategy, researchers can now scale recurrent models to unprecedented temporal depths and parameter counts on specialized hardware like the Graphcore IPU.

Summary updated

BibTeX
@misc{bencheikh2024optimal,
  author = {Wadjih Bencheikh and Jan Finkbeiner and Emre Neftci},
  title = {{Optimal Gradient Checkpointing for Sparse and Recurrent Architectures using Off-Chip Memory}},
  year = {2024},
  eprint = {2412.11810},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.11810},
}
Figure