Quantifying the Vanishing Gradient and Long Distance Dependency Problem in Recursive Neural Networks and Recursive LSTMs

Phong Le, Willem H. Zuidema

Abstract

Recursive neural models are theoretically well-suited for hierarchical data like natural language, yet their ability to handle long-distance dependencies has lacked rigorous quantitative evaluation. This study investigates the vanishing gradient problem in standard Recursive Neural Networks (RNNs) versus Recursive LSTMs (RLSTMs). Using a controlled artificial task, we demonstrate that while standard RNNs fail as tree depth increases, RLSTMs successfully propagate signals by employing gating mechanisms. Notably, RLSTMs exhibit a "gradient explosion" strategy during early training to locate distant signals, maintaining high accuracy where RNNs revert to random guessing.

Introduction

In Natural Language Processing, recursive models are designed to mirror the nested, hierarchical nature of language. While linear Recurrent Neural Networks are known to suffer from vanishing gradients, it was hypothesized that the hierarchical structure of recursive models might inherently mitigate this by reducing the path length between distant nodes. However, quantitative proof of this mitigation was missing. This paper addresses whether a tree structure alone is sufficient to solve long-distance dependencies or if complex gating, such as that found in LSTMs, is required.

Methods

The study compares two primary architectures:

  1. Recursive Neural Network (RNN): A standard model where parent nodes are computed via a simple one-layer feed-forward network of their children.
  2. Recursive LSTM (RLSTM): An extension of the LSTM to trees, utilizing input, forget (one per child), and output gates to control information flow through a memory cell.

To isolate the effect of tree depth, the authors developed a controlled artificial task. Sentences consist of random integers, with a single "keyword" (integer < 1,000) determining the target class. The model must identify this keyword within a randomly generated binary tree and propagate its signal to the root. The "vanishing gradient" is quantified by the ratio of the error vector norm at a keyword leaf node to that at the root.

Key Results

Accuracy vs. Depth

The experimental results reveal that hierarchy alone does not prevent the vanishing gradient problem. The standard RNN performs well on short sequences but its accuracy drops to random levels (~10%) once the keyword depth exceeds 3 levels. In contrast, the RLSTM maintains over 90% accuracy for keyword depths up to 8 and remains significantly better than random even at depths of 12 or 13.

Accuracy of RNN (red line) vs. RLSTM (blue boxplots) as a function of sentence length and keyword depth.

Gradient Persistence and Training Dynamics

A key finding is the difference in gradient propagation. While RNN gradient ratios stay near zero for deep nodes, RLSTMs maintain high ratios. Interestingly, RLSTMs exhibit a unique "explosion" strategy in early training epochs, where gradient ratios often exceed 1.0, suggesting an aggressive search for the signal within the tree structure. Once the model "hooks" onto the signal, the gradients stabilize.

Gradient ratios for RLSTMs across training epochs, showing the 'explosion' strategy in early epochs to capture deep signals.

Discussion and Conclusion

The findings suggest that hierarchical structure and LSTM-style gating are complementary. While the tree provides a linguistically appropriate map, the gates provide the necessary mechanism for signals to travel across that map without vanishing. The primary limitation is the simplicity of the artificial task, which involves only a single keyword. Future work should explore more complex compositional tasks where multiple keywords interact, moving beyond simple identification to better simulate the full complexity of human language composition.

Summary updated

BibTeX
@inproceedings{le2016quantifying,
  author = {Phong Le and Willem H. Zuidema},
  title = {{Quantifying the Vanishing Gradient and Long Distance Dependency Problem in Recursive Neural Networks and Recursive LSTMs}},
  booktitle = {Rep4NLP @ ACL},
  year = {2016},
  url = {https://openreview.net/forum?id=QsjCv9NPmmX},
}
Figure