Abstract
Recurrent neural networks (RNNs) provide state-of-the-art performance in processing sequential data but are memory intensive to train, limiting the flexibility of RNN models which can be trained. Reversible RNNs---RNNs for which the hidden-to-hidden transition can be reversed---offer a path to reduce the memory requirements of training, as hidden states need not be stored and instead can be recomputed during backpropagation. We first show that perfectly reversible RNNs, which require no storage of the hidden activations, are fundamentally limited because they cannot forget information from their hidden state. We then provide a scheme for storing a small number of bits in order to allow perfect reversal with forgetting. Our method achieves comparable performance to traditional models while reducing the activation memory cost by a factor of 10--15. We extend our technique to attention-based sequence-to-sequence models, where it maintains performance while reducing activation memory cost by a factor of 5--10 in the encoder, and a factor of 10--15 in the decoder.
Introduction
Training deep Recurrent Neural Networks (RNNs) is often constrained by the "memory wall" of modern hardware. Standard training via Truncated Backpropagation Through Time (TBPTT) requires storing the hidden state $H$ for every timestep $T$, leading to a memory complexity of $O(TH)$. This linear scaling prevents researchers from training larger models or processing longer sequences on standard GPUs.
This paper, presented at NIPS 2018, proposes a solution inspired by reversible architectures in feedforward networks (like RevNet). By making the hidden-to-hidden transitions reversible, the hidden states can be recomputed during the backward pass, effectively trading computation for memory.
Reversible RNN Architectures
The authors introduce RevGRU and RevLSTM based on a reversible coupling scheme. The hidden state is partitioned into two halves, $h_1$ and $h_2$, which are updated in a staggered manner. This structure allows the input state to be algebraically recovered from the output state.
However, a significant hurdle exists: standard reversible logic is inherently "information-preserving." In finite-precision arithmetic, multiplying a state by a forget gate (a value between 0 and 1) discards information. Without the ability to forget, the hidden state would eventually saturate with irrelevant information, severely limiting the model's capacity.
Fractional Forgetting
To enable forgetting while maintaining reversibility, the authors propose a "fractional forgetting" mechanism. By treating hidden states as fixed-point integers, the information "lost" during a forgetting operation can be captured as a remainder. Instead of discarding these bits, they are pushed onto a compact information buffer (a stack).
During the backward pass, these bits are popped from the buffer to perfectly reconstruct the previous state. The key insight is that this buffer is significantly smaller than the full 32-bit activations. Empirical tests show that storing only 2 to 5 bits per unit is sufficient to maintain performance.
Experimental Results
The proposed models were evaluated on language modeling (Penn TreeBank, WikiText-2) and machine translation (Multi30K, IWSLT 2016) tasks.
The results demonstrate that RevRNNs achieve a 10–15x reduction in activation memory. On the Penn TreeBank dataset, reversible models matched standard LSTMs and GRUs almost exactly. In machine translation tasks, the RevGRU even outperformed the baseline GRU on the Multi30K dataset while utilizing a fraction of the memory.
Conclusion and Future Work
Reversible RNNs provide a powerful mechanism for training large-scale sequential models on limited hardware. While the approach introduces a computational overhead (approximately 50% slower training due to recomputation), the order-of-magnitude memory savings enable the exploration of much larger architectures. Future work may involve optimizing bit-level buffer management on GPUs to further reduce the overhead of these memory-efficient models.
Summary updated