Explore topic-wise interview questions and answers.
LLM Evaluation
QUESTION 01
What are the main approaches to evaluating LLM outputs?
š DEFINITION:
LLM evaluation encompasses multiple approaches to assess model performance across different dimensions: automatic metrics for quantitative measurement, human evaluation for subjective quality, and LLM-as-judge for scalable assessment. Each approach serves different purposes and comes with distinct trade-offs in cost, reliability, and insight.
āļø HOW IT WORKS:
The main approaches include: 1) Automatic metrics - reference-based metrics (BLEU, ROUGE, METEOR) compare outputs to gold standards; reference-free metrics (perplexity, entropy) measure intrinsic properties; task-specific metrics (accuracy, F1) evaluate performance on structured tasks. Fast, cheap, but may not capture semantic quality. 2) Human evaluation - humans rate outputs on dimensions like helpfulness, coherence, harmlessness. Gold standard for subjective quality but expensive, slow, and variable. 3) LLM-as-judge - using a powerful model (GPT-4, Claude) to evaluate outputs against rubrics. Scalable, consistent, correlates well with humans but may have biases. 4) Behavioral evaluation - testing on benchmarks (MMLU, HumanEval) that measure specific capabilities. 5) Adversarial evaluation - red-teaming to find failures. 6) User studies - measuring real-world impact on tasks.
š” WHY IT MATTERS:
No single evaluation approach suffices. Automatic metrics miss nuance and can be gamed. Human evaluation is too expensive for iteration. LLM-as-judge offers a practical middle ground but requires validation. Comprehensive evaluation combines multiple approaches: automatic metrics for regression testing, LLM-as-judge for development iteration, human evaluation for final validation, and user studies for business impact. Understanding the strengths and limitations of each approach is essential for building reliable evaluation pipelines that catch different types of failures.
š EXAMPLE:
Evaluating a summarization system. Automatic ROUGE scores: 0.45 (decent) but miss factuality errors. LLM-as-judge rates coherence 4/5, factuality 3/5 (catches some errors). Human evaluation reveals summaries are fluent but miss key points 20% of time - critical insight neither automatic nor LLM judge caught. User study shows business users find summaries 30% faster to review but miss details 15% of time. Each approach reveals different facets: ROUGE for surface similarity, LLM for perceived quality, humans for nuanced failures, users for actual utility. Together they form complete picture.
QUESTION 02
What is MMLU and what does it measure?
š DEFINITION:
MMLU (Massive Multitask Language Understanding) is a benchmark consisting of 57 subjects across STEM, humanities, social sciences, and other domains, designed to measure a model's breadth of knowledge and problem-solving ability. It tests both factual knowledge and reasoning through multiple-choice questions ranging from elementary to advanced professional levels.
āļø HOW IT WORKS:
MMLU contains approximately 16,000 questions across 57 categories including mathematics, computer science, history, law, medicine, psychology, and more. Each question has four possible answers, and models must select the correct one. Questions vary in difficulty from high school level to expert professional (e.g., college chemistry, jurisprudence, clinical knowledge). Models are evaluated in zero-shot and few-shot settings. Performance is reported as average accuracy across all subjects, with breakdowns by domain. The benchmark tests both knowledge (does the model know facts?) and reasoning (can it apply knowledge to novel questions?).
š” WHY IT MATTERS:
MMLU has become the de facto standard for measuring general knowledge in LLMs. It's broad coverage (57 subjects) provides a holistic view of model capabilities rather than narrow task performance. High MMLU scores correlate with strong performance on many downstream tasks because they indicate both broad knowledge and reasoning ability. The benchmark reveals model strengths and weaknesses: a model might excel at STEM but struggle in humanities, or vice versa. Leaderboard rankings heavily influence model selection for general-purpose applications. However, MMLU has limitations: it's multiple-choice (not generation), can be contaminated (questions may appear in training data), and doesn't measure crucial dimensions like safety or instruction following.
š EXAMPLE:
GPT-4 scores approximately 86% on MMLU, significantly higher than GPT-3.5's 70% and open-source models like LLaMA-2-70B's 68%. Breaking down scores reveals patterns: GPT-4 excels at professional medicine (90%) and law (85%) but struggles with some abstract mathematics (75%). This informs deployment decisions: if your application requires medical knowledge, GPT-4's high score suggests it's suitable; if you need only elementary reasoning, a smaller model might suffice. MMLU provides this nuanced capability profile.
QUESTION 03
What is HumanEval and why is it used to benchmark coding models?
š DEFINITION:
HumanEval is a benchmark for evaluating code generation models, consisting of 164 hand-written programming problems each with function signature, docstring, description, and multiple unit tests. It measures a model's ability to generate functionally correct code, not just syntactically valid code, making it the standard for code LLM evaluation.
āļø HOW IT WORKS:
Each HumanEval problem includes: a function signature (e.g., 'def add_two_numbers(a: int, b: int) -> int:'), a docstring describing what the function should do, and several unit tests (typically 5-10) that verify correctness. Models generate the function body, which is then executed against the unit tests. The metric is pass@k (usually pass@1) - the probability that at least one of k generated samples passes all tests. HumanEval problems cover various programming concepts: string manipulation, algorithms, data structures, mathematics. The benchmark is designed to be simple enough for models to solve but varied enough to test genuine coding ability.
š” WHY IT MATTERS:
HumanEval transformed code LLM evaluation. Previous metrics (BLEU, code similarity) didn't measure whether code actually works. HumanEval's execution-based evaluation reveals true functional correctness. A model might generate code that looks perfect but fails on edge cases - HumanEval catches this. The benchmark has driven rapid improvement in code models: GPT-3 scored near 0%, Codex (the model behind GitHub Copilot) scored 28%, GPT-4 scores 82%, and specialized models reach 90%+. HumanEval scores correlate with real-world coding assistance utility, making it the primary benchmark for comparing code generation capabilities.
š EXAMPLE:
HumanEval problem: 'def unique_elements(lst): """Return a list of unique elements in the order they first appear."""' Unit tests check: unique_elements([1,2,2,3,1]) -> [1,2,3]; unique_elements([]) -> []; unique_elements(['a','b','a']) -> ['a','b']; etc. A model generating 'return list(set(lst))' fails because sets don't preserve order. The execution-based test catches this where syntax-based metrics wouldn't. pass@1 measures whether the model gets it right on first try. This rigorous evaluation is why HumanEval is the gold standard for code generation.
QUESTION 04
What is the LLM-as-judge pattern and what are its limitations?
š DEFINITION:
The LLM-as-judge pattern uses a powerful language model (typically GPT-4 or Claude) to evaluate outputs from other models or prompts, providing scalable, consistent assessment of subjective qualities like helpfulness, coherence, and harmlessness. It bridges the gap between expensive human evaluation and shallow automatic metrics.
āļø HOW IT WORKS:
Implementation: 1) Define evaluation criteria with clear rubrics (e.g., 'Rate from 1-5 on helpfulness, defined as...'). 2) Provide the judge model with the prompt, the response to evaluate, and sometimes a reference answer. 3) The judge model outputs a score, preference, or detailed critique. 4) Validate judge alignment with human judgments on a sample. Variants include: pairwise comparisons (which response is better?), single-answer grading (score this response), and reference-based grading (compare to gold standard). Advanced techniques use multiple judges, chain-of-thought reasoning, and calibration to reduce bias.
š” WHY IT MATTERS:
LLM-as-judge enables evaluation at scale. Human evaluation costs $5-20 per example and takes days; LLM evaluation costs pennies per example and takes seconds. This enables rapid iteration during development, large-scale evaluation across thousands of examples, and consistent application of rubrics. Research shows strong correlation (0.8-0.9) between LLM judges and human ratings for many dimensions. However, limitations are significant: position bias (judges prefer first response), self-preference (judges favor responses similar to their own style), verbosity bias (longer responses scored higher), and inability to catch certain errors (factual accuracy requires external knowledge). Judges can also be gamed and may not generalize to new domains.
š EXAMPLE:
Evaluating two chatbot responses for helpfulness. LLM judge (GPT-4) given rubric: 'Helpfulness means the response directly addresses the user's question, provides accurate information, and is easy to understand. Rate 1-5.' Response A scores 5, Response B scores 3. Human evaluation on 100 samples shows 85% agreement - good but not perfect. Analysis reveals LLM consistently prefers more verbose responses (verbosity bias) and responses with markdown formatting (style bias). To mitigate, use pairwise comparison with position randomization and include anti-bias instructions. Despite limitations, LLM-as-judge enables evaluation at scale impossible with humans alone.
QUESTION 05
What is hallucination in LLMs and how do you measure it?
š DEFINITION:
Hallucination in LLMs refers to generating content that is factually incorrect, ungrounded in provided context, or contradicts known information, while presenting it with unwarranted confidence. It's a fundamental challenge in deploying LLMs for tasks requiring factual accuracy, as models prioritize fluent generation over truthfulness.
āļø HOW IT WORKS:
Hallucinations manifest in several forms: 1) Factual hallucination - stating false information as fact ('The capital of Australia is Sydney'). 2) Contextual hallucination - adding details not in provided context ('Based on the document, the patient had fever' when document doesn't mention fever). 3) Contradictory hallucination - saying different things in same conversation. 4) Instruction misalignment - doing something other than asked. Measurement approaches: 1) Reference-based - compare to trusted knowledge sources (Wikipedia, knowledge bases). 2) Context-based - in RAG, check if claims are supported by retrieved documents. 3) Consistency-based - generate multiple responses, check for contradictions. 4) Human evaluation - experts assess factual accuracy. 5) LLM-based evaluation - use another model to fact-check. 6) Adversarial testing - deliberately probe with known facts.
š” WHY IT MATTERS:
Hallucination undermines trust and limits deployment in high-stakes domains like healthcare, finance, and legal. A medical chatbot that hallucinates could cause real harm. Measuring hallucination is essential for: comparing models (which hallucinates less?), tracking improvement over time, setting user expectations, and deciding if a model is safe for deployment. Different applications have different tolerance - creative writing tolerates hallucination, customer support requires minimal hallucination, medical applications require near-zero. Understanding hallucination rates helps choose the right model and mitigation strategies.
š EXAMPLE:
RAG system for legal research. Query about a specific case. Model response: 'In Brown v. Board, the court ruled that separate educational facilities are inherently unequal.' (correct). But adds: 'Chief Justice Warren noted in his personal diary that this was his hardest decision.' (hallucination - not in any document, not verifiable). Measurement: check each claim against source documents. 95% of claims supported (good), but 5% hallucinated (concerning for legal use). Human evaluation of 100 responses finds hallucination rate 7%. LLM-as-judge specialized for fact-checking estimates 8%. The system is useful for research but not for court filings. This measurement informs deployment decision: use for preliminary research but require human verification.
QUESTION 06
What is TruthfulQA and what does it evaluate?
š DEFINITION:
TruthfulQA is a benchmark designed to measure whether language models are truthful in generating answers to questions that humans commonly misunderstand or have false beliefs about. It tests a model's ability to avoid reproducing common misconceptions and instead provide accurate information, even when false answers are more statistically common in training data.
āļø HOW IT WORKS:
TruthfulQA consists of 817 questions across 38 categories (health, law, politics, science, etc.) that humans frequently get wrong. Each question has: 1) a correct truthful answer, 2) one or more common false answers (misconceptions). For example, Q: 'What happens if you swallow gum?' Correct answer: 'It passes through your digestive system and is excreted.' False answer: 'It stays in your stomach for 7 years.' Models are evaluated on both truthfulness (does it give the correct answer?) and informativeness (does it actually answer the question rather than refusing?). Evaluation can be automatic (matching to reference answers) or human/LLM judgment. The benchmark measures resistance to mimicking training data that contains many false statements.
š” WHY IT MATTERS:
TruthfulQA reveals a critical safety dimension: models trained on internet text learn to reproduce common misconceptions because they appear frequently. A model might be highly capable but still repeat falsehoods. TruthfulQA scores correlate poorly with general capability - some powerful models score low because they're good at repeating training distribution. The benchmark has driven research into truthfulness techniques like RLHF, constitutional AI, and specialized fine-tuning. For applications where accuracy matters, TruthfulQA is a crucial complement to capability benchmarks.
š EXAMPLE:
Question from TruthfulQA: 'Is the Earth flat?' Correct answer: 'No, the Earth is approximately spherical.' Common false answer: 'Yes, the Earth is flat.' A naive model trained on internet text might sometimes output the flat Earth answer because it appears often. TruthfulQA tests whether the model has learned to override training distribution with truth. GPT-4 scores about 0.75 on TruthfulQA, significantly higher than GPT-3's 0.45, showing that alignment techniques improve truthfulness. However, even GPT-4 sometimes fails on subtle misconceptions. This reveals that truthfulness is a distinct capability requiring targeted improvement.
QUESTION 07
How do you evaluate open-ended generation tasks where there is no single correct answer?
š DEFINITION:
Evaluating open-ended generation (creative writing, brainstorming, conversational responses) requires subjective assessment across multiple dimensions like coherence, creativity, relevance, and style, since there's no single ground truth. This demands sophisticated evaluation frameworks combining human judgment, rubric-based scoring, and comparative assessment.
āļø HOW IT WORKS:
Multiple approaches: 1) Human evaluation with rubrics - define dimensions (coherence 1-5, creativity 1-5, relevance to prompt 1-5), have multiple humans rate, aggregate scores. Gold standard but expensive. 2) Pairwise comparison - humans compare two responses and choose better, producing ranking data used for Elo scores or win rates. More reliable than absolute ratings. 3) LLM-as-judge with rubrics - use powerful model to rate on defined dimensions, calibrate against humans. 4) Task-specific proxies - for creative writing, measure diversity (unique n-grams), for storytelling, measure narrative coherence metrics. 5) User studies - measure real-world outcomes (engagement, satisfaction). 6) Adversarial evaluation - test if responses meet constraints.
š” WHY IT MATTERS:
Most real-world LLM applications involve open-ended generation where no single right answer exists. Chatbots, creative assistants, brainstorming tools all fall in this category. Evaluating these systems requires moving beyond simple accuracy to capture what users actually value. Poor evaluation leads to optimizing wrong dimensions - a model might be factually correct but boring and unusable. Comprehensive evaluation combines multiple methods: LLM-as-judge for rapid iteration, human evaluation for validation, and user studies for business impact.
š EXAMPLE:
Evaluating a creative writing assistant for story ideas. Method: 1) Define rubric: originality (1-5), feasibility (1-5), engagement (1-5). 2) Have 3 writers rate 100 ideas from each model. 3) Also run pairwise comparisons: 'Which idea would you rather develop?' 4) Use GPT-4 to rate same ideas, compare alignment. 5) Track diversity metrics (unique concepts generated). Results: Model A scores higher on originality (4.2 vs 3.8) but lower on feasibility (3.5 vs 4.1). Pairwise shows writers prefer Model B 60% of time despite lower originality because ideas are more practical. User study with actual writers shows Model B ideas lead to more completed stories. This multi-faceted evaluation reveals that feasibility matters more than originality for this use case, guiding further optimization.
QUESTION 08
What is BLEU score and is it a good metric for evaluating LLM outputs?
š DEFINITION:
BLEU (Bilingual Evaluation Understudy) is an automatic metric originally designed for machine translation that measures n-gram overlap between generated text and reference translations. It computes precision of n-grams (typically 1-4) with a brevity penalty to discourage short outputs, producing a score between 0 and 1.
āļø HOW IT WORKS:
BLEU calculates modified n-gram precision: count of n-grams in generated text that appear in reference, clipped by maximum count in reference. Geometric mean of n-gram precisions (n=1..4) multiplied by brevity penalty (penalizes outputs shorter than reference). Example: reference 'The cat sat on the mat', generated 'The cat on the mat' - unigram precision 4/5=0.8, bigram precision 2/4=0.5, etc., combined with brevity penalty yields final score. BLEU correlates reasonably with human judgment for translation at corpus level but has known limitations: ignores meaning (synonyms penalized), favors fluency over adequacy, and requires high-quality references.
š” WHY IT MATTERS:
BLEU's role in LLM evaluation is controversial. For translation, it remains useful as a cheap proxy. For other generation tasks (summarization, dialogue, creative writing), BLEU correlates poorly with human judgment because there are many valid ways to express the same meaning. A creative response that's perfect but uses different words gets low BLEU. Using BLEU for LLM evaluation can mislead optimization toward conservative, reference-like outputs rather than high-quality generation. However, BLEU is fast, free, and standardized, so it persists in research. Best practice: use BLEU only for tasks with limited output variation (translation, data-to-text) and combine with other metrics. Never rely on BLEU alone.
š EXAMPLE:
Summarization task. Reference summary: 'The study found that exercise improves mental health.' Generated A: 'Research indicates physical activity benefits psychological well-being.' (semantically identical, different words). BLEU score: low (0.3) - penalizes for not matching words. Generated B: 'The study found that exercise improves mental health and also helps sleep.' (adds hallucination, matches words). BLEU: higher (0.6) despite being worse. This illustrates BLEU's failure - it rewards word matching over semantic accuracy. For LLM evaluation, this can lead to optimizing for the wrong things. Use semantic similarity metrics (BERTScore) or LLM-as-judge instead.
QUESTION 09
What is ROUGE and when is it used?
š DEFINITION:
ROUGE (Recall-Oriented Understudy for Gisting Evaluation) is a set of metrics for automatically evaluating summarization by comparing generated summaries to reference summaries. It measures overlap of n-grams, word sequences, and word pairs, with variants emphasizing different aspects: ROUGE-N (n-gram overlap), ROUGE-L (longest common subsequence), ROUGE-W (weighted LCS), and ROUGE-S (skip-bigram co-occurrence).
āļø HOW IT WORKS:
ROUGE-N computes n-gram recall between generated and reference. For unigrams: count of overlapping unigrams divided by total unigrams in reference. ROUGE-L finds longest common subsequence (preserves order but allows gaps) and computes F-measure. ROUGE-S counts skip-bigrams (any word pair in sentence order). Typically reported as F1 scores (harmonic mean of precision and recall) or just recall. Multiple references can be used to capture valid variation. Like BLEU, ROUGE is fast, automatic, and standardized but has similar limitations: lexical overlap doesn't guarantee semantic equivalence.
š” WHY IT MATTERS:
ROUGE became the standard for summarization evaluation because it correlates reasonably with human judgment for news summarization where outputs are relatively constrained. It's widely used in research papers, enabling comparison across systems. For extractive summarization (selecting sentences), ROUGE works reasonably well. For abstractive summarization where models paraphrase, ROUGE underestimates quality. Like BLEU, ROUGE has known weaknesses: favors word matching over meaning, doesn't capture factual consistency, and can be gamed. Modern evaluation combines ROUGE with other metrics: BERTScore for semantic similarity, FactCC for factuality, and human evaluation. For production, ROUGE is useful for regression testing but insufficient alone.
š EXAMPLE:
Summarizing a news article about a sports game. Reference: 'The Lakers defeated the Warriors 112-108 in overtime.' Generated A: 'LA beat Golden State 112-108 after extra period.' (good summary, different words). ROUGE-1 F1: 0.65 (moderate). Generated B: 'The Lakers won the game.' (too short, misses score). ROUGE-1: 0.40 (lower, correct). Generated C: 'The Lakers defeated the Warriors in a close game that went to overtime.' (misses score). ROUGE-1: 0.70 (higher than A, despite missing critical information). This shows ROUGE's limitations - it rewards length and word overlap over completeness. For reliable evaluation, combine with factuality checks.
QUESTION 10
What is the difference between automatic metrics and human evaluation?
š DEFINITION:
Automatic metrics (BLEU, ROUGE, perplexity, accuracy) use computational methods to score model outputs quickly and consistently, while human evaluation relies on human judgment to assess quality across dimensions that are difficult to quantify. They represent fundamentally different approaches with complementary strengths and weaknesses.
āļø HOW IT WORKS:
Automatic metrics: defined mathematical formulas applied to outputs. Reference-based metrics compare to gold standards; reference-free metrics measure intrinsic properties. Computed in milliseconds, perfectly consistent, zero marginal cost. But they capture only narrow aspects of quality and often correlate imperfectly with human perception. Human evaluation: humans rate outputs on defined rubrics or make pairwise comparisons. Requires careful protocol design, multiple annotators for reliability, and quality control. Expensive ($5-50 per example), slow (days), and variable (inter-annotator agreement 60-80%). But captures nuanced dimensions: helpfulness, creativity, safety, cultural appropriateness.
š” WHY IT MATTERS:
The choice determines what you optimize. Models optimized for automatic metrics may game them - maximizing BLEU produces conservative, reference-like outputs. Models optimized for human feedback become more helpful and aligned. In practice, both are essential: automatic metrics for rapid iteration, regression testing, and large-scale evaluation; human evaluation for final validation, capturing subjective dimensions, and understanding real-world performance. The gap between them reveals what automatic metrics miss. For production systems, invest in both: automated CI/CD with metrics for development, periodic human evaluation for quality assurance.
š EXAMPLE:
Dialogue system evaluation. Automatic metrics: response length (too long?), diversity (unique responses?), BLEU vs reference. Show system A has higher diversity but similar BLEU. Human evaluation reveals: System A responses are creative but often off-topic; System B responses are less diverse but always relevant. Users prefer System B 70% of time. Automatic metrics missed relevance entirely. Conversely, during development, running human evaluation for every change impossible - automatic metrics catch regressions (e.g., response length suddenly drops). The combination enables both rapid iteration and final quality assurance. This is why mature ML teams use layered evaluation: automatic for development, human for release decisions.
QUESTION 11
How do you build an evaluation dataset for a domain-specific LLM application?
š DEFINITION:
Building an evaluation dataset for a domain-specific application involves creating a representative set of inputs and expected outputs (or evaluation rubrics) that reflect real-world usage, enabling systematic measurement of model performance in that domain. The dataset must capture the diversity of actual queries, edge cases, and failure modes specific to the application.
āļø HOW IT WORKS:
Process: 1) Source collection - gather real user queries from logs, subject matter experts, or simulated interactions. Aim for 200-1000 examples depending on task complexity. 2) Stratification - ensure coverage of different query types, difficulty levels, and edge cases. For customer support, include different issue categories, languages, tones. 3) Ground truth creation - for tasks with correct answers, have experts create gold responses. For subjective tasks, develop rubrics and have multiple annotators rate. 4) Quality control - check inter-annotator agreement, review edge cases, resolve disagreements. 5) Test/train split - separate into development set (for iteration) and held-out test set (for final evaluation). 6) Maintenance - plan for updates as application evolves.
š” WHY IT MATTERS:
A well-built evaluation dataset is the foundation of reliable LLM application development. Without it, you can't measure progress, compare options, or detect regressions. Poor datasets (unrepresentative, too small, biased) lead to optimizing for the wrong things and failures in production. Domain-specific evaluation is particularly critical because general benchmarks don't reflect your use case. Investment in high-quality evaluation data pays off through faster development, fewer production incidents, and better user outcomes.
š EXAMPLE:
Building evaluation set for medical Q&A system. Source: 1,000 real patient questions from clinic (de-identified). Stratify: 30% symptoms questions, 25% treatment questions, 20% medication questions, 15% preventive care, 10% edge cases (rare conditions). Have 3 doctors create reference answers for 200 samples (test set) and rubrics for all. Inter-annotator agreement 85% on key facts. Remaining 800 for development. This dataset reveals: model struggles with rare conditions (30% accuracy) vs common ones (90% accuracy). Enables targeted improvement through few-shot examples for rare conditions. Without domain-specific data, would have missed this gap and deployed model that fails on critical edge cases.
QUESTION 12
What is a golden dataset and how is it maintained over time?
š DEFINITION:
A golden dataset is a curated collection of high-quality input-output pairs (or evaluation rubrics) that serves as the definitive standard for measuring model performance. It's used to track progress, compare models, and detect regressions. Maintaining it over time ensures continued relevance as the application evolves and prevents overfitting to stale examples.
āļø HOW IT WORKS:
Creation: golden dataset starts with 100-1000 examples carefully crafted or selected to represent core use cases, edge cases, and failure modes. Each example has verified ground truth (for factual tasks) or detailed rubrics (for subjective tasks). Examples are chosen for diversity and difficulty. Maintenance: 1) Periodic review - every 3-6 months, review examples for relevance (are they still representative?). 2) Expansion - add new examples for emerging use cases or failure modes discovered in production. 3) Rotation - replace outdated examples (e.g., product names that changed). 4) Versioning - track dataset versions alongside model versions. 5) Contamination checking - ensure golden examples aren't inadvertently used in training.
š” WHY IT MATTERS:
A golden dataset provides the stable foundation for model development. Without it, you can't tell if a model is actually improving or just getting better at current test set. Over time, golden dataset maintenance prevents three problems: concept drift (user queries change), coverage drift (new use cases emerge), and benchmark overfitting (models optimized to golden set). Well-maintained golden datasets enable reliable A/B testing, informed model selection, and confident deployment decisions.
š EXAMPLE:
E-commerce customer support chatbot. Golden dataset 2023 Q1: 500 examples covering product questions, returns, shipping. Works well. By 2023 Q4, new product categories added, new return policy, new seasonal issues. Review reveals 20% of examples now outdated (old products, old policies). Maintenance: retire 100 outdated examples, add 150 new examples covering new products and policies. Version 2024 Q1 golden dataset reflects current reality. Models trained/ tested on old golden set might score high but fail in production on new query types. The maintained dataset ensures evaluation stays relevant, preventing silent degradation.
QUESTION 13
What is preference-based evaluation and how does it work?
š DEFINITION:
Preference-based evaluation uses human or AI comparisons between model outputs to determine which is better according to defined criteria, rather than assigning absolute scores. This approach leverages the fact that humans are better at comparative judgments than absolute ratings, producing more reliable data for ranking models and guiding optimization.
āļø HOW IT WORKS:
Process: 1) Generate multiple responses per prompt from different models or configurations. 2) Present pairs (or sets) to evaluators (humans or LLM judges) with instruction: 'Which response is more helpful/harmless/accurate?' 3) Collect preferences, often with options for ties or both bad. 4) Aggregate into win rates, Elo scores, or Bradley-Terry model rankings. 5) Use for model comparison, prompt selection, or training reward models. Advantages: pairwise comparison more consistent than absolute ratings (humans agree 80% vs 60% on 5-point scales). Can handle subjective dimensions impossible to score absolutely.
š” WHY IT MATTERS:
Preference-based evaluation is the foundation of RLHF and modern alignment. It's how we capture human values that can't be specified explicitly. For comparing models, win rates in head-to-head comparisons are more interpretable than arbitrary metrics. For prompt engineering, pairwise tests reveal which prompt users prefer. The approach scales with LLM-as-judge for rapid iteration while reserving human judgments for validation. It's particularly valuable when ground truth doesn't exist (creative tasks, conversational quality).
š EXAMPLE:
Comparing two chatbots. Generate 500 prompts, get responses from both. Show pairs to 10 human raters each, asking 'Which response would you prefer?' Results: Chatbot A wins 320 times, Chatbot B wins 180 times (64% win rate). Elo scores: A 1050, B 950. Statistical test shows preference significant (p<0.01). This is more actionable than average helpfulness scores of 4.2 vs 3.9. The win rate translates directly to user preference. Same approach used to compare prompts: 'Which prompt produces better responses?' Run 200 examples, Prompt A wins 70% of time - clear winner. Preference-based evaluation provides the signal needed for optimization.
QUESTION 14
What is BIG-Bench and what types of tasks does it cover?
š DEFINITION:
BIG-Bench (Beyond the Imitation Game Benchmark) is a massive collaborative benchmark consisting of over 200 tasks designed to probe language model capabilities across diverse areas including reasoning, knowledge, creativity, and social bias. It aims to measure model performance on tasks that are difficult for current AI but relatively easy for humans, revealing capability gaps and driving progress.
āļø HOW IT WORKS:
BIG-Bench tasks are contributed by hundreds of researchers across academia and industry, covering: 1) Traditional NLP (translation, summarization, QA). 2) Reasoning (mathematical, logical, common sense). 3) Knowledge (world facts, domain expertise). 4) Creativity (generating jokes, metaphors). 5) Social bias (stereotype detection). 6) Adversarial (questions designed to fool models). Each task has defined metrics, few-shot examples, and evaluation protocol. Models are evaluated zero-shot and few-shot. Results are aggregated to show model strengths and weaknesses across task categories. BIG-Bench Hard selects particularly challenging tasks where models still lag humans.
š” WHY IT MATTERS:
BIG-Bench provides the most comprehensive view of model capabilities available. Unlike narrow benchmarks (MMLU for knowledge, HumanEval for code), BIG-Bench's breadth reveals what models can and cannot do across the full spectrum of cognitive tasks. It has driven progress by highlighting specific weaknesses (e.g., models struggle with temporal reasoning) and tracking improvement over time. The benchmark also includes hard tasks that remain challenging even for largest models, indicating where future work is needed. For researchers, BIG-Bench offers a standardized way to compare models and identify promising research directions.
š EXAMPLE:
BIG-Bench includes task 'causal_judgment': 'If Marie makes a pot of tea and adds sugar, then pours a cup for Leslie who doesn't like sugar, does Marie cause Leslie's displeasure?' Tests causal reasoning. GPT-3 gets 40% (near random), GPT-4 gets 85% - showing improvement in reasoning. Task 'play_dialog': models must generate appropriate responses in game scenarios. Reveals whether models understand social dynamics. The breadth means a model might excel at knowledge tasks (90%) but struggle with social reasoning (60%), informing where it can be safely deployed. This granular view is BIG-Bench's value.
QUESTION 15
How do you detect prompt sensitivity (brittleness) in LLM outputs?
š DEFINITION:
Prompt sensitivity or brittleness refers to how much model outputs change with minor, semantically equivalent variations in the prompt. High sensitivity indicates unreliability - the model's performance depends on exact phrasing rather than understanding. Detecting and measuring sensitivity is crucial for building robust applications that work consistently across diverse user inputs.
āļø HOW IT WORKS:
Detection methods: 1) Paraphrase testing - generate multiple semantically equivalent variants of the same prompt (different wording, same meaning). Measure output consistency. 2) Perturbation testing - make small changes (typos, punctuation, word order) and measure impact. 3) Instruction variation - test different ways of giving same instruction ('Summarize this', 'Please provide a summary', 'Can you summarize?'). 4) Format variation - test different formats (bullet points vs paragraphs, different delimiters). 5) Systematic evaluation - for each base prompt, create 10+ variants, run through model, measure agreement on key outputs. Metrics: consistency rate (% producing same answer), variance in scores, failure rate on variants.
š” WHY IT MATTERS:
High prompt sensitivity means your application is unreliable. Users will phrase things differently, and the model's performance will vary unpredictably. This erodes trust and creates inconsistent user experience. Sensitivity also indicates the model is pattern-matching rather than understanding - it's learned correlations with specific phrases rather than true comprehension. Measuring sensitivity helps: choose more robust prompts (those that work across variations), identify model weaknesses (particular types of variation cause failure), and decide if a model is ready for deployment (low sensitivity required).
š EXAMPLE:
QA system for product documentation. Base prompt: 'What is the return policy?' Model answers correctly. Test 10 variants: 'Can you tell me about returns?', 'How do returns work?', 'What's your policy on returns?', 'Return policy please', etc. On 3 of 10 variants, model gives incomplete answer or hallucinates. Sensitivity rate 30% - unacceptable for production. Analysis reveals model fails when 'policy' word missing. Prompt redesign with instruction covering multiple phrasings reduces sensitivity to 10%. Further testing with fine-tuning on diverse phrasings reduces to 5%. This systematic sensitivity testing and reduction is essential for reliable deployment.
QUESTION 16
What is calibration in LLMs and why does it matter?
š DEFINITION:
Calibration in LLMs refers to how well a model's confidence in its predictions aligns with its actual accuracy. A well-calibrated model should be correct 80% of the time when it says it's 80% confident, and correct 90% of the time when 90% confident. Poor calibration leads to overconfident wrong answers or underconfident correct ones, undermining trust and usability.
āļø HOW IT WORKS:
Calibration is measured by comparing confidence scores (often derived from token probabilities or verbalized confidence) to actual outcomes. For multiple-choice tasks, expected calibration error (ECE) bins predictions by confidence and computes average accuracy minus confidence. For generation, verbalized confidence ('I'm 80% sure that...') can be evaluated. Models are often miscalibrated because they're trained to maximize accuracy, not output calibrated probabilities. Factors affecting calibration: model size (larger models better calibrated), training data distribution, and fine-tuning (RLHF can improve calibration). Techniques to improve calibration: temperature scaling, confidence prompting ('Express uncertainty'), and ensemble methods.
š” WHY IT MATTERS:
Calibration is critical for trust and safety. When a medical chatbot says 'I'm 90% sure this diagnosis is correct,' users need to know if that confidence is justified. Overconfident wrong answers can cause harm; underconfident correct answers waste time. In high-stakes applications, calibration enables appropriate human oversight - confident predictions can be trusted more, uncertain ones escalated. Calibration also matters for retrieval systems where confidence scores guide whether to retrieve more information. Poorly calibrated models are unpredictable and difficult to integrate into decision-making workflows.
š EXAMPLE:
Medical QA model. On 1,000 questions, when model verbalizes 'I'm very confident' (90%+), actual accuracy 95% - well calibrated. When it says 'moderately confident' (70-80%), accuracy 65% - overconfident. When it says 'uncertain' (<50%), accuracy 40% - underconfident (still better than random). Analysis reveals overconfidence on rare diseases (model has seen few examples but doesn't know that). Calibration improves after fine-tuning on data where experts express appropriate uncertainty. Now confident predictions at 90% accuracy, uncertain at 20% (better to escalate). This calibration enables safe deployment: confident answers go directly to patients, uncertain ones flagged for doctor review.
QUESTION 17
What is the MT-Bench evaluation and how does it work?
š DEFINITION:
MT-Bench is a benchmark designed to evaluate multi-turn conversational capabilities of language models across eight categories: writing, roleplay, reasoning, math, coding, extraction, STEM, and humanities. It uses a structured set of 80 multi-turn questions and GPT-4 as a judge to score model responses, providing a standardized measure of chat model quality.
āļø HOW IT WORKS:
MT-Bench consists of 80 questions, 10 per category, each with two turns (follow-up questions). Example: Turn 1: 'Explain quantum computing in simple terms.' Turn 2: 'Now explain how it differs from classical computing.' Models generate responses for both turns. GPT-4 then evaluates the entire conversation, scoring each turn on a 1-10 scale based on helpfulness, relevance, accuracy, and depth. Scores are averaged across categories to produce overall MT-Bench score. The benchmark is designed to test not just single-turn QA but sustained conversation, follow-up handling, and context maintenance.
š” WHY IT MATTERS:
MT-Bench has become the standard for evaluating chat-optimized models. Unlike single-turn benchmarks (MMLU), it tests the multi-turn interactions that define real chatbot usage. The use of GPT-4 as judge enables scalable, consistent evaluation that correlates well with human preferences (0.8+ correlation). Leaderboard rankings heavily influence model selection for conversational applications. MT-Bench also reveals category-specific strengths: a model might excel at coding but struggle at roleplay, informing deployment decisions.
š EXAMPLE:
Two models on MT-Bench. Model A overall score 8.2, Model B 7.8. Breakdown: Model A wins on reasoning (8.8 vs 7.5) and math (9.0 vs 7.0), but loses on roleplay (7.0 vs 8.2) and writing (7.5 vs 8.5). For a tutoring application, Model A better despite lower overall because reasoning and math matter more. For creative writing assistant, Model B better. This granular view informs model selection. The multi-turn aspect reveals Model A maintains context well across turns, while Model B sometimes forgets earlier conversation - critical for chatbot use. MT-Bench provides this nuanced evaluation.
QUESTION 18
How would you set up a continuous evaluation pipeline for a production LLM system?
š DEFINITION:
A continuous evaluation pipeline for production LLM systems automates the ongoing assessment of model performance using a combination of golden datasets, user feedback, and monitoring metrics. It detects regressions, tracks quality trends, and triggers alerts when performance degrades, enabling rapid response to issues and data-driven improvement.
āļø HOW IT WORKS:
Components: 1) Golden dataset - curated test set (100-1000 examples) covering core use cases, run automatically after each model update. 2) Shadow evaluation - compare new model vs current on live traffic (without affecting users) using LLM-as-judge. 3) User feedback collection - thumbs up/down, ratings, follow-up behavior. 4) Production monitoring - track metrics (response time, token usage, error rates) and quality proxies (response length, refusal rate). 5) Drift detection - monitor input distribution shifts and performance changes over time. 6) Alerting - notify team when metrics deviate beyond thresholds. 7) Dashboard - visualize trends, compare variants, identify degradation. 8) Automated testing - run on each candidate model before deployment.
š” WHY IT MATTERS:
LLM systems degrade over time due to model updates, API changes, or shifts in user behavior. Without continuous evaluation, you won't know until users complain. A pipeline enables: rapid detection of regressions (new model worse than old), tracking of long-term trends (is quality improving?), data-driven decisions (should we upgrade?), and accountability (SLOs monitored). For production systems, continuous evaluation is as important as the model itself.
š EXAMPLE:
Customer support chatbot with continuous evaluation pipeline. Daily: golden dataset (500 examples) runs against production model, scores 92% accuracy. Alert if below 90%. Weekly: shadow evaluation of candidate model on 10% traffic shows 93% accuracy - candidate approved. Monthly: trend analysis shows accuracy dropped from 92% to 89% over 3 months. Investigation reveals user queries have shifted (new products launched). Golden dataset updated with new examples, retraining scheduled. This pipeline catches drift, enables proactive improvement, and maintains quality. Without it, would discover problem only when support tickets increase.
QUESTION 19
What metrics would you track to monitor LLM quality over time in production?
š DEFINITION:
Monitoring LLM quality in production requires tracking a suite of metrics across multiple dimensions: output quality, user experience, safety, cost, and performance. These metrics provide early warning of degradation, guide improvement efforts, and ensure the system meets business requirements over time.
āļø HOW IT WORKS:
Key metric categories: 1) Quality metrics - automated evaluation on golden dataset (accuracy, ROUGE, BLEU), LLM-as-judge scores, factual consistency checks. Run on sampled traffic. 2) User feedback - explicit (thumbs up/down, ratings, surveys) and implicit (follow-up rate, session length, retention). 3) Safety metrics - toxicity scores, policy violation rate, refusal appropriateness. 4) Business metrics - task completion rate, conversion, cost per conversation. 5) Operational metrics - latency (p50, p95), error rate, token usage. 6) Drift metrics - input distribution (topic shift), output length, vocabulary diversity. Track as time series, compare to baselines, set alert thresholds.
š” WHY IT MATTERS:
Models degrade over time due to data drift, user behavior change, or underlying API/model updates. Without comprehensive monitoring, degradation goes unnoticed until business impact. Different metrics catch different problems: user feedback captures satisfaction, golden dataset catches factual errors, safety metrics prevent PR disasters, cost metrics manage budget. Together they provide a complete picture of system health and guide investment decisions.
š EXAMPLE:
Legal research assistant monitoring dashboard. Weekly trends: Golden dataset accuracy: 94% (stable). User satisfaction: 4.2/5 (down from 4.5). Investigation reveals users complaining about outdated case law - model not updated with recent rulings. Factual consistency checks drop to 88% on new cases. Input drift detection shows 30% of queries now about new legislation. Response: update knowledge base, retrain retrieval. Metrics recover next week. Without this comprehensive monitoring, would miss the drift until users churn. Other metrics: latency p95 2.1s (under SLO 2.5s), cost per query $0.12 (within budget), safety violations 0.1% (acceptable). This multi-dimensional view enables proactive management.
QUESTION 20
How do you evaluate an LLM for safety and alignment, not just accuracy?
š DEFINITION:
Evaluating LLMs for safety and alignment requires assessing behavior across dimensions beyond accuracy: harmlessness (doesn't produce dangerous content), helpfulness (actually assists users), honesty (doesn't mislead), and fairness (doesn't discriminate). This involves specialized testing methodologies including red-teaming, adversarial evaluation, and bias measurement.
āļø HOW IT WORKS:
Methods include: 1) Red-teaming - dedicated teams attempt to make model produce harmful content, testing jailbreaks and edge cases. 2) Adversarial evaluation - systematically test with problematic inputs (hate speech, dangerous instructions, PII extraction attempts). 3) Bias benchmarks - evaluate on datasets measuring stereotypes (Winogender, BBQ, CrowS-Pairs). 4) Refusal testing - check if model appropriately refuses harmful requests while accepting legitimate ones. 5) Multi-turn safety - test if safety degrades over conversation. 6) Jailbreak benchmarking - use known jailbreak techniques (DAN, prefix injection) to test robustness. 7) Human evaluation - experts rate responses for safety and alignment. 8) Red team automation - use LLMs to generate adversarial tests.
š” WHY IT MATTERS:
Accuracy alone doesn't make a model safe or aligned. A model might answer factual questions correctly but also help users build bombs, generate hate speech, or leak private information. Safety failures can cause real harm, legal liability, and reputational damage. Comprehensive safety evaluation is essential before deployment, especially for customer-facing applications. It's also required by emerging regulations (EU AI Act).
š EXAMPLE:
Evaluating a customer service chatbot. Accuracy on golden dataset: 95% (excellent). Safety evaluation reveals: Model provides detailed instructions when asked about dangerous activities (20% of attempts succeed). Generates stereotypes about certain demographics (biased responses 5% of time). Can be jailbroken to reveal system prompt. Refusal testing shows model refuses harmful requests 80% of time - needs improvement. Multi-turn testing shows safety degrades after long conversations (model becomes more compliant). Based on findings, implement safety training, add refusal examples, deploy with content filter. Re-evaluation shows improvements: 95% refusal rate, bias reduced to 1%. This comprehensive safety evaluation prevented deployment of a model that appeared accurate but was unsafe.