AI Engineering Interview Questions: Evaluation & Safety
Reviewed by Mark Dickie · Last updated
6 questions on this page you can answer and see marked on the spot. Go to the first one
AI engineering is the discipline of designing, evaluating, and deploying machine learning systems, and the evaluation-safety subfield covers the methods that keep those systems both accurate and non-harmful. For an interview you should know how to measure model quality with automatic metrics and human evaluation. You should also understand where those metrics break down, and how alignment methods like RLHF and DPO change model behavior. Expect questions on red-teaming, bias auditing, and the guardrail patterns that filter unsafe outputs before they reach a user.
What does an AI engineering interview test for evaluation and safety?
Interviewers check whether you can reason about model quality beyond a single accuracy number. You need to pick the right evaluation method for a given task, explain where metrics break down, and describe the standard safety mechanisms. The core techniques:
- RLHF: trains a reward model on human preference pairs, then fine-tunes the policy with reinforcement learning.
- DPO: skips the separate reward model and optimizes directly on preference data.
- Red-teaming: adversarially probes the model for harmful, biased, or jailbreak prompts before deployment.
- Guardrails: runtime filters that block or rewrite unsafe content before it reaches the end user.
How do you evaluate an LLM in production?
The evaluation toolkit spans cheap automated checks to expensive human ratings. You should be able to compare these on the spot:
| Method | What it measures | Trade-offs |
|---|---|---|
| BLEU / ROUGE | N-gram overlap with a reference | Cheap, but misses semantic quality |
| Perplexity | How well the model predicts tokens | Good for base models, less useful for instruction-tuned ones |
| LLM-as-judge | Rubric-based scoring by another model | Scales well, but inherits the judge model's biases |
| Human evaluation | Fluency, relevance, helpfulness | The gold standard, but expensive and slow |
| Benchmark suites (HELM, MMLU) | Performance across many tasks | Good for comparison, but can be gamed |
Key facts
- Tarmac has 130 AI Engineering interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 2,298 job postings asking for AI Engineering in September 2026.
- Roles asking for AI Engineering advertise a median base salary of US$180,000, across 793 job postings as of September 2026.
- Tarmac last reviewed these AI Engineering interview questions on 12 October 2026.
At a glance
| Questions | 10 shown · 130 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Multiple choice, Fill in the blank, Multiple answer, Find the bug, Short answer |
What you'll review
- evaluation safety
- guardrails
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
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.
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.
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.
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.
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. Reusing training data means the model has already been optimized on those exact prompts — good performance there reflects memorization, not robustness. Using a well-known public safety benchmark without checking whether those prompts appeared in the training data 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. Evaluating only on benign prompts and measuring the false-refusal rate measures over-refusal of benign requests, which is a complementary safety metric but tells you nothing about whether harmful requests are actually refused.
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.
You are building an automated evaluation pipeline that uses GPT-4 as an LLM-as-a-judge to score candidate model responses on a benchmark. Which of the following are documented, systematic biases that LLM judges exhibit and that you must account for when designing this pipeline?#
Options
Pick every one that applies.
Show answer
The three documented systematic biases are position bias (higher scores for the first-presented answer), verbosity bias (longer answers rated higher regardless of quality), and self-enhancement bias (same-family model outputs rated more favourably). These are empirically demonstrated in the MT-Bench and Chatbot Arena literature. Calibration drift from temperature sampling and sycophancy leakage are not the same phenomenon — they describe target-model behaviour, not judge-model structural bias.
LLM-as-a-judge is a popular evaluation technique, but it has well-documented systematic biases. Studies (e.g., from Zheng et al. 2023 on MT-Bench) show that GPT-4 and similar judges exhibit (1) position bias — preferring the first answer shown, (2) verbosity bias — favouring longer answers regardless of correctness, and (3) self-enhancement bias — rating outputs from models of the same family higher. Calibration drift and sycophancy are real but are properties of the target model, not the judge. The key insight for senior engineers is that using a single LLM judge without positional swapping, length normalization, or multi-judge consensus will silently skew evaluation results.
The following Python guardrail function uses the OpenAI Moderation API (SDK v1+) to block policy-violating user messages before they reach an LLM. It contains one bug that causes a runtime error on every call. Identify the buggy line.#
import openai
def moderate(user_message: str) -> str | None:
client = openai.OpenAI()
results = client.moderations.create(input=user_message)
if results[0]['flagged']:
return None # block the message
return user_message
def chat(user_message: str) -> str:
safe_message = moderate(user_message)
response = openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": safe_message}]
)
return response.choices[0].message.contentShow answer
The bug is on line 6.
The FIND_THE_BUG here targets a subtle but critical mistake: the moderate function calls openai.Moderation.create but then checks results[0]['flagged'] using dict-style access on a Pydantic model object returned by the newer OpenAI Python SDK (v1+). The correct attribute access is results.results[0].flagged (dot notation on the model object). Additionally, the guard short-circuits on None return but the caller never checks for None, meaning a flagged message silently disappears without raising an error or returning a meaningful response — but the primary code-level bug is the results[0]['flagged'] dict access which raises a TypeError at runtime with the v1 SDK. The buggy line is line 6.
In a production LLM application with a RAG pipeline, your security review flags two distinct failure modes:#
Show answer
A single input guardrail catches malicious user queries (prompt injection) but cannot intercept PII that the model extracts from retrieved documents and embeds in its response — the violation happens after the LLM call. Conversely, a single output guardrail can redact PII in responses but allows the injected prompt to reach the model, risking system-prompt override or data exfiltration during generation. The minimum architecture requires: (1) an input guardrail applied before the LLM call that detects prompt-injection patterns, validates query intent, and sanitises user input; and (2) an output guardrail applied after the LLM call that scans the generated response for PII (using regex, NER, or a classifier), policy violations, and hallucinated citations before returning to the user. Both layers must be independent so a bypass of one does not compromise the other.
This question tests deep knowledge of layered guardrail architecture. Input guardrails run before the LLM call to block malicious or off-topic prompts. Output guardrails run after the LLM response to catch hallucinations, PII leakage, or policy violations before delivery to the user. A correct defence-in-depth pipeline therefore needs both layers. Relying only on input guardrails misses prompt-injection-induced unsafe outputs; relying only on output guardrails still allows prompt injection to reach the model, wasting compute and risking data exfiltration. Grounding checks (RAG relevance) are an output-side concern. Rate limiting is an infrastructure concern orthogonal to content safety. A well-designed system applies: (1) input validation → (2) LLM call → (3) output validation, with each stage having independent failure modes.
A team uses Claude 3.5 Sonnet as an LLM-as-judge to evaluate the safety of refusal responses produced by two models: Claude 3 Haiku (same model family) and GPT-4o (different family). Independent human re-annotation reveals that the judge consistently rates Claude 3 Haiku's borderline refusals as "safe" more often than humans do, while flagging GPT-4o's structurally similar borderline refusals as "unsafe" more often. No statistically significant difference in refusal length or response ordering is present. Which well-documented LLM-as-judge bias best explains this discrepancy?#
Options
Show answer
The discrepancy is best explained by self-preference bias: LLM judges tend to rate outputs from models sharing their own training lineage more favorably, independent of content quality. Because the judge and the Claude 3 Haiku model share training data and stylistic patterns, the judge perceives same-family refusals as more natural and rates them more leniently, while applying a stricter standard to the structurally similar GPT-4o refusals.
Self-preference bias (documented by Panickssery et al., 2024, and others) is the tendency for an LLM judge to prefer outputs produced by models in its own family, because shared training data and stylistic patterns make same-family outputs feel more natural or higher-quality to the judge. The scenario controls for the two most common confounds — position bias and length bias — by stating there is no significant difference in ordering or length. Calibration drift refers to threshold instability across a batch, which is unrelated to the model-identity correlation described. The pattern of same-family leniency and cross-family strictness is the hallmark signature of self-preference bias.
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.
The judge model sharing architectural lineage and training data with the model under test 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. The eval prompt distribution being static and curated while production inputs exhibit distribution shift 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. The harness evaluating only single-turn interactions 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. Setting the judge model's temperature to 0 for deterministic scoring 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. The eval set being drawn from public benchmarks that the model under test may have encountered during pretraining 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 120 questions
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 120 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