AI Engineering Interview Questions: Evaluation, Safety & Hallucination
Reviewed by Mark Dickie · Last updated
AI hallucination is a model's tendency to generate confident-sounding output that is factually incorrect or entirely fabricated. It ranks among the most frequently tested failure modes in AI engineering interviews, alongside broader evaluation and safety topics. Expect questions on quantitative metrics like RAGAS faithfulness scores, guardrail design, and red-teaming prompts that surface where a model invents information.
What does an AI engineering interview test about hallucination and safety?
| Topic | What interviewers ask |
|---|---|
| Hallucination detection | How do you measure whether a model fabricates facts? What is faithfulness vs. answer relevance? |
| Evaluation metrics | When would you use RAGAS over BLEU? What are the limits of LLM-as-judge? |
| Guardrails | How do you filter unsafe or off-topic outputs at inference time? |
| Red-teaming | Can you craft prompts that break a model's safety alignment? |
| RAG failure modes | What causes a retrieval pipeline to increase hallucination instead of reducing it? |
How do you prepare for evaluation and safety questions?
- Learn where each evaluation family breaks down. BLEU and ROUGE miss semantic equivalence; embedding similarity struggles with negation; LLM-as-judge can favor verbose answers.
- Study RAGAS or similar frameworks that score faithfulness and answer relevance separately from context precision.
- Practice red-teaming by writing adversarial prompts that target jailbreaks, prompt injection, or factual fabrication.
- Map out guardrail architectures: input classifiers and output filters sit at different points in the inference pipeline, and constitutional AI methods add another layer.
- Be ready to discuss the tension between helpfulness and safety. Cutting hallucination often narrows what a model will answer.
Key facts
- Tarmac has 26 AI Engineering interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 4,175 job postings asking for AI Engineering in August 2026.
- Roles asking for AI Engineering advertise a median base salary of US$180,000, across 773 job postings as of August 2026.
- Tarmac last reviewed these AI Engineering interview questions on 31 August 2026.
At a glance
| Questions | 25 shown · 26 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Fill in the blank, Multiple choice, Multiple answer, Ordering, Short answer |
What you'll review
- hallucination
- evaluation safety
- llm eval
- rag eval metrics
- llm observability
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
AI Engineering/evaluation-safety/hallucination
Retrieval-Augmented Generation (RAG) completely eliminates hallucinations in large language models by grounding every response in retrieved documents.#
Options
Show answer
False — Retrieval-Augmented Generation (RAG) reduces hallucinations by grounding responses in retrieved documents, but it does not completely eliminate them. The model can still misinterpret retrieved content, fabricate details not present in the source, or receive irrelevant retrieval results, all of which can still lead to hallucinated outputs.
RAG significantly reduces hallucinations by giving the model access to relevant retrieved context, but it does not completely eliminate them. The model can still hallucinate by misinterpreting retrieved documents, generating statements not supported by the retrieved text, or failing to retrieve the right documents in the first place. RAG is a mitigation strategy, not a guaranteed cure.
AI Engineering/evaluation-safety/hallucination
In the RAGAS framework for RAG evaluation, the metric that checks whether every claim in the generated answer is supported by the retrieved context is called _____. The primary metric in RAGAS (v0.1.x) that compares the generated answer against the ground-truth answer by combining semantic similarity and factual correctness (using an F1-style blend of precision and recall) is called _____.#
Show answer
In the RAGAS framework for RAG evaluation, the metric that checks whether every claim in the generated answer is supported by the retrieved context is called faithfulness. The primary metric in RAGAS (v0.1.x) that compares the generated answer against the ground-truth answer by combining semantic similarity and factual correctness (using an F1-style blend of precision and recall) is called answer_correctness.
In the RAGAS framework, 'faithfulness' measures the fraction of claims in the generated answer that are grounded in the retrieved context — a low score signals hallucination. 'Answer correctness' (the canonical top-level metric in ragas ≥ 0.1.x) evaluates how well the generated answer matches the ground-truth answer by blending factual correctness (an F1-style overlap of claims) with semantic similarity; it subsumes what earlier discussions called 'answer recall' as a component rather than a standalone metric. These two metrics are complementary: faithfulness guards against unsupported claims, while answer_correctness guards against missing or wrong facts relative to the ground truth.
AI Engineering/evaluation-safety
If a toxicity classifier achieves 99% accuracy on a held-out test set, it is guaranteed to be safe for production deployment without any further evaluation.#
Options
Show answer
False. High accuracy on one test set does not guarantee production safety because the test data may not represent real-world inputs, may contain demographic blind spots, or may hide class-imbalance problems. Further evaluation such as subgroup fairness analysis, adversarial testing, and ongoing drift monitoring is needed before deployment.
High accuracy on a single test set does not guarantee production safety. The test set may not be representative of real-world inputs, the classifier may have blind spots for underrepresented demographic groups, and accuracy alone can mask severe class-imbalance issues (e.g., flagging very few inputs as toxic). Additional evaluation — such as subgroup fairness analysis, adversarial testing, and monitoring for drift — is required before deployment.
AI Engineering/evaluation-safety/hallucination
A language model confidently states a false fact that was never present in its training data or the provided context — for example, it invents a citation to a research paper that does not exist. What is the standard term for this failure mode?#
Options
Show answer
The correct term is hallucination. Hallucination describes a language model confidently generating factually incorrect or entirely fabricated content — like a non-existent paper citation — that has no grounding in its training data or provided context. It is distinct from distributional shift, prompt injection, or catastrophic forgetting, each of which describes a different failure category.
When an LLM generates plausible-sounding but factually incorrect content that is not grounded in any source — such as fabricating citations — this is called hallucination. Catastrophic forgetting refers to a model losing old knowledge after fine-tuning; distributional shift is a mismatch between training and inference data distributions; prompt injection is a security attack where adversarial instructions override system prompts.
AI Engineering/evaluation-safety/hallucination
Which of the following techniques are commonly used to reduce or detect hallucinations in large language model (LLM) systems? Select all that apply.#
Options
Pick every one that applies.
Show answer
The three standard techniques are: RAG (Retrieval-Augmented Generation), which anchors answers in retrieved evidence; citation verification, which programmatically checks that sources the model names actually exist; and self-consistency checking, which samples multiple responses and flags disagreements. Raising temperature increases randomness and generally makes hallucination worse, and replacing the softmax layer is an unrelated architectural change.
RAG grounds the model's answer in retrieved documents, making fabrication easier to detect and less likely. Citation verification is a downstream check that catches invented references. Self-consistency (sampling N outputs and voting) exposes answers that are inconsistent across samples, a signal of low-confidence or hallucinated content. Increasing temperature makes outputs more random and typically worsens hallucination. Swapping softmax for sigmoid in the output layer is an architectural change unrelated to hallucination mitigation.
AI Engineering/evaluation-safety/hallucination
A model that achieves a high BLEU score on a benchmark automatically has a low hallucination rate, because BLEU directly measures factual accuracy.#
Options
Show answer
False. BLEU measures n-gram overlap with reference texts, not factual accuracy. A model can produce fluent output that closely mirrors reference phrasing yet still contain hallucinated facts, earning a high BLEU score. Evaluating hallucination requires dedicated metrics such as FactScore, NLI-based faithfulness scores, or human factual verification — none of which BLEU captures.
BLEU (Bilingual Evaluation Understudy) is an n-gram overlap metric originally designed for machine translation. It measures surface similarity between generated text and reference text — not factual accuracy or groundedness. A model can score highly on BLEU by parroting fluent, reference-like phrasing while still hallucinating facts. Hallucination evaluation requires dedicated fact-checking metrics (e.g., FactScore, BERTScore with NLI, or human annotation), not BLEU.
AI Engineering/evaluation-safety
You are evaluating an LLM safety guardrail classifier that decides whether to block a user prompt before it reaches the model. In your deployment context, a false negative (a harmful prompt that slips through to the model) is far more costly than a false positive (a benign prompt that gets blocked). Which single metric should you prioritize maximizing when comparing candidate classifiers?#
Options
Show answer
Maximize recall. Recall measures the fraction of harmful prompts that the classifier successfully blocks (TP / (TP + FN)), so pushing it higher directly reduces false negatives — the most costly failure mode when harmful content slipping through is worse than blocking a benign prompt.
Recall = TP / (TP + FN), measuring the proportion of actual harmful prompts that the classifier correctly blocks. When false negatives are the dominant cost, maximizing recall directly minimizes the rate of harmful prompts that slip through. Precision focuses on false positives (lower priority here), accuracy is dominated by the large class of benign prompts and can mask poor harmful-prompt detection, and F1 weights precision and recall equally rather than reflecting the asymmetric cost structure.
AI Engineering/evaluation-safety
In LLM safety evaluation, a _____ exercise is an adversarial testing practice in which human or automated testers deliberately craft inputs designed to elicit harmful, biased, or policy-violating outputs from the model, so that vulnerabilities are discovered and patched before deployment.#
Show answer
In LLM safety evaluation, a red team exercise is an adversarial testing practice in which human or automated testers deliberately craft inputs designed to elicit harmful, biased, or policy-violating outputs from the model, so that vulnerabilities are discovered and patched before deployment.
Red-teaming is the standard term for adversarial probing of LLMs. Testers (human or automated) attempt to bypass safety guardrails using techniques like jailbreaks, prompt injections, and edge-case inputs. The goal is to surface failure modes before real users encounter them, then use the findings to improve alignment, filters, or system prompts. This contrasts with benign evaluation, which tests standard capability and quality on representative — not adversarial — inputs.
AI Engineering/evaluation-safety/hallucination
You are evaluating an LLM-powered question-answering system for hallucination. Which of the following techniques are directly designed to detect or reduce hallucination in LLM outputs?#
Options
Pick every one that applies.
Show answer
The techniques directly designed to detect or reduce hallucination are: RAG with source grounding, self-consistency sampling, and NLI-based factual consistency scoring. RAG anchors claims to retrieved evidence; self-consistency flags uncertain outputs where sampled responses disagree; NLI scoring explicitly checks whether the model's output is entailed by reference documents. Raising temperature increases hallucination risk, and vocabulary expansion is unrelated to factual faithfulness.
RAG with source attribution grounds claims in retrieved evidence, making it straightforward to verify and reduce fabricated facts. Self-consistency sampling exploits the intuition that a model that truly 'knows' an answer will produce consistent outputs; large variance signals uncertainty/hallucination. NLI-based factual consistency scoring (e.g., using a model like TRUE or MiniCheck) directly tests whether the generated text is entailed by a reference, making it a standard hallucination-detection approach. Raising temperature increases randomness/diversity but generally worsens hallucination rather than controlling it. Expanding the tokenizer vocabulary addresses out-of-vocabulary token coverage, not factual faithfulness.
AI Engineering/evaluation-safety/hallucination
A team is building a hallucination evaluation pipeline for a retrieval-augmented chatbot. Arrange the following steps in the correct logical order, from first to last.#
Put these in order
Show answer
The correct order is: (1) Retrieve relevant passages → (2) Generate the LLM response → (3) Split the response into atomic claims → (4) Run NLI classification on each claim → (5) Aggregate verdicts into a faithfulness score. Retrieval must precede generation; decomposing into atomic claims before NLI allows fine-grained blame assignment; aggregation into a score and threshold check is always the final reporting step.
The pipeline must first retrieve the grounding passages (a), then generate the response using them (b). The response is then decomposed into atomic claims (c) so that fine-grained verification is possible—evaluating the whole response at once makes it hard to pinpoint which parts hallucinate. Each atomic claim is then checked against the retrieved passages via an NLI model (d), following the approach used in systems like RAGAS or FActScoring. Finally, the individual verdicts are aggregated into a faithfulness metric and a pass/fail threshold is applied (e). This order is canonical in modern RAG evaluation frameworks.
AI Engineering/evaluation-safety/hallucination
In the context of LLM hallucination evaluation, what is the difference between intrinsic hallucination and extrinsic hallucination? Give a concrete example of each in a summarisation setting.#
Show answer
Intrinsic hallucination occurs when the model produces output that directly contradicts information present in the source document (e.g., the source says 'the meeting was held on Monday' but the summary says 'the meeting was held on Wednesday'). Extrinsic hallucination occurs when the model adds information that cannot be verified from the source at all — it is neither supported nor contradicted — such as inventing the name of an attendee who is never mentioned in the document. Intrinsic hallucinations are direct factual contradictions with the input; extrinsic ones are unsupported fabrications.
The intrinsic/extrinsic taxonomy (introduced in the survey by Ji et al., 2023 and widely adopted) is fundamental to hallucination evaluation design. Intrinsic hallucinations are objectively falsifiable because the source text contains contradicting evidence — these are easier to detect automatically with NLI models. Extrinsic hallucinations are harder to catch because they neither appear in nor contradict the source; they require external knowledge or world-model checks. Understanding this distinction guides which evaluation metrics and mitigation strategies are appropriate.
AI Engineering/evaluation-safety
You are building an automated safety evaluation pipeline for an LLM-based chatbot. You want to measure whether a new model version has regressed on refusing harmful requests. Which evaluation setup produces the most reliable signal for detecting a safety regression?#
Options
Show answer
The most reliable setup is a held-out set of harmful prompts curated by an independent team that was not involved in training, including paraphrased and novel attack vectors. This avoids data contamination (reusing training prompts inflates scores via memorization) and avoids reliance on public benchmarks that may have leaked into training data. It measures genuine generalization to unseen harmful inputs, which is exactly what a safety regression test needs.
Option (b) is correct because a held-out, independently curated test set with novel attack vectors avoids both data contamination and overfitting to the training distribution, giving a genuine estimate of generalization to unseen harmful inputs. Option (a) reuses training data, so the model has already been optimized on those exact prompts — good performance there reflects memorization, not robustness. Option (c) risks benchmark contamination: if the public benchmark was seen during pre-training or fine-tuning, scores are inflated and regressions on truly novel prompts would be missed. Option (d) measures over-refusal of benign requests, which is a complementary safety metric but tells you nothing about whether harmful requests are actually refused.
AI Engineering/evaluation-safety
In AI safety evaluation, _____ is the practice of generating adversarial prompts designed to elicit harmful or policy-violating outputs from a model, specifically to identify and fix safety vulnerabilities before deployment. The term originates from cybersecurity, where a team simulates attacks against a system to probe its defenses.#
Show answer
In AI safety evaluation, red-teaming is the practice of generating adversarial prompts designed to elicit harmful or policy-violating outputs from a model, specifically to identify and fix safety vulnerabilities before deployment. The term originates from cybersecurity, where a team simulates attacks against a system to probe its defenses.
Red-teaming is the standard term for adversarially probing an LLM to surface safety failures before deployment. It borrows the cybersecurity concept of a 'red team' that simulates attacks. In practice, red-teams craft jailbreaks, prompt injections, and socially engineered requests to measure attack success rate (ASR) and identify guardrail weaknesses. The accept list covers the hyphenated, spaced, and standalone variants since all are in common use.
AI Engineering/evaluation-safety/hallucination
You are evaluating an LLM-based RAG system for hallucination. Which of the following metrics or techniques directly measure whether the model's output is grounded in the retrieved context, as opposed to measuring general output quality?#
Options
Pick every one that applies.
Show answer
The metrics that directly measure groundedness in retrieved context are faithfulness score (fraction of claims entailed by retrieved passages), attribution/citation recall (each factual sentence must cite a source), and NLI-based entailment (classifying output sentences as Entailed/Neutral/Contradicted by the context). ROUGE-L measures lexical overlap with a reference answer, not source grounding, and perplexity measures language-model fit to a corpus — neither targets hallucination relative to retrieval.
Faithfulness (a), attribution/citation recall (c), and NLI-based entailment (e) all directly ask: 'Is the model's claim supported by the retrieved context?' — the core definition of groundedness. ROUGE-L (b) measures lexical overlap against a reference answer, not against the retrieved context, so it detects recall-style quality, not hallucination relative to sources. Perplexity (d) is a language-modelling metric that has no connection to retrieval grounding whatsoever. A system can have low perplexity and still hallucinate facts not in any retrieved passage.
AI Engineering/evaluation-safety/hallucination
Describe the Self-Consistency decoding technique (Wang et al., 2022) and explain how it can be used as a proxy signal for detecting potential hallucinations in chain-of-thought reasoning. What is its key limitation when used for this purpose?#
Show answer
Self-Consistency samples multiple independent chain-of-thought reasoning paths from the model for the same prompt (using temperature > 0) and then takes a majority vote over the final answers. If the model's answers are highly consistent across samples, that suggests the model has strong, well-grounded beliefs; if they are inconsistent or spread across many different answers, it signals the model is uncertain or potentially confabulating. As a hallucination proxy, low self-consistency (high entropy over sampled answers) is treated as a risk flag. The key limitation is that a model can be consistently wrong — it may hallucinate the same false fact confidently across all samples (especially for facts baked into its weights), so high consistency does not guarantee correctness or factual grounding.
Self-Consistency (Wang et al., 2022) leverages the intuition that correct reasoning paths tend to converge. For hallucination detection, inconsistency across samples is a useful uncertainty signal. However, the critical failure mode is systematic hallucination: if incorrect knowledge is strongly encoded in model weights, all sampled paths will agree on the wrong answer, yielding high consistency but a hallucinated output. This 'confident but wrong' failure is why self-consistency alone is insufficient for hallucination mitigation without external grounding.
AI Engineering/evaluation-safety/hallucination
A team is building a production hallucination-mitigation pipeline for an LLM application. Arrange the following pipeline stages in the most defensible runtime + deployment lifecycle order, from the first action taken (earliest in the workflow) to the last.#
Put these in order
Show answer
The correct order is: (1) Offline red-teaming & benchmarking → (2) RAG retrieval → (3) Prompt assembly with grounding instruction → (4) Post-generation faithfulness check → (5) Human-in-the-loop review. Red-teaming happens before deployment; at runtime, retrieval must occur first so documents can be injected into the grounded prompt; automated NLI checking filters outputs before the costliest step, human review, is invoked.
The defensible order is: (a) Pre-deployment red-teaming establishes the baseline hallucination rate and determines whether the system is ready for production — this is the very first lifecycle step. (b) At runtime, RAG retrieval fires first when a user query arrives: the system must fetch relevant documents before it can compose a meaningful grounded prompt. (c) Prompt assembly with the grounding instruction comes next — only after the retrieved documents exist can they be injected alongside the system instruction into the final prompt sent to the LLM; the instruction explicitly references 'the provided context,' so it is necessarily assembled after retrieval. (d) Once the LLM generates a response, a post-generation NLI faithfulness check verifies claims against the retrieved sources and flags low-scoring outputs. (e) Only after automated checks flag a response is it escalated to a human reviewer — the most expensive layer and therefore the last resort in the funnel.
AI Engineering/evaluation-safety/hallucination
You need to reduce hallucinations in a factual Q&A assistant. Which of the following meaningfully reduce or detect ungrounded answers?#
Options
Pick every one that applies.
Show answer
What meaningfully reduces or detects ungrounded answers is grounding answers in retrieved sources with an instruction to answer only from them, allowing the model to say it does not know when the context lacks the answer, and requiring citations whose claims you verify against the retrieved text. These anchor the model to checkable evidence. Raising temperature makes confident fabrication more likely, and a bare instruction to never hallucinate is unenforceable wishful thinking.
Hallucination drops when the model is anchored to real evidence: retrieval-grounding with an instruction to answer only from context (a) constrains it to supported claims. An explicit "I don't know" escape hatch (b) gives the model a correct option other than fabricating, which it otherwise tends to avoid. Citation + verification (c) turns grounding into something you can check, catching claims that aren't actually supported. Raising temperature (d) increases randomness and makes confident fabrication more likely, not less. A bare instruction to "never hallucinate" (e) is wishful — the model has no reliable internal signal of its own factuality, so an unenforceable command doesn't change behavior in a measurable way; grounding and verification do.
AI Engineering/evaluation-safety/hallucination
Adding RAG to a feature eliminates hallucination because the model now answers from retrieved documents instead of its own weights.#
Options
Show answer
False. RAG reduces hallucination by grounding answers in retrieved context, but it does not eliminate it. The model can still ignore the context, blend it with parametric knowledge, mis-attribute a fact, or confidently extrapolate when retrieval returns nothing relevant. Production RAG needs grounding guardrails: instruct the model to answer only from context and say it does not know otherwise, require citations, and run faithfulness evals to catch ungrounded claims.
RAG reduces hallucination by grounding answers in retrieved context, but it does not eliminate it. The model can still ignore the context, blend it with parametric knowledge, mis-attribute a fact to the wrong source, or confidently extrapolate when retrieval returns nothing relevant. Production RAG needs grounding guardrails — instruct the model to answer only from context and say "I don't know" otherwise, require citations, and run faithfulness/groundedness evals to catch ungrounded claims.
AI Engineering/evaluation-safety/llm-eval
You're shipping an LLM feature and need to know if a prompt change is an improvement. Outline how you'd evaluate it, and one pitfall of using an LLM as a judge.#
Show answer
Build an offline eval set of representative inputs with known-good expectations, then score each candidate prompt against it — using exact/programmatic checks where possible (does it parse, does it match the schema, is the retrieved fact present) and an LLM-as-judge with a rubric for open-ended quality. Compare versions on the same dataset so changes are measurable rather than vibes, and track regressions over time. A key pitfall of LLM-as-judge is bias: judges favor longer or more verbose answers, can be inconsistent run-to-run, and may rate their own model's style higher, so you should calibrate the judge against human labels and pin its temperature.
Treat prompts like code: a versioned eval dataset with deterministic checks plus an LLM judge for subjective dimensions, run on every change so you catch regressions instead of guessing. LLM judges are useful but biased — they reward verbosity, drift between runs, and can prefer their own family's outputs — so anchor the judge to human-labeled examples, use a strict rubric, and keep its temperature low. Eyeballing a handful of outputs is not evaluation.
AI Engineering/evaluation-safety/hallucination
You are designing a hallucination-detection pipeline for a retrieval-augmented generation (RAG) system deployed in a high-stakes medical Q&A product. The system retrieves passages from a verified document corpus and generates answers with a large language model.#
Options
Pick every one that applies.
Show answer
The well-founded strategies are SelfCheckGPT (inter-sample consistency), Chain-of-Verification (self-auditing via sub-questions), NLI-based attribution scoring (entailment against retrieved passages), and Semantic Entropy (meaning-level uncertainty). Perplexity thresholding is not reliable: RLHF/fine-tuned models can produce low-perplexity yet factually wrong text, making a fixed threshold an ineffective hallucination detector.
SelfCheckGPT (Manakul et al., 2023) exploits the observation that a model is more consistent across samples when it 'knows' a fact, making consistency a cheap hallucination proxy. Chain-of-Verification (Dhuliawala et al., 2023) forces the model to self-audit its claims via targeted sub-questions, catching internal contradictions. NLI-based attribution scoring directly checks whether each generated claim is textually entailed by retrieved evidence — the gold standard for RAG attribution. Semantic entropy (Kuhn et al., 2023) measures uncertainty at the meaning level, not the surface level, and correlates strongly with factual errors. Option C is incorrect: token-level perplexity reflects how surprising a sequence is to the model, but low perplexity can coincide with confident hallucinations (the model is confidently wrong), and the relationship is not reliable enough to use as a standalone factuality filter, especially with fine-tuned or RLHF-trained models whose perplexity distributions shift considerably.
AI Engineering/evaluation-safety/hallucination
In the Semantic Entropy framework for hallucination detection (Kuhn et al., NeurIPS 2023), why is it necessary to cluster generations by semantic equivalence before computing entropy, rather than computing entropy directly over the raw token-sequence distribution? What specific failure mode does naive token-level entropy suffer from in this context, and how does semantic clustering address it?#
Show answer
Computing entropy directly over the token-sequence distribution treats superficially different strings (e.g., 'The capital of France is Paris.' vs. 'Paris is France's capital.') as distinct outcomes, inflating entropy even when every sampled generation expresses the same fact. This is called surface-form variability: the model may be highly certain of a fact yet sample many paraphrases, yielding high token-level entropy that falsely signals factual uncertainty. Semantic clustering (using bidirectional NLI or embedding similarity) groups generations that are meaning-equivalent into the same cluster, then computes entropy over the cluster-probability distribution. This means a model that consistently outputs the same meaning — regardless of phrasing — will have low semantic entropy (low hallucination risk), whereas a model that generates contradictory meanings will have high entropy (high hallucination risk). The result is a calibrated, surface-form-invariant uncertainty estimate that correlates far better with actual factual accuracy than raw token or sequence probability entropy.
The core insight of Semantic Entropy is that language models can express one concept in many surface forms. Naive entropy over token sequences penalizes the model for linguistic diversity even when it is factually certain, leading to false positive hallucination flags. By clustering semantically equivalent generations (via NLI or dense embeddings) and computing entropy over those clusters, Semantic Entropy isolates epistemic uncertainty (does the model know the answer?) from linguistic variability (how many ways can it phrase the answer?). This distinction is critical in production RAG systems where the model may be paraphrase-diverse but factually consistent.
AI Engineering/evaluation-safety/hallucination
A senior AI engineer is building a production-grade hallucination evaluation harness for a long-form generation system. Place the following steps in the correct logical order to produce a rigorous, end-to-end attribution-based hallucination score for a batch of model outputs.#
Put these in order
Show answer
The correct order is: Collect model outputs → Claim decomposition → Evidence retrieval → NLI scoring → Aggregation → Calibration & threshold-setting. You must generate outputs first, then split them into atomic checkable claims, retrieve supporting evidence per claim, classify entailment, aggregate into a response-level score, and only then calibrate the detection threshold against human-annotated ground truth — calibration requires a fully defined scoring function.
The pipeline must start by collecting the model's raw outputs (F). These are then decomposed into atomic claims (A) so that attribution can be evaluated at the finest verifiable granularity — doing this at the paragraph level would conflate supported and unsupported claims. For each atomic claim, relevant evidence must be retrieved (B) before any inference can be drawn. The NLI model (C) then evaluates whether the retrieved evidence entails, contradicts, or is neutral to the claim. Individual claim labels are aggregated (D) into a scalar or structured response-level score. Finally, the score threshold is calibrated (E) against a gold human-annotation set so the detector operates at a meaningful precision/recall point for the target deployment context. Calibration must come last because it depends on having a complete scoring function and human-labelled ground truth.
AI Engineering/evaluation-safety/rag-eval-metrics
If a RAG answer scores perfectly on faithfulness, it is guaranteed to be a correct and complete answer to the user's question.#
Options
Show answer
False. Faithfulness measures only that every claim in the answer is supported by the retrieved context — that the model did not fabricate beyond its evidence. It says nothing about whether that context was the right or complete evidence, or whether the answer is on-topic. A perfectly faithful answer can still be irrelevant (faithfully summarizing the wrong passages) or incomplete (faithful to context that was missing the key fact because retrieval failed). That is why evals score faithfulness alongside answer relevance and retrieval metrics.
Faithfulness measures only that every claim in the answer is supported by the retrieved context — i.e. the model didn't fabricate beyond its evidence. It says nothing about whether that context was the right or complete evidence, nor whether the answer is on-topic. A perfectly faithful answer can still be (1) irrelevant — faithfully summarizing the wrong passages instead of answering the question (low answer relevance), or (2) incomplete or wrong — faithful to context that was itself missing the key fact because retrieval failed (low context recall). That's exactly why RAGAS-style evals score faithfulness alongside answer relevance and the retrieval metrics, instead of trusting any single one.
AI Engineering/ai-production/llm-observability
An LLM observability alert fires indicating a spike in user-reported bad answers. Order the triage steps from alert to actionable fix.#
Put these in order
Show answer
Triage the alert from coarse signal to fix in this order:
- Query the trace backend to isolate the request cohort that triggered the spike
- Inspect individual traces to identify which pipeline stage (retrieval, prompt construction, generation) correlates with failure
- Sample failing completions and classify the failure mode (hallucination, retrieval miss, format error, etc.)
- Reproduce the most common failure locally with a minimal prompt and document the root cause
- Ship a targeted fix (prompt patch, retrieval config change, or guard) and confirm the alert clears on the next production window
Triage moves from the coarse signal to the atomic cause: isolate the cohort (time window, model version, experiment arm) from traces so you are not analysing noise; find the stage where the failure is concentrated — retrieval misses and generation errors need different fixes; classify the failure mode by sampling actual bad completions, because the same symptom can have multiple causes; reproduce locally to confirm the root cause in a controlled environment before writing any fix; and verify the fix in production by confirming the alert clears — a fix that only passes local evals but leaves the alert firing means something else is wrong.
AI Engineering/evaluation-safety
An AI team is building an automated safety evaluation harness for their production LLM. They use an LLM-as-judge (a separate, larger model from the same model family) to classify whether each model response to 5,000 adversarial prompts is 'safe' or 'unsafe.' They observe a 99.2% safety rate on the eval set but receive multiple user reports of unsafe behavior in production.#
Options
Pick every one that applies.
Show answer
The gap can be explained by correlated blind spots between a same-family judge and the model under test, distribution shift between static eval prompts and production inputs, single-turn evaluation missing multi-turn jailbreak patterns, and benchmark contamination where the model pattern-matches to refusal on known prompts while remaining vulnerable to paraphrases. Lowering the judge's temperature to 0 does not guarantee catching all unsafe outputs — temperature controls sampling, not accuracy.
(a) is correct: when the judge and the model-under-test share training data and architecture, they tend to have correlated failure modes — content that the model produces unsafely is also content the judge fails to flag as unsafe. This is a well-documented concern in LLM-as-judge safety evaluation. (b) is correct: static curated eval sets cannot cover the full distribution of production inputs, and novel adversarial techniques (multi-turn jailbreaks, encoding tricks, persona-based attacks) that emerge after the eval set was created will not be caught. (c) is correct: single-turn evaluation misses multi-turn attack patterns where each individual turn appears benign but the conversation trajectory progressively erodes the model's safety guardrails — a known limitation of single-turn safety benchmarks. (d) is incorrect: lowering the judge's temperature to 0 makes its scoring deterministic but does not guarantee correctness. A temperature-0 judge can still systematically fail to identify unsafe content due to capability gaps, prompt-engineering flaws, or shared blind spots with the model under test — temperature controls sampling stochasticity, not accuracy. (e) is correct: benchmark contamination is a well-recognized problem. If the model saw the exact safety test prompts during pretraining, it may learn to refuse those specific strings without generalizing the underlying safety principle, causing inflated eval scores that don't reflect robustness to paraphrased or restructured variants of the same attack.
Related interview questions
Job market
See ai-engineering salaries and hiring demand from live job postings.
The other 1 question
This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 1 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan