RETRIEVAL WASN'T THE BOTTLENECK: WHAT EVALS TAUGHT ME BUILDING A BROWSER-ONLY CAR-BUYING ADVISOR
- Problem
- Car buyers ask questions that mix constraints across brochures, reviews and rating reports — and generic chatbots answer from memory and get the figures wrong.
- Audience
- Car buyers comparing a shortlist who need figures they can trust.
- My role
- Product Owner & Builder (solo)
- Key decision
- Narrowed from “any document” to car buying only — less reach, but it made a domain-vocabulary guard, buyer-intent sections and a tighter prompt possible.
- Solution
- A browser-only RAG advisor (Qwen2.5-0.5B via WebGPU) that answers only from retrieved passages, refuses off-topic questions before any model runs, and shows which passages it used.
- Outcome
- Retrieval on a held-out set: 26/28
- Generation on answers the model wrote: 29% — the real bottleneck, found by evals
- Server and per-query cost: $0
In one line: I built a car-buying advisor that answers only from documents and runs entirely in the browser — then wrote 75 eval questions, which showed retrieval was working and the small model's generation wasn't. That finding, not the build, decided what comes next.
Try it: enterprise-rag-2026.web.app — runs on sample data, not real car figures.
1. The Problem
Car buyers ask questions that mix constraints: “7-seater under 18 lakh, safety matters, mostly city driving.” The answers sit in different places — brochures, reviews, rating reports. A generic chatbot answers confidently from memory and gets the figures wrong, at exactly the moment the buyer is trusting it.
The goal: an advisor that answers only from documents, and says so when it can't.
2. Goals and Non-Goals
Goals — constraints I chose on purpose:
- No server, no per-query cost. The model (Qwen2.5-0.5B) runs in the user's browser via WebGPU.
- No invented numbers. Every figure must come from a retrieved passage.
- Honest refusal. Off-topic or uncovered questions get a refusal, not a guess.
Non-goals for this version:
- Answering questions about any document — dropped on purpose (Decision 1).
- Real car data — the live build uses sample documents until licensed ones are in place.
- Letting visitors change the library — upload, delete and clear are off in production (Decision 4).
3. Key Product Decisions
Decision 1 — Expert, not generalist
I first built it to work on any uploaded document, then dropped that. Narrowing to cars made three things possible: a domain-vocabulary guard, buyer-intent sections (price, safety, mileage, space, ownership cost) and a tighter prompt.
Trade-off: less reach, in exchange for a product people can trust.
Decision 2 — Hide the plumbing, keep the proof
The document library and system prompt moved behind a menu, because a buyer doesn't need them. I kept the 2D vector map visible and made it highlight the passages used for the last answer — it's the clearest way to show why an answer appeared.
Trade-off: a cleaner screen for buyers, while keeping the one piece of transparency that builds trust.
Decision 3 — Cut a feature that didn't earn its place
I built a marketing-funnel copilot (awareness, intent, desire, action) and removed it: it added nothing over simply answering the question. It did expose a real gap — questions that span several topics — and I kept that fix.
Trade-off: a day of build time, written off. The lesson stayed; the feature didn't.
Decision 4 — Lock down production
Production ships a curated library. Upload, delete and clear are switched off in the production build by a build-time flag, which stays on in development.
Trade-off: visitors can't try their own documents, but nobody can break or pollute the public demo.
4. How It Works
Six steps run for every question, and the model only appears in step five:
- Chunking — documents split by section, with five strategies plus automatic selection.
- Embedding — 256-dimension hashed character n-grams: no model download, and the same result every time.
- Retrieval — dense similarity and BM25 keyword scoring, fused with reciprocal rank fusion, with a boost for the section that matches the buyer's intent.
- Guard — off-topic questions are refused before any model runs.
- Generation — a short grounded prompt, with a quote-the-documents fallback for browsers without WebGPU.
- 2D map — a real PCA projection of the embeddings, showing which passages were used.
5. What Broke, and What I Changed
Most of the problems were upstream of the model — in the data, the search or the guard — not in the prompt.
| Problem | Fix |
|---|---|
| The bot repeated the same answer | Duplicate chunks were looping the small model. Documents are now replaced on re-upload, and near-duplicates (Jaccard ≥ 0.8) are dropped. |
| The off-topic guard stopped working as the library grew (“recipe for chocolate babka” matched the word “give”) | Added a car-vocabulary check. |
| Keyword matches were outvoted by noisy embedding scores | Reweighted the fusion. |
| “7 seater” didn't match “seven” | Added numeral aliases. |
| Per-car searches only saw the top 12 results | Search all candidates. |
| PDF headings were lost on extraction | Heading-preserving extractor. |
| DOCX table rows split apart | Collapse paragraph breaks inside cells first. |
6. Measuring It: The Evals
I built a gold set of 47 questions and a held-out set of 28, both scored by deterministic checks rather than by eye.
| Measure | Result | How to read it |
|---|---|---|
| Retrieval, gold set | 47/47 | Optimistic — I tuned against this set |
| Retrieval, held-out set | 26/28 | The honest retrieval number |
| Generation, all 75 cases | 41% | Flattered by correct refusals that never reached the model |
| Generation, answers the model actually wrote | 29% | The number that reflects the model's work |
What the evals found
- Retrieval isn't the bottleneck; generation is. The right passage was found, then the 0.5B model garbled it.
- Failures are mostly misattribution, not invention. It gave an unrated car three stars, gave a sunroof to the wrong model, and turned 310 km into 310 miles.
- Prompt wording didn't matter. Three prompt variants were statistically indistinguishable. At this model size, the real levers are a bigger model or asking the model to compose less.
- The headline number flatters. 41% counts questions correctly refused with no model call. 29% is the one that measures the model.
7. How Should It Be Judged? LLM-as-Judge vs Human Labels
My recommendation is layers, not a choice between them:
- Deterministic checks on every change — free and exact.
- An LLM judge, offline only — for what string matching misses, mainly answers attributed to the wrong car.
- Humans to calibrate the judge — not to grade everything.
In my own test, the deterministic scorer agreed with my verdicts on 17 of 21 answers. Kappa was only 0.39, and it passed 3 of the 18 answers I failed — all attribution errors that would have shipped. I had 21 labels against the 30 needed, so none of this counts as validated yet. That's why human labeling is next.
8. What I'd Do Next
- Real data: replace the sample documents with real, licensed ones.
- Test the model-size hypothesis: re-run the same evals on a ~1–1.5B model to see whether size lifts the 29%.
- Validate the judge: finish human labeling to measure whether an LLM judge can be trusted.
9. PM Takeaways
- Narrow beats broad when trust is the product.
- Measure the right denominator. A refusal that happens before the model runs shouldn't inflate model quality.
- Evals changed the roadmap. They showed the bottleneck was generation, not retrieval — and that prompt tweaks were wasted effort.
- Kill features early. The funnel copilot cost a day and taught me something, but it didn't belong in the product.
- A judge needs its own eval. An unvalidated judge is just a second opinion you can't audit.
Caveat: all figures come from sample data in a single run at temperature 0.2. Treat them as relative, not absolute.
KEY OUTCOMES & DELIVERABLES
- Scoped the product down from general document Q&A to car buying, trading reach for trust.
- Built a 47-question gold set and a 28-question held-out set with deterministic scorers; held-out retrieval scored 26/28.
- Used the evals to locate the bottleneck — generation at 29%, not retrieval — and to rule out prompt tweaks as a lever.
- Cut a marketing-funnel copilot that added nothing over answering the question, keeping only the multi-topic fix it exposed.
- Shipped with no server and no per-query cost, and a production build locked to a curated library.
