// Artifact · LLM Fine-Tuning
Haven — Anatomy of a Listening Machine
A fully local AI therapy companion: QLoRA fine-tuned Llama, a trained emotion classifier, retrieval-grounded answers, and local voice — every step of the ML lifecycle on an 8 GB laptop GPU
// 01 · Introduction
Introduction
Haven is a private mental-wellness companion whose every model runs on my own machine: a Llama fine-tuned with QLoRA on 10,752 real emotional-support conversations, a DistilRoBERTa classifier scoring 28 emotions per message, retrieval over 36 public-domain clinical publications (NIMH, VA, NIH), and fully local speech-to-text and neural text-to-speech. The embedded artifact below documents all ten steps of the machine-learning lifecycle with the real numbers the pipeline produced — including a live demo video of the app in a hands-free voice conversation.
// 02 · Description
Description
The build walks the complete ML lifecycle and is honest about where it broke: four datasets cleaned and deduplicated (42% of the counseling corpus were exact duplicates — removed before splitting to prevent leakage); EDA whose class-imbalance findings dictated the metrics; feature engineering with assistant-only loss masking, conversation windowing, and sequence packing; baseline-first model selection; QLoRA training on an RTX 3070 that required writing a chunked cross-entropy trainer to stop the 128k-vocabulary logits from overflowing 8 GB of VRAM; and a three-part evaluation that caught the fine-tune regressing on crisis safety — repaired with targeted safety-patch training and a defense-in-depth server layer that makes application-level safety independent of model behavior. Headline results: validation perplexity 32.6 → 9.79; the classifier — after per-class threshold tuning, the build's best lesson — beats its TF-IDF baseline on both micro-F1 (0.563 vs 0.460) and macro-F1 (0.433 vs 0.411); the patched model beats base on crisis handling (75% vs 62.5%) and the application passes the full 18-prompt safety suite by construction.
// 03 · Objective
Objective
Demonstrate command of every stage of the machine-learning lifecycle learned in the AI/ML program — data, cleaning, EDA, features, model selection, training, evaluation, deployment, and ethics — in one coherent, working system, on consumer hardware, in the highest-stakes domain for getting AI behavior right.
// 04 · Process
Process
// 05 · Tools & Technologies
Tools & Technologies
// 06 · Value Proposition
Value Proposition
Unique Value
Most portfolio chatbots are a system prompt on someone else's API. Haven is trained: the empathy is learned from data, the emotion perception is a model I trained and threshold-tuned, and the safety behavior is trained, adversarially evaluated, honestly reported where it failed, and guaranteed at the system level. The full receipts — technical report, model card, loss curves, and evaluation files — ship with the project.
Relevance to My Audience
For AI/ML hiring managers it demonstrates end-to-end applied machine learning — dataset engineering, fine-tuning under hard memory constraints, honest evaluation, and responsible-AI system design — not just API integration. The failure-and-fix stories (duplicate leakage, threshold-driven macro-F1, VRAM thrash → chunked loss, safety drift → patch + guarantees) show engineering judgment under real constraints.
// 07 · References
References
- Technical Report & System Design (PDF) — architecture, build journey, and how each model was trained
- Model Card (PDF) — data, metrics, failure modes, ethical considerations
- Source code — full pipeline, app, and safety system
- Dettmers et al. (2023), "QLoRA: Efficient Finetuning of Quantized LLMs"
- Liu et al. (2021), "Towards Emotional Support Dialog Systems" — ESConv
- Rashkin et al. (2019), "Towards Empathetic Open-domain Conversation Models"
- Demszky et al. (2020), "GoEmotions: A Dataset of Fine-Grained Emotions"