AI Evals & LLM-as-Judge interview questions
Evaluation datasets, automated metrics, LLM-as-a-judge patterns, human review, and continuous testing in production. Click a question to reveal a focused answer, then use the examples to shape your own response.
A demo that looks good is not a quality process. These lessons cover building real eval sets, choosing the right kind of metric for a task, using an LLM as a judge without being misled by it, and wiring evals into how you actually ship changes.
judge_prompt = f"""Evaluate the candidate answer on factual grounding.
Criteria: Score 1 (fabricated) to 5 (fully grounded in reference).
Reference: {context}
Candidate: {answer}
Provide step-by-step reasoning followed by [[score]]:"""01What is an evaluation (eval) in generative AI engineering, and why is it necessary?
An eval is an automated or systematic process for measuring the quality, accuracy, safety, and consistency of an AI system across a standardized test dataset. Unlike traditional deterministic software where unit tests check exact boolean outputs, LLMs produce non-deterministic, open-ended responses. Without evals, teams rely on subjective "vibe checks," making it impossible to know whether a prompt change, model upgrade, or retrieval tweak improved the system or caused silent regressions.
Frame evals as the software testing equivalent for stochastic systems: without deterministic benchmarks and qualitative scorecards, you cannot ship prompt or model updates safely.
02How do offline evals differ from online evals in production systems?
Offline evals are run pre-deployment against a curated, versioned benchmark dataset to validate model performance, safety, and formatting before merging code or promoting a prompt. Online evals measure live production traffic in real time, tracking signals such as implicit user feedback (clicks, copy actions, completions), explicit ratings (thumbs up/down), latency, token costs, hallucination rates on sampled transcripts, and human escalation rates.
Distinguish offline regression testing on curated gold datasets from online monitoring of production user telemetry, thumbs up/down, and latency.
03What are deterministic evals, and when should you prefer them over LLM judges?
Deterministic evals use rule-based code assertions without invoking an AI model. Examples include validating JSON schema compliance, regex checks for expected entity formats, string inclusion of mandatory keywords, Python unit test execution, and forbidden word allow/deny lists. You should always prefer deterministic evals when evaluating format, syntax, schema shape, or verifiable facts because they run in milliseconds, cost zero tokens, and produce 100% reproducible results.
Prefer deterministic checks (regex, schema validation, exact string matching, Python assertions) for facts, syntax, and schema shapes before spending tokens on an LLM judge.
04What is the LLM-as-a-judge pattern, and how does it work?
LLM-as-a-judge is an evaluation methodology where a highly capable language model (typically a frontier model like Claude 3.5 Sonnet or GPT-4o) assesses the outputs of other models based on a structured rubric. The judge prompt receives the original user input, any reference ground-truth or retrieved context, and the candidate model’s response. It is instructed to output step-by-step reasoning followed by a quantitative score or categorical rating.
Explain the LLM-as-a-judge pattern clearly: using a capable frontier model with a strict scoring rubric and explicit criteria to evaluate complex, open-ended outputs.
05What are the primary biases of LLM judges, and how do you mitigate them?
Common biases include: 1) Verbosity bias (preferring longer, authoritative-sounding answers even if redundant); 2) Position bias (in pairwise comparisons, favoring the first or second option regardless of quality); 3) Self-enhancement bias (favoring answers generated by the same model family); and 4) Egocentric bias (penalizing stylistic variations). Mitigations include swapping order in pairwise tests, standardizing answer lengths, using strict granular rubrics, masking model identities, and calibrating scores against human annotations.
Acknowledge position bias, verbosity bias, and self-enhancement bias in LLM judges, and explain how to mitigate them via prompt calibration, anonymization, and position swapping.
06How do you design an effective scoring rubric for an LLM judge?
An effective rubric defines explicit, observable criteria for every score anchor rather than vague subjective labels like "good" or "bad." For example, on a 1-5 scale: 1 means factually false or harmful; 3 means factually accurate but missing essential nuance or containing minor hallucinations; 5 means completely accurate, fully grounded in the provided context, and following all stylistic constraints. The rubric must also require the judge to quote exact evidence from both the context and the candidate answer.
Show how to construct an unambiguous rubric with distinct numerical anchors (e.g., 1=hallucinated, 3=partially grounded, 5=fully verified) and step-by-step reasoning requirements.
07What is the difference between single-answer grading and pairwise comparison?
Single-answer grading presents one candidate response to the judge and asks for a direct score (e.g., 1 to 5) against a rubric. Pairwise comparison presents two candidate answers (Model A vs. Model B) to the judge and asks which is better or if they tie. Pairwise comparison typically correlates much higher with human preferences because relative judgment is cognitively easier for models than absolute calibration. However, pairwise requires evaluating both orders (A/B and B/A) to cancel position bias, doubling token cost.
Compare single-answer grading with pairwise head-to-head comparison, noting that pairwise comparison with randomized order often yields higher human correlation.
08How do you curate a high-quality "golden" evaluation dataset?
A golden dataset should be representative of real-world production traffic rather than synthetic happy-path questions. Best practices include: sampling real user queries across different intent categories, sanitizing PII, hand-crafting challenging adversarial edge cases, including ambiguous inputs, and establishing expert human consensus on the reference answers. Golden sets should be version-controlled, immutable per release, and maintained like critical test fixtures.
Explain how to curate a golden test dataset: sampling representative user queries, annotating edge cases, redacting PII, and establishing human ground-truth consensus.
09What is benchmark data contamination, and how do you protect against it?
Contamination occurs when evaluation examples accidentally leak into the pre-training data, fine-tuning corpora, or few-shot prompt examples of the model being evaluated. When this happens, high benchmark scores reflect rote memorization rather than generalized problem-solving ability. Protection strategies include generating dynamic synthetic test sets with recent timestamps, keeping eval repositories private and unindexed, and running n-gram overlap checks between training and eval sets.
Warn about benchmark data contamination, explaining why evaluation examples must never be included in fine-tuning sets or prompt templates.
10How do you measure hallucination and groundedness in a RAG pipeline?
Groundedness measures whether every factual claim in the generated answer can be mathematically or logically traced back to the retrieved context chunks. It is evaluated by decomposing the answer into individual atomic claims, passing each claim alongside the retrieved context to an eval check (or specialized model), and determining whether the claim is entailed, contradicted, or unsupported. Unentailed claims are flagged as hallucinations.
Define groundedness and faithfulness metrics in RAG: verifying that every asserted fact in the output is directly supported by retrieved reference contexts.
11What is G-Eval, and why is it significant?
G-Eval is a framework that uses chain-of-thought (CoT) prompting and form-filling to evaluate generation tasks with LLMs. Instead of directly asking for a score, G-Eval instructs the model to generate a set of step-by-step evaluation steps based on the task description, evaluate the input against each step, and output token probabilities or structured ratings. This structured intermediate reasoning substantially increases correlation with human expert judgment across summarization and dialogue tasks.
Discuss G-Eval and chain-of-thought evaluation: having the judge model generate explicit reasoning steps before outputting a numerical score improves correlation with human judgments.
12How do you calibrate an automated LLM judge against human expert annotators?
Calibration involves running both the automated judge and multiple expert human reviewers on a representative sample of 100-500 outputs. You calculate inter-annotator agreement metrics such as Cohen’s Kappa (for categorical labels) or Spearman’s rank correlation (for numerical rankings). If agreement is low (<0.7), analyze the disagreements to identify rubric ambiguities, refine prompt instructions, or add few-shot calibrated examples illustrating edge-case scoring.
Calculate Cohen’s Kappa or Spearman correlation to measure agreement between automated LLM judges and expert human reviewers before trusting automated scores.
13How do you evaluate structured outputs like JSON or code generated by an LLM?
Evaluation should follow a layered pyramid: First, syntactic validity—does the output parse as valid JSON or compile without syntax errors? Second, schema conformity—do all required keys exist with correct data types and value constraints (using Pydantic, Zod, or JSON Schema)? Third, programmatic execution—for code, do unit tests and integration tests pass in a sandboxed runner? Fourth, semantic quality—does the structured data accurately capture user intent?
Validate JSON outputs using schema validators (such as Pydantic or Zod) to check key presence, types, and value constraints before scoring semantic quality.
14What are unit evals versus trajectory evals for multi-step AI agents?
Unit evals test individual agent components in isolation: evaluating whether the tool-selection logic chose the correct tool given a prompt, whether argument extraction matches schema, or whether single-turn memory retrieval was accurate. Trajectory evals assess the entire multi-step run: did the agent reach the final goal, how many intermediate steps did it take, did it recover from tool errors, and were any unsafe actions attempted during the execution path?
Distinguish component-level unit evals (evaluating retrieval recall or tool argument generation) from full end-to-end multi-step trajectory evaluation.
15Why is statistical significance important when interpreting eval score changes?
Because LLMs exhibit variance across non-zero temperatures and small sample sizes, a 2% score increase across 30 test cases is likely random noise rather than a genuine capability improvement. Engineering teams must calculate standard error, use bootstrap resampling, and measure statistical significance (p-values or confidence intervals). Critical decisions should rely on sufficiently large eval sets (often 200+ samples) or multiple evaluation passes.
Emphasize statistical significance: small sample sizes (e.g., 20 examples) cannot prove a 2% model improvement; use bootstrap confidence intervals and adequate sample sizes.
16How do you wire automated evals into a CI/CD development pipeline?
Evals should run as automated GitHub Actions or CI steps whenever prompt templates, model configurations, or retrieval pipelines are modified. A small, fast "smoke test" suite (20-50 critical must-pass cases) runs on every pull request, blocking merges that introduce regressions. A comprehensive, larger benchmark suite (hundreds of cases) runs nightly or before production deployment releases.
Describe how to run automated eval suites in CI/CD pull requests, preventing prompt or code merges that cause score regressions on must-pass suites.
17What metrics should you track when evaluating open-ended conversational assistants?
You should track orthogonal evaluation dimensions: 1) Relevance (did it directly answer the user prompt?); 2) Groundedness/Faithfulness (are claims verified against knowledge?); 3) Conciseness (is it appropriately brief without fluff?); 4) Tone and Brand Alignment (is it empathetic, professional, and non-defensive?); 5) Safety/Toxicity (did it avoid harmful content or prompt injection vulnerabilities?); and 6) Latency/Token cost.
Measure open-ended conversational quality across multiple orthogonal dimensions: relevance, conciseness, tone, helpfulness, and safety.
18What are the limitations of classical metrics like BLEU and ROUGE for LLM evaluation?
BLEU and ROUGE rely on exact n-gram overlap between a candidate text and reference text. They penalize valid synonyms, paraphrasing, restructuring, and creative explanations. A candidate response might be completely accurate and well-written yet receive a near-zero BLEU score simply because it used different vocabulary than the reference answer. Conversely, a response with high n-gram overlap can invert the entire meaning with a single missing negation word ("not").
Clarify that n-gram metrics like BLEU and ROUGE fail on creative or semantic paraphrasing and should be reserved for strict extraction or translation tasks.
19How do you manage the financial cost and latency of running large automated eval suites?
Cost optimization strategies include: 1) Tiered execution: run fast, free deterministic checks first, weeding out failures before calling models; 2) Model cascading: use smaller, cheaper models (e.g., Flash or Haiku) for straightforward formatting and extraction checks, reserving expensive frontier models for subtle qualitative scoring; 3) Prompt caching: cache static rubric definitions and few-shot examples; and 4) Subset sampling during development, running full suites only on release candidates.
Reduce eval cost and latency by cascading judges: running fast heuristic checks first, small judge models for straightforward checks, and frontier models only for borderline cases.
20What is the "eval flywheel," and how does it improve AI products over time?
The eval flywheel is a continuous feedback loop: production interactions (user downvotes, bug reports, escalations, guardrail triggers) are automatically captured, scrubbed of PII, categorized, and converted into new test cases in the golden eval dataset. As the product encounters new real-world failure modes, the eval suite permanently grows to prevent regressions, creating a compound moat for system quality and reliability.
Describe the eval flywheel: automatically mining real production edge cases, production failures, and user corrections to continuously expand the test suite.
Sources and further reading
These primary or specialist references informed the concepts in this guide. Product details can change, so verify current documentation before implementation.