Latent Variable Sentiment Grammar

Liwen Zhang, Kewei Tu, Yue Zhang

Introduction

While neural models like Tree-LSTMs are adept at capturing the hierarchical structure of language, they typically treat sentiment composition as a "black box." They learn to represent phrases as hidden vectors, but they do not explicitly model the logic of sentiment—for example, how a "negative" word like not interacts with a "positive" word like good to produce a "negative" phrase.

Figure 1: An example of sentiment composition in a sentence tree, illustrating how sentiment labels (e.g., -1, 0, 1) flow and interact across phrases.

The authors argue that existing models lack explicit sentiment compositionality. Without a structured way to represent sentiment signals (like +1 for positive or -1 for negative), models may struggle with subtle linguistic phenomena like intensification, negation, and contrast. This paper introduces Latent Variable Sentiment Grammars, a novel approach that explicitly models how sentiment "flows" and composes within a sentence's tree structure.

Methodology

The researchers propose three increasingly sophisticated grammar formalisms to sit on top of a standard neural encoder (like a Tree-LSTM or BCN):

  1. Weighted Grammars (WG): The simplest version where nonterminals are just the sentiment labels (e.g., 0-4 in SST). It models the first-order correlation between labels in a tree.
  2. Latent Variable Grammars (LVG): Inspired by the idea that "positive" isn't just one thing, this model splits each sentiment label into discrete "subtypes." For example, it might learn different subtypes for "strong positive" vs. "weak positive."
  3. Gaussian Mixture Latent Vector Grammars (GM-LVeG): Instead of discrete subtypes, this version represents sentiment in a continuous, low-dimensional space using Gaussian mixtures. This allows the model to capture an "infinite" variety of subtle sentiment nuances.

To handle these grammars, the authors use the inside-outside algorithm for training and a max-rule product decoding algorithm for parsing, which helps find the most probable sentiment tree given a sentence's syntactic structure.

Experimental Results

The models were evaluated on the Stanford Sentiment Treebank (SST), specifically SST-2 (binary) and SST-5 (fine-grained). The authors used provided gold-standard constituent trees for both training and testing.

Figure 6: Confusion matrices for the baseline (ConTree) and the proposed grammar models (WG, LVG4, LVeG). The grammar-based models show improved classification performance across various sentiment levels.

Key results include:

  • State-of-the-Art Performance: Using a Bi-attentive Classification Network (BCN) with ELMo embeddings and the GM-LVeG grammar, the authors achieved 56.0% accuracy on SST-5 (root level), outperforming previous benchmarks.
  • Consistency Across Encoders: The grammar layer improved performance across the board, regardless of whether the underlying encoder was a simple Tree-LSTM or a complex BCN.
  • Depth Advantage: Performance gains were most pronounced for longer phrases and full sentences (higher up the tree), where the complexity of sentiment composition is greatest.

Discussion and Conclusion

The study demonstrates that moving from implicit vector composition to explicit grammar-based composition consistently improves performance. Splitting coarse sentiment labels into latent subtypes (LVG and LVeG) significantly boosted accuracy, suggesting that standard 5-point scales are too blunt to capture the actual emotional variety in language. Furthermore, the continuous approach (GM-LVeG) generally outperformed the discrete one (LVG), supporting the theory that emotions exist on a continuous spectrum.

While the model currently relies on pre-existing syntactic skeletons and is more computationally expensive than simple feed-forward passes, it offers a more interpretable and effective way to handle complex sentiment logic. Future work may explore joint models for syntactic parsing and sentiment analysis.

Summary updated

BibTeX
@inproceedings{zhang2019latent,
  author = {Liwen Zhang and Kewei Tu and Yue Zhang},
  title = {{Latent Variable Sentiment Grammar}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1457},
}
Figure