Evals, Benchmarks and RL Environments
Evals vs RL environments
Two important ideas. RL environments - used when you train a model. Evals and benchmarks - used when you test a model.
- Data labeling companies (Scale, Mercor and similar) work with labs like OpenAI and Anthropic
- They supply data, and increasingly RL environments
- A job at such a company often means building RL environments
Evals and benchmarks only give a final score (model performs x%). Environments feed rewards back and change the model's weights.
Why evals are hard
Eval - systematic method to measure how well a model performs by checking outputs against a standard (correctness, desired behaviour).
Example
How do you know Lovable is better than another app builder? Outputs are non-deterministic and frontend is subjective. We know GPT-5.5 beats GPT-2, but saying it is 20% better needs an eval.
Categories of evals
| Category | What it is | Example |
|---|---|---|
| Benchmark evals | Standard public question sets across skills | SWE-bench, math, puzzles, visual questions |
| Task-specific evals | Custom tests for a niche task | Support-ticket summariser, code reviewer |
| Human evals | People rate outputs | Humans compare two responses |
| Model evals | Another LLM grades the output | Judging a Lovable output |
| Safety evals | Check harmful requests are refused | How to make a bomb -> should refuse |
| Regression evals | Things that work today must keep working | Checks run before every new model release |
Benchmark - a fixed dataset plus a scoring method, so different models, versions or harnesses compare on equal footing. Each single question in it is an eval. Labs optimise for many benchmarks, including abstract grid puzzles where you must infer a pattern with no instructions (for example predict the next number in a sequence).
Designing evals for a Lovable-style agent
- 1) Does it build? Weak models write React that does not even compile. Build failure = fail.
- 2) Functional correctness - are all requested features present? (e.g. a to-do app with 20 features)
- - Hard to automate from vague prompts
- - Fix: specify endpoints and UI elements upfront in the prompt (e.g. a button to create a todo)
- - Then write Cypress/Playwright tests that click those known elements
- 3) Code architecture quality - subjective for humans, so an LLM scores it out of 10 against about 20 best practices.
- 4) Efficiency - token usage, and inspecting the history for wasted work (writing then deleting code, reading unneeded files). Latency matters only if the user cares.
- 5) Multi-turn behaviour - most agents build one version fine, but fail after repeated follow-ups (dark mode, change a button colour).
Example
Multi-turn test: build a long conversation history with a model. Ask to change one button's colour. Use Playwright to check that only that button changed. This is where agents break, and likely what improves Lovable.
If a company relies on a third-party reviewer, it cannot see what happens inside. Owning your eval set lets you compare each release (better or worse?).
Writing your first eval in code
Scenario: the agent works, and you want to swap model A for model B. Before switching, prove B is better on your own agent.
Example
Case: prompt 'create a to-do app, dark mode, delete functionality', plus commands that must run. Run build for every case, then an LLM scores quality (e.g. 7/10).
For a coding-judge product the eval is simpler. Each case is a question with test cases, e.g. 'create function sum of two inputs', input (1,2) -> output 3. Send the prompt to the agent, run its code on all test cases, count passes.
Running evals across many models has real infrastructure challenges (sandboxes).
SWE-bench and benchmark saturation
SWE-bench - software engineering benchmark built from real issues. Score = share solved. The top of the leaderboard solves about 76%, while GPT-2 solved about 2%.
- Once most tasks are solved, the benchmark no longer improves models
- Like repeating easy problems, you learn nothing new
- Labs want data on what models cannot solve yet
- New harder benchmarks keep appearing
How SWE-bench checks a fix: it does not compare the model's patch to the human patch. It runs the repository's tests written for that issue and counts passes.
Unit tests vs LLM judge
- Math problems have one final answer -> simple check, no LLM needed
- Most coding tasks, especially backend -> unit tests
- Frontend -> debatable, may need an LLM
- Creativity, subjective quality -> LLM judge
- Rule: if simple unit tests can score it, use them
Pre-training, SFT and RL: why environments matter
Example
Ask a raw pretrained model 'who is the prime minister of India?' It may continue with 'and where does he live and what does he do?' because it saw such text online. It completes, it does not answer.
- Stage 1 pre-training: next-token prediction on internet data
- Stage 2 SFT: human-written question-answer pairs make it an assistant
- Problem: human data is slow to produce and already largely exhausted
- Stage 3 RL: model learns by doing, gets rewards
Example
Flappy Bird: a tiny neural network gets the nearest tower position as input and outputs press or not. Reward = points. Thousands of copies learn over time with no hand-written rules.
Reinforcement learning - generate responses, a reward says how good each was, update to make high-reward behaviour more likely. Not copying a fixed answer.
An environment is close to unlimited data. A good environment keeps producing training signal.
RLHF vs verifiable environments
- RLHF - humans see two responses and choose one. Limited by human labelling speed.
- Verifiable reward - no human; run the output against tests
- Reward = tests passed, e.g. 10/10 high, 3/10 low
Example
Competitive programming environment, like authoring a Codeforces problem: problem statement, expected solution, many inputs and outputs. Compile the model's answer, run all inputs, compare outputs, give a score. People who can write problems LLMs cannot solve (Codeforces E level) are in demand.
Exploration, exploitation and reward hacks
- Exploitation - keep repeating a path that already scores
- Exploration - try other actions that might score more
- Reward leak - a loophole the model finds and exploits for reward without learning anything
Example
AlphaGo: the environment is a board plus rules. The model chooses moves and learns from win or loss.
When designing environments, make sure there is no reward hack. Study open environment repos like Terminal-Bench: how tasks are designed, contributor PRs, and how solutions are checked.
Distillation
Distillation - using a strong model to generate lots of answers and reasoning, then training another model on them so it imitates the stronger one.
- Goal: match the probability distribution of the strong model's tokens
- KL divergence - measure of how different two probability distributions are
- Small KL difference means the models behave almost the same
Glossary
- Eval
- A test case that checks a model's output against a standard.
- Benchmark
- A fixed dataset of evals plus a scoring method for comparing models.
- SWE-bench
- Software engineering benchmark of real issues scored by running tests.
- Distillation
- Training a model on a stronger model's outputs to imitate it.
- KL divergence
- Measure of difference between two probability distributions.