AI Engineering interview questions: LLM evaluation and safety

Reviewed by Mark Dickie · Last updated

5 questions on this page you can answer and see marked on the spot. Go to the first one

AI engineering is the work of building products on top of large language models, and evaluation is the topic interviewers probe hardest. You should be able to say how you would measure answer quality before a release, how you would catch a regression after a prompt or model change, and how you would test for unsafe output or data leakage. Strong answers name a method you have run, such as a labeled golden set scored by exact match or rubric, or an LLM judge that you checked against human labels.

TopicWhat to explainConcrete example to name
Golden setHow you build and version the labeled test casesSampled production queries, labeled by two reviewers, stored with the prompt version they were run against
LLM-as-judgeHow the judge is prompted and how you check its agreement with peoplePairwise comparison with position swapped, agreement measured against a human-labeled subset
Regression gatingWhat blocks a deployA change to the system prompt fails CI if the golden-set pass rate drops below the last release
Prompt injectionHow untrusted text in retrieved documents can override instructionsAn indirect injection planted in a web page the agent summarizes, then tested in an adversarial suite
PII leakageHow you detect personal data in outputs and logsRegex and classifier scans on responses, plus canary strings planted in the system prompt
HallucinationHow you check claims against the sourceCitation-required answers, checked by a grounding judge that sees the retrieved passages

What does an AI engineering evaluation question test?

Interviewers want to see that you can design the test, not only name the metric. For each question, decide what a failure looks like, how you would detect it, and what you would do when the score moves.

  1. Write a rubric for one output type, such as a support answer, and list the failures it must catch.
  2. Build a small golden set from real queries, then score two prompt versions and explain which change you would ship.
  3. Plant a prompt injection in a retrieved document and show whether your guardrail or model refuses it.
  4. Audit a judge model by measuring how often it agrees with your human reviewers on the cases where they disagree with each other.

Key facts

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

At a glance

Questions10 shown · 37 in the bank
Difficulty2–5 of 5
FormatsOrdering, Code output, Multiple choice, True / false, Short answer, Flashcard, Fill in the blank, Find the bug, Multiple answer

What you'll review

  1. llm eval
  2. eval datasets
  3. rag eval metrics
  4. model routing
  5. agent loops

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

Order the stages of standing up evaluation for a new LLM feature so you can ship and iterate with confidence.#

Put these in order

Show answer

Stand up evaluation in this order:

  1. Define the task and success criteria / metrics
  2. Build a representative eval dataset with expected outcomes
  3. Run candidate prompts/models against the dataset and score them
  4. Compare results and pick the best variant
  5. Monitor live outputs in production and feed failures back into the eval set
Why:

Evaluation starts by defining what good means (criteria/metrics), then assembling a representative dataset of inputs with expected outcomes. You score candidate variants against it, compare and select the winner, and finally monitor in production, routing real-world failures back into the dataset so the eval set hardens over time. Skipping the dataset step is the classic mistake — you can't iterate on quality you don't measure.

A small evaluation script scores a model's answers with normalized exact match. What does it print?#

def normalize(s):
    return " ".join(s.lower().strip().split())

preds = ["Paris", " paris ", "London", "new  york", "Berlin"]
golds = ["Paris", "Paris", "London", "New York", "Rome"]

score = sum(normalize(p) == normalize(g) for p, g in zip(preds, golds)) / len(golds)
print(f"{score:.2f}")
Show answer
0.80
Why:

normalize lowercases, strips outer whitespace, and collapses internal runs of whitespace into single spaces. Comparing pairs after normalization: 'Paris' matches 'Paris'; ' paris ' matches 'Paris'; 'London' matches 'London'; 'new york' normalizes to 'new york', which matches 'New York'; and 'Berlin' does not match 'Rome'. That gives 4 matches out of 5 pairs, i.e. 0.8, which the f-string formats with two decimal places as 0.80.

You change a production prompt to fix one class of failure. Before shipping, how do you confirm the change is a net improvement and did not quietly break cases that used to work?#

Options

Show answer

Run both the old and new prompt against a versioned golden set of representative cases with expected outcomes, score each, and compare, gating on any regression before shipping. The golden set catches regressions before they reach users and localizes which cases changed. Watching the live thumbs-down rate is post-hoc, slow, and noisy; eyeballing a handful of outputs misses the long tail you were already passing; and temperature is unrelated to whether the new prompt is better.

Why:

A golden set is a versioned, labeled dataset of representative inputs with known-good expectations; running both prompt versions against it and comparing scores catches regressions before they ship and localizes which cases changed. Watching the live thumbs-down rate is post-hoc, slow, and noisy — it only tells you something broke after real users hit it, and can't isolate the regressed cases. Eyeballing a handful doesn't cover the long tail you were already passing. Temperature is unrelated to whether the new prompt is actually better.

Running an online A/B test of a new prompt on live production traffic removes the need for an offline golden eval set, because real users provide the ground truth directly.#

Options

Show answer

False. An A/B test measures online outcome metrics on live traffic, which is valuable but slow, noisy, confounded by traffic mix, and only observable after you have already exposed real users to the change. It gives no labeled ground truth on known-hard cases, cannot catch a regression before it ships, and cannot tell you which inputs broke. An offline golden set is the pre-ship regression gate; A/B testing complements it rather than replacing it.

Why:

An A/B test measures online outcome metrics (engagement, task success, thumbs-up) on live traffic — valuable, but slow, noisy, confounded by traffic mix, and only observable after you have already exposed real users to the change. It gives you no labeled ground truth on known-hard cases, can't catch a regression before it ships, and can't tell you which inputs broke. An offline golden set — versioned, labeled, and run in CI on every change — is the pre-ship regression gate. A/B testing complements it (does the improvement hold up with real users?); it does not replace it.

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.

Why:

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.

What is "LLM-as-judge" evaluation, and what are its main pitfalls?#

Show answer

LLM-as-judge uses a (usually strong) model to score or compare outputs against a rubric — e.g. rating faithfulness, relevance, or picking the better of two responses — so you can evaluate open-ended generations at scale where exact-match metrics fail. Pitfalls: positional/verbosity/self-preference bias (favoring the first option, longer answers, or its own family), rubric ambiguity producing noisy scores, cost/latency of judging at scale, and drift when the judge model changes. Mitigate with clear rubrics and few-shot anchors, randomized option order, pairwise comparisons over absolute scores, and calibrating the judge against a human-labeled gold set.

Why:

LLM-as-judge unlocks scalable evaluation of subjective/open-ended outputs, but it's a measurement instrument that must itself be validated against human labels and de-biased — otherwise you optimize toward the judge's quirks rather than real quality.

You ship prompt changes weekly and need a scalable regression check on answer quality for open-ended summaries, where exact-match scoring is meaningless. Which evaluation approach is the most appropriate primary method, and what is its key caveat?#

Options

Show answer

Use LLM-as-judge scoring against a rubric on a fixed eval set; the key caveat is that the judge can be biased and must itself be validated against human labels. For open-ended generation it scales and correlates reasonably with human judgment when given a clear rubric, but the judge is a fallible model with known biases (position, verbosity, self-preference). Exact match and BLEU penalize valid paraphrases, and reading every output manually does not scale to weekly iteration.

Why:

For open-ended generation, LLM-as-judge over a fixed, versioned eval set scales and correlates reasonably with human judgment when you give the judge a clear rubric and, ideally, a reference answer. The essential caveat is that the judge is itself a fallible model — it shows known biases (position bias, verbosity/length bias, self-preference) — so you must validate it against a sample of human labels and re-check when you change the judge model. Exact match fails by design for free-form text where many wordings are equally correct. BLEU against a single reference was built for machine translation and penalizes valid paraphrases; its weakness is poor correlation with quality on summaries, not speed. Reading every output manually does not scale to weekly iteration; spot-checking belongs alongside an automated eval, not as the primary gate.

In component-wise RAG evaluation, two retrieval-stage metrics are context _____ (are the retrieved passages relevant?) and context _____ (were all the passages needed to answer actually retrieved?). On the generation side, _____ measures whether every claim in the answer is supported by the retrieved context.#

Show answer

In component-wise RAG evaluation, two retrieval-stage metrics are context precision (are the retrieved passages relevant?) and context recall (were all the passages needed to answer actually retrieved?). On the generation side, faithfulness measures whether every claim in the answer is supported by the retrieved context.

Why:

Context precision = relevance/signal of the retrieved passages (relevant ones ranked high); context recall = coverage (did retrieval fetch everything needed, usually checked against a reference answer). Faithfulness (a.k.a. groundedness) = the share of the answer's claims entailed by the retrieved context — the anti-hallucination signal. The fourth common metric, answer relevance, checks that the answer actually addresses the question. Splitting retrieval metrics from generation metrics is what lets you attribute a failure to the right stage.

This cascade is meant to escalate to the strong tier whenever the cheap tier's answer isn't good enough, not just when the call errors. Which line lets a wrong-but-successful cheap-tier answer through unescalated?#

async function answerQuery(query: string): Promise<string> {
  try {
    const cheap = await callModel("cheap-tier", query);
    return cheap.text;
  } catch {
    const strong = await callModel("strong-tier", query);
    return strong.text;
  }
}
Show answer

The bug is on line 4.

Why:

Line 4 returns the cheap tier's text the instant the call succeeds, with no check on whether the answer is actually any good. The catch block only fires on a thrown exception — a timeout, a 5xx, a malformed-request error — never on a response that came back fine but is low-confidence, off-topic, or simply wrong. Cascades work specifically because escalation is driven by a quality/confidence signal on the cheap tier's real output — a verifier score, a self-consistency check, a validator against the expected shape, or the model's own confidence — not by whether an exception was thrown (this is the core idea behind cascade-based serving approaches like FrugalGPT). As written, this code silently serves bad answers from the cheap tier on exactly the hard requests it was supposed to catch and escalate, while only ever escalating for unrelated infrastructure failures. The fix is to score cheap.text against a threshold after line 4 and route to the strong tier when it doesn't clear it.

You want an agent loop covered by tests that run on every pull request, with no live model or tool calls. Which of these make that possible? Select all that apply.#

Options

Pick every one that applies.

Show answer

Inject the tools and the model client so a test can drive a scripted run, assert on the sequence of tool calls rather than the model's prose, and keep the loop's control logic free of network calls so the step cap and stop condition are ordinary unit-testable functions. Together these cover the paths hardest to trigger live — a tool 500, a malformed argument, a run that hits its cap. Calling the real model at temperature 0 is not a substitute: it reduces variance without guaranteeing identical output, and it puts network access and spend on every pull request.

Why:

Agent loops are testable to the exact degree that the loop is separable from the two things that make it non-deterministic and slow. Injecting tool implementations and the model client is what lets a test drive the loop through a scripted run — including the paths that matter most and are hardest to trigger live: a tool 500, a malformed argument, an unterminated run hitting the step cap. Asserting on the call sequence rather than the prose gives you a stable oracle, because "which tools, with what arguments, in what order" is the loop's actual behaviour; the wording of the final answer is not. Keeping control logic network-free means the step cap and stop condition are ordinary functions with ordinary unit tests. Setting temperature to 0 and calling the real model is the trap: temperature 0 reduces variance but does not guarantee identical output — batching and floating-point non-determinism on the provider's side still shift results, models are updated underneath you, and the test now needs network access and a budget on every pull request. Reproducible-looking beats reproducible right up until it flakes in someone else's branch.

Related interview questions

Job market

See ai-engineering salaries and hiring demand from live job postings.

The other 27 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 27 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.