Abstract
SentiBERT is a novel architecture designed to capture compositional sentiment semantics by integrating the contextual power of BERT with the structural logic of constituency parse trees. By explicitly modeling phrase-level interactions, SentiBERT effectively handles complex linguistic phenomena like negation and contrast. It achieves state-of-the-art performance on phrase-level sentiment tasks and demonstrates strong transferability to diverse emotion detection benchmarks.
Introduction
Sentiment analysis is a fundamental task in natural language processing, yet it remains challenging due to the nuance of human language. A critical aspect is semantic compositionality: the principle that the meaning of a complex expression is determined by the meanings of its constituent parts and the rules used to combine them.
Consider the phrase: "Frenetic but not really funny." To correctly classify its sentiment, a model must recognize that "funny" is positive, "not" negates it, and "but" shifts the overall focus toward the latter part of the sentence. While modern Transformers like BERT excel at capturing context, they do not explicitly model the hierarchical syntactic structure necessary for such compositional reasoning. SentiBERT bridges this gap by combining contextual embeddings with syntactic composition logic.
Methodology
SentiBERT extends the BERT (or RoBERTa) architecture with a specialized composition module guided by constituency parse trees. The architecture is divided into three primary modules:
- Module I (The Encoder): A standard pre-trained BERT model generates contextualized representations ($h_1, ..., h_n$) for every token in the input sentence.
- Module II (Semantic Composition): This module utilizes a binary constituency parse tree to recursively compose phrase representations. It employs a dual-level attention mechanism:
- Attention to Tokens: Phrase nodes attend to the specific tokens they encompass.
- Attention to Children: Parent nodes attend to their immediate children and themselves, explicitly learning how sentiment is composed from sub-components (e.g., how "not" + "funny" results in a negative sentiment).
- Module III (The Predictor): The model predicts the sentiment label for every node in the tree, from individual words to the root sentence node.
The training objective incorporates Masked Language Modeling (MLM) alongside phrase-level sentiment prediction, forcing the model to internalize the structural logic of sentiment.
Experimental Results
The authors evaluated SentiBERT primarily on the Stanford Sentiment Treebank (SST), which provides phrase-level annotations.
Performance on SST
SentiBERT achieved significant improvements over both traditional Recursive Neural Networks and vanilla Transformer baselines:
- Phrase-level Accuracy: SentiBERT reached 68.31% (BERT backbone) and 68.98% (RoBERTa backbone), outperforming vanilla BERT (64.53%) and traditional Recursive NNs (58.33%).
- Sentence-level Accuracy: On the SST-5 benchmark, the RoBERTa-based SentiBERT achieved 56.87%.
Transferability and Robustness
A key strength of SentiBERT is its ability to transfer learned compositional logic to other domains. Despite being trained on SST, the model outperformed XLNet and RoBERTa on:
- Twitter Sentiment Analysis (SemEval 2017).
- Emotion Intensity Classification (EmoInt).
- Contextual Emotion Detection (EmoContext).
The model's advantage is most pronounced in "locally difficult" cases—sentences where sentiment flips between child and parent nodes due to negation or contrastive conjunctions.
Conclusion
SentiBERT demonstrates that incorporating syntactic structure into Transformer architectures significantly enhances their ability to model compositional sentiment. By explicitly learning from phrase-level labels, the model gains a "syntactic guide" that improves performance on complex linguistic structures and transfers effectively across diverse sentiment and emotion tasks. While the reliance on phrase-level annotations presents a data acquisition challenge, SentiBERT sets a new standard for structurally-aware sentiment analysis.
Summary updated