RoBERTa-base + R-Drop for End-to-End Aspect-Based Sentiment Analysis

This model finds the product aspects a review mentions and labels each one positive, negative or neutral, in a single pass. It powers the "Customers say" highlighter in antedotee/nlp-multi-aspect-analyzer.

"The battery life is incredible, but the charging case feels flimsy." → battery life: positive · charging case: negative

Usage

from transformers import pipeline

absa = pipeline("token-classification",
                model="Deepanshu027/roberta-base-rdrop-absa-semeval14",
                aggregation_strategy="simple")

absa("The battery life is incredible, but the charging case feels flimsy.")
# [{'entity_group': 'POS', 'word': ' battery life',  'start': 4,  'end': 16, 'score': 0.998},
#  {'entity_group': 'NEG', 'word': ' charging case', 'start': 40, 'end': 53, 'score': 0.996}]

entity_group is the sentiment, and start/end are character offsets into the input. For whole-review handling, long-review chunking and Amazon-style aspect chips, use infer.py from the GitHub repository.

Labels

The model tags each token with one of 7 BIO labels: O (not an aspect), plus B- (first token) and I- (continuation) for each sentiment, POS, NEG and NEU.

Evaluation

The model is evaluated on the official SemEval-2014 Task 4 gold test sets (800 sentences per domain, including sentences with no aspect). The metric is strict end-to-end F1: a prediction counts only if the character span and the sentiment both match exactly. Scores are mean ± std over 3 seeds; this checkpoint is the seed with the best dev F1.

Model Laptops Restaurants Both
RoBERTa-base + R-Drop (this model) 68.89 ± 0.20 78.90 ± 0.25 75.29 ± 0.21
DeBERTa-v3-base 68.26 ± 0.82 78.61 ± 1.33 74.84 ± 1.03
RoBERTa-base 67.47 ± 0.81 77.86 ± 0.56 74.11 ± 0.48
ModernBERT-base 59.45 ± 1.35 74.17 ± 0.47 68.86 ± 0.76
BERT-base 59.71 ± 0.31 73.24 ± 0.64 68.34 ± 0.48
  • Against plain RoBERTa: R-Drop beat it on all 3 seeds in both domains (+1.4 laptops, +1.0 restaurants).
  • Against DeBERTa-v3: the gap is within DeBERTa's seed spread, so treat it as a tie.
  • By sentiment (both test sets): positive F1 0.82, negative 0.71, neutral 0.55.
  • False aspects: on test sentences that contain none, the model predicts one 4.8% of the time on laptops and 9.3% on restaurants.

Training

Data Original SemEval-2014 Task 4 XML, laptops + restaurants trained together. Official training sets split 90/10 into train/dev (5,346 / 595 sentences); sentences with no aspect are included. Sentences containing a conflict aspect are dropped from train/dev.
Objective Token cross-entropy with R-Drop (Liang et al., 2021): every batch passes twice with different dropout masks, plus α · symmetric KL between the two predictions, α = 1.5
Hyper-parameters 6 epochs, learning rate 3e-5, batch 16, weight decay 0.01, 10% warmup, gradient clip 1.0, max 256 tokens, fp16; best epoch by dev F1
Hardware One NVIDIA T4, about 4 minutes per run

The full benchmark script is benchmark_official.py.

Limitations

  • Domain: trained only on laptop and restaurant reviews. Accuracy on other products (e.g. headphones) has not been measured on labelled data.
  • Neutral sentiment is much weaker than positive or negative.
  • Contrast and idioms: sentences that set up an expectation and then reverse it ("I expected it to be terrible, but it is excellent"), and idioms such as "dies fast", can get the wrong sentiment with high confidence.
  • Explicit aspects only: implicit ones ("it lasts all day" → battery) are not labelled in SemEval-2014.
  • Input length: 512 tokens. The GitHub repository's infer.py splits longer reviews between sentences.
  • Data terms: SemEval-2014 data is distributed for research use. Check its terms before commercial use.

References

  • Pontiki et al. 2014. SemEval-2014 Task 4: Aspect Based Sentiment Analysis.
  • Liang et al. 2021. R-Drop: Regularized Dropout for Neural Networks. NeurIPS.
  • Li et al. 2019. Exploiting BERT for End-to-End Aspect-based Sentiment Analysis. W-NUT.
Downloads last month
22
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Deepanshu027/roberta-base-rdrop-absa-semeval14

Finetuned
(2,432)
this model