What Is an LLM Eval Pipeline? Why You Need One and How to Build It on Your Laptop
From the publisher’s feed, collected in the ZeroLabs newsroom.
A checklist of tests where most pass and one fails (image generated by AI)An eval pipeline is a set of test questions, a script that sends them to an AI model, and a way to score the answers. It works like unit tests for code, but for an AI feature. You can build a small one on your own laptop with Ollama and llama.cpp, and this story shows how.The whole pipeline. The runner talks to any server that speaks the OpenAI chat format.What an eval pipeline isAnthropic describes an eval as a test for an AI system, where you give it an input and check its output. A pipeline has four parts.Test cases are questions or tasks, each with a note on what a good answer looks like.A runner is a script that sends every case to the model and saves the answers.Graders score each answer. Simple code checks come first. Does the answer match exactly, contain the right number, or parse as valid JSON? If code can’t decide, a second AI model can act as the judge.A report shows the overall score and how it compares with the last run.A benchmark such as GSM8K is a public test set that everyone uses. A pipeline points the same idea at your own task, and you run it every time something changes.Why you need oneWithout tests, you hear about problems from your users. Anthropic describes the usual pattern. People say the AI feels worse after a change, and the team can only guess and check. Fixing one bug can break something else.A public benchmark does not tell you how your task will go. Hamel Husain, who writes about building AI products, says tests built around your users’ tasks measure something different from general benchmarks. Setup matters too. On the ARC Prize leaderboard, GPT-6.2 Astra scored 70.3% with a basic setup and 99.8% with a tuned one, at the same reasoning level.A new model is a change too. In Husain’s case study of a real estate assistant, progress stalled because fixing one problem created others, so the team built a proper way to test it. Anthropic says that when a new model comes out, an eval suite shows quickly what got better.You need to know whether a score is real. Anthropic found that CPU and memory limits on the test machine alone moved scores on a coding benchmark, Terminal-Bench 2.0, by about 6 points. A score without a margin of error can’t tell you if a gain is real.How to use itCollect 20 to 50 real cases. Use things that went wrong, such as your bug tracker, support messages and the checks you already do by hand. Anthropic says a small set is enough at the start, because early changes tend to have big effects.Decide how each case is scored. A good case is one where two experts would agree on pass or fail. Use a code check where you can.Run it once and save the result. That is your baseline.Change one thing. It can be the model, the prompt, a setting or the size of the model file.Run it again and compare. Look at the margin of error before you believe a difference.Keep the cases. Add a new case for every new failure, and run the set after every change.Where this helps in practiceThese situations are made up, but most people who build with AI run into one of them.You fix one prompt problem and break another. Say a support bot sorts messages into bug, billing and feature request. Someone edits the prompt so billing questions are handled better, and bug reports start landing in the wrong group. Nobody notices until customers complain. With a saved set of cases, the next run shows which ones flipped.A new model comes out and the headlines say it is better. Better at what? Run your own cases on the old and the new model and compare them case by case. A leaderboard can’t tell you how a model does on your messages.You want a cheaper or smaller model, maybe one that runs on your laptop so your data stays with you. Run the same cases on both. The Q4 and Q8 comparison further down is an example of this check.The demo worked, and then real users broke it. They phrase things in ways you never tried. Each time it happens, add that message as a new case, so the same failure can’t come back unnoticed.Build it on your laptopRunning tests locally costs only electricity, keeps your data on your machine and lets you test something that hosted APIs hide, such as which compressed version of a model you use. Quantization shrinks a model by storing its numbers with fewer bits. A Q4 file is smaller than a Q8 file and can be a little less accurate.Ollama and llama.cpp are two popular programs that run models on your computer. Both can answer in the same format as the OpenAI API, so one script can test either.Step 1. Start the serversThese commands are for a Mac with Homebrew. On Linux and Windows, install both from their websites.brew install ollama llama.cppollama serve # leave it running, port 11434ollama pull qwen3.5:4b # Q4_K_M, 3.3 GBollama pull qwen3.5:4b-q8_0 # the same model at Q8_0, 5.2 GBllama.cpp is optional. Its server, llama-server, can download a model file from Hugging Face with -hf (the default size is Q4_K_M), and --alias sets the model name you use in requests:llama-server -hf unsloth/Qwen3.5-4B-GGUF:Q4_K_M --alias qwen3.5-4b-q4 --port 8080On a 16 GB laptop, stay at 9B parameters or smaller. Ollama lists qwen3.5:9b at about 7 GB and gpt-oss:20b at 14 GB, which leaves little room for everything else.Step 2. Write the test casesEach case is one line of JSON, a plain text format for data. It has four parts. prompt is what the model sees, check is how to score the answer, expect is a correct answer and tag is a group name for the report. Two lines from the demo set, with the prompts shortened:{"id": "label-04", "tag": "label", "prompt": "Classify the customer message ... Message: The app crashes every time I open the settings page.", "check": "exact", "expect": "bug"}{"id": "json-01", "tag": "json", "prompt": "Extract the person, city and year ... Sentence: Grace Hopper joined the Navy Reserve in New York in 1943.", "check": "json", "expect": {"name": "Grace Hopper", "city": "New York", "year": 1943}}The check depends on the task. Four examples:Sorting support messages into groups. The expected answer is one word, such as bug, so the exact check works. It wants a word for word match.Pulling facts out of text, such as a name, a city and a year. The expected answer is a small JSON object, so the json check parses the reply and compares the fields.A math or counting question. The answer is a number, so a regex check (a text pattern) looks for it in the reply.Writing a summary or setting a tone. There is no single right answer, so the judge check lets a second model decide against one clear rule, such as "mentions the refund deadline".Here is what happens to one case. Take label-04, where the message says the app crashes every time the settings page opens and the prompt asks for only the label. The runner sends it to the model. Say the model replies Bug. The exact check drops the final period, ignores capital letters, gets bug and finds it equal to the expected answer, so the case passes. If the model had replied This looks like a bug report, the case would fail, even though a person would accept it. The check is strict on purpose, which is why the prompt demands a single word.The demo set has 40 cases (10 each of arithmetic word problems, JSON extraction, support ticket labels and short exact answers). It only shows how the pipeline works, and you can download all 40 cases and the script from this gist. Write your own cases from failures you have seen.Step 3. The scriptSave this as evals.py. It is 95 lines of standard Python, so there is nothing to install, and it works on Python 3.9 and newer (checked on 3.9 and 3.12). You can copy it as is.#!/usr/bin/env python3"""evals.py: a tiny eval runner for any OpenAI-compatible local server (Ollama, llama-server)."""import argparse, json, math, re, statistics, sys, time, urllib.requestdef chat(base, model, prompt, temperature=0.0, seed=0, max_tokens=1024, effort=None): body = {"model": model, "messages": [{"role": "user", "content": prompt}], "temperature": temperature, "seed": seed, "max_tokens": max_tokens} if effort: body["reasoning_effort"] = effort # "none" turns thinking off on Ollama models that allow it req = urllib.request.Request(base + "/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"}) t0 = time.time() with urllib.request.urlopen(req, timeout=900) as r: d = json.load(r) text = d["choices"][0]["message"].get("content") or "" text = re.sub(r".*?", "", text, flags=re.S).strip() return text, time.time() - t0, d.get("usage", {}).get("completion_tokens", 0)def grade(case, out, judge): kind, want = case["check"], case["expect"] if kind == "exact": return out.strip().strip(".\"'").lower() == want.lower() if kind == "regex": return re.search(want, out, re.S | re.I) is not None if kind == "json": m = re.search(r"\{.*\}", out, re.S) try: got = json.loads(m.group(0)) except (AttributeError, ValueError): return False return all(got.get(k) == v for k, v in want.items()) if kind == "judge": # last resort: a second model grades against a one-line criterion q = ("Question: %s\nAnswer: %s\nCriterion: %s\n" "Does the answer meet the criterion? Reply with exactly PASS or FAIL." % (case["prompt"], out, want)) verdict, _, _ = chat(judge[0], judge[1], q, max_tokens=512) return verdict.strip().upper().startswith("PASS") raise ValueError("unknown check: " + kind)def mean_ci(xs): se = statistics.stdev(xs) / math.sqrt(len(xs)) if len(xs) > 1 else 0.0 return statistics.fmean(xs) * 100, 1.96 * se * 100 # in percent: mean and 95% half-widthdef main(): p = argparse.ArgumentParser() p.add_argument("cases") p.add_argument("--base", default="http://localhost:11434") # llama-server: port 8080 p.add_argument("--models", nargs="+", required=True) p.add_argument("--repeats", type=int, default=1) p.add_argument("--temperature", type=float, default=0.0) p.add_argument("--effort") p.add_argument("--judge", help="BASE,MODEL of the judge server, needed only for judge cases") p.add_argument("--save", help="write per-case scores to this JSON file") p.add_argument("--baseline", help="JSON saved by an earlier run; exit 1 if the first model got worse") p.add_argument("--max-drop", type=float, default=5.0, help="allowed drop in points") a = p.parse_args() cases = [json.loads(line) for line in open(a.cases) if line.strip()] judge = a.judge.split(",") if a.judge else None scores = {} print("%-26s %6s %8s %8s %7s" % ("model", "pass", "+/-95%", "tok/s", "sec")) for model in a.models: scores[model], toks, secs = {}, 0, 0.0 for c in cases: ok = [] for r in range(a.repeats): out, sec, n = chat(a.base, model, c["prompt"], a.temperature, r, effort=a.effort) ok.append(grade(c, out, judge)) toks, secs = toks + n, secs + sec scores[model][c["id"]] = sum(ok) / len(ok) mean, half = mean_ci(list(scores[model].values())) print("%-26s %5.1f%% %7.1f %8.1f %7.0f" % (model, mean, half, toks / secs if secs else 0, secs)) for tag in sorted({c["tag"] for c in cases}): xs = [scores[model][c["id"]] for c in cases if c["tag"] == tag] print(" %-22s %5.1f%% (%d cases)" % (tag, statistics.fmean(xs) * 100, len(xs))) first = a.models[0] for m in a.models[1:]: # paired difference: the same cases, so compare case by case d = [scores[m][c["id"]] - scores[first][c["id"]] for c in cases] mean, half = mean_ci(d) print("%s minus %s: %+.1f points (+/- %.1f)" % (m, first, mean, half)) if a.save: json.dump(scores, open(a.save, "w"), indent=1) if a.baseline: old = json.load(open(a.baseline))[first] before = statistics.fmean(old.values()) * 100 now = statistics.fmean(scores[first].values()) * 100 print("baseline %.1f%% -> now %.1f%%" % (before, now)) if before - now > a.max_drop: sys.exit("REGRESSION: dropped more than %.1f points" % a.max_drop)if __name__ == "__main__": main()It sends each case to the model, one at a time, and prints the score. A few details:It sets temperature to 0, which makes the model pick its most likely words, and uses a fixed seed. Runs are then mostly repeatable, but not always. Thinking Machines asked one model the same question 1,000 times at temperature 0 and got 80 different answers, because the result depended on how many requests the server was handling at once. Treat one run as one sample. --repeats shows how stable each answer is.Some models think out loud before answering. --effort none turns that off where the model allows it (gpt-oss can't), in Ollama and llama-server. The script also strips blocks.The score is the average over all cases, with a margin of error, which is a range the true score probably falls in. Evan Miller’s paper on error bars for evals recommends reporting it.With two or more models, the script compares each with the first on the same cases. That is fairer than comparing two separate scores.--save stores a run. --baseline compares a new run with a saved one and exits with an error if the score dropped by more than --max-drop points.Step 4. Run itpython3 evals.py cases.jsonl --models qwen3.5:4b qwen3.5:4b-q8_0 --effort none --save runs/today.jsonAgainst llama-server, change the base URL and use the alias:python3 evals.py cases.jsonl --base http://localhost:8080 --models qwen3.5-4b-q4 --effort noneThe script prints a report like this one. It comes from a fake test server that returns made-up answers, so the numbers mean nothing and only the layout matters. The fake server also answers instantly, which is why the speed looks absurd and the time is 0 seconds.model pass +/-95% tok/s secmodel-a 72.5% 14.0 10552.0 0 json 70.0% (10 cases) label 60.0% (10 cases) math 70.0% (10 cases) short 90.0% (10 cases)model-b 75.0% 13.6 36698.8 0 json 90.0% (10 cases) label 90.0% (10 cases) math 60.0% (10 cases) short 60.0% (10 cases)model-b minus model-a: +2.5 points (+/- 21.6)pass is the share of cases answered correctly, and +/-95% is the margin of error in points. tok/s is the speed in tokens (small pieces of words) per second, and sec is the total time.The indented lines show the score for each tag, so you can see which kind of task changed. With only 10 cases per tag, treat them as hints.The last line compares the two models on the same cases. Here model-b looks 2.5 points better, but the margin is 21.6, so this gap proves nothing.How to read the resultsSay you run 40 cases and score 70%. How far can you trust that? The margin of error is about 14 points either way (1.96 times the square root of 0.7 × 0.3 ÷ 40). A 70% and an 80% can’t be told apart from numbers like these. More cases shrink the margin. Running the same 40 cases again doesn’t, because the 40 cases are your sample.An illustration, not measured data. Two scores on the same 40 cases, each with its margin of error.A real study shows how small the differences can be. In January 2026, researchers tested Llama-3.1-8B-Instruct in different llama.cpp sizes on five public benchmarks. The average score was 69.47 at full precision, 69.41 at Q8 and 69.15 at Q4_K_M, while the files were 47% and 69% smaller. A gap of 0.3 points is far too small for 40 cases to show. Quality only dropped at 3 bits (Q3_K_S averaged 65.49). The authors also warn that small gains can be noise. It is one model, so run your own cases.When you need a judgeSome answers can’t be checked with simple code, such as a summary, a tone or an explanation. For those, a second AI model can grade the first one (called LLM as a judge), and the script has a judge check for it. Two warnings:Judges have biases. The MT-Bench paper found they tend to favor the first answer shown, longer answers and answers written by themselves.Small judges are worse. In a study of 13 judge models, only the best and largest agreed reasonably well with humans, and scores could be off by up to 5 points. Ranking models still worked with smaller judges.Use a different model as judge than the one you test, ask one pass or fail question per call, and read about 20 verdicts yourself.When to use a ready-made toolOnce your cases outgrow one file, existing tools can take over.promptfoo keeps tests in a YAML file and uses Ollama through ollama:chat:. Its judge defaults to an OpenAI model, so point defaultTest.options.provider at a local one.lm-evaluation-harness runs standard public benchmarks. Use --model gguf for llama-server.Inspect AI has a built-in Ollama provider, ollama/.DeepEval says in its docs that any model served by Ollama can run its evals.Keep it runningAfter a good run, save it. After every change (a new model file, a different size, an edited prompt), run again with --baseline so it fails if the score drops by more than 5 points. You can start it from a git hook or a CI job. One catch is that with 40 cases, 5 points is well inside the margin of error, so it can fail for no reason. Raise the limit or add cases.What this story does not showThe demo cases are small and simple. A score on them says nothing about your task.The script has no retries and no parallel runs, and it treats cases as independent. Miller’s paper says related questions need a more careful margin of error.The script has only been tested against a fake server that imitates the API, not real models. The numbers here come from the linked sources, not from my own runs. Treat your first real run as a test of the script too.Final thoughtsChoosing good cases takes more work than writing the script, and Anthropic says the same about writing good tasks. Start with 20 to 50 cases from real failures. Test two models or settings side by side, and trust a difference only when it is bigger than the margin of error.If you enjoyed this article, I’d be grateful for your supportI’m a Product Manager with an engineering background (ex SWE), focused on building, scaling and growing products. I’m especially interested in new technologies, particularly AI/ML, and how they can be applied in real workflows.Email: akzhankalimatov@gmail.com✅ Connect with me on LinkedIn, X (Twitter)✅ Press and hold the 👏 to give up to 50 claps for this articleSources:Anthropic: Demystifying evals for AI agentsHamel Husain: Your AI Product Needs EvalsARC Prize: ARC-AGI-3 leaderboardAnthropic: Quantifying infrastructure noise in agentic coding evalsAdding Error Bars to Evals (arXiv)Thinking Machines: Defeating Nondeterminism in LLM InferenceWhich Quantization Should I Use? A Unified Evaluation of llama.cpp Quantization on Llama-3.1-8B-Instruct (arXiv)Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (arXiv)Judging the Judges: Evaluating Alignment and Vulnerabilities in LLMs-as-Judges (arXiv)Ollama: OpenAI compatibilityOllama library: qwen3.5 tagsOllama library: gpt-oss tagsllama.cpp server READMEHugging Face: unsloth/Qwen3.5-4B-GGUFlm-evaluation-harness READMEpromptfoo: Ollama providerpromptfoo: llm-rubricInspect AI: providersDeepEval: OllamaWhat Is an LLM Eval Pipeline? Why You Need One and How to Build It on Your Laptop was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.