A multi-class NLP sentiment engine that combines VADER lexicon scoring with a fine-tuned BERT classifier — trained on 50K+ reviews for nuanced 5-class emotion detection.
Simple positive/negative sentiment classification misses the nuance real businesses need. A review saying "The product is okay but the shipping was a disaster" carries mixed sentiment — binary classifiers collapse this to a single polarity and lose the signal entirely. Product teams need to know which dimension failed, not just that something did.
Off-the-shelf models also struggle with domain-specific language — technical jargon, industry slang, irony, and sarcasm that is perfectly legible to a human reader but systematically misclassified by generic pretrained models. The solution required both a richer label space (five classes) and a model that could adapt to the target domain through fine-tuning.
The key insight is that VADER and BERT are complementary — VADER is fast and rule-based with strong baseline performance on explicit sentiment words, while BERT captures contextual meaning and long-range dependencies. Combining their outputs as a hybrid feature vector before the classification head outperforms either model alone.
The preprocessing stage handles tokenisation, lowercasing, emoji-to-text expansion, and noise removal. SMOTE oversampling and class-weighted loss address the severe class imbalance inherent in review datasets, where neutral reviews dominate by a factor of 3–4×.
VADER alone fails on mixed and sarcastic inputs because it processes each token independently. The hybrid architecture was not an optimisation — it was a fundamental requirement to reach meaningful accuracy on the hard cases.
Neutral reviews overwhelmingly dominate real-world datasets. Training without correction produced a model that predicted "Neutral" 60% of the time. SMOTE oversampling and per-class loss weighting were both needed to fix this.
General BERT underperforms on industry-specific vocabulary. Even 2,000 in-domain fine-tuning steps significantly shifted the model's probability distributions for product jargon, brand names, and technical slang.
For downstream business use, a confidence score below a threshold is often more actionable than the class label itself. Building confidence-aware inference from the start — rather than retrofitting it — shapes better product decisions.
Check out the full model training pipeline on GitHub or get in touch to discuss applied ML projects.