Tree-Structured Composition in Neural Networks without Tree-Structured Architectures

Samuel R. Bowman, Christopher D. Manning, Christopher Potts

Introduction

Linguists have long argued that human language is inherently hierarchical—sentences are built like trees, not just flat strings of words. To capture this, researchers developed tree-structured neural networks (Recursive Neural Networks) that process data according to a predefined syntactic structure. However, a puzzling trend emerged in NLP: simple sequence models, like LSTMs, often perform nearly as well as these sophisticated tree models on real-world tasks.

This raises a fundamental question: Are LSTMs actually learning to represent the underlying tree structure of language implicitly, or are tree models simply not as necessary as we thought? This paper investigates this by testing whether models can generalize to complex, recursive logic that they haven't seen during training.

Methods

The authors set up a "head-to-head" competition between two classes of encoders:

  1. Tree-structured models: TreeRNN, TreeRNTN, and TreeLSTM. These models are given the "correct" tree structure for every sentence.
  2. Sequence-structured models: A standard LSTM. To ensure a fair fight, the LSTM is given the same structural information as the tree models by including parentheses as explicit tokens in the input string (e.g., ( not p3 )).
The general architecture (a) and the specific sentence models for tree structures (b) and sequences (c).

Both types of encoders produce a fixed-length vector representing a sentence. These vectors are then fed into a high-performance classifier—a Neural Tensor Network (NTN) followed by additional tanh layers—to perform a Recognizing Textual Entailment (RTE) task. The goal is to determine the logical relationship between two sentences (e.g., does sentence A entail sentence B, or do they contradict each other?).

Datasets

The study uses an artificial logic dataset designed to isolate the effects of recursion.

  • Vocabulary: Six variables ($p_1$ through $p_6$) and three logical operators (and, or, not).
  • Labels: Seven mutually exclusive logical relations (e.g., entailment, equivalence, contradiction, and semantic independence).
  • Structure: The data is divided into "bins" based on the number of logical operators. This allows the researchers to train models on simple sentences (e.g., $\le 6$ operators) and test them on much longer, more complex ones (up to 12 operators) to see if they truly learned the "rules" of the language.
Examples of the artificial logic dataset showing premises, hypotheses, and their logical relations.

Key Insights and Results

Implicit vs. Explicit Bias

Tree models have an "inductive bias"—they are hard-coded to understand hierarchy. LSTMs have no such bias; they must discover the hierarchy from the raw sequence of tokens and parentheses. The authors found that LSTMs can learn to generalize to deeper recursion, but they require significantly more training data to reach the same level of performance as a tree model.

The Generalization Gap

The real test of "understanding" is generalization. If a model only sees sentences with 3 operators but can correctly interpret a sentence with 10, it has likely learned the recursive nature of the logic rather than just memorizing patterns.

  • Training Performance: All models (Tree and LSTM) performed exceptionally well on sentences of the lengths they were trained on, reaching 94–99% accuracy.
  • Generalization Decay: When tested on sentences longer than those in the training set, tree models showed a graceful, slow decline in accuracy. LSTMs showed a much sharper drop-off. For example, when trained on sentences with $\le 4$ operators, the LSTM's accuracy plummeted by 10% when moving to the next complexity level, whereas tree models only dropped by about 4%.

Conclusion

While LSTMs can eventually "get it" if given enough examples, they consistently lag behind tree models in data efficiency and generalization capability. This suggests that tree architectures provide a valuable "shortcut" for learning hierarchical concepts.

However, sequence models have practical advantages: they are easier to optimize on GPUs and can "look ahead" at the whole sentence more easily. Future work might involve finding "middle-ground" architectures—sequence models that are better at capturing hierarchy without the computational overhead of explicit tree structures.

Summary updated

BibTeX
@inproceedings{bowman2015tree,
  author = {Samuel R. Bowman and Christopher D. Manning and Christopher Potts},
  title = {{Tree-Structured Composition in Neural Networks without Tree-Structured Architectures}},
  booktitle = {CoCo @ NeurIPS},
  year = {2015},
}
Figure