← govind p lal
AI and ML Bootcamp · Lecture 27 · lecture notes

Evals, Benchmarks and RL Environments

In short — How do you know one model or agent is better than another, and how do labs turn that testing into training? This lecture covers categories of evals, how to design a first eval for an app like Lovable, how benchmarks such as SWE-bench work, when to use unit tests versus an LLM judge, and how RL environments differ from evals by actually changing the model.

Evals vs RL environments

builds on Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026, Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026

Two important ideas. RL environments - used when you train a model. Evals and benchmarks - used when you test a model.

!

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

adds to earlier · Lovable-style frontend agents as example of subjective outputs hard to quantify. · builds on Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026, Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026

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

builds on Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026
CategoryWhat it isExample
Benchmark evalsStandard public question sets across skillsSWE-bench, math, puzzles, visual questions
Task-specific evalsCustom tests for a niche taskSupport-ticket summariser, code reviewer
Human evalsPeople rate outputsHumans compare two responses
Model evalsAnother LLM grades the outputJudging a Lovable output
Safety evalsCheck harmful requests are refusedHow to make a bomb -> should refuse
Regression evalsThings that work today must keep workingChecks 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

builds on Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026, Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026
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

builds on Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026, Lecture 18: Week 17 - AI&ML | Harness, Context, and Evals | 09/05/2026

Scenario: the agent works, and you want to swap model A for model B. Before switching, prove B is better on your own agent.

promptDataset of promptscases + checksYour agentimported packageOutputfiles / codeSandbox runbuild + testsScore
A first eval loop for an app-building 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

builds on Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026

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%.

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

builds on Lecture 26: Week 26 - AI&ML | Evals | 11/07/2026, Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026

Pre-training, SFT and RL: why environments matter

adds to earlier · Argument that human data is exhausted so RL environments became the third stage, with the Flappy Bird analogy. · builds on Lecture 8: Week 7 - AI&ML | Training Your First Model | 28/02/2026, Lecture 14: Week 13 - AI&ML | Fine-tuning - Part 2 | 11/04/2026, Lecture 16: Week 15 - AI&ML | RLVR | 25/04/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026
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.

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

adds to earlier · Partial-credit reward from test pass fraction and the competitive programming environment example. · builds on Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026, Lecture 16: Week 15 - AI&ML | RLVR | 25/04/2026, Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026
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

adds to earlier · Exploration vs exploitation trade-off, AlphaGo environment example. · builds on Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026, Lecture 15: Week 14 - AI&ML | Fine-tuning - Part 3 | 17/04/2026
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.

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.