[Paper Review] Context-Guided BERT for Targeted Aspect-Based Sentiment Analysis
This paper proposes Context-Guided BERT (CG-BERT) and a novel Quasi-Attention CG-BERT (QACG-BERT) model to enhance targeted aspect-based sentiment analysis (TABSA) by integrating context into self-attention mechanisms. By introducing context-guided softmax attention and compositional quasi-attention with subtractive capabilities, QACG-BERT achieves state-of-the-art performance on SentiHood and SemEval-2014 datasets, outperforming prior models in F1 scores and demonstrating improved context-aware attention learning.
Aspect-based sentiment analysis (ABSA) and Targeted ASBA (TABSA) allow finer-grained inferences about sentiment to be drawn from the same text, depending on context. For example, a given text can have different targets (e.g., neighborhoods) and different aspects (e.g., price or safety), with different sentiment associated with each target-aspect pair. In this paper, we investigate whether adding context to self-attention models improves performance on (T)ABSA. We propose two variants of Context-Guided BERT (CG-BERT) that learn to distribute attention under different contexts. We first adapt a context-aware Transformer to produce a CG-BERT that uses context-guided softmax-attention. Next, we propose an improved Quasi-Attention CG-BERT model that learns a compositional attention that supports subtractive attention. We train both models with pretrained BERT on two (T)ABSA datasets: SentiHood and SemEval-2014 (Task 4). Both models achieve new state-of-the-art results with our QACG-BERT model having the best performance. Furthermore, we provide analyses of the impact of context in the our proposed models. Our work provides more evidence for the utility of adding context-dependencies to pretrained self-attention-based language models for context-based natural language tasks.
Motivation & Objective
- To improve targeted aspect-based sentiment analysis (TABSA) by making BERT models context-aware in their attention mechanisms.
- To address the limitation of standard softmax attention, which cannot model subtractive or compositional attention, by introducing quasi-attention with negative weights.
- To investigate how context influences attention distribution and model decisions in sequence modeling for sentiment analysis.
- To achieve state-of-the-art performance on TABSA benchmarks through architectural modifications to pretrained BERT.
Proposed method
- Adapt a context-aware Transformer to produce CG-BERT, which uses context-guided softmax attention to dynamically adjust attention weights based on target and aspect context.
- Propose QACG-BERT, a novel model that learns quasi-attention weights allowing for negative attention values, enabling subtractive and compositional attention mechanisms.
- Introduce a bidirectional gating factor λ_A^h that controls whether context contributes positively or negatively to attention, enabling dynamic suppression of irrelevant tokens.
- Formulate attention as a composition of vanilla self-attention A_Self-Attn^h and context-guided quasi-attention A_Quasi-Attn^h, combined via a learned gate to produce final attention Â^h.
- Train both models end-to-end on SentiHood and SemEval-2014 (Task 4) using fine-tuned BERT as the base encoder.
- Use gradient sensitivity analysis and attention visualization to interpret model behavior and validate context-aware attention learning.
Experimental results
Research questions
- RQ1Can integrating context into the attention mechanism of BERT improve performance on targeted aspect-based sentiment analysis?
- RQ2Does allowing negative attention weights through quasi-attention improve modeling of complex sentiment dependencies in TABSA?
- RQ3How do context-guided attention mechanisms affect attention distribution and model interpretability in sentiment classification?
- RQ4To what extent do auxiliary sentence appendages affect performance in context-aware TABSA models?
Key findings
- QACG-BERT achieves state-of-the-art performance on both SentiHood and SemEval-2014 (Task 4) datasets, surpassing previous SOTA models in F1 scores.
- The QACG-BERT model learns to assign higher gradient importance to contextually relevant words, such as 'rent' and 'cheaper' for price aspects, and correctly identifies target-specific sentiment cues like 'costs' for LOC1 and 'cheap' for LOC2.
- Visualization of quasi-attention shows that negative attention weights are learned, particularly on words like 'nice' that are sentimentally negative in price context, enabling the model to de-emphasize such tokens.
- The bidirectional gating factor λ_A^h learns to modulate context influence, with slightly more negative values, allowing the model to suppress irrelevant or misleading attention heads.
- The final attention matrix Â^h contains both positive and negative weights, demonstrating that the model can perform subtractive attention, a capability missing in standard softmax attention.
- Despite minor metric drops in some cases, the model maintains strong performance when trained with appended auxiliary sentences, indicating robustness to input perturbations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.