Learning to Embed Sentences Using Attentive Recursive Trees.

Jiaxin Shi, Lei Hou, Juanzi Li, Zhiyuan Liu, Hanwang Zhang

Introduction

In Natural Language Processing (NLP), sentence embedding aims to transform text into dense mathematical vectors that encapsulate semantic meaning. While Recurrent Neural Networks (RNNs) and Convolutional Neural Networks (CNNs) have been standard, Tree-structured Recursive Neural Networks (TreeRNNs) offer a more linguistically intuitive approach by capturing the hierarchical nature of language.

However, traditional latent tree models often treat all words as equal leaves at the base of a tree, building upward through adjacent merges. This approach lacks a mechanism to prioritize highly informative words. The Attentive Recursive Tree (AR-Tree) addresses this by treating the tree structure itself as an attention mechanism. By placing critical words closer to the root, the model ensures they have a disproportionate impact on the final sentence representation.

Comparison between (a) an AR-Tree structure where the informative word "interesting" is at the root, and (b) a standard binary tree.

The AR-Tree Model

The AR-Tree employs a two-stage process: top-down construction followed by bottom-up embedding.

Top-Down Construction

Unlike grammar-fixed trees, the AR-Tree uses a trainable scoring function (a 2-layer MLP) to assign an "importance" score to each word. The model greedily selects the word with the highest score to serve as the root. The sentence is then partitioned into subsequences—words appearing before and after the root—and the process repeats recursively to build the branches.

Bottom-Up Embedding

Once the hierarchy is established, a modified Tree-LSTM unit aggregates information from the leaves to the root. Because the most salient words are positioned near the root, they are processed last, allowing their semantics to dominate the final embedding vector.

The Tree-LSTM unit used for bottom-up semantic composition, aggregating hidden states ($h$) and cell states ($c$) from child nodes.

Training via Reinforcement Learning

Selecting a root word is a discrete, non-differentiable operation, precluding standard backpropagation. To overcome this, the authors utilize the REINFORCE algorithm. A key innovation is the "macro normalization" strategy, which prevents the model from defaulting to high-frequency but low-information words (like "the" or "is"). By averaging gradients at the word level rather than the node level, the model learns to focus on truly task-relevant terms.

Evaluation and Key Results

The AR-Tree was evaluated across three major benchmarks:

  • SNLI (Stanford Natural Language Inference): Achieving 85.5% accuracy with a 300D model.
  • SST (Stanford Sentiment Treebank): Reaching 90.4% on SST-2 (binary sentiment).
  • Author Profiling: Predicting age ranges from Twitter data.

Qualitative analysis confirms that the model successfully identifies task-specific "keywords." For instance, in sentiment analysis, adjectives like "embarrassing" or "remarkable" are frequently elevated to the root, whereas in logical inference tasks, the model prioritizes verbs and negations.

Conclusion

The AR-Tree demonstrates that hierarchical structure can serve as an effective, task-adaptive attention mechanism. By learning to "re-order" the importance of words through tree depth, it outperforms traditional Tree-LSTM variants. While the current implementation is limited to binary trees and faces some computational overhead due to its recursive nature, it opens new avenues for interpretable and semantically rich sentence modeling.

Summary updated

Abstract

Sentence embedding is an effective feature representation for most deep learning-based NLP tasks. One prevailing line of methods is using recursive latent tree-structured networks to embed sentences with task-specific structures. However, existing models have no explicit mechanism to emphasize taskinformative words in the tree structure. To this end, we propose an Attentive Recursive Tree model (AR-Tree), where the words are dynamically located according to their importance in the task. Specifically, we construct the latent tree for a sentence in a proposed important-first strategy, and place more attentive words nearer to the root; thus, AR-Tree can inherently emphasize important words during the bottomup composition of the sentence embedding. We propose an end-to-end reinforced training strategy for AR-Tree, which is demonstrated to consistently outperform, or be at least comparable to, the state-of-the-art sentence embedding methods on three sentence understanding tasks.
BibTeX
@inproceedings{shi2019learning,
  author = {Jiaxin Shi and Lei Hou and Juanzi Li and Zhiyuan Liu and Hanwang Zhang},
  title = {{Learning to Embed Sentences Using Attentive Recursive Trees.}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33016991},
}
Figure