---
title: "Write the eval before the prompt"
url: https://eldan.ai/writing/write-the-eval-before-the-prompt
canonical: https://eldan.ai/writing/write-the-eval-before-the-prompt
locale: en
language: en
published: 2026-11-06
updated: 2026-11-23
author: "Eldan Abdrashim"
cite_as: "Eldan Abdrashim. \"Write the eval before the prompt.\" Eldan.ai, 6 November 2026, updated 23 November 2026. https://eldan.ai/writing/write-the-eval-before-the-prompt."
---

# Write the eval before the prompt

> Most teams tune prompts by feel and learn about regressions from users. Reverse the order: define what right means, collect twenty real inputs, get a baseline, then write the prompt.

Here is how most AI features get built. Someone writes a prompt. They try it on three inputs and it works. They tweak a sentence, try again, and it looks better. They ship. Two weeks later a user finds a case that is badly wrong, someone patches the prompt, and nobody knows whether the patch broke something else.

Nothing in that loop is stupid. It is how we write code when we can run it and see the answer. The problem is that a model call is not a function with one right output. It is a distribution of outputs, and three samples from a distribution tell you almost nothing about it.

## The inversion

The habit I teach first is to write the eval before the prompt. Not the full, polished eval. The smallest thing that can disagree with you:

1. One sentence that says when an output of this feature is right.
2. Twenty real inputs, including a few ugly ones.
3. The correct answer for each, written down before you look at any model output.
4. A few lines of code that run the feature on every input and print a score.

That is perhaps an hour of work. Then you write the prompt, and for the first time you can ask a real question: is this version better than the last one, and by how much?

## Why before, not after

Writing the eval first changes the project in four ways.

It forces a definition of right. Many features fail not because the model is weak but because nobody agreed what a good answer looks like. When you try to label twenty inputs, the disagreements surface in an hour instead of in production. If two people label the same input differently, you have found a missing requirement, and no prompt will fix that.

It gives you a baseline. Run the eval on the laziest possible prompt, one sentence, and write down the score. Now you know what “nothing clever” achieves. Sometimes that number is already good enough. Sometimes a regular expression beats it. Both are useful things to learn before you spend a month on prompt engineering.

It stops you from anchoring. If you write the labels after reading the model’s answers, you will agree with the model more often than you should, because the answer is right there and looks plausible. Labels written first are an independent opinion.

It turns every change into an experiment. A new prompt, a new model version, a different chunk size: you run the eval and look at the number. You still use judgement, but now the judgement has evidence under it.

## The gap in the industry

This is not a fringe idea, and the numbers suggest it is not yet common practice. A February 2026 review of 31 AI-engineer job postings by [Heavybit](https://heavybit.com/library/article/so-you-want-to-be-an-ai-engineer) found evals mentioned in 61 percent of them, and a [July 2026 analysis of 390 postings](https://dev.to/ali_82f3409ed625e8ba8515b/ai-engineer-roadmap-2026-what-390-job-postings-actually-require-3jdo) put the figure at 56 percent. Employers ask for it. Yet in [LangChain’s survey of 1,340 practitioners](https://langchain.com/state-of-agent-engineering), 52 percent of organisations said they run offline evaluations, while 89 percent had observability in place. Teams can watch what the system does faster than they can judge whether it is good.

## Three objections

“I have no data yet.” Then your first task is to get some. Ask a colleague for ten real messages, or log inputs for a week. Twenty real inputs beat two hundred invented ones.

“My task is subjective.” Break it down. “A good summary” is vague. “Mentions the deadline, mentions the amount, stays under 80 words” is three yes/no questions you can score. Where a criterion truly needs judgement, use a model judge, but calibrate it against human labels first.

“Evals are expensive.” Fifty cases on a mid-sized model cost cents to a few dollars per run. A bad release costs support time, trust and often a rollback. The expensive eval is the one you did not write.

## A worked example

Say your feature routes support tickets into four queues. The sentence reads: a ticket is routed correctly when it lands in the queue that matches the customer’s main problem. You collect twenty real tickets, five per queue, and label them. A one-line prompt scores 15 out of 20. You read the five failures and find that three of them are tickets with two problems in one message. You add a tie-break rule to the prompt, rerun, and get 18 out of 20, with the billing queue back from 3 of 5 to 5 of 5.

The whole exercise takes a morning. Notice what you did not do: you did not argue about tone, and you did not shop for a bigger model. The number pointed at the problem, and the fix was one sentence.

## What the first run teaches

Expect the first score to disappoint you, and expect the failures to be educational. Read all of them and sort them into named groups: wrong language, two issues in one message, a missing field in the context. Count the groups. The largest one is your next task, and it is usually not what you guessed. This habit, called error analysis, is worth more than any dashboard.

Be careful with small samples, too. With twenty cases, one flipped case moves the score by five points, so do not celebrate a four-point gain. Grow the set as you learn. Every bug a user reports should become a new test case before it becomes a fix.

## Start today

You do not need a platform to begin. A JSONL file, a loop and a counter are enough. If you want a guided version, the tutorial “Your First Eval” builds exactly this in five short lessons, and the free email course walks you through the same steps on your own feature. Write the sentence that says when your output is right. Then collect the twenty inputs. The prompt can wait an hour.

_Evals · How to learn_
