Polarity Classification with Multitask Learning Syntax Augmentation
Organizations: Universidade da Coruña, CITIC, Depto. de Ciencias de la Computación y Tecnologías de la Información, Campus de Elviña s/n, 15071 A Coruña, Spain
Abstract
Sentiment Analysis (SA) is a fundamental NLP task concerned with the identification and categorization of subjective information in text. While lexicon-based methods offer transparency, they often struggle with linguistic phenomena such as negation and intensification. Syntactic parsing has been integrated into SA pipelines to address this, but conventional parsers introduce significant computational overhead. Recent work shows that reformulating dependency parsing as a Sequence Labeling (SEL) task can improve efficiency. We propose and compare two strategies for integrating syntactic knowledge into a neural sentiment analysis model under unified Multi-Task Learning (MTL). The first, Standard-MTL, jointly learns dependency parsing (via sequence labeling) and sentiment polarity classification using a shared encoder with two task-specific heads. The second, Contrastive-MTL, provides implicit syntactic guidance through a contrastive auxiliary objective and a syntax-biased attention pooling mechanism, without requiring explicit label prediction. Both rely on syntactic annotations during training and eliminate need for hand-crafted compositional rules or external parsing at inference. We evaluate eleven datasets spanning seven languages---the MARC corpus (English, Spanish, French, German) and seven datasets from SemEval-2022 Task 10 (English, Spanish, Norwegian, Basque, Catalan)---using four established SEL encodings. With the relative encoding, Contrastive-MTL outperforms a syntax-naive baseline on 10 of 11 datasets and surpasses the external rule-based pipeline (SELSP) that parses at inference on all six datasets where the latter applies, while being 1.5--9 faster at evaluation. Standard-MTL is more dataset- and encoding-dependent. These results show implicit syntactic supervision during training can match or exceed explicit parsing at inference without computational overhead.
Figures & tables
| Review | Polarity |
|---|---|
| Clean , renewed rooms. | Positive |
| Food very basic. | Negative |
| What can we say. | No Annotation |
| Dataset | Data | Total | Discarded | Remaining |
|---|---|---|---|---|
| Split | Rows | Rows | Rows | |
| OpeNER en | Train | 1744 | 344 | 1400 |
| Dev | 249 | 51 | 198 | |
| Test | 499 | 92 | 407 | |
| OpeNER es | Train | 1438 | 186 | 1252 |
| Dev | 206 | 32 | 174 |
| Hyperparameter | Value |
|---|---|
| Encoder | XLM-RoBERTa-large |
| Encoder init. | Pre-trained |
| Head init. | Random |
| Optimizer | AdamW |
| Enc. learning rate | |
| Head learning rate |
| Dataset | Encoding | Standard-MTL | Contrastive-MTL | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Acc | Prec | Rec | F1 | Acc | Prec | Rec | F1 | ||
| Darmstadt_unis | Baseline | 0.822 | 0.546 | 0.553 | 0.549 | 0.822 | 0.546 | 0.553 | 0.549 |
| SELSP | 0.414 | 0.581 | 0.414 | 0.399 | 0.414 | 0.581 | 0.414 | 0.399 | |
| Brk7Bits | 0.843 | 0.574 | 0.562 | 0.567 | 0.865 | 0.575 | 0.582 | 0.579 | |
| BrkBased | 0.867 | 0.576 | 0.584 | 0.580 | 0.911 | 0.608 | 0.612 | 0.610 | |
| Absolute | 0.867 | 0.576 | 0.581 | 0.578 | 0.867 | 0.580 | 0.579 | 0.579 | |
| Dataset | Encoding | Contrastive-only MTL | Syntax-only MTL | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Acc | Prec | Rec | F1 | Acc | Prec | Rec | F1 | ||
| Darmstadt_unis | Baseline | 0.822 | 0.546 | 0.553 | 0.549 | 0.822 | 0.546 | 0.553 | 0.549 |
| Brk7Bits | 0.899 | 0.597 | 0.607 | 0.602 | 0.843 | 0.577 | 0.554 | 0.558 | |
| BrkBased | 0.878 | 0.595 | 0.586 | 0.589 | 0.844 | 0.565 | 0.564 | 0.563 | |
| Absolute | 0.856 | 0.578 | 0.568 | 0.570 | 0.867 | 0.578 | 0.581 | 0.579 | |
| Relative | 0.876 | 0.592 | 0.581 | 0.586 | 0.867 | 0.578 | 0.581 | 0.579 | |
| Dataset | Method | Standard-MTL | Contrastive-MTL | ||
|---|---|---|---|---|---|
| Train (s) | Eval (s) | Train (s) | Eval (s) | ||
| Darmstadt_unis | Baseline | 206.061 | 0.678 | 206.061 | 0.678 |
| SELSP | - | 5.104 | - | 5.104 | |
| Ours | 325.681 | 0.686 | 282.294 | 0.674 | |
| MPQA | Baseline | 486.676 | 1.930 | 486.676 | 1.930 |
| SELSP | - | 17.056 | - | 17.056 | |
| Relation | Attention | Bias | |
|---|---|---|---|
| advmod | 320 | 0.0762 | |
| amod | 375 | 0.0662 | |
| dep | 40 | 0.0580 | |
| prep | 31 | 0.0565 | |
| cop | 265 | 0.0537 | |
| neg | 63 | 0.0536 |
| Relation | Baseline | Contrastive-MTL | Contrastive-only MTL | Syntax-only MTL | |
|---|---|---|---|---|---|
| Lexical relations (predictable from token identity) | |||||
| det | 586 | 0.804 | 0.988 | 0.988 | 0.930 |
| punct | 76 | 0.790 | 0.974 | 0.961 | 0.263 |
| amod | 375 | 0.627 | 0.880 | 0.899 | 0.307 |
| nn | 220 | 0.218 | 0.832 | 0.832 | 0.077 |
| Context-dependent relations (require the sentence) | |||||
Sentiment Analysis
Sentiment analysis detects and measures opinions, emotions, and evaluative stance in text and multimodal data.
See all 133 papers