Abstract
While BERT has revolutionized natural language processing, its internal mechanisms for fine-grained tasks like Aspect-Based Sentiment Analysis (ABSA) remain opaque. This study investigates whether BERT's standard Masked Language Modeling (MLM) pre-training effectively captures the relationship between product aspects and associated sentiments. Through attention analysis, t-SNE visualizations, and linear probing, we demonstrate that while BERT excels at identifying semantic aspects and domain-specific contexts, it lacks dedicated "sentiment neurons." Our findings suggest that sentiment information is sparsely distributed and that MLM may inherently prioritize semantic noun prediction over sentiment-aware representations, necessitating extensive fine-tuning for ABSA tasks.
Introduction
Aspect-Based Sentiment Analysis (ABSA) represents a granular approach to sentiment analysis, identifying specific entities (aspects) and the sentiments expressed toward them. Despite the state-of-the-art performance of BERT-based models in ABSA, the extent to which general-purpose pre-training via Masked Language Modeling (MLM) contributes to this success is unclear. This research probes BERT’s internal representations to determine if it naturally learns the nuances of aspects and opinions or merely acts as a high-dimensional feature extractor requiring significant supervision.
Methodology
The diagnostic study utilized a multi-faceted approach to evaluate a BERT-base model:
- Domain-Specific Pre-training: The model was pre-trained on a 20GB+ corpus of Amazon and Yelp reviews to align its vocabulary with consumer review language.
- Attention Analysis: All 144 self-attention heads were analyzed to identify patterns related to aspect-opinion linking.
- Latent Space Visualization: t-SNE was employed to visualize the clustering of aspect and sentiment words in BERT's hidden states.
- Linear Probing: Logistic regression probes were trained on frozen BERT layers to quantify the localization of aspect and sentiment information.
Data and Evaluation
The study leveraged massive pre-training datasets (Amazon and Yelp reviews) and validated findings using the SemEval 2014 (Task 4) and SemEval 2016 (Task 5) datasets. Specifically, 150 annotated examples from the Laptop and Restaurant domains were used for diagnostic probing.
Analysis of BERT's Internal Representations
A key finding is the significant impact of domain on BERT's latent space. Hidden states are highly sensitive to the specific context of the review.
As shown in the t-SNE plots, "laptop" and "restaurant" aspects form distinct clusters, indicating that BERT effectively captures domain-specific semantics. Furthermore, while the model can distinguish aspects from non-aspects, this knowledge is not localized to a single feature but is distributed across the representation space.
The Sentiment Representation Gap
Despite its semantic prowess, BERT exhibits a notable "opinion gap." Attention analysis revealed that only 2 to 4 out of 144 heads focus on connecting aspects to opinion words. Most attention is dedicated to general linguistic structures.
Probing results further support this. While a linear probe using all 768 dimensions achieves high F1 scores for aspect identification (79%) and sentiment polarity (83%), performance drops significantly when restricted to individual neurons. For instance, the "best" neuron for aspect detection (Neuron 180, visible as a spike in the neuron weight plot) only achieves a 31% F1 score.
Unlike smaller models that may develop specialized "sentiment neurons," BERT's sentiment information is scattered. This suggests that MLM might actually hinder sentiment learning; to predict a masked aspect like [battery] in "The [MASK] is long-lasting," the model may prioritize noun frequency and local context over the sentiment-bearing word "long-lasting."
Conclusion
This study highlights that while BERT provides a robust semantic foundation for ABSA, it does not inherently "understand" sentiment in a localized or disentangled manner. The lack of dedicated sentiment representations explains why heavy fine-tuning remains a prerequisite for high performance. Future work should focus on designing pre-training tasks that explicitly encourage the disentanglement of aspects and opinions, perhaps by incorporating weak supervision from star ratings or cross-review comparisons.
Summary updated