Skip to content
Stanford CME295 Transformers & LLMs | Autumn 2025 | Lecture 8 - LLM Evaluation
This video isn’t embeddableWatch on YouTube →
Stanford OnlineStanford Online

Stanford CME295 Transformers & LLMs | Autumn 2025 | Lecture 8 - LLM Evaluation

November 21, 2025

Dec 2, 20251h 49mWatch on YouTube

Summaries, chapters, transcripts, and FAQs on this page are made by uListen, not YouTube.

CHAPTERS

Jump to publisher timestamps

Chapter summaries

  1. Why LLM evaluation matters + recap of RAG, tool calling, and agents

    The lecturer frames evaluation as essential for knowing what to improve in LLM systems. They briefly recap prior material on retrieval-augmented generation, tool calling, and agentic workflows as context for what will be evaluated.

    • •Evaluation is positioned as critical because improvement requires measurement
    • •Recap of RAG as retrieval plus re-ranking, with an emphasis on quantifying retrieval quality
    • •Tool calling is described as selecting tools and arguments, then returning results in natural language
    • •Agentic workflows are presented as combining RAG and tool calling across multiple steps
    • •ReAct is referenced as an observe/plan/act style loop used in practice (e.g., coding assistants)
  2. What “evaluation” means in this lecture: output quality vs system metrics

    The lecturer defines evaluation broadly, then narrows the lecture’s focus to output quality. They highlight that universal metrics are hard because LLM outputs are free-form across many modalities.

    • •Evaluation could mean output quality, latency, pricing, uptime, and more
    • •This lecture focuses on output quality (how good the response is)
    • •Free-form generation (natural language, code, math, etc.) makes universal metrics difficult
    • •The lecture will survey practical approaches used in real settings
  3. Human ratings and subjectivity: inter-rater agreement as a health metric

    Using a gift-suggestion example, the lecturer shows that human judgments can vary because tasks are subjective. They motivate tracking rater consistency and aligning raters with clearer guidelines.

    • •Human judgments can disagree even when evaluating something like “usefulness”
    • •Simple agreement rate is introduced as the fraction of identical ratings
    • •Subjectivity motivates measuring rater consistency and improving rating guidelines
    • •Teams may run “agreement sessions” to align interpretations and reduce noise
  4. Inter-rater agreement metrics: why raw agreement is misleading (Cohen’s kappa and beyond)

    The lecturer explains that raw agreement can be inflated by chance and depends on base rates. They introduce chance-corrected agreement metrics and name common variants used for different settings.

    • •Agreement-by-chance can be high even with random independent raters
    • •A worked example shows 50% agreement can arise from random coin-flip labeling
    • •Cohen’s kappa is presented as adjusting observed agreement relative to chance
    • •Negative scores can occur if observed agreement is worse than chance
    • •Extensions are named: Fleiss’ kappa and Krippendorff’s alpha
  5. Rule-based metrics: using references to avoid repeated human scoring

    The lecturer transitions from direct human scoring to reference-based evaluation. The idea is to collect “ideal outputs” once and then compare model outputs against them during iteration.

    • •Instead of rating every output, humans can write reference answers once
    • •Model iterations can be compared to fixed references to reduce cost and time
    • •Rule-based metrics aim to be flexible because many valid phrasings exist
    • •These metrics still try to approximate what humans would consider good output
  6. METEOR: unigram matching with precision/recall and an ordering penalty

    METEOR is introduced as a translation metric combining an F-score with a penalty that discourages reordering. The lecturer notes its complexity and limited ability to capture stylistic variation.

    • •METEOR compares prediction and reference and penalizes word-order differences
    • •Precision and recall are defined over matched unigrams
    • •A penalty term is based on contiguous matched chunks vs matched unigrams
    • •The metric involves multiple hyperparameters and can feel arbitrary
    • •It partially expands matches via synonyms and shared roots but remains limited
  7. BLEU and ROUGE: common reference-based metrics and their limitations

    BLEU is described as a precision-oriented n-gram matching metric with brevity penalty, while ROUGE is mentioned as common for summarization. The lecturer emphasizes shared shortcomings: limited stylistic flexibility and weak correlation with human judgment.

    • •BLEU is framed as matching n-grams with a brevity penalty to avoid overly short outputs
    • •ROUGE is introduced as a summarization metric with multiple variants
    • •All reference-based metrics compare system output to reference text
    • •They struggle with paraphrases and stylistic rewordings that are equally correct
    • •Correlation with human ratings is described as not great, and they still require human effort to bootstrap
  8. LLM-as-a-judge: scoring responses without references, with rationales

    The lecturer motivates using an LLM to evaluate other LLM outputs, taking the prompt, response, and grading criteria as input. A key advantage is producing both a score and an interpretable rationale.

    • •LLM-as-a-judge uses a separate LLM to grade a model response
    • •Inputs include the original prompt, the response, and evaluation criteria
    • •Outputs include a score (e.g., pass/fail) and a rationale explaining the score
    • •Rationales make the evaluation more interpretable than formula-based metrics
    • •The approach is presented as reducing dependence on reference texts and initial human ratings
  9. Structured outputs for judges: making rationale/score reliably parseable

    The lecturer explains that judge outputs aren’t guaranteed to follow a clean schema due to probabilistic generation. They connect this to constraint-guided decoding and provider features often called structured output.

    • •A judge prompt does not guarantee a parseable rationale and score
    • •Constraint-guided decoding is referenced as a way to restrict generation to valid tokens
    • •Structured output is presented as the practical implementation in common LLM providers
    • •A schema with fields like rationale and score can be enforced via structured output settings
    • •The lecturer reiterates that structured outputs are the keyword for format guarantees
  10. Judge variants and failure modes: pointwise vs pairwise, and major biases

    The lecturer outlines two common judging setups (single-response scoring and pairwise comparisons) and then surveys key biases that can distort results. They also field questions about additional bias sources and model capacity choices.

    • •Two variants: pointwise judging (good/bad) and pairwise judging (A vs B)
    • •Pairwise judgments can be used to generate preference labels for training
    • •Position bias: the judge may favor the first-presented response; swapping order and voting is suggested
    • •Verbosity bias: longer answers can be preferred; mitigations include explicit instructions, examples, or length penalties
    • •Self-enhancement bias: a model may favor its own generations; using a different (often larger) judge model is suggested
  11. Best practices for LLM-as-a-judge: guidelines, binary scales, calibration, low temperature

    The lecturer compiles practical recommendations to improve judge reliability and reduce noise. They stress clarity of criteria, simpler scoring scales, and checking alignment with human ratings.

    • •Use crisp, explicit evaluation guidelines to reduce subjectivity
    • •Prefer binary scoring (pass/fail) to reduce ambiguity for both judges and humans
    • •Ask for rationale before score to improve judging quality
    • •Mitigate known biases and recognize the list is not exhaustive
    • •Calibrate by comparing judge scores to human ratings and analyzing correlation; use low temperature for reproducibility and avoid over-optimizing the proxy
  12. Factuality evaluation: decomposing text into facts and aggregating weighted correctness

    The lecturer focuses on factuality as a nuanced dimension that’s hard to score with a single binary label. They describe a multi-step approach: extract atomic facts, verify each (often with retrieval), and aggregate into an overall factuality score.

    • •Factuality is nuanced: a response may be partly correct and partly wrong
    • •Step 1: transform the output text into a list of factual statements via an LLM call
    • •Step 2: fact-check each statement in a binary way, often using retrieval methods like RAG or web search
    • •Optionally weight facts by importance and aggregate correctness into a final score
    • •An example illustrates deriving a non-binary overall score that reflects partial correctness
  13. Evaluating agentic workflows: breaking down the loop and tool-call pipeline

    A second lecturer shifts to evaluating agents, emphasizing that agents run multi-step loops. They propose analyzing failures by decomposing one loop into tool selection/argumenting, execution, and response synthesis.

    • •Agents are framed as looping through atomic steps (observe/plan/act style)
    • •A single tool-use cycle is decomposed into selecting the tool + arguments, executing the tool, and inferring a user-facing response
    • •Evaluation is framed around identifying failure modes at each stage
    • •Tool selection errors include not using a needed tool (punting) and issues with tool routing/recall
    • •The setup prepares a systematic debugging-oriented view of agent evaluation
  14. Agent failure modes in depth: tool selection, argument errors, backend outputs, and synthesis issues

    The lecturer enumerates common agent/tooling failures and practical causes: missing tools due to routing, hallucinated tool names, wrong tool choice, incorrect arguments, tool errors, empty tool outputs, and poor synthesis of tool results. They emphasize methodical categorization to debug effectively.

    • •Not using a needed tool can be caused by tool router recall failure or the model not learning to call tools; remedies include router tuning, SFT/prompt updates
    • •Tool hallucination: calling nonexistent functions; potential remedies include stronger models, clearer top-level instructions, and improved API naming/arguments/descriptions
    • •Wrong tool choice can come from router recall or overlapping/conflicting tool scopes; clarify tool APIs and selection rules
    • •Wrong arguments can stem from missing context (e.g., location) or poor tool-use learning; add prerequisite tools or revise training/prompting
    • •Backend/tool issues include tool bugs, returning raw errors, or returning no response; use meaningful structured outputs (even empty JSON) and ensure outputs are usable for synthesis; synthesis can fail if tool outputs are too large or poorly structured
  15. Benchmark landscape: knowledge, reasoning, coding, safety, and agents (plus contamination and interpretation)

    The lecturer surveys major benchmark categories and gives representative examples, explaining why constrained formats are common. They close by discussing how benchmarks are used in practice, how to interpret trade-offs, and why contamination and Goodhart’s law matter.

    • •Knowledge benchmarks: MMLU is described as diverse multiple-choice questions spanning many domains
    • •Reasoning benchmarks: AIME is presented as constrained-answer math; PIQA as everyday physical commonsense with two choices
    • •Coding benchmarks: SWE-bench evaluates patches against tests derived from real repository issues and pull requests
    • •Safety benchmarks: HarmBench categories are outlined; success can mean attempting harmful behavior, and a classifier is used for evaluation
    • •Agent benchmarks: TauBench uses domain tools/policies and a simulated user; evaluation uses task success (including database state) and introduces PassHatK (all K attempts succeed) for reliability; the lecturer warns about data contamination, emphasizes Goodhart’s law, and notes benchmarks characterize model profiles rather than providing universal answers

Publisher timestamps

  1. 0:00Introduction
  2. 7:08Inter-rater agreement metrics
  3. 18:24Rule-based metricsRead this chapter
  4. 21:00METEOR, BLEU ROUGE
  5. 28:00LLM-as-a-judgeRead this chapter
  6. 33:44Structured outputs
  7. 36:48Variants
  8. 38:47Position, verbosity, self-enhancement bias
  9. 47:22Best practices
  10. 54:06Factuality
  11. 1:00:15Agent evaluationRead this chapter
  12. 1:23:50Benchmarks
  13. 1:25:12Knowledge with MMLU
  14. 1:29:34Reasoning AIME, PIQARead this chapter from 1:29:35
  15. 1:33:57Coding with SWE-benchRead this chapter
  16. 1:36:15Safety with HarmBench
  17. 1:40:51Agents with Tau-Bench

Get more out of YouTube videos.

Read along on your phone, search it beside the video, or ask your favorite AI app what was said.