Batch Normalization (BN) is a cornerstone of modern deep learning, stabilizing training in feed-forward networks by reducing "internal covariate shift"—the constant change in the distribution of layer inputs as parameters are updated. However, extending BN to Recurrent Neural Networks (RNNs), particularly Long Short-Term Memory (LSTM) networks, has historically been difficult.
The challenge lies in the "horizontal" direction of RNNs: the hidden-to-hidden transitions. Because RNNs apply the same weights repeatedly across many timesteps, previous attempts to normalize these transitions often resulted in exploding or vanishing gradients. Consequently, researchers mostly limited BN to the "vertical" input-to-hidden transformations, missing out on the full potential of the technique for sequential data. This paper introduces a successful method for applying Batch Normalization to the recurrent connections of LSTMs, demonstrating significantly faster convergence and better generalization.
Reparameterizing the LSTM
The authors propose a specific reparameterization of the LSTM cell that incorporates Batch Normalization into both the input and recurrent components:
- Separate Normalization: BN is applied separately to the input-to-hidden term and the hidden-to-hidden term. This allows the model to independently control the relative contributions of new input versus past memory.
- Preserving Cell Dynamics: To maintain the linear gradient flow that makes LSTMs effective, the cell state update itself is not normalized directly. Instead, the cell state is normalized only before it passes through the final nonlinearity to produce the hidden state.
- Time-Dependent Statistics: Unlike feed-forward networks that use global statistics, this method maintains separate population means and variances for each timestep. This accounts for the "initial transient" phase where the distribution of activations changes rapidly before reaching a steady state.
The Saturation Trap and Crucial Initialization
A major insight from the paper is the realization that improper BN initialization kills the gradient in RNNs. If the variance is too high at the start, the tanh function flattens out, and the signal cannot propagate back through time. The standard practice of initializing the BN scale parameter ($\gamma$) to 1.0 causes these activations to saturate. The authors recommend initializing $\gamma$ to a small value (like 0.1) to keep activations in the linear regime during early training.
Key Results and Generalization
The proposed BN-LSTM was evaluated on several diverse benchmarks, including Sequential MNIST, Permuted MNIST (pMNIST), Character-level Language Modeling (Penn Treebank and Text8), and Question Answering (CNN corpus).
Across all tasks, the BN-LSTM reached lower error rates in significantly fewer iterations than the standard LSTM. Beyond just training faster, BN acts as a form of regularizer, leading to higher overall accuracy.
- pMNIST Accuracy: On the difficult permuted MNIST task, which requires the model to learn long-term dependencies across shuffled pixels, BN-LSTM achieved 95.4% accuracy, a substantial jump over the baseline LSTM's 90.2%.
- Language Modeling: On Penn Treebank, the BN-LSTM achieved a score of 1.32 bits-per-character (BPC), outperforming the baseline of 1.38 BPC.
- Question Answering: In the CNN QA task, the best BN-enhanced variant achieved a test error of 36.3%, compared to 45.0% for the standard LSTM baseline.
Limitations and Future Work
While highly effective, Recurrent Batch Normalization introduces a few practical considerations:
- Sequence Length at Test Time: Because the model uses separate statistics for each timestep, it must rely on a heuristic (like using the statistics from the final training timestep) for sequences longer than those seen during training.
- Constant Input Issues: In tasks where initial inputs might have zero variance (e.g., black pixels at the start of an MNIST image), the BN transform can struggle with division by zero. The authors mitigated this by adding Gaussian noise to the initial hidden states.
- Memory Overhead: Storing separate means and variances for every timestep increases the memory footprint, which could be a limiting factor for extremely long sequences.
Summary updated