# How do you know an LLM feature works before you ship it?

By Vishal Kumar · Published 2026-11-05 · Updated 2026-11-13
Source: https://fungyaan.com/p/llm-evals-before-shipping
Tags: ai, llm, evaluation, testing, engineering

**The verdict, which the evidence below will earn:** the same way you know any code works: automated tests, run on every change, against cases you didn't tune on. For an LLM feature, the tests are an **evaluation (eval)**: a fixed set of real inputs with known-good outputs (a **golden set**) and a script that scores the system against it. Keep a **held-out** part you never look at while tuning. Add an **LLM-as-judge** for open-ended outputs, but only after checking it against human ratings. Then keep measuring in production, because real users bring inputs your set doesn't have. "It looked good on ten examples" is not a test.

The numbers below come from my [LLM document-ingestion pipeline](https://github.com/the-vishal-kumar/llm-document-ingestion), which turns purchase orders (emails, PDFs, spreadsheets, chat messages) into structured data. It has an evaluation harness and published results; `make eval` reruns them.

Here's the case. A feature looks great in the demo, passes every example the team tried, and then quietly lets a wrong order through in production. Nobody lied; the examples just weren't the ones that mattered. What I find encouraging about evals is how familiar the solution turns out to be. LLMs feel new and slippery, yet the answer is the oldest good habit in software, testing against cases you didn't cheat on, applied with a little extra care. Let's see what that looks like with real numbers.

> **Case file**
>
> | | |
> |---|---|
> | **The case** | A feature passes every demo example, then lets a wrong order through in production |
> | **Suspects** | Eyeballing outputs, "it looked good on ten examples" |
> | **Culprit** | Testing only on the cases you tuned on |
> | **The fix** | A golden set in CI, a held-out split, a validated judge, production signals |
> | **Evidence** | llm-document-ingestion: 0.0% errors on the tuning set, 0.4% on held-out data |

## The suspects: four ways to check

| | Eyeballing outputs | Golden-set eval | LLM-as-judge | Production signals |
|---|---|---|---|---|
| **What it is** | Read some outputs and decide they look fine | Score outputs against known-correct answers, automatically | A model grades outputs against a rubric | Real usage: review rates, corrections, user feedback, A/B tests |
| **Catches** | Obvious breakage | Regressions; accuracy per field, format and case type | Quality of open-ended text (tone, completeness, faithfulness) | What your test set doesn't contain |
| **Misses** | Almost everything rare | Inputs unlike the set | Whatever the judge itself gets wrong | Problems before launch |
| **Cost per run** | Your time, every time | Near zero once built | Model calls | Needs users and instrumentation |
| **Use it** | Exploring, early | Always, in CI | When there's no single right answer | Always, after launch |

Eyeballing is the usual suspect people rely on, and it's the weakest witness. The others aren't alternatives to each other; they cover each other's blind spots. A shippable feature has a golden set in CI, a judge where the outputs are open-ended, and production metrics after launch.

## Case 1: extraction (there's a right answer)

**Situation:** turning a purchase order into fields (buyer, PO number, dates, currency, total) and line items (part number, quantity, unit, price, catalogue match).

This is the happy case. When there's a right answer, a golden set is straightforward: labelled documents, and a scorer that compares field by field. The pipeline's harness reports **precision and recall per field**, **accuracy by input format**, and the two numbers the business cares about:
- **straight-through rate:** how many documents were accepted with no human involved;
- **error rate among those:** how many accepted documents were wrong.

### Clue 1: keep data you don't tune on

The rule-based extractor was developed against one synthetic set (300 documents), then scored on a fresh one (1,000 documents, a different seed) that it had never been adjusted for:

| | Tuning set (300 docs) | Held-out set (1,000 docs) |
|---|---:|---:|
| Straight-through rate | 67.7% | 68.8% |
| **Errors among auto-accepted** | **0.0%** (0 of 203) | **0.4%** (3 of 688) |
| Documents fully correct, any route | 85.7% | 84.0% |

On the data it was tuned on, it looked perfect: a spotless alibi. On data it hadn't seen, it let three wrong documents through. I value this result because it's humbling. That's the most common way evals lie: you keep adjusting until the set passes, and you've tuned to the set. **Keep a held-out set, look at it rarely, and quote its number.**

The three errors were all the same case: a European-style `1.000` (one thousand) read as 1, in a request for quotation with no prices or total to cross-check it against. The tempting fix, another rule tuned to the test set, is a false lead. The real fix is knowing the buyer's locale from customer data. A held-out set finds failures like that; a tuning set hides them.

### Clue 2: pick the operating point with a sweep

Most LLM pipelines have a confidence threshold: auto-accept above it, send to a person below it. Re-scoring the same run at different thresholds shows the trade-off directly (held-out set; the [confidence routing post](/p/confidence-routing-llm-extraction) covers the routing design):

| Threshold | Straight-through | Errors among auto-accepted |
|---:|---:|---:|
| 0.85 | 68.8% | 0.4% (3) |
| 0.90 | 36.4% | 0.5% (2) |
| 0.95 | 0.0% | - |

Raising the threshold to 0.90 halved the automation and barely changed the errors, so 0.85 is the better operating point here. That's a business decision (cost of a wrong order vs cost of a review), and the sweep turns it into a table someone can choose from. I love how a vague argument about "how safe is safe" collapses into three rows.

### Clue 3: count *why* things fail

The harness records why each document went to human review. On the held-out set, the top reasons were:
- low confidence in the buyer field (38% of reviewed documents);
- line items parsed from free text (38%);
- line totals not adding up to the document total (18%);
- text addressed to an AI system, a possible prompt injection, routed to a person by design (10%).

That list *is* the roadmap: it says exactly which improvement would automate the most. An eval gives you a to-do list ranked by the data itself.

**One honest gap:** the repo has measured results only for the rule-based extractor. The LLM and "rules first, LLM when unsure" extractors run through the same harness (`-extractor llm` or `cascade`), but need a model API key. Results for them get published the same way when run, and the comparison is only fair because the golden set and the scorer stay identical.

```mermaid
flowchart LR
  D["Purchase order"] --> X["Extractor"]
  X --> C{"Confidence ≥ threshold?"}
  C -- yes --> A["Auto-accept"]
  C -- no --> H["Human review, with a reason"]
  H --> R["Reasons ranked = roadmap"]
  A --> P["Production signals"]
  P -- failure --> G["Add to golden set"]
  H -- failure --> G
```

## Case 2: a support assistant (several right answers)

**Situation:** answering customers' questions from your help-centre articles with RAG (retrieval-augmented generation: fetch relevant text, then answer from it; see the [RAG vs fine-tuning post](/p/rag-vs-finetuning-vs-long-context)).

This case is harder: there's no single right string to compare against. So score properties instead:
- **Retrieval:** did the right article appear in the top 5? That's a plain golden-set metric (recall@k), and it fails before generation does.
- **Faithfulness:** is every claim in the answer supported by the retrieved text? A judge model can check this well, with the source text in its prompt.
- **Answer quality:** did it answer the question, in the right tone, and say "I don't know" when it should? Use a rubric with a 1-5 score per criterion.

**Question the judge first, because it's a witness too:** have people rate 50-100 answers, have the judge rate the same ones, and measure how often they agree. Fix the rubric until agreement is high. Then also include questions that *should* get "I don't know" (not in the docs, out of scope); assistants fail those most.

## Case 3: a summariser (quality is subjective)

**Situation:** summarising long tickets or meeting notes for a busy reader.

- **Hard checks:** length limits, required sections, no invented names, numbers or dates (compare against the source).
- **Judge checks:** coverage of the key points (from a human-written list per document), faithfulness, readability.
- **Pairwise comparisons:** when changing the prompt or model, show judges (people or a model) the old and new summary side by side and ask which is better. It's more reliable than absolute scores.
- **Production:** how often do readers expand the original? How often do they edit or regenerate? Those are your real quality signals.

## The reveal: a golden set that's worth having

Every clue so far points to the same tool. A good golden set pays you back with every change you make, and that compounding is what I find quietly elegant about it.

1. **Start with real inputs:** a few hundred, sampled across formats, customers and edge cases. Add synthetic data for rare cases you can describe but haven't seen.
2. **Label carefully,** and write down the labelling rules: two people should label the same input the same way.
3. **Add every production failure.** Each bug becomes a test case, as in normal software.
4. **Split it:** a development set you look at and tune on, and a held-out set you only score.
5. **Make the eval deterministic and diffable.** The ingestion pipeline's report has no timestamps, so the same seed and code produce the same bytes, and CI shows exactly which numbers moved.
6. **Run it in CI** on every change to prompts, models, retrieval or code, and fail the build on regressions beyond a threshold.

## After the verdict: production

Evals before launch are necessary, and not enough; the case stays open once real users arrive:
- **Log inputs and outputs** (respecting privacy and retention), so new failures can join the golden set.
- **Track the human-review rate and correction rate:** they're the production versions of straight-through rate and accuracy.
- **Watch for drift.** New customers, new document layouts and new model versions all move the numbers. Re-run the eval when the provider updates a model, even if you didn't change anything.
- **A/B test** prompt and model changes on real traffic when the stakes allow, with the golden set as the gate before that.

> **Remember this**
> - Keep a held-out set, look at it rarely, and quote its number.
> - Measure automation rate and error rate at a chosen threshold.
> - Every production failure becomes a test case.

## Case closed: what I'd do by default

1. **No LLM feature ships without a golden set and an eval in CI.** Start with 50 real cases; grow it with every failure.
2. **Report on a held-out set,** and treat a big gap between development and held-out results as overfitting.
3. **Measure the numbers the business decides with:** automation rate and error rate at a chosen threshold, not average accuracy alone.
4. **Use LLM-as-judge for open-ended outputs,** after validating it against people.
5. **Route low-confidence outputs to a person,** and use the reasons as the backlog.

The good news is that you don't need new instincts for LLM features, only the old ones held to a slightly higher standard. Build the golden set, protect the held-out data, and you get to ship with something better than hope.

*Numbers from [llm-document-ingestion](https://github.com/the-vishal-kumar/llm-document-ingestion) `results/baseline.md` and `results/baseline-heldout.md` (rule-based extractor, synthetic documents, seeds 42 and 2026), Nov 2026. LLM-extractor numbers aren't published yet.*
