Education

LLM-as-a-Judge: How to Grade AI Agents | Stanford CS329Z Lecture 13 with John Yang

by Stanford Online

Share:

📚 main topics

  • Why Verification MattersThe lecture focuses on verification as a core part of benchmark design: graders should match the task, correctly distinguish success from failure, and account for tasks whose answers or environments change over time. 8:25
  • Three Types of GradersThe lecture compares programmatic tests, human annotation, and language-model judges, highlighting differences in cost, speed, flexibility, and consistency. 15:08
  • The Evolution of LLM JudgesLLM judging has expanded from comparing text with references, to modeling human preferences, to using agents that interact with artifacts such as websites and judge trajectories. 31:06
  • Biases and ReliabilityThe lecture discusses judge biases such as answer-order and response-length preferences, and ways to test whether LLM judgments align with human evaluations. 53:54
  • Scoring Repeated RunsThe lecture contrasts average scores, pass@k for whether a task can be solved at least once, and pass^k for whether it can be solved reliably across runs. 11:05

✨ key takeaways

  • Unit Tests Are Useful but LimitedProgrammatic tests are fast, cheap, and repeatable, but can be incomplete, overly prescriptive, static, or unable to assess open-ended outputs. Moving verification to a higher level of abstraction can allow more varied solutions. 17:13
  • Human Grading Adds NuanceHuman judges can assess flexible tasks that resist exact tests, but they are expensive and may disagree, so reliability needs to be measured. 23:54
  • LLM Judges Need ValidationA judge should be checked for agreement with human preferences and consistency. Position and length biases can distort scores, so evaluations should test for and mitigate these effects. 39:22
  • Choose Metrics for the Taskpass@k suits settings where solving once is meaningful; pass^k better reflects reliability. Neither is universally correct, and averages can hide differences in how models perform across runs. 12:01
  • Trajectory Judging Is ChallengingLLM agents can inspect screenshots, actions, and outcomes, but judging from trajectories alone may be unreliable and should be validated carefully. 1:07:25

🧠 lessons learned

  • Align the Grader With the GoalIf a verification method rewards the wrong behavior or fails to cover valid solutions, the benchmark score can be misleading. Check that correct solutions pass and incorrect ones fail. 8:57
  • Watch for Reward HackingJudges may favor repeated or unnecessarily long responses. Rubrics and evaluation design should avoid rewarding superficial signals unrelated to task quality. 43:32
  • Test Order and Length EffectsIn pairwise evaluation, swapping answer order can reveal position bias; controlling for response length can expose verbosity bias. 54:26
  • Preserve Statistical ReliabilityRepeated model runs and, where applicable, confidence intervals help reveal variability in both model outcomes and human or LLM grading. 27:01

🏁 conclusion/next steps

  • Build Evaluation Around the TaskSelect unit tests, human review, LLM judging, or a combination based on the task’s openness, required nuance, and need for repeatability. 30:36
  • Report the Right MeasureDecide whether the evaluation should emphasize average quality, the chance of succeeding at least once, or consistent success across attempts. 18:50
  • Continue With Agent Safety and Coding AgentsThe lecture closes by pointing to upcoming course sessions on safety and coding agents. 1:19:20

Transcript excerpt

0:05 We're going to talk a little bit about uh language models being used as judges um and also just sort of details related to evaluation. So just as like a little bit of a rehash um last time we talked a lot about benchmarks and we got into the nitty-gritty of sort of like how they generally work uh the environment, the problem statement, the verification, these sort of general three building blocks um and then how that template is very conducive to then seeding very sort of practical types of task and

0:36 evaluations um in coding and web use and computer use, you know, everything like that, right? Um so today what we're going to do is we're going to zoom in on verification very specifically and we're going to just sort of really closely inspect sort of like what makes verification tick. Um so in the first seven minutes we'll talk a bit about why we even care about verification in the first place, like why is this important. Um I think everybody already has like a pretty good idea of why um but

🔒 The full, searchable transcript is available with Pro.

🔒 Unlock Premium Features

This is a premium feature. Upgrade to unlock unlimited Q&A, transcripts, mindmaps, and translations.

Questions & Answers

Common questions about this video

Why is verification important in AI agent evaluations?

Verification must be aligned with the task and correctly distinguish successful solutions from failures. Weak or incomplete checks can mark incorrect solutions as passing, or miss valid solutions that the tests do not account for. 8:57

What are the three main types of graders discussed in the lecture?

The three main types are programmatic checks such as unit tests, human annotation, and language models used as judges. Unit tests are generally fast and cheap, while human graders can handle open-ended work but are costly and may disagree. 15:08

When is a language model useful as a judge?

An LLM judge can apply a rubric to one solution or compare two solutions, and it can evaluate work that is difficult to capture with exact tests. It can also act as an agent that interacts with an artifact, such as a website, while grading it. 28:03

What biases can affect LLM judges?

LLM judges can show position bias, preferring the first answer in a pair, and length bias, favoring longer responses even when they are not better. These biases can be tested by swapping answer order or controlling for response length. 53:54

What is the difference between pairwise and pointwise evaluation?

In pairwise evaluation, the judge compares two solutions and selects or ranks the one it prefers. In pointwise evaluation, it assesses a single solution, often by applying a rubric and assigning a score. 28:33

What is the difference between pass@k and pass^k?

Pass@k measures whether a model succeeds at least once across k attempts, which is useful when solving a hard task once is valuable. Pass^k measures whether it succeeds on every attempt, emphasizing reliability. 14:06

Why might average scores hide important differences between agents?

Two agents can have the same average score while behaving differently—for example, one may perform moderately on every run, while another succeeds completely on some runs and fails on others. Metrics such as pass@k or pass^k can reveal these differences. 12:32

🔒 Unlock Premium Features

Access to Chat is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Mindmap is a premium feature. Upgrade now to unlock unlimited studying tools.

Get unlimited summaries, Q&A, transcripts and more with Pro

Upgrade to Pro

Suggestions

🔒 Unlock Premium Features

Access to AI Suggestions is a premium feature. Upgrade now to unlock unlimited studying tools.