CoolFace
Modelpublic

Yi-Siang/sg-sentiment-roberta

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes13downloads
Model Card

SG Sentiment RoBERTa

A 3-class sentiment classifier for Singapore English and Singlish, fine-tuned with QLoRA.

Most off-the-shelf sentiment models are trained on American English Twitter data and degrade on local phrasing, particle usage (lah, sia, meh), and code-mixing. This model adapts a strong English sentiment base to Singaporean text using a small, cheap adapter rather than a full fine-tune.

Usage

python
from transformers import pipeline

classifier = pipeline("sentiment-analysis", model="Yi-Siang/sg-sentiment-roberta")
classifier("wah shiok sia this chicken rice confirm best")
# [{'label': 'positive', 'score': ...}]

To load the adapter directly onto the base model instead of the merged weights:

python
from peft import AutoPeftModelForSequenceClassification
from transformers import AutoTokenizer

model = AutoPeftModelForSequenceClassification.from_pretrained("Yi-Siang/sg-sentiment-roberta")
tokenizer = AutoTokenizer.from_pretrained("Yi-Siang/sg-sentiment-roberta")

Model details

Base modelcardiffnlp/twitter-roberta-base-sentiment-latest
MethodQLoRA: 4-bit NF4 quantised base + LoRA adapters
LoRA configr=8, alpha=16, dropout=0.1, target modules query and value
Also trainedclassifier and score heads (modules_to_save)
Trainable params1.48M
Task3-class sentiment (positive / negative / neutral)
Epochs3
Learning rate5e-4

Only the query and value projections carry adapters, which is the standard LoRA placement from the original paper. The classification head is trained in full because the base model's head does not transfer cleanly to a relabelled dataset.

Training data

SourceExamplesLabelling
`mteb/tweet_sentiment_extraction`25,342Original human labels
HardwareZone forum posts1,998Auto-labelled with Gemma2:2b, run locally via Ollama
Total27,340Stratified train / validation / test split

Class imbalance was handled with computed class weights (roughly 1.06 / 0.88 / 1.08), so the classes are close to balanced and weighting is a minor correction rather than a load-bearing fix.

The Singaporean portion is deliberately small relative to the tweet corpus. The design assumption is that the base model already handles English sentiment well, and the local data is there to shift the decision boundary on Singlish rather than to teach sentiment from scratch.

Results

Best configuration, held-out evaluation set:

MetricScore
Accuracy0.782
F1 Macro0.784

Ablation

Four configurations were trained and compared, tracked in Weights & Biases:

RunLoRA rankLearning rateTrainable paramsAccuracyF1 Macro
1162e-42.96M0.7680.770
282e-41.48M0.7660.768
385e-41.48M0.7740.776
485e-41.48M0.7820.784

Run 4 shares its hyperparameters with Run 3 and differs in the classification head setup, which produced the single largest gain in the sweep.

Two further things the sweep shows. Doubling the rank from 8 to 16 doubled trainable parameters and improved neither metric, so the adaptation required here is genuinely low-rank and rank 8 is already sufficient capacity. Learning rate mattered more than capacity, which is the usual pattern for LoRA on a dataset this size. F1 macro tracks accuracy closely across all four runs, which is expected given the classes are near-balanced.

Intended use

Sentiment analysis of informal Singaporean English text: forum posts, social media, reviews, chat.

Limitations

  • Label noise. The HardwareZone portion was labelled by a 2B parameter local LLM, not by humans. Those labels are not audited and will contain errors.
  • Narrow Singlish coverage. 1,998 local examples from a single forum, skewed toward the demographics and topics of that forum. Singlish from other contexts is underrepresented.
  • Informal register only. Not appropriate for formal documents, legal text, or long-form content.
  • Three coarse classes. No intensity, no aspect-level sentiment, no sarcasm handling. Sarcasm is common in forum text and is a known failure mode here.
  • Not evaluated for fairness. No testing across demographic, dialect, or topic subgroups.

Reproduction

Full data pipeline, training script, and serving code are in the GitHub repo, including the W&B run configuration and the Docker setup for the inference API.

Citation

bibtex
@misc{chew2026sgsentimentroberta,
  author = {Chew, Yi Siang},
  title  = {SG Sentiment RoBERTa: QLoRA-adapted Sentiment Classification for Singapore English},
  year   = {2026},
  url    = {https://huggingface.co/Yi-Siang/sg-sentiment-roberta}
}