Charles Cozad

Sentiment in your browser

I have reviewed enough build-vs-buy proposals to know when an AI feature earns its line item. Generic sentiment on English text, in 2026, does not. The model that does this runs in your browser.

Below is a working classifier — a 67 MB DistilBERT model that loads into your browser on the first run, caches there, and infers per turn entirely on your device. Pick a sample customer-service call or paste your own.

friendly → frustrated → resolved

First run downloads the model (~67 MB). Subsequent runs are instant and stay in your browser cache.

What this can't do

The model is a general-purpose binary sentiment classifier trained on movie reviews. It is honest at what it is, and that includes its blind spots. Treat low-confidence outputs (under 70% in this UI) as the model saying it does not really know.

  • Domain-specific jargon. Legal, medical, technical, or trader-speak does not map cleanly onto movie-review sentiment.
  • Sarcasm and irony. “Great, another bug,” will probably register as positive.
  • Code-mixed language or non-English text. The tokenizer was trained on English; the output for other languages is undefined.
  • Context outside the turn. Each utterance is scored independently. A turn that resolves a prior complaint reads in isolation, not in conversation.
  • Neutral content. The model only emits POSITIVE or NEGATIVE. The UI surfaces low-confidence outputs as uncertain rather than forcing a label.

When you actually pay the vendor

The point of this demo is not that vendors selling sentiment-flavored products are unnecessary. It is that paying for specifically the sentiment-classification line item, on generic English text, in 2026, makes less sense than it did even two years ago. There are still real reasons to write a check — they just have to be specific.

  • Compliance posture. SOC 2, HIPAA, PCI, regional data residency. When the call audio or transcript is itself regulated, the vendor's certification and BAA are the value, not the model.
  • Integrated platform. Transcription + redaction + sentiment + summarization + routing + ticketing in one workflow. A standalone model is half the system; the rest is plumbing the vendor already owns.
  • Operational features. Real-time agent coaching, supervisor alerting, queue triage on negative-sentiment calls. These are product surfaces around the model, not the model itself.
  • Audit and retention. Tamper-evident logs, retention controls, eDiscovery, legal hold. Build this in-house and it is a six-month project regardless of how cheap the inference is.
  • Custom-trained models on your industry's language. Off-the-shelf binary sentiment on movie reviews is not the same as a model fine-tuned on healthcare collections calls. If your domain has real vocabulary, the vendor may have the only honest model.
  • SLA and accountability. Someone whose job it is to answer the phone when accuracy drops. Open-source models do not pick up.

If you are paying a vendor for any of those, the line item is earned. If you are paying for sentiment classification on generic English text and that's it, the math has shifted.

Tech stack

  • Transformers.js (Hugging Face's official JS port) running the model in-browser via ONNX Runtime + WebAssembly, with WebGPU when available
  • DistilBERT SST-2 (Xenova/distilbert-base-uncased-finetuned-sst-2-english) — the well-known baseline; ~67 MB on first download
  • Next.js dynamic import keeps the model and library out of the main bundle until the demo page loads
  • No backend, no API key, no telemetry. Inputs and outputs stay in your browser — even pasting your own transcript does not send anything to a server
  • Sample transcripts are hand-written for a fictional SaaS company; no real call data was used to build the demo