AI Evaluation and Response Quality

AI Evaluation and Response Quality

GenAI-Powered .NET Β· double-click any text to add a note Β· hover dotted terms for definitions
Tutorial 26 of 27 Intermediate C#

1 Overview: Is the Answer Actually Good?

Tutorial 22 introduced evaluation infrastructure — a golden dataset, metrics, regression testing. Tutorial 25 covered the operational metrics a dashboard tracks automatically — cost, latency, error rate. Neither answers the question this tutorial takes on directly: is what the model actually said good? A response can be fast, cheap, and error-free while still missing the point of the question, confidently stating something false, or contradicting itself between two similar questions. This tutorial is about judging response quality itself, the dimension no amount of operational monitoring can substitute for.

This is an intermediate-level, practical tutorial covering: evaluating response relevance (does the answer address the actual question); detecting hallucinations (is it making things up); consistency checks (does it answer the same question the same way twice); prompt refinement based on outputs (using what you observe to improve the prompt, not just the code); basic qualitative evaluation metrics (structured but non-automated judgment); and comparing multiple outputs (choosing between candidates, whether from different prompts, different models, or repeated runs). These are the techniques that let you say, with evidence, 'this answer is good' rather than 'this answer arrived quickly.'

Everything here complements, not replaces, tutorial 22's golden-dataset infrastructure. This tutorial is about what specifically to judge and how to judge it; tutorial 22 is about the harness that runs those judgments repeatably.

2 Learning Objectives

  • Evaluate response relevance — whether an answer actually addresses what was asked, independent of factual correctness.
  • Detect hallucinations, including groundedness checks against source context for RAG systems.
  • Run consistency checks to reveal how stable a model's answers are across repeated or logically equivalent questions.
  • Refine prompts based on observed output patterns, closing the loop from evaluation back to prompt design.
  • Apply basic qualitative evaluation metrics using rubrics and LLM-as-judge techniques where fully automated metrics fall short.
  • Compare multiple candidate outputs systematically, including pairwise comparison, to choose the best one.

3 Prerequisites

  • Tutorial 22's evaluation foundation: golden datasets, evaluation metrics, and regression testing.
  • Tutorial 15's RAG concepts, particularly grounding and citations, which this tutorial's hallucination detection builds on directly.
  • Comfort writing and iterating on system prompts (tutorials 11, 15, 17) — prompt refinement assumes you can already write a first-draft prompt.
  • No new frameworks are introduced; this tutorial is technique and practice, applicable to any system built in this course.
Keep a RAG or agent-based system you've built earlier in the course open. Every technique in this tutorial is best learned by applying it to real outputs from a real system, not by reading about it in the abstract.

4 Key Concepts: Quality Has Dimensions

'Is this answer good?' is not one question — it's several distinct questions that can each be true or false independently. An answer can be relevant but hallucinated (directly addresses the question, with a fabricated fact). It can be grounded but incomplete (everything stated is true, but it misses part of what was asked). It can be excellent once and wildly different the next time on the same question (inconsistent). Evaluating response quality means checking each dimension deliberately rather than forming one vague overall impression.

Quality dimension Question it answers Subtopic
Relevance Does this address what was actually asked? Evaluating response relevance
Groundedness Is every claim actually supported by facts/context? Detecting hallucinations
Consistency Does it answer the same question the same way twice? Consistency checks
Improvement How do we use what we observe to make it better? Prompt refinement based on outputs
Structured judgment How do we score quality when there's no exact right answer? Basic qualitative evaluation metrics
Comparison Given two candidate outputs, which is actually better? Comparing multiple outputs

These six feed into each other as a loop: you evaluate relevance, groundedness, and consistency on real outputs; that evaluation reveals specific patterns of failure; prompt refinement acts on those patterns; and comparing outputs (old prompt versus new) tells you whether the refinement actually helped, closing the loop back to evaluation. Qualitative metrics and rubrics are the tool that makes each of these judgments structured and repeatable rather than ad hoc.

None of these checks require a large team or heavy tooling to start. Evaluating ten real outputs by hand against explicit criteria, consistently, teaches more than an elaborate but unused evaluation pipeline.

5 Deep Dive 1: Evaluating Response Relevance and Detecting Hallucinations

Response relevance asks a narrower question than 'is this a good answer': does it actually address what was asked, at all? A fluent, well-written, entirely accurate response to a question the user didn't ask is still a failure — a common pattern is a RAG system retrieving the wrong passage and confidently answering the question that passage happens to address, rather than the user's actual question. Evaluating relevance means checking, explicitly, whether the answer's content maps onto the question's content, independent of whether that content is true.

Hallucination is a distinct failure: fluent, confident output that is factually wrong or unsupported. For grounded (RAG) systems specifically, a groundedness check verifies every claim in the answer traces back to the retrieved source passages — an answer can be relevant (it's clearly trying to answer the right question) and still hallucinated (it states something the sources never said). Citation accuracy is a specific, checkable form of this: if an answer cites [2] for a claim, does source [2] actually support that claim, or was the citation just plausibly placed near the right area of the text?

🎬 Relevance and groundedness are independent axes
An answer can fail on either axis without failing on the other.
Question "What's the refund window?"
➜
Relevant + Grounded correct, on-topic answer
➜
Relevant + Hallucinated on-topic, wrong fact
➜
Irrelevant + Grounded true statement, wrong topic
A simple groundedness check comparing claims to source passages (illustrative)
// Illustrative structure: an LLM-as-judge call checking each claim against sources.
async Task<GroundednessResult> CheckGroundednessAsync(
    string answer, IReadOnlyList<string> sourcePassages, CancellationToken ct)
{
    string judgePrompt = $"""
        Sources:
        {string.Join("\n---\n", sourcePassages)}

        Answer to check: {answer}

        For each factual claim in the answer, state whether it is directly
        supported by the sources (SUPPORTED), contradicted (CONTRADICTED),
        or not mentioned at all (UNSUPPORTED). List each claim and its verdict.
        """;

    var judgeCompletion = await judgeClient.CompleteChatAsync(
        new UserChatMessage(judgePrompt), cancellationToken: ct);
    return ParseGroundednessVerdicts(judgeCompletion.Value.Content[0].Text);
}
An LLM-as-judge check is itself a model call and can itself be wrong — it's a strong, scalable heuristic, not an infallible ground truth. Spot-check judge verdicts against human review periodically, especially when first setting up a new evaluation.

6 Deep Dive 2: Consistency Checks and Prompt Refinement

Consistency checks test whether a model gives the same, or compatibly equivalent, answer across repeated runs of the same question or across logically equivalent rephrasings. Self-consistency — running the identical prompt several times and comparing outputs — reveals output variance: at low temperature, a well-designed prompt should produce largely stable answers on factual questions; wide variance on a factual question (not a creative one) is a signal the prompt is underspecified or the question is more ambiguous than intended. A related check: asking the same underlying question two different ways ('what's the refund window?' versus 'how many days do I have to return something?') should produce compatible answers — a contradiction between them reveals a gap in the system's actual knowledge or grounding, not just prompt phrasing sensitivity.

A basic self-consistency check
async Task<double> MeasureSelfConsistencyAsync(
    string question, int runs, CancellationToken ct)
{
    var answers = new List<string>();
    for (int i = 0; i < runs; i++)
    {
        var completion = await chat.CompleteChatAsync(
            new UserChatMessage(question),
            new ChatCompletionOptions { Temperature = 0.2f }, ct);
        answers.Add(completion.Value.Content[0].Text);
    }

    // Illustrative: an LLM-as-judge call comparing all answers for compatible meaning,
    // returning a 0-1 consistency score rather than requiring exact string match.
    return await JudgeSemanticConsistencyAsync(answers, ct);
}

Prompt refinement based on outputs is the deliberate response to what relevance, groundedness, and consistency checks reveal: a specific, observed failure pattern (not a vague 'the answer wasn't great') points at a specific prompt change. If relevance checks reveal the model frequently answers an adjacent-but-wrong question, the system prompt may need an explicit instruction to restate the question before answering. If groundedness checks reveal frequent unsupported claims, the grounding instruction (tutorial 15) may need strengthening or the retrieval step improved rather than the generation prompt. If consistency checks reveal high variance, lowering temperature or adding more explicit constraints to the prompt is the likely fix.

🎬 The iterative evaluation loop
Observation drives refinement, and refinement is validated by re-observation.
Generate run the current prompt
➜
Evaluate relevance, groundedness, consistency
➜
Identify pattern a specific, recurring failure
➜
Refine prompt a targeted change
➜
Re-evaluate did it actually help?
Refine one dimension at a time and re-evaluate before making a second change. Changing several things about a prompt at once makes it impossible to tell which change caused which effect on the next evaluation pass.

7 Deep Dive 3: Basic Qualitative Evaluation Metrics

Some quality dimensions resist a clean automated pass/fail check — tone appropriateness, whether an explanation is pitched at the right level, whether a summary captures what actually matters. Qualitative evaluation judges these with human or model-assisted judgment against explicit criteria, rather than leaving 'is it good' as an unstructured impression. A rubric makes this structured: a defined set of criteria (relevance, completeness, tone, groundedness) each with a scoring scale (e.g. 1–5) and concrete guidance for what each score level means, so different evaluators — or the same evaluator on different days — apply the same standard.

A simple rubric-based evaluation structure
public sealed record RubricScore(
    int Relevance,      // 1-5: does it address the actual question?
    int Completeness,   // 1-5: does it cover everything asked?
    int Groundedness,   // 1-5: is every claim supported by sources?
    string Notes);

// LLM-as-judge applying the rubric consistently across many outputs --
// scalable where a human reviewing every single output isn't practical.
async Task<RubricScore> ScoreWithRubricAsync(
    string question, string answer, string sources, CancellationToken ct)
{
    string rubricPrompt = $"""
        Score the answer below on a 1-5 scale for each criterion.
        Relevance: does it directly address the question asked?
        Completeness: does it cover everything the question requires?
        Groundedness: is every claim supported by the provided sources?

        Question: {question}\nAnswer: {answer}\nSources: {sources}

        Respond as: Relevance=<n>, Completeness=<n>, Groundedness=<n>, Notes=<text>
        """;
    var completion = await judgeClient.CompleteChatAsync(
        new UserChatMessage(rubricPrompt), cancellationToken: ct);
    return ParseRubricScore(completion.Value.Content[0].Text);
}

LLM-as-judge — using a model to apply the rubric — makes qualitative evaluation scalable across hundreds of outputs where a human reviewing every single one isn't practical, and tutorial 22's golden dataset is exactly what a rubric-based LLM-judge evaluation runs against as regression testing. The tradeoff: the judge model can share biases or blind spots with the model being judged, so periodic human spot-checks of judge scores (especially when a rubric is new, or scores cluster suspiciously high) remain part of the practice, not an optional extra.

A rubric's value comes from its specificity. 'Rate the answer 1-5 for quality' produces inconsistent scores because 'quality' means something different to every evaluator; 'rate 1-5 for whether every claim is supported by the given sources' produces comparable, actionable scores because the criterion is concrete and checkable.

8 Deep Dive 4: Comparing Multiple Outputs

Comparing multiple outputs is the technique behind nearly every improvement decision in this tutorial: is the new prompt better than the old one, is model A better than model B for this task, is this repeated run better than that one? Every comparison needs explicit evaluation criteria stated up front — relevance, groundedness, completeness — so 'better' means something concrete rather than an unstated preference. Scoring each output independently (as the rubric in deep-dive 3 does) works, but pairwise comparison — presenting two candidate outputs side by side and asking which is better, and why — is often more reliable for close calls, because judging 'is this a 4 or a 5' in isolation is harder and less consistent than judging 'is A or B better' directly.

A pairwise comparison between two prompt variants (illustrative)
async Task<string> ComparePairwiseAsync(
    string question, string answerA, string answerB, CancellationToken ct)
{
    string comparePrompt = $"""
        Question: {question}
        Answer A: {answerA}
        Answer B: {answerB}

        Which answer better addresses the question, considering relevance,
        groundedness, and completeness? Respond with 'A', 'B', or 'TIE',
        followed by a one-sentence justification.
        """;
    var completion = await judgeClient.CompleteChatAsync(
        new UserChatMessage(comparePrompt), cancellationToken: ct);
    return completion.Value.Content[0].Text;
}
🎬 Comparing a prompt refinement across the golden dataset
Pairwise comparison at scale, using tutorial 22's evaluation infrastructure.
Old prompt current baseline
➜
New prompt candidate refinement
➜
Golden dataset same questions, both prompts
➜
Pairwise judge A vs B per question
➜
Win rate did the refinement help?

This pairwise approach is also how a real A/B test of prompts works at the level of live traffic, matching tutorial 23's canary rollout practice: a portion of real requests gets the new prompt, the rest the old, and outcomes (evaluation scores, user feedback, downstream metrics) are compared between the two groups rather than just between a handful of manually-reviewed examples. For repeated-run consistency (deep-dive 2) specifically, pairwise or rubric scoring across several runs of the same question is what actually quantifies 'how consistent' rather than leaving it as an impression from reading a few outputs.

When a pairwise comparison judge frequently returns TIE, that's informative too — it may mean the two variants are genuinely equivalent on the criteria given, or that the comparison prompt's criteria aren't specific enough to distinguish them. Both are useful things to learn.

9 Ecosystem and Tools

Tool / technique Role in evaluating response quality
Azure AI Foundry evaluation (tutorial 16) Platform-level tooling for running groundedness, relevance, and similar evaluations at scale
Golden dataset + regression testing (tutorial 22) The infrastructure this tutorial's specific checks (relevance, groundedness, consistency) run against repeatably
LLM-as-judge Using a model to apply rubrics or pairwise comparisons across many outputs where human review doesn't scale
Human review / spot-checking The ground-truth check against which LLM-as-judge reliability is periodically validated
A/B testing infrastructure (tutorial 23's canary rollout) Comparing prompt/model variants on real traffic, not just offline evaluation
Structured rubric templates Making qualitative judgment consistent and comparable across evaluators and over time
Citation/source tracking (tutorial 15's RAG pipeline) The data groundedness and citation-accuracy checks are verified against

This tutorial adds specific, response-quality-focused techniques on top of tutorial 22's general evaluation infrastructure and tutorial 16's platform tooling — it answers what to measure and how to judge it, while those earlier tutorials provide where that measurement runs and how it's automated at scale.

10 Use Cases

  • A RAG support assistant running a groundedness check on every golden-dataset answer before each release, blocking a release if unsupported-claim rate exceeds a threshold.
  • A team discovering, via relevance evaluation, that a chatbot frequently answers a related-but-different question, and refining the system prompt to require restating the question first.
  • A consistency check revealing a factual-question prompt has high output variance, leading to a temperature reduction and a more explicit constraint in the prompt.
  • A prompt refinement cycle: observe hallucination patterns, strengthen the grounding instruction, re-run evaluation, confirm the hallucination rate dropped without a relevance regression.
  • A rubric-based qualitative evaluation of tone and completeness for a customer-facing assistant, scored by an LLM judge and spot-checked monthly by a human reviewer.
  • A pairwise comparison between two candidate models for a summarization task, run across the golden dataset, informing a model-tiering decision (tutorial 25) with actual quality evidence.
  • An A/B test comparing an old and new grounding prompt on live traffic, following tutorial 23's canary practice, before fully committing to the new version.

11 Code Examples

These examples combine relevance scoring, groundedness checking, and pairwise comparison into one evaluation run against a golden dataset.

Example 1 — A combined evaluation pass over the golden dataset
public sealed record EvalResult(string Question, int Relevance, int Groundedness, string Notes);

async Task<List<EvalResult>> RunQualityEvaluationAsync(
    IReadOnlyList<GoldenCase> goldenSet, IChatService candidate, CancellationToken ct)
{
    var results = new List<EvalResult>();
    foreach (var testCase in goldenSet)
    {
        var answer = await candidate.AskGroundedAsync(testCase.Question, ct);
        var score = await ScoreWithRubricAsync(
            testCase.Question, answer.Text, string.Join("\n", answer.Sources.Select(s => s.Content)), ct);
        results.Add(new EvalResult(testCase.Question, score.Relevance, score.Groundedness, score.Notes));
    }
    return results;
}
Example 2 — Flagging outputs for human review below a threshold
var lowScoring = results.Where(r => r.Relevance < 3 || r.Groundedness < 3).ToList();

logger.LogWarning("{Count} of {Total} evaluated answers scored below threshold and need human review",
    lowScoring.Count, results.Count);

foreach (var flagged in lowScoring)
    logger.LogWarning("Flagged: '{Question}' -- Relevance={Relevance} Groundedness={Groundedness} Notes={Notes}",
        flagged.Question, flagged.Relevance, flagged.Groundedness, flagged.Notes);
Example 3 — Comparing old vs. new prompt with an aggregate win rate
int newWins = 0, oldWins = 0, ties = 0;
foreach (var testCase in goldenSet)
{
    var oldAnswer = await oldPromptService.AskAsync(testCase.Question, ct);
    var newAnswer = await newPromptService.AskAsync(testCase.Question, ct);
    string verdict = await ComparePairwiseAsync(testCase.Question, oldAnswer, newAnswer, ct);

    if (verdict.StartsWith("B")) newWins++;        // B = new answer in this ordering
    else if (verdict.StartsWith("A")) oldWins++;
    else ties++;
}
logger.LogInformation("New prompt: {NewWins} wins, {OldWins} losses, {Ties} ties out of {Total}",
    newWins, oldWins, ties, goldenSet.Count);

12 Step by Step: Evaluating and Refining a RAG Assistant's Responses

This walkthrough runs a full evaluate-refine-compare cycle against the tutorial-15 RAG assistant, using every technique from this tutorial.

  1. Take 10-15 real or representative questions for your RAG assistant (a subset of, or the full, tutorial-22 golden dataset) and generate answers with the current system prompt.
  2. Manually review each answer for relevance: does it address the actual question, independent of correctness? Note any that answer an adjacent-but-wrong question.
  3. Run a groundedness check (deep-dive 1's pattern) on each answer against its retrieved sources, flagging any unsupported or contradicted claims.
  4. Run a self-consistency check (deep-dive 2) on 2-3 of the factual questions, generating 3-5 repeated answers each and comparing them for compatible meaning.
  5. Identify the single most common failure pattern across all three checks — likely candidates: answering an adjacent question, unsupported claims, or high variance on factual questions.
  6. Make ONE targeted prompt refinement addressing that specific pattern (deep-dive 2's discipline — one change at a time).
  7. Re-run the same 10-15 questions with the refined prompt and repeat the relevance, groundedness, and consistency checks.
  8. Run a pairwise comparison (Example 3) between the old and new prompt's answers across the same question set, and compute the aggregate win rate.
  9. Build a simple rubric (deep-dive 3) scoring relevance, completeness, and groundedness 1-5, and apply it via LLM-as-judge to the refined prompt's answers as a baseline for future comparisons.
  10. Document the finding: what failure pattern was observed, what change was made, and what the pairwise win rate showed — this is the artifact that justifies (or rules out) shipping the refinement.
Resist refining more than one thing in step 6, even if you notice multiple issues in steps 2-4. Fixing the biggest issue first and measuring its isolated effect is what makes step 8's win rate actually mean something.

13 Limitations and Caveats

  • LLM-as-judge is a scalable heuristic, not ground truth — it can share blind spots or biases with the model it's judging, and periodic human spot-checks remain necessary, especially for a newly-built rubric.
  • Relevance and groundedness are related but genuinely independent; a system optimized for one metric alone can silently regress on the other if only one is tracked.
  • Self-consistency checks assume low temperature should produce stable answers on factual questions; for genuinely creative or open-ended tasks, high variance is expected and not a defect.
  • Rubric quality determines evaluation quality — a vague rubric ('rate 1-5 for quality') produces inconsistent, low-value scores regardless of how carefully it's applied.
  • Pairwise comparison can be sensitive to answer ordering (which answer is presented as 'A' versus 'B') in some models; consider running comparisons in both orders and checking for order bias.
  • This tutorial's code examples (rubric parsing, pairwise judging) are illustrative structures; production evaluation pipelines should use more robust parsing and, ideally, established evaluation frameworks rather than ad hoc string parsing of judge output.
  • Evaluating response quality takes real time and (for LLM-as-judge) real token cost; scope the frequency and depth of evaluation to the stakes of the feature, not uniformly to the maximum for every change.
  • None of these techniques catch every failure mode; they are the practical, learnable core of a much larger evaluation discipline that professional evaluation frameworks and research continue to develop.

14 Best Practices

  • Evaluate relevance and groundedness as separate, explicit checks — never assume one implies the other.
  • Treat hallucination detection as mandatory for any system that generates factual claims, not just RAG systems specifically.
  • Run consistency checks on factual/deterministic-expected tasks, and expect (don't penalize) higher variance on genuinely creative tasks.
  • Refine one dimension of a prompt at a time and re-evaluate before making a second change, so cause and effect stay traceable.
  • Write specific, checkable rubric criteria rather than a single vague 'quality' score.
  • Spot-check LLM-as-judge verdicts against human review periodically, especially for a new or recently-changed rubric.
  • Use pairwise comparison for close calls between two candidates; use rubric scoring when you need an absolute, comparable score across many outputs over time.
  • Document every evaluation finding and refinement decision — the failure pattern observed, the change made, the measured effect — as the evidence trail for why a prompt looks the way it does.
Common mistake Do this instead
Treating a relevant-sounding answer as automatically correct Check relevance and groundedness as separate, explicit dimensions
Trusting a single manually-reviewed example as representative Run checks across a representative set (the golden dataset), not one anecdote
Changing several prompt elements at once Refine one dimension at a time and re-evaluate before the next change
A vague 'rate this 1-5' rubric Specific, checkable criteria per rubric dimension
Trusting LLM-as-judge scores blindly Periodic human spot-checks, especially for new rubrics
Shipping a prompt change based on a few manual tries Pairwise comparison across the full golden dataset before shipping

20 Summary

  • Response relevance and groundedness are independent quality dimensions: an answer can be relevant-but-hallucinated or grounded-but-irrelevant, so both need explicit, separate checks.
  • Hallucination detection via groundedness checks — decomposing an answer into claims and verifying each against source passages — is how confident-but-wrong output gets caught before users see it.
  • Consistency checks reveal output variance, interpreted differently for factual tasks (stability expected) versus creative tasks (variance expected and desirable).
  • Prompt refinement based on outputs means changing one targeted thing at a time in response to an observed, recurring failure pattern, then re-evaluating before the next change.
  • Qualitative evaluation via specific, checkable rubrics — applied by LLM-as-judge for scale, with periodic human spot-checks for reliability — turns 'is this good' into a structured, repeatable judgment.
  • Comparing multiple outputs, especially via pairwise comparison, is how a prompt refinement, model choice, or repeated-run consistency gets validated with evidence rather than assumed from a few manual examples.

You now have the substantive judgment techniques that make tutorial 22's evaluation infrastructure meaningful: what to check about a response's quality, and how to check it in a way that's structured, scalable, and honest about its own limitations. Combined with tutorial 25's operational monitoring, you can now say, with real evidence, not just that a system is fast and affordable, but that it's actually giving good answers — the complete picture a production AI system needs. With every technical, architectural, operational, security, and quality discipline of this course now in place, the final tutorial brings everything together into one complete, real-world application.

21 Next Steps

Next tutorial: Building a Real-World GenAI-Powered .NET Application (building-real-world-ai-dotnet-app). This is the course's capstone: a complete application synthesizing every tutorial's techniques — from tutorial 10's model deployment through this tutorial's evaluation practice — into one cohesive, production-shaped GenAI .NET application.

  • Practice: complete the step-by-step evaluate-refine-compare cycle on a RAG or agent system you've built earlier in the course, documenting the failure pattern found and the measured improvement.
  • Practice: build a rubric for a system of your own with at least three specific, checkable criteria, and apply it via LLM-as-judge to ten real outputs.
  • Practice: run a self-consistency check on both a factual question and a creative task from the same system, and confirm you can correctly interpret the different variance expectations.
  • Practice: implement pairwise comparison between two prompt variants and compute an aggregate win rate across a small golden dataset.
  • Read: any current guidance on LLM evaluation frameworks, groundedness/faithfulness metrics, and Azure AI Foundry's built-in evaluation capabilities (tutorial 16).
Bring your golden dataset, evaluation scripts, and rubrics into the final capstone project. The complete application in the next tutorial is exactly where every technique from this entire course — including this one — gets exercised together for real.

15 Quiz: AI Evaluation and Response Quality

Pick an answer for each question, then press Check answer. (Notes are disabled in this tab.)

1. What does evaluating response relevance specifically check?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Relevance is about topical fit — does the answer's content map onto the question's content — which is a distinct question from correctness. A fluent, accurate answer to the wrong question still fails on relevance.

2. What is a hallucination in the context of AI-generated responses?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Hallucination describes a model stating something false or unsupported with the same fluent confidence as a correct statement — the central quality failure that grounding techniques (tutorial 15) and groundedness checks aim to catch and reduce.

3. What does a groundedness check specifically verify?

βœ… Correct!
❌ Not quite β€” the correct answer is .
A groundedness check tests each factual claim in an answer against the provided source context, verifying it's actually supported rather than fabricated or contradicted — directly relevant to any RAG or context-grounded system.

4. Can an answer be relevant but still hallucinated? Explain why this matters.

βœ… Correct!
❌ Not quite β€” the correct answer is .
Relevance and groundedness are independent axes: an answer can be clearly on-topic yet still fabricate a fact not present in its sources. This is why both must be checked separately — checking only one can miss failures on the other.

5. What does a self-consistency check measure?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Self-consistency runs the identical prompt several times and compares the outputs, revealing output variance — high variance on a factual question (as opposed to a creative one) signals the prompt may be underspecified or the question ambiguous.

6. Why is high output variance NOT necessarily a defect?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The expectation for consistency depends on task type: a factual question should produce stable answers at low temperature, while a creative brainstorming task producing different ideas each run is working as intended, not malfunctioning.

7. What discipline does this tutorial recommend when refining a prompt based on observed output patterns?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Changing several prompt elements simultaneously makes it impossible to tell which specific change caused which effect on the next evaluation. Refining one targeted dimension and re-evaluating before the next change keeps cause and effect traceable.

8. What is a rubric in the context of qualitative evaluation?

βœ… Correct!
❌ Not quite β€” the correct answer is .
A rubric defines explicit criteria (relevance, completeness, groundedness) each with a scoring scale and concrete guidance for what each score means, making qualitative judgment consistent across evaluators and over time, rather than an unstructured impression.

9. Why does a vague rubric like 'rate the answer 1-5 for quality' produce poor evaluation results?

βœ… Correct!
❌ Not quite β€” the correct answer is .
A vague criterion gives every evaluator (human or LLM-judge) a different implicit standard to apply, producing inconsistent scores that aren't meaningfully comparable. Specific, checkable criteria (like 'is every claim supported by the sources') produce comparable, actionable scores.

10. What is LLM-as-judge?

βœ… Correct!
❌ Not quite β€” the correct answer is .
LLM-as-judge uses a model call to apply a rubric or comparison criteria across many outputs, making qualitative evaluation scalable where human review of every single output isn't practical — while still needing periodic human spot-checks for reliability.

11. Why is periodic human spot-checking of LLM-as-judge verdicts recommended?

βœ… Correct!
❌ Not quite β€” the correct answer is .
An LLM-as-judge call is itself a model call subject to its own errors, and may share systematic blind spots or biases with the model it's evaluating. Periodic human spot-checks validate that the judge's verdicts are actually trustworthy, especially for a newly-built rubric.

12. What is pairwise comparison, and why is it often more reliable for close calls than independent scoring?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Deciding 'is this answer a 4 or a 5' in isolation is a harder, less consistent judgment than directly comparing two candidates and picking the better one — pairwise comparison sidesteps the difficulty of calibrating an absolute scale for close, similar-quality outputs.

13. How does comparing multiple outputs relate to A/B testing described in earlier deployment tutorials?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Comparing two prompt variants' outputs across a golden dataset offline mirrors, at evaluation time, what a canary/A/B rollout does on live traffic: comparing outcomes between an old and new variant to decide, with evidence, whether the new version is actually better.

14. What should a team do if a pairwise comparison judge frequently returns 'TIE' between two prompt variants?

βœ… Correct!
❌ Not quite β€” the correct answer is .
A frequent TIE result is useful information rather than a non-result: it could mean the two variants are truly comparable in quality, or that the comparison prompt's criteria need to be more specific to actually distinguish meaningful differences between them.

15. How do the six subtopics of this tutorial (relevance, hallucination detection, consistency, refinement, qualitative metrics, comparison) relate to each other as a practice?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The subtopics connect as a coherent cycle: evaluation checks (relevance, groundedness, consistency) surface specific quality issues, prompt refinement targets those issues, and comparing outputs (pairwise or via rubric) provides evidence of whether the refinement actually improved things — closing the loop back into further evaluation.

16 Exam: Written Questions

Try answering each question yourself before expanding the model answer.

1. Explain response relevance as a distinct evaluation dimension, and describe a concrete scenario where a response fails on relevance despite being entirely factually accurate.
Response relevance measures whether an answer's content actually addresses what the user asked, independent of whether that content is true. It is a distinct dimension from correctness or groundedness because a response can be perfectly accurate about something while still not answering the actual question posed. A concrete scenario: a user asks a RAG-based support assistant 'what's your refund policy for damaged items?' but the retrieval step, due to a keyword overlap, surfaces a passage about general shipping timelines instead of the damaged-item refund policy. The model then generates a fluent, entirely accurate summary of the shipping timeline passage it was given — every statement in the answer is true and grounded in a real source document — but it does not address damaged-item refunds at all, which is what the user actually asked about. This is a pure relevance failure: nothing in the answer is wrong, but the answer doesn't serve the user's actual need, illustrating why relevance must be evaluated as its own explicit check rather than assumed whenever groundedness passes.
2. Describe hallucination and groundedness checking, and explain the mechanism by which a groundedness check identifies a hallucinated claim.
Hallucination is fluent, confident model output that is factually wrong or unsupported by available context — the model states something with the same tone of certainty whether the statement is accurate or fabricated, which is what makes hallucinations dangerous: nothing in the surface presentation signals unreliability. A groundedness check identifies hallucinated claims by decomposing an answer into its individual factual assertions and testing each one against the source passages the model was actually given (for a RAG system) or against verifiable facts more broadly. Mechanically, this is often implemented as an LLM-as-judge call: the judge model receives the source passages and the answer, and for each claim in the answer, determines whether it is SUPPORTED (the sources directly state this), CONTRADICTED (the sources say something different), or UNSUPPORTED (the sources simply don't mention this at all, even though it's not directly contradicted). Any claim landing in the CONTRADICTED or UNSUPPORTED category is a hallucination candidate, distinguishing an answer that is faithful to its given context from one that has added claims the model's own training knowledge supplied rather than the actual retrieved sources.
3. Explain self-consistency checking, what output variance reveals, and why the same variance level means something different depending on task type.
Self-consistency checking runs the identical prompt multiple times and compares the resulting outputs to measure output variance — how much the answers differ from each other across repeated runs. For a factual question at low temperature, a well-designed prompt should produce largely stable, compatible answers each time; if repeated runs of 'what is the refund window?' produce meaningfully different answers (7 days one run, 14 days the next), that variance signals either an underspecified prompt, genuine ambiguity in the underlying question or source data, or a temperature setting too high for a task that needs determinism. However, the same numerical variance would mean something entirely different for a creative task: if a prompt asks 'suggest three taglines for this product' and produces different sets of taglines each run, that is the system working as intended — variety is the explicit goal, not a defect to fix. This is why self-consistency checks must be interpreted relative to the task's actual determinism expectations rather than judged against one universal 'low variance is always good' standard; the same technique (running repeated trials and comparing) applies to both cases, but the correct interpretation of the result depends entirely on whether the task calls for stability or diversity.
4. Walk through the iterative evaluation loop connecting evaluation checks, prompt refinement, and comparison, explaining why the discipline of changing one thing at a time matters.
The loop begins with generation: run the current prompt against real or representative questions. Evaluation follows: apply relevance, groundedness, and consistency checks to the resulting outputs, looking specifically for recurring failure patterns rather than one-off anomalies. Once a specific pattern is identified — say, frequent unsupported claims on questions about a particular topic — prompt refinement makes one targeted change addressing that specific pattern, such as strengthening the grounding instruction in the system prompt. Re-evaluation then re-runs the same or an expanded question set through the refined prompt and re-applies the same checks, and comparison (often pairwise, old versus new) quantifies whether the targeted dimension actually improved and whether any other dimension regressed as a side effect. The discipline of changing only one thing at a time is essential to this loop's validity: if a refinement pass changes the grounding instruction, the temperature, and the phrasing of the question-restatement rule all simultaneously, and the re-evaluation shows improved groundedness, there is no way to know which of the three changes caused the improvement — or whether one change improved groundedness while another caused an undetected regression in relevance that happened to be masked in the aggregate result. Isolating changes keeps the causal chain from observation to refinement to validated improvement fully traceable, which is what turns prompt engineering from guesswork into an evidence-based practice.
5. Explain qualitative evaluation and rubrics, and design a rubric for evaluating a customer-support AI assistant's responses, specifying at least three criteria and what a low versus high score means for each.
Qualitative evaluation judges dimensions of output quality that resist a clean automated pass/fail test — like tone appropriateness or whether an explanation is pitched at the right level — through structured human or model-assisted judgment against explicit criteria, rather than an unstructured overall impression. A rubric makes this structured and repeatable by defining specific criteria with a scoring scale and concrete guidance for each level. A rubric for a customer-support assistant: Relevance (1-5) — a score of 1 means the answer addresses a different topic than what was asked; a score of 5 means it directly and fully addresses the specific question asked, with no unrelated content. Groundedness (1-5) — a score of 1 means multiple claims are unsupported or contradicted by the source documents/policies; a score of 5 means every factual claim is directly traceable to a source, with no fabricated details. Tone appropriateness (1-5) — a score of 1 means the response is curt, overly technical, or inappropriately casual for a support context; a score of 5 means the response is warm, clear, and appropriately professional throughout. Each criterion is specific enough that two different evaluators (or the same evaluator on different days, or an LLM-as-judge) applying the rubric to the same answer should converge on similar scores, which is the entire value a rubric provides over an unstructured 'rate this 1-5' request.
6. Explain LLM-as-judge, its scalability advantage, and its key limitation, using a specific example of when the limitation would actually manifest.
LLM-as-judge uses a model call to apply evaluation criteria — a rubric, a groundedness check, a pairwise comparison — across outputs, rather than requiring a human to manually review each one. Its scalability advantage is significant: evaluating hundreds or thousands of golden-dataset outputs by hand for every prompt iteration is impractical in time and cost, while an LLM-judge can apply the same criteria consistently across an arbitrarily large set of outputs at a fraction of the time and often the cost of human review, enabling frequent regression testing (tutorial 22) that would otherwise be infeasible. Its key limitation is that the judge is itself a model call subject to the same categories of error as the model it's judging, and may share systematic blind spots with it — if both the system being evaluated and the judge model come from the same underlying model family or have been trained on overlapping data, they may share the same misconceptions about a topic, meaning the judge would fail to flag a hallucination that happens to align with a shared blind spot rather than a fact either model would recognize as wrong. A concrete manifestation: if both models have a subtly incorrect but widely-repeated belief about some fact (common in training data despite being wrong), the system under evaluation states this incorrect fact confidently, and the judge model — sharing the same misconception — rates the claim as SUPPORTED or accurate, when a human fact-checker aware of the correct information would have caught the hallucination the judge missed entirely. This is precisely why periodic human spot-checking of judge verdicts remains part of the practice rather than being replaced entirely by LLM-as-judge.
7. Compare pairwise comparison and rubric-based independent scoring as evaluation methods, explaining when each is the better choice.
Rubric-based independent scoring evaluates each output on its own against fixed criteria, producing an absolute score (e.g., Relevance=4) that can be tracked over time, compared across many different outputs or model versions, and aggregated into dataset-wide statistics — its strength is that scores are comparable across a whole evaluation history, not just between two specific candidates being compared right now. Pairwise comparison instead presents two candidate outputs together and asks which is better, producing a relative judgment (A, B, or TIE) rather than an absolute number — its strength is that it is often more reliable and consistent specifically for close, similar-quality outputs, because deciding 'is this a 4 or a 5' in isolation requires calibrating an absolute internal scale that is harder to apply consistently than directly comparing two things side by side and picking the better one. The practical choice: use rubric scoring when you need a score that's comparable over time, across many different variants, or as input to dashboards and thresholds (tutorial 25) — an absolute number is what a trend line or an alert threshold needs. Use pairwise comparison specifically when deciding between two close candidates right now — a new prompt versus the current one, model A versus model B for a specific task — where the question is genuinely 'which of these two is better,' and the extra reliability pairwise comparison offers for close calls outweighs not producing a standalone absolute score. Many mature evaluation practices use both: rubric scoring for ongoing tracked metrics, pairwise comparison specifically when validating a proposed change before shipping it.
8. A team's RAG assistant passes all groundedness checks (every claim is supported by sources) but users still report the assistant is unhelpful. Diagnose the likely evaluation gap and propose a fix.
The likely gap is that groundedness alone was checked while relevance and completeness were not, and these are independent dimensions — an answer can be perfectly grounded (every stated claim is genuinely supported by the source documents) while still being unhelpful if it addresses a narrower or different aspect of the question than what the user actually needed, or if it's technically accurate but incomplete, covering only part of what was asked. For example, if a user asks 'how do I cancel my subscription and will I get a refund,' a groundedness-passing answer might correctly and accurately describe only the cancellation process (fully grounded, zero hallucination) while never addressing the refund question at all (a completeness failure) or address a slightly different aspect of cancellation than the user's specific situation warranted (a relevance failure) — both would pass a pure groundedness check while still leaving the user's actual need unmet, which is exactly what 'the assistant is unhelpful' describes. The fix: add explicit relevance and completeness checks (via a rubric, deep-dive 3) alongside the existing groundedness check, applied to the same golden dataset and real user question logs, specifically looking for the pattern of technically-correct-but-incomplete or off-target answers; this closes the evaluation gap that let a system pass its existing quality bar while still under-serving real users on a dimension that was never being measured at all.
9. Design an evaluation and refinement plan for a hallucination problem discovered in production, integrating relevance, groundedness, consistency, refinement, and comparison from this tutorial.
First, quantify the problem: run a groundedness check (deep-dive 1) across the full golden dataset (tutorial 22) to establish a baseline hallucination rate — what percentage of answers contain at least one unsupported or contradicted claim — rather than relying on the handful of production reports that first surfaced the issue, since those may not represent the full pattern. Second, characterize the pattern: review the flagged claims for commonality — are hallucinations concentrated on a specific question type, a specific retrieval scenario (e.g., when retrieval returns few or weak-relevance passages), or spread evenly, since the fix differs depending on the answer. Third, check relevance isn't confounding the diagnosis: verify the hallucinated claims occur even when the answer is clearly on-topic (a relevant-but-hallucinated failure) rather than the model compensating for irrelevant retrieved context by inventing something that sounds more applicable — this distinguishes a pure grounding-instruction problem from a retrieval-quality problem needing a different fix. Fourth, refine one targeted element — likely strengthening the grounding instruction ('never state anything not directly present in the sources; say you don't know if the sources are insufficient') or, if the pattern points to weak retrieval, improving the retrieval step instead, per deep-dive 2's one-change-at-a-time discipline. Fifth, re-run the same groundedness check on the refined version and compute a pairwise comparison against the original across the full golden dataset, confirming the hallucination rate dropped without a corresponding relevance or completeness regression. Sixth, run a self-consistency check on a sample of previously-hallucinating questions to confirm the fix is stable across repeated runs, not just a lucky single pass. Only after this full sequence — quantify, characterize, refine once, compare with evidence, confirm consistency — would the fix be considered validated rather than merely 'seems better now.'
10. Explain why this tutorial insists on evaluating relevance and groundedness as separate, explicit checks rather than assuming one implies the other, using both directions of the independence.
The independence runs in both directions, and assuming either implication is wrong leads to a specific blind spot. Assuming groundedness implies relevance misses the case where an answer is entirely accurate and fully supported by real source documents, yet addresses a different (or narrower) aspect of the question than what was actually asked — a retrieval mismatch or a model answering the 'nearest' question it found supporting evidence for rather than the literal question posed; checking groundedness alone would score this answer well despite it failing to serve the user. Assuming relevance implies groundedness misses the opposite case: an answer that is unmistakably on-topic, directly engaging with exactly what was asked, while confidently stating a fact that the source documents never actually said — the model correctly identified what needed answering but filled a gap in its retrieved context with a plausible-sounding fabrication; checking relevance alone would score this answer well despite it containing a hallucination that could mislead the user. Because a system can fail on either dimension while passing the other, and because the failure modes require different fixes (a relevance failure often points at a retrieval or question-understanding problem, a groundedness failure often points at a generation or grounding-instruction problem), evaluating them together but separately — as this tutorial's two-axis animation illustrates — is necessary to correctly diagnose which specific problem an underperforming answer actually has, rather than conflating two distinct failure modes into one vague 'the answer wasn't great' impression that gives no actionable direction for a fix.
11. A stakeholder proposes skipping human spot-checks of LLM-as-judge scores since 'the judge model is very capable and rarely wrong.' Evaluate this proposal.
The proposal underestimates a specific, non-obvious risk: the judge model's capability level is not the relevant variable — the risk is correlated error between the judge and the system being evaluated, which persists regardless of how generally capable the judge model is. If the judge model and the evaluated system share training data, architecture lineage, or common training-era knowledge gaps, they can share the same misconceptions about specific facts, meaning the judge would confidently validate a hallucination that happens to align with a blind spot both models share — a failure mode that has nothing to do with the judge's overall capability and everything to do with correlated blind spots. A judge model being 'very capable' on average says little about this specific correlated-error risk, and average capability numbers (from general benchmarks) don't measure it at all. Additionally, even an excellent judge model can be led astray by an ambiguously-worded rubric or a comparison scenario where subtle context matters in ways the judge prompt doesn't surface — capability doesn't fully compensate for evaluation-prompt design quality either. The reasonable middle ground, following this tutorial's guidance, is not full human review of every output (which defeats the scalability LLM-as-judge exists to provide) nor zero human involvement, but periodic, sampled spot-checks — reviewing a subset of judge verdicts by hand on a recurring basis, with extra scrutiny whenever a rubric is new or recently changed — calibrating trust in the judge over time with actual evidence rather than an assumption based on general capability.
12. Explain how comparing multiple outputs (this tutorial) relates to the canary rollout and A/B testing practices from the deployment tutorial, and why offline comparison alone is insufficient for a full rollout decision.
Comparing multiple outputs offline — running old and new prompt variants across a golden dataset and using pairwise comparison or rubric scoring to determine a winner — is the evaluation-time analog of what a canary release does on live traffic: both compare an existing baseline against a candidate change to decide, with evidence rather than assumption, whether the candidate is actually better. The offline version has real advantages: it's fast, cheap relative to live experimentation, doesn't expose any real users to a potentially worse variant, and can be run repeatedly during iterative refinement (deep-dive 2's loop) long before anything reaches production traffic. However, offline comparison alone is insufficient for a full rollout decision because a golden dataset, however well-constructed, cannot represent every real-world input distribution, edge case, or context a live user population will actually present — a prompt refinement that wins convincingly on the golden dataset's 15-30 curated questions could still behave unexpectedly on a real user's oddly-phrased or unanticipated question that the dataset doesn't cover. This is exactly why the deployment tutorial's canary rollout process comes after offline evaluation, not instead of it: offline comparison is the cheap, fast, safe first gate that catches obvious regressions and validates the core hypothesis before any real user is exposed, and canary/A-B testing on a small percentage of live traffic is the necessary second gate that catches whatever the offline evaluation's finite dataset couldn't anticipate, with the blast radius limited to a small fraction of traffic rather than everyone.
13. How would you decide the appropriate depth and frequency of response-quality evaluation for a given AI feature, avoiding both under-evaluation and wasteful over-evaluation?
I would scale evaluation depth and frequency to the feature's stakes and change frequency, rather than applying one uniform standard everywhere. For stakes: a feature whose wrong answers have low consequence (an internal tool suggesting meeting time slots) warrants lighter-touch evaluation — perhaps occasional spot-checks and a lightweight rubric — than a feature whose wrong answers have real consequences (a customer-facing assistant making claims about refund eligibility, or any system feeding into a decision with financial or safety implications), which warrants full groundedness and relevance checking on every release, tighter rubric criteria, and more frequent human spot-checks of the judge. For change frequency: a prompt or system that changes rarely doesn't need continuous re-evaluation, while a system under active, frequent iteration benefits from evaluation being cheap and fast enough to run on every change (tutorial 22's regression-testing practice) — which argues for LLM-as-judge over full human review specifically because it's fast enough to run that often. I would also scale evaluation to where problems have actually been found: a dimension that consistently scores well over many evaluation cycles might reasonably move to periodic sampling rather than exhaustive per-release checking, freeing effort toward dimensions or features where real issues keep surfacing. The core judgment is matching evaluation cost (time, tokens, human review effort) to the actual risk and rate of change of what's being evaluated, not defaulting to either 'evaluate nothing beyond a quick manual look' or 'apply maximum evaluation depth uniformly to everything regardless of stakes.'
14. Explain the relationship between this tutorial's response-quality evaluation and tutorial 25's operational monitoring (cost, latency, error rate) — why does a production system need both, and what would be missing with only one?
Tutorial 25's operational monitoring answers questions about the system's behavior as a running service: is it fast, is it affordable, is it reliably completing requests without errors. This tutorial's response-quality evaluation answers a different question entirely: given that a request completed successfully, quickly, and cheaply, was the actual content of the answer any good — relevant, grounded, consistent. These are genuinely independent dimensions, and a system can score well on one while failing badly on the other: a RAG assistant could have excellent p95 latency, low token cost per request, and a near-zero error rate (all green on tutorial 25's dashboard) while confidently hallucinating incorrect information on a meaningful fraction of questions, a failure that operational monitoring has no way to detect because hallucination doesn't manifest as a slow response, an expensive response, or an HTTP error — it manifests as a fluent, fast, cheap, technically-successful response that happens to be wrong. Conversely, a system could produce excellent, well-grounded, highly relevant answers while having unacceptable latency or runaway costs that only operational monitoring would surface. A production system needs both because operating a bad-but-broken system and operating a well-behaved-but-wrong system are both failure states a team needs to detect, and neither monitoring practice can substitute for the other — they check orthogonal properties of the same requests, and a mature operational practice tracks both side by side rather than treating operational health as a proxy for response quality or vice versa.
15. Reflecting on tutorials 22 through 26, explain what this tutorial specifically adds to the course's evaluation story that tutorial 22's golden-dataset infrastructure alone did not provide.
Tutorial 22 established the infrastructure of evaluation: what a golden dataset is, how to define metrics against it, and how to run it as regression testing so changes are validated systematically rather than by ad hoc manual checking. What tutorial 22 did not deeply cover is the harder, more specific question this tutorial addresses: what exactly should those metrics measure about response quality, and how do you actually judge something as subjective-seeming as 'is this a good answer' in a structured, repeatable way. This tutorial supplies that missing layer: relevance and groundedness as two genuinely independent dimensions that must be checked separately; consistency checking as a technique for revealing when a system's behavior is more variable than a task warrants; the discipline of using observed evaluation failures to drive targeted, one-at-a-time prompt refinement rather than undirected trial and error; rubrics and LLM-as-judge as the concrete mechanism that turns qualitative judgment into something scalable and comparable, with the important caveat about needing human spot-checks; and pairwise comparison as often the more reliable method for close calls between candidates. In short, tutorial 22 built the engine (the repeatable evaluation harness); this tutorial supplies the specific judgment techniques that engine runs — what to check, how to check it, and how to act on what the check reveals. Together they form a complete evaluation practice: the infrastructure to run evaluation repeatably and the substantive techniques for judging response quality that make that infrastructure actually meaningful rather than an empty harness with no real judgment inside it.

17 Flashcards

Click a card to reveal the back.

Response relevance
Does the answer address what was ACTUALLY asked, independent of factual correctness? A fluent, accurate answer to the wrong question still fails relevance.
Hallucination
Fluent, confident output that is factually wrong or unsupported. No surface cue distinguishes it from a correct answer — that's what makes it dangerous.
Groundedness check
Decompose an answer into claims; verify each is SUPPORTED, CONTRADICTED, or UNSUPPORTED by the source passages. Catches hallucination directly.
Relevance vs groundedness = independent
An answer can be relevant+hallucinated (on-topic, wrong fact) OR irrelevant+grounded (true, wrong topic). Check BOTH, separately.
Self-consistency / output variance
Run the same prompt N times, compare answers. High variance on FACTUAL questions = underspecified prompt. High variance on CREATIVE tasks = expected, not a defect.
Prompt refinement discipline
One targeted change at a time, then re-evaluate. Multiple simultaneous changes make cause-and-effect untraceable in the next evaluation pass.
Rubric
Specific, checkable criteria + scoring scale (e.g. 1-5) + concrete guidance per level. Vague 'rate for quality' rubrics produce inconsistent, low-value scores.
LLM-as-judge
A model applies the rubric/comparison at scale where human review of every output isn't practical. Enables frequent regression testing (tutorial 22).
LLM-as-judge limitation
The judge is a model call too — can share blind spots/biases with the system it judges. Needs periodic HUMAN spot-checks, especially for new rubrics.
Pairwise comparison
Present two outputs, ask which is better (A/B/TIE). More reliable than absolute scoring for CLOSE calls — easier to judge 'which is better' than 'is this a 4 or 5.'
Rubric scoring vs pairwise
Rubric: absolute score, comparable over time/across many outputs (feeds dashboards/trends). Pairwise: relative judgment, best for close head-to-head decisions.
TIE in pairwise comparison
Informative, not a non-result — means variants are genuinely equivalent OR comparison criteria aren't specific enough to distinguish them.
Comparison = offline A/B test
Pairwise comparison across a golden dataset is the offline analog of tutorial 23's canary/A-B rollout on live traffic — cheap first gate before real exposure.
Iterative evaluation loop
Generate → Evaluate (relevance/groundedness/consistency) → Identify ONE pattern → Refine → Re-evaluate/Compare → repeat.
Response quality ≠ operational health
A system can have great latency/cost/error-rate (tutorial 25) while confidently hallucinating — operational monitoring can't detect a fast, cheap, WRONG answer.

18 Interview Questions and Answers

1. How do you evaluate whether an AI system's response is actually good?
I break 'good' into distinct, checkable dimensions rather than forming one vague impression. Relevance: does the answer actually address what was asked, regardless of whether it's true? Groundedness: is every factual claim actually supported by the source context, catching hallucination? Consistency: does the system answer the same or equivalent question compatibly across repeated runs? These are genuinely independent — I've seen answers that are perfectly grounded but miss the point of the question, and answers that are clearly on-topic but confidently state something the sources never said. I evaluate each explicitly rather than assuming one implies the others, because they fail independently and need different fixes when they do.
2. Walk me through how you'd detect hallucinations in a RAG system's outputs.
I'd run a groundedness check: decompose the answer into its individual factual claims, and for each one, check it against the actual retrieved source passages — is it directly supported, does it contradict the sources, or is it simply not mentioned in them at all. I typically implement this as an LLM-as-judge call, since checking claim-by-claim against sources at scale isn't practical to do fully by hand across a real evaluation dataset. Anything landing in the contradicted or unsupported category is a hallucination candidate. I'd run this against my golden dataset as regression testing whenever the prompt, retrieval logic, or model changes, and I'd periodically spot-check the judge's verdicts with a human reviewer, because the judge is itself a model call that can share blind spots with the system it's evaluating.
3. What's the difference between checking relevance and checking groundedness, and why do you need both?
Relevance asks 'does this answer address what was actually asked,' completely independent of whether the content is true. Groundedness asks 'is everything stated actually supported by the source material,' independent of whether it's on-topic. They're genuinely independent failure modes — I can have an answer that's perfectly grounded, every claim traceable to a real source, but that addresses a slightly different question than what the user asked because retrieval pulled the wrong passage; and I can have an answer that's clearly and directly on-topic but fabricates a specific detail the sources never mentioned. If I only check one, I miss failures on the other axis entirely, and since the fixes are different — a relevance problem often points at retrieval or question understanding, a groundedness problem points at the generation prompt or grounding instruction — conflating them into one 'the answer wasn't great' judgment gives me no actionable direction.
4. How would you use a self-consistency check, and how would you interpret the results differently for different kinds of tasks?
I'd run the same prompt multiple times at a low, deterministic-leaning temperature and compare the outputs, either by direct comparison or with an LLM-as-judge assessing whether the answers are semantically compatible. For a factual question — 'what's our refund window' — I expect low variance; if I get meaningfully different answers across runs, that tells me something's wrong: the prompt might be underspecified, the source data might be genuinely ambiguous, or the temperature is too high for a task that needs determinism. But for a creative task — 'suggest three taglines' — I'd expect and want variance across runs; getting the same three taglines every time would actually be a sign something's constraining the model too tightly. So the technique is identical, but I interpret the result completely differently depending on whether the task calls for stability or diversity, and I'd never apply a blanket 'low variance is always good' standard.
5. Describe your approach to refining a prompt based on evaluation results.
I look for a specific, recurring pattern across multiple evaluated outputs, not a one-off oddity in a single example. Once I've identified something concrete — say, unsupported claims showing up specifically on questions where retrieval returns weak or few relevant passages — I make exactly one targeted change addressing that pattern, like strengthening the explicit grounding instruction or adding a 'say you don't know if the sources are insufficient' rule. Then I re-run the same evaluation and, critically, compare old versus new — often with a pairwise comparison across my golden dataset — before making any further change. I'm strict about changing one thing at a time, because if I change the grounding instruction, the temperature, and the phrasing all at once, and the next evaluation shows improvement, I have no way to know which change actually caused it, or whether one improvement masked a regression somewhere else.
6. What is a rubric, and how do you design a good one?
A rubric is a defined set of specific, checkable criteria with a scoring scale and concrete guidance for what each score level actually means — the thing that turns 'is this good' from an unstructured, evaluator-dependent impression into something consistent and comparable. A good rubric avoids vague criteria like 'rate 1-5 for quality,' because 'quality' means something different to every evaluator and produces scores that aren't meaningfully comparable across reviews. Instead I write specific criteria: relevance (does it address the actual question), groundedness (is every claim supported by sources), completeness (does it cover everything asked) — each with concrete anchors for what a 1 versus a 5 looks like. The specificity is what makes two different evaluators, or an LLM-judge applying it consistently, converge on similar scores for the same output.
7. How do you know if you can trust an LLM-as-judge's evaluation of your system's outputs?
I treat it as a scalable, valuable heuristic, not ground truth, and I validate it periodically rather than assuming it's correct because the model is capable. The specific risk I watch for is correlated error — if the judge model shares training data, architecture lineage, or common knowledge gaps with the system it's evaluating, both can share the same misconception about a fact, and the judge would confidently validate a hallucination that happens to align with a blind spot they both share. That's not really about how generally capable the judge is; it's about correlation between judge and judged. So I run periodic human spot-checks on a sample of judge verdicts, especially when I've just built or changed a rubric, comparing the judge's scores against what a human reviewer would actually conclude, and I treat systematic disagreement as a signal to refine the rubric or reconsider the judge setup rather than trusting the judge blindly going forward.
8. When would you use pairwise comparison instead of rubric-based scoring?
I use rubric scoring when I need an absolute number I can track over time or compare across many different outputs or model versions — something that feeds a trend line or a dashboard threshold, where I need scores to be comparable not just between two specific things but across a whole evaluation history. I reach for pairwise comparison specifically when I'm deciding between two close candidates right now — is this new prompt actually better than the current one, is model A better than model B for this specific task — because judging 'is this a 4 or a 5' in isolation is a harder, less consistent calibration problem than directly comparing two outputs side by side and picking the better one. In practice I use both: rubric scores as an ongoing tracked metric, and pairwise comparison specifically at decision points where I'm validating a proposed change before shipping it.
9. A team reports their RAG assistant passes every automated groundedness check but users still complain it's not helpful. What's your diagnosis?
My first hypothesis is that they're only checking groundedness and missing relevance and completeness entirely, since those are independent dimensions a pure groundedness check can't catch. It's entirely possible for an answer to be perfectly grounded — every stated fact genuinely comes from a real source — while addressing a narrower slice of the question than what the user actually needed, or answering a slightly adjacent question because retrieval surfaced the wrong passage. 'Every claim is true' and 'this actually helped the user' are different bars, and a system optimized to pass only the first one can systematically fail the second while looking clean on the metric being tracked. I'd add explicit relevance and completeness checks — probably via a rubric — run against the same golden dataset and against real production question logs, specifically looking for the pattern of technically-correct-but-off-target or partial answers that a pure groundedness check would never flag.
10. How do you validate that a prompt refinement actually improved things before shipping it?
I don't rely on a handful of manual spot-checks — I run the refined prompt across the full golden dataset and do a pairwise comparison against the old prompt's outputs, question by question, computing an aggregate win rate. That gives me evidence across a representative set of cases rather than an impression from the two or three examples I happened to look at by hand, which can easily be unrepresentative in either direction. I also re-run the same relevance, groundedness, and consistency checks I used to identify the original problem, confirming the targeted dimension actually improved and, just as importantly, that nothing else regressed as a side effect of the change. Only with that combination — a quantified win rate plus confirmation of no regression on the other dimensions — do I consider the refinement validated enough to move toward a canary rollout on real traffic.
11. Why isn't offline evaluation on a golden dataset sufficient on its own before shipping a prompt change?
Because a golden dataset, no matter how carefully built, is necessarily finite and can't represent every real-world question, phrasing, or edge case a live user population will actually send. A prompt change can win convincingly on my curated 20-30 golden questions and still behave unexpectedly on something a real user asks that the dataset simply doesn't cover — an unusual phrasing, an edge case nobody thought to include, a combination of context the dataset didn't anticipate. That's exactly why offline comparison is the first gate, not the only gate — it's fast, cheap, and catches obvious regressions before any real user sees them, but it needs to be followed by a canary rollout on a small percentage of live traffic, which is what actually tests the change against the full messy diversity of real usage, with the blast radius limited if something the offline evaluation missed does surface.
12. How do response-quality evaluation and operational monitoring (cost, latency, errors) complement each other?
They check completely orthogonal things about the same requests. Operational monitoring tells me if a request completed quickly, cheaply, and without an error — but says nothing about whether the actual content of the answer was any good. Response-quality evaluation tells me if the content was relevant, grounded, and consistent — but says nothing about speed or cost. A system can look perfectly healthy on every operational dashboard tile while confidently hallucinating on a meaningful fraction of real questions, because hallucination doesn't show up as latency, cost, or an HTTP error — it shows up as a fast, cheap, technically-successful response that happens to be wrong. I track both side by side for exactly this reason; treating good operational metrics as a proxy for good response quality is a mistake I've seen bite teams that only had dashboards from the deployment side and no equivalent quality-tracking practice.
13. How would you scale your evaluation practice for a low-stakes internal tool versus a customer-facing assistant?
I match evaluation depth and frequency to actual stakes and change frequency rather than applying one standard everywhere. For a low-stakes internal tool where a wrong answer has minimal consequence, I'd keep it lightweight — occasional spot-checks, a simple rubric, evaluation run when something changes rather than continuously. For a customer-facing assistant, especially one making claims that affect real decisions (refund eligibility, account status), I'd run full groundedness and relevance checks on every release against a well-maintained golden dataset, with tighter rubric criteria and more frequent human spot-checks of the judge's verdicts. I'd also let the evaluation history itself inform this: a dimension that's consistently scored well across many cycles can reasonably move to periodic sampling, freeing effort toward whatever dimension or feature keeps surfacing real issues — the goal is matching evaluation cost to actual risk, not defaulting to either extreme of doing nothing or over-evaluating everything uniformly.
14. What would you tell a team that wants to skip formal evaluation and just 'eyeball a few examples' before shipping prompt changes?
I'd point out that eyeballing a few examples is exactly how subtle regressions slip through — a handful of manually chosen examples, even reviewed carefully, can't represent the full range of questions a real system will face, and there's a real risk of unconsciously picking examples that happen to look good rather than genuinely representative ones. I'd also point out that without a repeatable evaluation, there's no way to know if a change actually improved things versus just feeling better because you looked at different examples than last time. My counter-proposal isn't a heavyweight process — it's running the change against an existing golden dataset with a pairwise comparison against the current version, which for a modest dataset takes a script and a few minutes of LLM-judge calls, giving an actual win-rate number instead of an anecdotal impression. That's a small time investment relative to the risk of shipping a regression that a handful of manual checks happened not to catch.
15. How does this tutorial's focus on response quality relate to the golden-dataset evaluation infrastructure taught earlier in the course?
The golden-dataset infrastructure is the engine — a repeatable harness for running the same test cases against a system and comparing results over time, which is essential but content-neutral: it doesn't by itself tell you what to actually check about the outputs. This tutorial supplies that missing substance: specifically what to evaluate (relevance, groundedness, consistency) and how to evaluate it in a structured way (rubrics, LLM-as-judge, pairwise comparison), plus the discipline of using what you find to drive targeted refinement rather than undirected trial and error. Without this layer, a golden-dataset harness could run consistently and produce numbers that don't actually capture what makes an answer good — the earlier infrastructure would be technically functioning while evaluating the wrong things, or evaluating them too vaguely to be actionable. Together, the harness plus these specific judgment techniques form a complete practice: repeatable infrastructure running substantive, well-designed checks, which is what actually lets a team say 'this system's responses are good' with evidence rather than hope.

19 Glossary

Response relevance
How directly and completely a model's answer addresses what the user actually asked, independent of whether the content is factually correct.
Hallucination
Fluent, confident model output that is factually wrong or unsupported by the given context — the central quality failure RAG grounding targets.
Hallucination detection
Techniques for identifying when a model's claims are not supported by its source context or by verifiable facts.
Groundedness check
A specific test of whether every claim in an answer can be traced back to the source passages the model was given.
Consistency check
Testing whether a model gives the same, or compatibly equivalent, answer to the same or logically equivalent questions across repeated runs.
Self-consistency
Running the same prompt multiple times and comparing outputs to gauge how stable or variable the model's answer is.
Prompt refinement
Iteratively adjusting a prompt based on observed output quality, rather than writing it once and assuming it's correct.
Qualitative evaluation
Judging output quality through human or model-assisted judgment against criteria, rather than only automated numeric metrics.
Rubric
A structured set of criteria and scoring guidance used to evaluate outputs consistently, whether by a human or a model-as-judge.
LLM-as-judge
Using a language model itself to evaluate the quality of another model's, or its own, output against defined criteria.
Pairwise comparison
An evaluation method that presents two candidate outputs and asks which is better, rather than scoring each in isolation.
A/B test
Comparing two prompt or model variants by exposing each to a portion of traffic and measuring the difference in outcomes.
Citation accuracy
Whether an answer's citations actually point to and are supported by the sources they claim to reference.
Faithfulness
How accurately a response reflects the source material it is supposed to be grounded in, without adding unsupported claims.
Completeness
Whether a response covers everything the question or task actually required, not just part of it.
Evaluation criteria
The specific dimensions — relevance, groundedness, completeness, tone — an evaluation judges an output against.
Iterative evaluation loop
The repeating cycle of generating output, evaluating it, refining the prompt, and re-evaluating.
Output variance
The degree to which a model's responses differ across repeated or similar requests, relevant to consistency checks.

πŸ—’ My Notes