Wink Pings

Write 20 failure cases first, then decide which model to use

The core action of eval-driven development is very simple: first define what good means, then use the same set of cases to test the model, retrieval, architecture, cost, and latency together. A single pass can deceive you, and so can an average. The article includes concrete examples of a VPN ticket, OCR losing a line, and 100 samples disagreeing with 1,000 samples.

AI projects’ most expensive step often happens in the model-selection meeting: several people each advocate a different model, and nobody can convince anyone else. In the article Eval-driven development: how to choose model, retrieval, and design by testing instead of guessing, Sergii Makarevych offers a tougher alternative: write evals first, then build the agent. An eval is a test with scoring: give an input, observe behavior, assign a score. A golden is an input plus a picture of 'good behavior,' stating clearly what must happen, what must never happen, and what counts as good. A metric is the actual scoring check; it can be a code rule or a model review. A judge handles what rules cannot see, such as tone. A trace is the full record of one run, including tool calls and steps.

This setup solves the default opening of an AI project: which model to choose, how to configure retrieval, single agent or routing, and how many tools to add. Without evals, these questions are settled by demos and the loudest voices. Agents also fail quietly: change one sentence in a prompt or switch the model, and behavior elsewhere drifts, while the tests fail to catch it. Fix 'good' first, and make every design option prove itself against the same set of cases. The smoother the demo, the easier it is to treat untested paths as nonexistent.

The core loop is short:

  1. Define good first, as goldens and clear metrics, ideally before the agent can pass those cases.
  2. Make the agent work until new cases pass. Use code whenever code can judge it; use a judge only for what requires reading to know.
  3. Save the full trace for every run so that when something fails you can see which step broke.
  4. Run every design option against the same set of cases, and ship only options that win repeatedly. Every time a user finds a bug, add that case to the set.
  5. Use it from the first design decision onward: models, retrieval, tools, and architecture. Skip it only when the logic is fixed, the output is fixed, and unit tests are already sufficient.

A single pass is dangerous. Agents are not deterministic programs. Sampling is random, so the same prompt may be reworded; many answers are correct, so exact matching can kill good answers; and the agent chooses tools and order itself. The VPN example in the article is very concrete: the user says the VPN will not connect, and three runs can be search docs then reply, open a ticket directly, or search, find nothing, then open a ticket. Which run is right depends on the rules. If the rule requires checking the help docs first, the second run is broken; if the rule requires that VPN failures must open a ticket, the first run is broken. So the question must become 'How many runs, and what is the pass rate?' A trial is one run; pass rate is passes divided by total runs. Three compliant runs out of five is a 60% pass rate, and that number is more honest than one success or one failure. Run new cases 3 times first; if results split, mark them unstable and increase to 5 to 10 runs; start critical safety cases at 10 runs.

The test set starts from real failures. Many teams want a fixed number; the article says there is no such rule, and method matters more than count. Start by collecting real tickets, chat logs, broken live runs, and bugs caught by human review; remove privacy information but keep profanity, typos, half-sentences, and anger. Each task should cover at least three kinds of behavior: what must happen, what must never happen, and what old behavior must keep working. Escape bugs users encounter should become permanent cases. Also keep a hidden set that you cannot use to tune prompts. After tuning on the main set, run once on the hidden set. High scores on the main set and low scores on the hidden set mean overfitting. Generated cases can be scaffolding, but not a long-term foundation.

The checker order is code first, judge second, people third. Do not let a model judge what a program can judge. Whether the tool was called correctly, whether the arguments are right, whether the side effect actually happened, and whether citation markers are present—use code for these. The article gives very concrete readings: 47 out of 50 calls used the tool correctly, meaning routing basically works, and the 3 failures point to a specific confusion; 42 out of 50 answers had citations, meaning grounding is weak, so fix that first. The model judge should read only what code cannot see: tone, policy details, clarity. Judges have biases: position bias, verbosity bias, and self-preference. Use bidirectional ordering, short good examples paired with long bad examples, different model families, write the rationale before the score, and provide an 'insufficient evidence' exit. People define good and audit the judge. In a sample of 50, humans and the judge agreed on 41; the remaining 9 disagreements are rubric gaps.

Separate outcomes from steps. When the path is free, look only at outcomes. Research tasks require correct summaries and real sources; bug fixes require the failing test to pass without breaking anything else. When the path is locked by rules, you must check steps. Verify eligibility first, confirm before irreversible actions, get guardrail order right, and cap cost. Numbers from the article: 46 out of 50 verified eligibility first, meaning the guardrail basically holds, and the 4 skips must be fixed before release; 43 out of 50 requested confirmation at the correct point, and about one in seven acted too early, which is a blocker for high-risk actions; 29 of 30 unsafe drafts were blocked, and the 1 escape defines the next probe. Record the trace no matter what is gated. When scores drop, the trace points within minutes to the wrong document, a misread record, a skipped confirmation, or a tool with wrong arguments. Failure logs also become the next known-bad case.

A score is a range, not a verdict. Run the same agent on the same test set twice, and both 82 and 79 can appear. With 20 cases, each case is worth 5 points, so one lucky guess can move the headline by 5 points. With 100 cases, each is worth 1 point; with 200, each is worth 0.5. Compare versions by running on the same set of cases and reading per-case flips. The old version passed 47 of 60 and the new version passed 50, so the average rose—but 5 went from fail to pass and 2 went from pass to fail; those 2 are breakage hidden inside the average. Set gates only for repeated, clear regressions. Block a candidate only when it clearly loses to a fixed baseline twice in a row. Plot quality, cost, and latency on the same chart to avoid bad trades where quality rises 3 points, cost doubles, and latency goes from 2 seconds to 5 seconds.

System selection uses the same setup. Whether the model is good enough, whether a retrieval knob helps, and whether to use one agent or multiple agents are all compared on the same set of cases. On simple tasks, a small model is often only 2 to 3 points behind, at one-tenth the cost and twice the speed; in that case the small model wins. On hard tasks, a large model may specifically fix the 5 to 10 cases the small model always fails, and only then is upgrading justified. For retrieval, change only one knob at a time: first check whether the correct document is in the top results, using code; then check whether the answer is faithful to the retrieved content, using a judge. A re-ranker raised faithfulness from 36/50 to 43/50 for 15% more cost, which is usually worth it; doubling latency for only 1 point is not. Hold off on multi-agent: each additional agent adds a handoff point, and context, latency, cost, and debugging all get heavier. Split only when evals show that a certain pattern can be fixed by splitting.

CI should be split by speed. Code checks on every commit, in seconds; judge on every PR and nightly; multi-turn simulations and adversarial probes nightly or weekly, not in the merge gate. In the article, one team cut 20 consecutive tickets from about 162 seconds to about 18 seconds, 9 times faster. If evals take minutes, developers skip them; if they take seconds, they stay. Before any metric earns gate authority, it must first fail on a known-bad set. A judge that says yes to everything is worse than no judge. Make cost visible from day one: print the token bill on every run, sample expensive checks, and self-host frequent judges. Close the loop after launch: every reply goes through guardrails, real threads are sampled for judges, uncertain cases go to human annotation, and failures are clustered into new goldens.

Several replies make the pitfalls of implementation more concrete. Emilio Ranucoli says the prerequisite for eval-driven development is being able to reproduce the failure state; they save raw payloads and full traces so they can replay deterministically. Arpit says an eval of 100 samples said it won, while 1,000 samples said it tied. Model Test Lab gives an OCR example: an average CER of 0.15% hid the fact that GLM-OCR quietly dropped a line of 16 words on a skewed page—321/337 words—and only a separate hard-page set exposed it. Aleksandar Janca says teams often skip defining good and write evals only after choosing the model. Pascal says single-pass pass rates are the easiest thing to skip: the model looks good once and collapses over the next ten runs. Sundaram Kumar Jha calls the new name verification driven development; the name changed, but the action is still to define verifiable good first.

Original link: https://x.com/sermakarevich/status/2123078038598365335
Article link: https://x.com/i/article/2122698097268551680
References: LangChain’s What Is Eval-Driven Development, Anthropic’s Demystifying Evals for AI Agents, and OpenAI’s Evaluation Best Practices. The specific links are in the original article’s reference list; quoted views are based on the original article and the replies above.

发布时间: 2026-11-19 01:28