Improving the Gating Mechanism of Recurrent Neural Networks

Albert Gu, Çaglar Gülçehre, Tom Le Paine, Matthew W. Hoffman, Razvan Pascanu

Introduction

Recurrent Neural Networks (RNNs), particularly Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures, have long been the standard for sequence modeling. However, they face a fundamental challenge: the "saturation paradox." To maintain information over long time horizons, the gating mechanisms (typically sigmoid functions) must output values extremely close to 1. Unfortunately, as the output of a sigmoid function approaches 0 or 1, its derivative approaches zero. This leads to vanishing gradients, where the network effectively stops learning because the signal required to update long-term dependencies cannot propagate back through the saturated gates.

This paper introduces the UR gating mechanism, a dual-component solution comprising Uniform Gate Initialization (UGI) and a novel "refine gate." This approach allows RNNs to operate at the extremes necessary for long-term memory without sacrificing the gradient flow essential for training.

The UR Gating Mechanism

The UR mechanism consists of two synergistic modifications that can be integrated into any gated recurrent architecture.

1. Uniform Gate Initialization (UGI)

Standard initialization often sets gate biases to zero, clustering initial gate activations around 0.5. This biases the network toward medium-term memory. UGI instead initializes pre-activation biases such that the post-sigmoid gate values are uniformly distributed between 0 and 1. This ensures that from the first iteration, the network possesses a diverse range of internal timescales, with some neurons primed for immediate processing and others for long-term storage.

2. The Refine Gate

To resolve the saturation problem, the authors propose an auxiliary "refine gate" ($r_t$) that additively modulates the primary forget gate ($f_t$). Instead of relying solely on the potentially saturated output of $f_t$, the system computes an effective gate $g_t$ by interpolating around $f_t$ using the refine gate's output.

Architecture of the Refine mechanism and its integration into a standard LSTM cell.

As shown in the architecture diagram above, the refine mechanism acts as a residual connection for the gate itself. This allows the effective gate to reach extreme values (e.g., 0.99) even if the base gate is at a less saturated value (e.g., 0.90), thereby bypassing the vanishing gradient trap.

Theoretical Insights

The core advantage of the refine gate is mathematical. By modulating the gate output additively, the network can achieve high-fidelity memory without the sigmoid function entering its flat, zero-derivative regime.

Mathematical properties of the refine gate, showing the expanded band range and modified activation curves.

Figure (a) above illustrates the "band range" $c(f)$, showing how the refine gate expands the reach of the gating mechanism. Figure (b) demonstrates how the resulting activation curves (purple and red) provide steeper gradients at the extremes compared to the standard sigmoid (black), facilitating learning in regimes where standard LSTMs would stall.

Experimental Evaluation

The UR-LSTM was evaluated across diverse domains, demonstrating significant gains over standard gated models:

  • Synthetic Memory: On the 500-length Copy task, the UR-LSTM achieved perfect accuracy, while standard LSTMs failed to learn entirely.
  • Computer Vision: In sequential CIFAR-10, the UR-LSTM reached 71.00% accuracy, a substantial improvement over the 63.01% achieved by a standard LSTM.
  • Language Modeling: On the WikiText-103 dataset, the mechanism improved test perplexity from 35.8 to 34.6 without additional hyperparameter tuning.
  • Reinforcement Learning: In 3D navigation tasks requiring long-term credit assignment (Active Match), UR-LSTM agents successfully solved tasks where standard LSTMs failed to find the optimal policy.

Conclusion

The UR gating mechanism provides a simple, plug-and-play improvement for recurrent models. By addressing the saturation paradox through UGI and refine gates, the authors enable RNNs to capture long-term dependencies more effectively. While Transformers have become dominant in many NLP tasks, these improvements are vital for domains like Reinforcement Learning and edge computing, where the efficiency and bounded memory of RNNs remain indispensable.

Summary updated

BibTeX
@inproceedings{gu2020improving,
  author = {Albert Gu and Çaglar Gülçehre and Tom Le Paine and Matthew W. Hoffman and Razvan Pascanu},
  title = {{Improving the Gating Mechanism of Recurrent Neural Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=0DP17sdjD5},
}
Figure