The flywheel: production data back into evals
For engineers
Online evals, LLM judges, budgets and agentic RAG evaluation that feed the next release.
A chat assistant improves when every real failure becomes a test, every fix is checked against the tests, and every release is watched against a cost and speed budget.
The case
Loom & Lane sells furniture online. Lane is its support assistant: it answers delivery, returns and assembly questions from the help center, using retrieval over about 300 articles and a Claude model for the answers. It handles 6,000 chats a week. In November the return window changed from 30 to 14 days. Lane kept quoting 30 days, and nobody noticed for nine days, because only 72 chats a week get a thumbs-down.
The team builds a loop. Production produces failures, failures become eval cases, cases guard the next change, and the next release produces new production data. This is the data flywheel.
How the loop runs
1. Find the failures. Every chat has a trace id. Instead of waiting for votes, the team samples traces by signal: hand-offs to a human agent, regenerate clicks, judge failures and thumbs-down. They add a small random slice for failures no signal sees. They read the traces and give each failure a name, such as stale-return-window.
2. Judge live traffic. A model judge scores a random 25 percent of chats each week within a fixed budget. It asks one yes-or-no question per failure mode, writes a short critique first and then gives PASS or FAIL. The judge is not trusted on faith: it is checked against expert labels it has not seen, and its true-positive and true-negative rates are published next to its pass rate. A judge that passes 8 of 20 real failures overstates quality, even if it agrees with people 88 times in 100.
3. Make cases. Confirmed failures become regression cases. Names, phones and addresses are replaced with placeholders. The expected behaviour is written as a property ("states the window is 14 days"), and a grader checks it. The team also checks consent: a customer who opted out of training can still have an anonymised chat used for evaluation, but never for fine-tuning.
4. Test retrieval and answers apart. For each question the team labels the passage that answers it. Recall@k and MRR show whether retrieval found it. Faithfulness and refusal scores show whether the answer stuck to it. The set includes real customer wording and questions the help center cannot answer, where the right reply is a refusal.
5. Use search loops only where they pay. A question like "my Harlow sofa leg arrived cracked, when will a replacement reach my postcode?" needs sale terms, a damage policy, a product lead time and a delivery zone. Lane runs an agentic search for those. "What is the return window?" gets one retrieval. The loop has a step cap, a few snippets per search, and a rule to reword or stop when results are weak.
6. Hold a budget. Lane's value is the human chat it replaces, $3.00. The owner will spend 10 percent of that, so the ceiling is $0.30 per resolved chat, and the reply target is p95 under 3 seconds. The team reports cost per resolved chat, not per call, with retries and failed runs included. Averages are never used for latency, because a few slow replies hide in them.
Before and after
Before: a prompt edit, "always say 14 days", deployed to everyone on Friday afternoon, judged by whether the thumbs-down rate moved. After: nine anonymised cases added, the full suite run, the fix released to 10 percent of chats for two days, and hand-off rate, p95 and cost per resolved chat compared with the control.
What goes wrong
- Thumbs as the only signal. Few users vote, and the ones who do are not typical. Hand-offs and resolution rates carry more weight.
- An unchecked judge. Its errors become dashboard numbers and then eval labels. Calibrate it, and re-check when its model version changes.
- Cases that leak or only echo. Raw personal data in a shared set is a breach, and a set made only of last week's bugs will not catch next week's.
- Unbounded loops and tiny tests. A search loop with no cap can cost 18 times a normal chat, and an A/B test on 200 chats per side cannot separate a half-point gap from noise.
The loop only works with an owner and a cadence: someone reads the traces every week, and every release ends by feeding the next one.
Steps
Mine production traces for failures
Every chat has a trace id. Pull traces by signal: hand-offs to a human, regenerates, thumbs-down and judge failures, plus a small random slice. Read them, and group the failures into named categories such as stale-return-window or ignored-postcode. Names make the counts countable and the fixes assignable.
One week of Lane traces by signal 6,000 chats Signal Chats Read this week Handed to a human 840 60 sampled Regenerate 310 30 sampled Judge failed 190 all Thumbs-down 72 all Random slice 6000 40 sampled Judge live traffic on a budget
Run a judge asynchronously on a random sample of live chats, sized to a weekly spend. Watch the pass rate and alert when it drops. Send flagged chats to triage, read them, and keep only confirmed failures. Judge errors go to the calibration set, not the eval set.
Write the judge as a binary rubric and calibrate it
One judge per failure mode, with a short critique first and then PASS or FAIL, plus one example of each. Measure true-positive and true-negative rates on expert labels it has not seen, and correct the reported pass rate for them. Pin the judge version.
Judge: return window Question
Does the reply state the return window as 14 days from delivery, or decline to state one? Write two sentences of critique, then PASS or FAIL.
Example FAIL
"You have 30 days to return any item."
Example PASS
"Returns are accepted within 14 days of delivery."
Turn failures into anonymised regression cases
Replace names, phone numbers and addresses with placeholders. Write the expected behaviour as a property, attach a grader, tag the category, and check consent: an opt-out covers training, not evaluation. Keep the set balanced so it does not mirror last week's bugs only.
Score retrieval and answers separately
Label the gold passage for each question, compute recall@k and MRR, then score faithfulness and refusals on the answer. Include real customer wording and unanswerable questions. When retrieval is fine and answers are wrong, the fault is in generation, and the reverse.
RAG eval on 120 questions Run after the fix Metric Before After Recall@5 0.86 0.88 Faithfulness 0.93 0.94 Correct refusals 0.90 0.92 Route multi-part questions to a bounded agent
Send a question to the search loop only when it needs several dependent passages. Give the loop a step cap, a small result count per search and a rule to rewrite or stop when results are weak. Log every step so a bad run can be read.
Set cost and latency budgets and ship in stages
Derive a cost ceiling per resolved chat and a p95 reply time from what a chat is worth. Alert on daily spend and p95, and cap each run. Ship each fix to a small share of traffic, check the budgets and the hand-off rate, then widen.
Rollout plan Goal: Ship the stale-window fix safely
- 1. Rerun the offline suite; no category may drop.
- 2. Release to 10% of chats for two days.
- 3. Compare hand-off rate, p95 and cost per resolved chat with the control.
- 4. Widen to 50%, then 100%, if nothing regressed.
- 5. Name the owner of next week's trace review.
Skills this scenario uses
Where to study
- Your AI product needs evals (Hamel Husain) (opens in a new tab)ArticleFree
A practical loop of error analysis, test cases and fixes for LLM products.
- Creating a LLM-as-a-Judge That Drives Business Results (Hamel Husain) (opens in a new tab)ArticleFree
Binary judges, critiques first and checking a judge against expert labels.
- Develop test cases (Claude docs) (opens in a new tab)DocsFree
How to write measurable criteria and test cases before shipping a prompt change.
- Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (Zheng et al.) (opens in a new tab)PaperFree
Measures position, verbosity and self-preference bias in model judges.
- RAGAS: Automated Evaluation of Retrieval Augmented Generation (opens in a new tab)PaperFree
Defines faithfulness and context relevance metrics for RAG pipelines.
- How we built our multi-agent research system (Anthropic) (opens in a new tab)ArticleFree
Agentic search design, its token cost and the effort limits that cap it.
- Prompt caching (Claude docs) (opens in a new tab)DocsFree
How cached input is billed and which prompt parts can be cached.
- Monitoring Distributed Systems (Google SRE Book) (opens in a new tab)BookFree
Why percentiles and the slow tail matter more than averages for latency.