What are evals and why does every LLM feature need them?
493 views
8 of 83
1
The problem
Question presented to candidate:
"Our team ships LLM features by trying a few prompts in a playground and saying 'looks good'. Explain what evals are, how they differ from normal unit tests, and why you would insist on having them before the next prompt change or model upgrade."
What a strong answer should cover:
An eval is a dataset of realistic inputs, a grader that turns each output into a score or pass/fail, and a harness that runs the system and aggregates the scores, ideally per slice
Why LLM features need them more than ordinary code: outputs are open-ended and nondeterministic, and a prompt or model change has non-local effects (fixing one case breaks others you did not look at)
The grader spectrum: code checks first, model-based (LLM-as-judge) graders for qualities code cannot check, human review to calibrate both
Report rates with uncertainty, not single anecdotes: a 20-case suite cannot tell 78% from 82%; slices and a regression gate catch what an overall average hides
Where evals live in the lifecycle: offline before shipping (CI gate on every prompt, model or retrieval change), online in production (sampled grading, user signals), and production failures fed back into the dataset
Code / implementation expected: Optional โ a small harness that runs two prompt versions over a labelled set with code graders and reports per-slice pass rates is a strong addition.
evals
testing
quality
llmops
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Anyone building on top of an LLM API who has never written an eval, and candidates who need to explain why "it looked good in the playground" is not a test.
Difficulty: Easy
Verified with: Node 22 and Python 3.12 (an eval harness over two stubbed prompt versions, and a sampling simulation with Wilson intervals). No model is called; the stub replies stand in for a real model. Vendor guidance is quoted with its source, checked October 2026.
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the words an interviewer expects. All program output shown was produced by actually running the examples; the Verified section quotes it in full.
1. Why This Even Matters โ A Story First
A bakery hires a new chef and changes the bread recipe: a little more salt, because one customer s
The solution is hidden so you can try first
13 min read ยท 11 sections
4
Read the code
A tiny eval harness: a prompt fix that regresses two other slices