Source: https://hatchery.build/docs/evals

# What is an eval?

Before you can improve how an AI model performs, you have to measure what it can do today. An **eval** is a test for a model: you give it a task, check its work, and record a score.

Scores turn vague impressions into concrete comparisons. Run the same eval on 2 models and you see which model handles the job better. Run it again when a new release lands next month and you see whether performance *actually* moved.

A **benchmark** is a shared set of evals that people agree to compare on, and a leaderboard is simply those scores sorted. Below, 3 models are graded on the same 8 questions.

```concept-demo
scoreboard
```

## From prompts to simulations

In 2023, when teams first started building products on large language models, an eval usually meant a list of prompts paired with expected answers. A script compared each reply against the answer key. That setup made sense while models only answered standalone questions.

Models have since become **agents**. An agent works across many steps: it reads files, searches records, runs code, talks to people, and changes shared state. A single reply tells you very little about whether an agent can handle that kind of work, so the test has to give the agent a workspace to operate in.

Evals have moved from prompt tests toward full simulations as a result. The shape of the test stays the same: a task goes in and a grade comes out. A simulation puts more of the real job inside the test and grades more of what the agent did.

```concept-demo
fidelity
```

The direction is toward high-fidelity tests that faithfully reproduce the real working environment. The closer the test sits to the real job, the more its score predicts performance on that job.

## A simulation exam for agents

An **RL environment** is a simulation exam for agents. You drop an agent into a simulated scenario, let it work through the problem, and grade how it performed.

Aviation uses the same idea for a pilot's simulator check. An examiner sets up a scenario, such as an engine failure on takeoff, watches how the pilot handles it, and scores both the outcome and the procedure. Every pilot faces the exact same scenario, and no aircraft is put at risk.

For a software developer, an RL environment is the modern form of an end-to-end test, where the system under test is the agent. The harness builds a realistic world, lets the agent run a full session, and inspects the state the session leaves behind.

Take a biology example where an agent investigates a cell culture that stopped growing. Play the run below to watch it work through the lab records, then watch the grader score its report 4 of 5 for a reward of 0.8.

```concept-demo
exam
```

The agent found the root cause and missed 1 follow-up step, earning partial credit. A single run of an agent through a scenario is a **trial**, and the score the grader gives that trial is its **reward**.

## The 4 parts of a task

Each scenario inside an RL environment is a **task**, and every task breaks down into 4 parts.

```mermaid
%%{init: {"fontFamily": "Arial", "themeVariables": {"fontFamily": "Arial", "fontSize": "16px"}, "flowchart": {"curve": "linear", "nodeSpacing": 24, "rankSpacing": 32, "padding": 12}}}%%
flowchart LR
  I["<b>Instruction</b><br/>what the agent is asked to do"] --> A["Agent"]
  E["<b>Environment</b><br/>files, tools, data, and people"] <--> A
  A --> W["The agent's work"]
  subgraph H["Hidden from the agent"]
    V["<b>Verifier</b><br/>the grader that scores the work"] --> R["<b>Reward</b><br/>a score from 0 to 1"]
  end
  W --> V
```

The same 4 parts describe knowledge work across biology, law, and software engineering.

```concept-demo
task-parts
```

Of the 4 parts, the grader is where a domain expert has the highest leverage. Coding and lab tasks can sometimes check an answer directly against a test suite or a measurement. More subjective work calls for expert judgment written down as clear criteria that a script or a [judge model](/blog/calibrating-a-judge-for-legal-work) can apply, such as "names the missed feed as the cause." Strong graders often combine both: they check that the outcome holds up and that the reasoning behind it is sound.

## What you can verify, you can optimize

Checking an answer is often far easier than producing it. A sudoku is hard to solve and quick to check; a proof is hard to write and far easier to follow. In machine learning, this asymmetry is called the **generator-verifier gap**.

How does that gap turn a test into something a model can learn from? Whenever a program can grade the work automatically, a model can attempt a task repeatedly, receive a score on every attempt, and update toward the attempts that scored well. Even when answers are slow to write, fast grading lets training run round after round until the pass rate climbs.

```concept-demo
verify
```

The loop is often pictured as [a builder bot that generates attempts and a teacher bot that grades them](https://www.youtube.com/watch?v=R9OHn5ZF4Uo). The grader decides what the machine learns, and people design the grader.

A good eval therefore does 2 jobs. It measures how capable a model is today, and in the right form it tells training which direction is better.

## An RL environment is an eval in a training form

RL stands for **reinforcement learning**, where a model learns by acting, receiving a reward, and doing more of what earned higher scores. An RL environment is an eval built in the form that reinforcement learning algorithms consume.

To support training, that form requires 3 properties:

- **Numeric reward:** Every trial ends in a number, produced by the grader from the agent's work.
- **Automated grading:** A program computes that score with no person grading each trial, so training can run thousands of trials.
- **Clean resets:** The environment resets to the exact same starting state, so every attempt faces the same task.

Training algorithms differ in how they turn those rewards into updates. **REINFORCE**, [the classic method](https://doi.org/10.1007/BF00992696), makes each action more likely in proportion to the reward that followed it. **GRPO**, [introduced with DeepSeekMath](https://arxiv.org/abs/2402.03300) and [behind recent reasoning models](https://arxiv.org/abs/2501.12948), runs a group of attempts at the same task, such as 4 tries in parallel, compares each try with the group's average, and moves the model toward the attempts that beat that average.

```concept-demo
group
```

[Harbor](https://docs.harborframework.com/) is an RL environment format built for agents that work inside a sandboxed computer. A Harbor task is a folder with an instruction, a container for the environment, and tests that write the reward. Hatchery runs Harbor tasks.

Every RL environment is an eval, while many evals remain measurement tools only. A team that only wants to measure performance can grade by hand, test standalone prompts, or review a single long project. An eval needs the RL form when you want to train with it.

## What makes a good RL environment

Training improves a model through **hill climbing**. Picture a mountain range where altitude is the reward. Every spot on the ground is a slightly different version of the model, and the highest summit is the best version.

Now imagine walking that terrain blindfolded. You have no map and cannot see the peak. All you can feel is whether a small step takes you higher, so you take a step, compare, keep it when it goes up, and repeat. Training navigates in the same way, and trials are its sense of touch.

A walker that only ever steps uphill stops at the first small peak it reaches, even when a taller summit rises across the valley. Training gets around this with randomness: every so often it accepts a step downhill, and a lucky sequence of those steps carries the walker across the valley to the higher peak.

```concept-demo
hill-climb climb
```

Because the grader sets the altitude at every spot, the task author shapes the mountain. A good RL environment is a mountain a blind walker can climb.

### Give partial credit

When a task scores only 0 or 1 and the agent almost always fails, the ground feels flat in every direction. Every step returns 0, so the walker wanders and learns nothing. The summit sits atop a sheer cliff, and only luck ever finds it.

**Reward shaping** turns that cliff into a climbable slope. Awarding partial credit for partial progress, such as finding the right record or naming the right cause with a weak fix, tells the walker which way is up.

```concept-demo
hill-climb cliff
```

A task the model already solves every time creates the opposite problem: the walker starts on the summit with nowhere left to climb. The most useful tasks leave *headroom*, where the model succeeds some of the time and fails often enough to leave something to learn. Finding those tasks takes [deliberate search](/blog/scaling-experts-to-build-hundreds-of-knowledge-work-environments), since tasks experts write by hand are often too easy for frontier models.

### Climb the right mountain

The walker climbs whatever slope the grader actually creates. When a grader rewards work that merely *looks* right, such as a confident tone or expected keywords, the walker climbs straight to that peak, even if it sits far from the work that is right. This is **reward hacking**.

The task author's job is to align the grader's mountain with the mountain of the real job, so the highest reward goes to work an expert would actually accept.

```concept-demo
hill-climb mountain
```

This is why keyword checklists make weak graders: an agent quickly learns to say the keywords. Criteria that test substance, paired with outcomes checked against measured results, keep the 2 peaks together.

### Keep the ground steady

A noisy grader shifts the ground beneath the walker's feet. When the exact same submission scores 0.4 on one run and 0.8 on the next, a single step cannot tell a better move from a lucky roll.

Noise slows the climb without stopping it. If the grader is right on average, its errors cancel out over many steps and the walker still reaches the top, only later. A biased grader is the bigger danger: when it is consistently off in one direction, it moves the peak itself, which is the wrong-mountain problem above.

A low-variance grader is still worth the effort, because every bit of noise costs training time. Test the grader itself: grade the same work several times and confirm the score holds steady. Averaging several trials per task also smooths out variance and keeps the ground level.

```concept-demo
hill-climb noise
```

## Next steps

The [Introduction](introduction.md) maps these concepts onto Hatchery's tasks, trials, and jobs, and the [Quickstart](quickstart.md) walks through running your first task.
