Noisy Recurrent Neural Networks

Soon Hoe Lim, N. Benjamin Erichson, Liam Hodgkinson, Michael W. Mahoney

Recurrent Neural Networks (RNNs) are the workhorses of sequential data, but they are notoriously finicky. They often suffer from unstable dynamics—the infamous exploding and vanishing gradient problems—and can be surprisingly fragile when faced with even a little bit of input noise.

In their NeurIPS 2021 paper, "Noisy Recurrent Neural Networks," Soon Hoe Lim and colleagues provide a rigorous mathematical framework to address these vulnerabilities. By treating RNNs as stochastic dynamical systems, they demonstrate that injecting noise during training isn't just a heuristic "hack"—it is a principled method to build models that are both stable and robust.

TL;DR

This paper introduces Noisy Recurrent Neural Networks (NRNNs), which treat RNNs as discretizations of stochastic differential equations (SDEs). By injecting noise into hidden states during training, the authors prove that the model gains "implicit regularization." This leads to flatter loss minima, more stable dynamics, and significantly better robustness against data perturbations and adversarial attacks.

The Challenge of RNN Stability

Standard RNNs are often viewed as discrete versions of Ordinary Differential Equations (ODEs). While this "continuous-time" perspective has led to more stable architectures (like Lipschitz RNNs), these models remain sensitive to corrupted data—such as a glitching sensor or a deliberate adversarial attack.

The challenge is twofold:

  1. Stability: How do we ensure the internal state of the RNN doesn't spiral out of control during long sequences?
  2. Generalization: How do we train a model that doesn't just memorize the training set but learns a smooth decision boundary capable of handling noisy, real-world inputs?

A Stochastic Framework for RNNs

The authors bridge the gap between Dynamical Systems and Stochastic Learning through a novel framework:

  • The SDE Framework: Instead of a standard ODE, the hidden state evolution is modeled as an Itô Stochastic Differential Equation (SDE). This introduces a "diffusion" (noise) term to the state transition.
  • Noise Injection: During training, both additive and multiplicative noise are injected into the hidden states. Crucially, this noise is removed at inference time.
  • Euler-Maruyama Discretization: To implement this computationally, the authors use the Euler-Maruyama scheme, which is the stochastic equivalent of the standard Euler method for solving differential equations.
  • Theoretical Analysis: The core theoretical contribution is a Taylor expansion in the "small noise regime." This allows the authors to derive an approximate explicit regularizer, mathematically revealing exactly how noise injection smooths the loss function under the hood.

Key Insights: Why Noise Works

  • Flatter is Better: The mathematical analysis reveals that noise injection acts as a regularizer favoring "wide" or "flat" minima in the loss landscape. Flat minima are highly desirable because they suggest the model's performance will remain stable even if the input data shifts slightly.
  • Stochastic Stabilization: The authors prove a fascinating phenomenon: even if a deterministic RNN is unstable (with diverging trajectories), adding the right amount of noise can actually stabilize the system.
  • Implicit Margin Maximization: In classification tasks, NRNNs implicitly try to maximize the "classification margin." The model pushes different classes further apart in its internal representation, making it much harder for noise to flip a prediction.

Empirical Results

The authors evaluated NRNNs against state-of-the-art recurrent models (like coRNN and Lipschitz RNN) on tasks including Ordered Pixel-by-Pixel MNIST and Electrocardiogram (ECG) classification. They tested these datasets under various corruptions, including additive white noise, "salt and pepper" noise, and adversarial perturbations.

The NRNN consistently outperformed deterministic baselines, especially as the environment became increasingly corrupted.

Test accuracy of various RNN models under different levels of white noise ($\sigma$) and perturbations ($\alpha$).
  • Robustness to White Noise: On the MNIST task with high noise ($\sigma = 0.3$), the NRNN maintained 73.5% accuracy, while the previous best-in-class (Lipschitz RNN) plummeted to 47.1%.
  • Adversarial Defense: Against adversarial attacks, the NRNN proved significantly more resilient. (For instance, at a perturbation level of $r=0.15$, the NRNN held 70.6% accuracy, whereas the next best model dropped to 37.1%).
  • Real-World Performance: On the ECG dataset, the NRNN achieved the highest accuracy on clean data (97.7%) and showed the least degradation as noise was added to the heart signals.

Limitations and Future Directions

While NRNNs are powerful, the authors note a potential trade-off:

  • Long-Term Memory: There is a risk that excessive noise injection could interfere with the network's ability to remember very long-term dependencies. Finding the optimal "Goldilocks zone" for noise variance is critical.
  • Hyperparameter Tuning: The model introduces new parameters (noise levels $\sigma_1$ and $\sigma_2$) that require careful tuning.

Future work will likely explore how NRNNs behave at the "edge of stability" and investigate the interaction between noise injection and specific stochastic optimizers like Adam. Ultimately, this paper provides the theoretical "why" behind the empirical success of noise, offering a robust blueprint for the next generation of reliable recurrent networks.

Summary updated

BibTeX
@inproceedings{lim2021noisy,
  author = {Soon Hoe Lim and N. Benjamin Erichson and Liam Hodgkinson and Michael W. Mahoney},
  title = {{Noisy Recurrent Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=uXfAFhzEzO},
}
Figure