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:

  1. RLHF: trains a reward model on human preference pairs, then fine-tunes the policy with reinforcement learning.
  2. DPO: skips the separate reward model and optimizes directly on preference data.
  3. Red-teaming: adversarially probes the model for harmful, biased, or jailbreak prompts before deployment.
  4. 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:

MethodWhat it measuresTrade-offs
BLEU / ROUGEN-gram overlap with a referenceCheap, but misses semantic quality
PerplexityHow well the model predicts tokensGood for base models, less useful for instruction-tuned ones
LLM-as-judgeRubric-based scoring by another modelScales well, but inherits the judge model's biases
Human evaluationFluency, relevance, helpfulnessThe gold standard, but expensive and slow
Benchmark suites (HELM, MMLU)Performance across many tasksGood for comparison, but can be gamed

Key facts

  • Tarmac has 136 AI Engineering interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 2,397 job postings asking for AI Engineering in November 2026.
  • Roles asking for AI Engineering advertise a median base salary of £80,000, across 622 job postings as of November 2026.
  • Tarmac last reviewed these AI Engineering interview questions on 12 October 2026.

At a glance

Questions10 shown · 136 in the bank
Difficulty1–5 of 5
FormatsTrue / false, Multiple choice, Fill in the blank, Multiple answer, Find the bug, Short answer

What you'll review

  1. evaluation safety
  2. 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.

Why:

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.

Why:

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 group of testers plays the role of an opposing force, borrowing the military and security-exercise metaphor in which a team acts as the attacker against defenders. Its members craft inputs to elicit harmful, biased, or policy-violating outputs so weaknesses are found and fixed before deployment. This practice is called _____.#

Show answer

In LLM safety evaluation, a group of testers plays the role of an opposing force, borrowing the military and security-exercise metaphor in which a team acts as the attacker against defenders. Its members craft inputs to elicit harmful, biased, or policy-violating outputs so weaknesses are found and fixed before deployment. This practice is called red teaming.

Why:

The practice is called red teaming, also written red-teaming, or referred to as a red team when the group itself is meant. The prompt pins the term through its military and security-exercise metaphor, in which a team plays the opposing force that attacks defenders, which is the origin of the name. In LLM work, such testers try to bypass guardrails with jailbreaks, prompt injections, and edge-case inputs, and the findings improve alignment, filters, or system prompts before real users meet the failures. This differs from benign evaluation, which measures standard capability and quality on representative, non-adversarial inputs.

You are building a regression test that compares a previous and a new version of an LLM chatbot on refusing harmful requests. Which design choice is essential so that a score difference between the two versions reflects a change in the model rather than a change in the test?#

Options

Show answer

Running both model versions on the same fixed, versioned set of harmful prompts is the essential design choice for a safety regression test. Because the inputs are identical across runs, any change in refusal rate can be attributed to the model itself rather than to different prompts. Regenerating prompts each run or reusing training data would confound the comparison.

Why:

A regression test detects change only if the inputs stay constant between versions. Running both the previous and new model on the same fixed, versioned set of harmful prompts makes any difference in refusal rate attributable to the model. Regenerating a new set with novel attacks on every run changes the inputs between comparisons, so score differences could come from the test rather than the model. Reusing prompts from the safety fine-tuning dataset measures memorization of trained examples rather than generalized refusal behavior. Measuring only the false-refusal rate on benign prompts captures over-refusal, not whether harmful requests are refused, so it cannot detect a drop in refusals of harmful requests.

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.

Why:

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. Which of the following are systematic judge biases that have been documented in published LLM-as-a-judge studies (for example, Zheng et al. 2023 on MT-Bench)?#

Options

Pick every one that applies.

Show answer

Position bias, verbosity bias, and self-enhancement bias are all documented systematic biases of LLM judges such as GPT-4. Position bias means verdicts can shift with presentation order, verbosity bias favors longer responses regardless of quality, and self-enhancement bias favors outputs from the judge's own model family. A reverse-order rule that always favors the second response is not a documented finding.

Why:

Three biases are documented in published LLM-as-a-judge work. Zheng et al. (2023) report position bias, where the verdict depends on presentation order; the direction varies by judge (GPT-4 mostly favored the first position, and Claude-v1 showed a strong first-position preference), so the bias is framed as order sensitivity rather than a fixed direction. They also report verbosity bias, where longer answers are favored regardless of correctness, and self-enhancement bias, where a model rates outputs from its own family higher. The claim that the judge always favors the second-presented response is clearly wrong, since the documented finding is a first-position preference for GPT-4 and Claude-v1, and it is not a universal rule for any judge.

The following Python guardrail code uses the OpenAI Moderation API (openai 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:
    client = openai.OpenAI()
    safe_message = moderate(user_message)
    if safe_message is None:
        return "Your message was blocked by the content policy."
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": safe_message}]
    )
    return response.choices[0].message.content
Show answer

The bug is on line 6.

Why:

Line 6 indexes the object returned by client.moderations.create with results[0]. In the v1+ SDK that return value is a ModerationCreateResponse Pydantic model, not a list or dict, so it does not support subscripting. Every call to moderate therefore raises TypeError ('ModerationCreateResponse' object is not subscriptable) before any flag check runs. The correct access is results.results[0].flagged. The other lines are correct: line 5 uses the v1 client call, and chat handles a None return from moderate by returning a refusal, so the None check is present. Line 14 only runs when a message is blocked, so it is not a bug.

A production LLM application uses a RAG pipeline. Security review flags two failure modes:#

Show answer

An input guardrail runs before the LLM call and only sees the user's query, so it cannot observe PII that the model later copies from retrieved documents into its response. That PII only exists after generation, so the violation happens after the LLM call. The guardrail that addresses it is an output guardrail placed after the LLM call: it scans the generated response for PII (using regex, named-entity recognition, or a classifier) before the response is returned to the user. For failure mode 1, the input guardrail sits before the LLM call and screens the user query for prompt-injection patterns. Together these two layers form the request/response boundary, and each covers a failure mode the other cannot see.

Why:

The question is scoped to guardrails at the request and response boundary of the LLM call, so the answer is judged on that scope. An input guardrail runs before the LLM call and inspects only the user's query. PII in failure mode 2 comes from retrieved documents, which enter the prompt inside the pipeline and appear only in the model's output, so an input guardrail never sees it. The output guardrail runs after the LLM call and scans the generated response for PII before delivery, which is where that leak can be detected. The input guardrail is still needed for failure mode 1, because prompt injection in the user query must be screened before it reaches the model. The answer is therefore an input guardrail before the LLM call for injection and an output guardrail after the LLM call for PII.

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.

Why:

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.

Why:

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 126 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 126 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.