
LLM vs Fine-Tuning
- Python 3.11 / 3.12
- PyTorch
- Hugging Face Transformers
- DistilBERT
- scikit-learn (TF-IDF, LinearSVC)
- Anthropic Claude API
- Structured Output / Tool Use
- QLoRA / PEFT
- Qwen2.5-1.5B
- FastAPI
- Gradio
- Hugging Face Spaces
- Docker
- pytest (92 tests, CI)
- pydantic-settings
Empirical study that reframes emotion classification as a production decision rather than a leaderboard contest. I benchmarked four approaches on the same 417k-sample corpus: TF-IDF and Linear SVM, fine-tuned DistilBERT, prompted Claude Haiku 4.5 with constrained structured output (zero- and few-shot), and QLoRA on Qwen2.5-1.5B. Each was measured on macro-F1, p95 latency and dollar cost per 1,000 predictions. The headline result: the 67M-parameter fine-tuned encoder reaches 0.9128 macro-F1 and beats the frontier LLM by roughly 40 points at effectively zero per-prediction cost, while even the classical SVM beats the LLM by 32 points. Shipped with a live three-way classifier on Hugging Face Spaces, a FastAPI inference service, a Docker image, a 92-test reproducibility harness and a written paper.


