Problem Statement
Understanding customer sentiment at scale is essential for product feedback, brand monitoring, and customer support. Manual review doesn't scale. An automated sentiment classifier that's both accurate and fast enough for real-time use bridges this gap.
Technical Approach
Model Architecture
- BERT (DistilBERT): Fine-tuned transformer model achieving 92% accuracy — 8 points higher than the best traditional baseline. Used Hugging Face Transformers with custom classification head.
- Traditional Baselines: Naive Bayes (84%) and SVM (86%) trained on TF-IDF features for comparison and lightweight deployment scenarios.
- Model Distillation: Distilled the fine-tuned BERT into a smaller model, reducing inference from 500ms to sub-200ms while retaining 90% of the accuracy gain.
Deployment
- Flask REST API: Serves predictions via a lightweight endpoint accepting JSON text input
- Real-time Web UI: Browser interface for interactive sentiment analysis with instant visual feedback
- Concurrency: Handles 50+ concurrent requests with sub-200ms response times
Key Results
- BERT model: 92% accuracy vs 84% Naive Bayes baseline
- Sub-200ms inference after distillation — suitable for real-time chat and review analysis
- REST API tested at 50+ concurrent requests without degradation
Tech Stack
BERT / DistilBERTPyTorchHugging FaceFlaskNLTKPythonScikit-learn