ReviewRadar sentiment (English + Roman Urdu)

Fine-tuned cardiffnlp/twitter-xlm-roberta-base-sentiment (XLM-RoBERTa-base already trained on multilingual tweet sentiment) that labels a customer review or comment as negative, neutral or positive. It handles English and Roman Urdu (Urdu written in Latin letters, e.g. "product bohat acha hai").

How to use

from transformers import pipeline
clf = pipeline("text-classification", model="fateemah26/reviewradar-sentiment")
clf("Quality achi hai lekin delivery late thi")

For best results, apply the same text normalisation as in training (normalise() in src/preprocess.py): lower-casing, removing URLs and mentions, and mapping common Roman Urdu spelling variants (e.g. nhi / nai β†’ nahi, bht β†’ bohat).

Training data

Source Language Rows used Labels
UCI Roman Urdu Data Set Roman Urdu 19,435 after cleaning Positive / Negative / Neutral (as given)
Amazon reviews (English) English 5,998 (balanced sample) 1–2 stars = negative, 3 = neutral, 4–5 = positive

Cleaning: lower-casing, URL and mention removal, Roman Urdu spelling normalisation, and removal of duplicates, of texts with conflicting labels and of texts under 3 characters. Split: 80 / 10 / 10 (train / validation / test), stratified by language and label.

Training procedure

Hugging Face Trainer on CPU: 2 epochs, learning rate 2e-5, batch size 32, 10% warmup, weight decay 0.01, max length 128 tokens. The 250k-token embedding layer was frozen (86M of 278M parameters trained) so that training fits in 7 GB of RAM. The best epoch was chosen by validation macro F1.

Evaluation

Test set: 2,544 reviews (the same rows for every model).

Model Accuracy Macro F1 Macro F1 (English) Macro F1 (Roman Urdu)
TF-IDF + Logistic Regression (baseline) 0.637 0.637 0.625 0.633
Multilingual DistilBERT, fine-tuned 0.649 0.647 0.665 0.635
XLM-RoBERTa (twitter-sentiment), fine-tuned - final 0.679 0.677 0.692 0.666

Per-class F1:

Model Negative Neutral Positive
TF-IDF + Logistic Regression (baseline) 0.608 0.629 0.676
Multilingual DistilBERT, fine-tuned 0.609 0.660 0.673
XLM-RoBERTa (twitter-sentiment), fine-tuned - final 0.644 0.681 0.707

The baseline is TF-IDF (word 1–2 grams) + Logistic Regression with balanced class weights. Multilingual DistilBERT fine-tuned from the general pre-trained checkpoint is shown for comparison. All models are trained and tested on exactly the same split.

Limitations

  • The Roman Urdu data is social-media comments, not product reviews. It covers politics, religion, sport and entertainment, so accuracy on Daraz-style Roman Urdu product reviews may be lower than the test score.
  • Neutral is the hardest class. Most errors are neutral confused with positive or negative, partly because the source labels for neutral are themselves inconsistent.
  • Sarcasm ("wah, 2 hafte mein delivery, bohat tez service") and mixed reviews (good quality but late delivery) get a single overall label. The demo's aspect view splits mixed reviews into clauses as a partial fix.
  • Urdu script and other languages were not in the training data.
  • 3-star English reviews are often genuinely mixed, so the "neutral" mapping is noisy.

Bias and risks

  • The Roman Urdu labels come from one public dataset with crowd-style labels. Label noise and the topics in that data (e.g. political and religious comments) can bias predictions for certain names, places or groups.
  • Spelling, dialect and slang differ across regions. Users who write differently from the training data may get worse predictions.
  • Do not use this model alone for decisions about individual people (e.g. moderation or customer bans). Use it to summarise large volumes of feedback, with a human reviewing important cases.
Downloads last month
17
Safetensors
Model size
0.3B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for fateemah26/reviewradar-sentiment

Finetuned
(40)
this model

Evaluation results