Topic 5 of 5 · 5 min read
Feeding production failures back into evals
Goal: Turn a batch of production failures into new eval cases and verify the fix against them.
Every production failure you understand should become a test case, so the same failure cannot ship twice. The loop is: collect, triage, add to the dataset, fix, re-run offline evals, then release.
Check yourself · 1 of 3
A flagged production trace shows a clear failure. What should you do before fixing the prompt?
Why it matters
Online signals tell you something went wrong. They do not stop it from returning. A failure that is fixed but not captured as a case comes back with the next prompt edit or model swap, and nobody notices until users do. Production traffic is also the best source of realistic test inputs you will ever get.
How to do it
- Collect candidates: flagged traces (thumbs-down, escalation, guardrail hit), low-scoring judged traces, and a small random sample for failures nobody flagged.
- Triage. Read each trace and label the failure mode in plain words: "ignored the date range", "cited a policy that does not exist", "wrong language". Group similar ones. Drop traces that were actually fine or ambiguous.
- Turn each group into cases. Keep the real input, remove personal data, and write the expected behaviour or the check that detects the failure. A single failure may become a code check, a judged rubric item, or a labeled example.
- Add them to a regression set with the source trace id and date, so you know why the case exists.
- Run the offline evals on the current version. The new cases should fail. If they already pass, the case does not capture the failure.
- Fix, re-run, and compare against the full dataset, not only the new cases, to check the fix did not break others.
- Release, then watch the same online metric to confirm the failure rate fell.
{
"id": "reg-2026-11-041",
"source_trace": "tr_8f3a1c",
"input": "Show refunds for last quarter",
"failure_mode": "ignored the date range",
"check": "output cites only refunds between 2026-07-01 and 2026-09-30",
"added": "2026-12-01"
}
What goes wrong
- Fixing without a case. The patch works today and regresses next month.
- Adding raw user text. Real inputs can contain private data; redact before storing.
- Only adding the failures. A set made only of failures drifts from real traffic. Add some normal traces as well.
- Cases that already pass. If a new case passes before the fix, it tests nothing.
- Judging the fix on the new cases only. Re-run the whole set to catch a new regression.
Examples
Nine traces, three cases
Nine escalated traces are triaged. Five show the bot answering a refund question from an outdated policy, two are wrong language replies, two are fine. That becomes three cases: refund policy date, reply-in-user-language, and a normal refund question. The first two fail on the current prompt; after the fix, the whole set passes and refund escalations fall the next week.
The case that already passed
A team adds a case for a wrong-date answer and it passes on the current prompt. The real failure only occurred with a long conversation history. They rewrite the case with the full history and now it fails, as it should.
Key points
- Collect flagged traces, low judge scores and a small random sample as failure candidates.
- Triage by naming the failure mode in plain words and grouping similar traces.
- A new case should fail on the current version before the fix, otherwise it does not capture the failure.
- Store each case with its source trace and date, and redact personal data before it enters the dataset.
- Re-run the whole offline set after the fix, then watch the same online metric after release.
Common mistakes
- Patching the prompt without adding any case to the dataset.
- Adding a case that already passes on the version that failed in production.
- Copying raw user messages with personal data into a shared dataset.
- Re-running only the new cases and missing regressions elsewhere.
Check yourself · 2 of 3
You add a new case from a production failure and it passes on the unfixed prompt. What does that tell you?
Check yourself · 3 of 3
After fixing a failure, which offline run is the right one?
Practice items, not counted towards your mastery.
Start here
- Langfuse: Evaluation overview (opens in a new tab)DocsFree
How online scores, user feedback and LLM-as-a-judge attach to production traces, next to offline datasets.
- Trustworthy Online Controlled Experiments (Kohavi, Tang, Xu) (opens in a new tab)BookPaid
The standard book on randomization units, guardrail metrics, sample size and novelty effects.
- OpenTelemetry semantic conventions for generative AI (opens in a new tab)StandardFree
Common attribute names for model calls, token usage and latency, so metrics line up across tools.
More for this topic
- Your AI product needs evals (Hamel Husain) (opens in a new tab)ArticleFree
A practitioner's account of building evals from real traces and logging production data into them.