Interview prep · Article

Prompt Engineering Interview Questions (2026): 15 Production Scenarios With Answers

15 scenario questions about the prompt itself, each with what it tests, an answer outline sourced to vendor docs and papers, and a follow-up.

Key Takeaways

  • Most lists of prompt engineering interview questions ask for definitions: what is zero-shot, what is a system prompt. The questions engineers actually get in applied rounds start from a prompt that is failing in production and ask what you would change.
  • This guide gives 15 prompt engineering interview questions built on production symptoms: a brittle format, a cache hit rate that collapsed, a role prompt that may do nothing, a prompt that broke when the vendor changed. Each is tagged junior, mid or senior, with what it tests, an answer outline and a follow-up.
  • Where the evidence exists, the answers cite it: the format-sensitivity study, the persona study, the vendor docs on caching, prefill and reasoning models. Where an answer is engineering judgment, we say so.
  • None of the 15 is a main question in our paid interview kit. If you want the broader set, the free sample PDF has 12 of the kit's 120 questions with full answers.

Prompt engineering interview questions have changed. Two years ago the round asked you to define few-shot prompting. Now the interviewer describes a prompt that works on the demo and fails on real traffic, and watches how you narrow it down: what you would measure, what you would read in the API response, what you would rewrite, and how you would prove the rewrite helped. Below are 15 questions in that shape, with the answer structure that tends to land: name the likely causes, say how you would tell them apart, then say what you would change and how you would check it.

Illustration of an engineer comparing two versions of a prompt side by side on a screen, with a small chart of eval scores and a cache-hit gauge, while an interviewer takes notes
Debugging the prompt itself, not the system around it.

Each question has a level: junior, mid or senior, the depth where a good answer starts. Levels are our editorial judgment, not data from any employer. This page is about the prompt. If the failure is in retrieval, decoding or the pipeline, see our LLM interview questions guide; for the full loop (rounds, company types, coding), start with AI engineer interview questions.

Advertisement

Prompt Engineering Interview Questions on Format and Output

1. The model cannot count the letters in a word, and "exactly 120 characters" comes back at 131. Why, and what do you do? (junior)

What it tests: whether you know what the model actually sees, and whether you reach for a post-check instead of a stronger instruction.

Answer outline:

  • Explain the cause: the model works on tokens, not characters. OpenAI's tokenizer README puts it plainly: "Language models don't see text like you and I, instead they see a sequence of numbers (known as tokens)" (tiktoken). Letter counts and character lengths are not quantities the model observes directly.
  • Stop asking the prompt to do arithmetic it cannot see. Move hard constraints into code: count after generation, and retry, truncate or trim when the output misses.
  • Where the constraint is structural rather than numeric, use the vendor's schema feature. Anthropic's structured outputs "constrain Claude's responses to follow a specific schema" (Anthropic structured outputs). Schemas constrain shape, not character counts, so a length check still belongs in code.
  • Get close in the prompt ("about two sentences"), then enforce the exact limit in code.

Follow-up: The product manager wants a hard 120-character limit for a UI label. What is the full design? (Prompt for a short label, validate length in code, retry once with the measured length in the retry prompt, and fall back to a truncation rule with an ellipsis.)

2. Switching bullet points to a numbered list changed the outputs. How do you measure prompt brittleness before shipping? (mid)

What it tests: whether you know format sensitivity is real and measurable, not folklore.

Answer outline:

  • Cite the evidence. Sclar et al. found models "extremely sensitive to subtle changes in prompt formatting in few-shot settings", with "performance differences of up to 76 accuracy points" on one model they tested, and that the "sensitivity remains even when increasing model size, the number of few-shot examples, or performing instruction tuning" (Sclar et al., 2023). Those numbers are for the models in the paper, so measure your own.
  • Do what the authors recommend: evaluate across a set of plausible formats and report the range, not a single number. Generate 5 to 10 semantically identical variants (separators, casing, list style, section order) and run your eval on each.
  • Treat a wide range as a design smell. Narrow it by making structure explicit. Anthropic's guidance is that XML tags "help Claude parse complex prompts unambiguously, especially when your prompt mixes instructions, context, examples, and variable inputs" (Anthropic prompting best practices).
  • Pick the format with the best worst case, not the best single run, and freeze it in a template so a copy edit cannot change it silently. Vendors say as much in gentler words: Google's guide notes that "The order of the content in the prompt can sometimes affect the response" (Gemini prompting strategies), and Hugging Face's advice is to "Test your prompts with different models to assess their robustness" (Transformers prompting guide).

Follow-up: How much of this belongs in CI? (The variant set, at a small sample size, as a regression check; see question 14.)

3. The model wraps JSON in code fences about 3% of the time and the parser throws. Triage it. (mid)

What it tests: whether you treat a 3% failure as an incident with layers of defense, or as a prompt-wording problem.

Answer outline:

  • Stop the bleeding first: a parser that strips fences and leading prose is a one-line fix, and it turns a hard failure into a logged warning. Anthropic's own advice includes "If the occasional preamble slips through, strip it in post-processing" (Anthropic prompting best practices).
  • Then remove the cause. Use a schema-constrained mode where one exists: Anthropic lists "Parsing errors from invalid JSON syntax" as the problem structured outputs removes, and describes the result as "Always valid: No JSON parsing errors" (Anthropic structured outputs). The same page notes that unsupported features return "a 400 error with details", so check your schema against the limits.
  • Know the alternatives when schema mode is not available: ask for output inside XML tags, use tool calling to carry the object, or a stop sequence after the closing brace.
  • Check truncation too. A response cut off by the token limit is also invalid JSON. Log the stop reason and the output length with every parse failure, so the two causes are not confused.

Follow-up: You used an assistant prefill of an opening brace to force JSON. Why might that stop working? (See question 8: prefill is not supported on newer models of at least one vendor.)

4. "Do not mention competitors" keeps being violated. Why do negative instructions fail, and how do you rewrite them? (mid)

What it tests: whether you can turn a prohibition into a behavior the model can actually follow, and back it with a check.

Answer outline:

  • Lead with the vendor advice. Anthropic's best practices say to "Tell Claude what to do instead of what not to do", with the example of replacing "Do not use markdown in your response" with "Your response should be composed of smoothly flowing prose paragraphs" (Anthropic prompting best practices).
  • It is not one vendor's quirk. Hugging Face's guide lists the same rule: "Instructions should focus on 'what to do' rather than 'what not to do'" (Transformers prompting guide).
  • Explain the engineering intuition (this part is reasoning, not a measured claim): a negative instruction names the forbidden thing, which puts it in context, and gives no positive target to generate toward. An allow-list ("recommend only products from this list") gives both.
  • Add an output check for anything with legal or brand consequences: a competitor-name filter on the response, with a retry that includes the detected name and the rule.
  • Measure the violation rate before and after on the same test set. If the positive rewrite plus filter does not take it to zero, the fix is in the retrieval or examples that keep introducing competitor names.

Follow-up: The filter now blocks legitimate comparisons the user asked for. What changed in the requirement? (The rule was never "never mention"; agree the real policy with the product owner before encoding it.)

The paid AI Engineer Interview Kit covers the rest of the prompting chapter: what goes into a system prompt, when few-shot helps, testing structured output, prompt injection and migrating a model version, with full answers and follow-ups. The free sample has 12 questions from across the kit.

Cost, Latency and Caching

5. The system prompt grew to 6,000 tokens and the latency budget is 800 ms. Cut it without losing behavior. (mid)

What it tests: whether you know the levers besides deleting text: caching, ordering, moving material out of the prompt, changing model.

Answer outline:

  • Measure first: time to first token versus total time, and input tokens per request. A long static prefix is a caching candidate before it is a deletion candidate: Anthropic's launch post for the feature claims it reduces "costs by up to 90% and latency by up to 85% for long prompts" (Anthropic on prompt caching), an upper bound you only reach when the prefix is long and reused.
  • Order the prompt for the cache. Anthropic's caching "covers the full prefix: tools, system, and messages (in that order), up to and including the block designated with cache_control" (Anthropic prompt caching). OpenAI's guide says the same in spirit: put reusable examples and reference material before the user's changing input (OpenAI prompt engineering). Anything that changes per request goes last.
  • Move what does not need to be read every time: reference tables into retrieval, long policy text into a tool the model calls when relevant, rare-case instructions into a post-check.
  • Consider the model. Anthropic notes that "you can sometimes improve latency and cost more easily by choosing a different model" (Anthropic prompt engineering overview). Run the eval on a smaller model with the trimmed prompt before assuming you need the large one.

Follow-up: After the cut, one rare behavior regressed. How do you decide whether to put the text back? (Count how often the case occurs in traffic and compare the cost of a post-check or tool against the tokens the text would add to every call.)

6. Cache hit rate fell to 5% after someone added today's date to the system prompt. Explain and fix it. (mid)

What it tests: whether you can read the usage counters and reason about prefix caching.

Answer outline:

  • Read the evidence. On Anthropic's API, cache_read_input_tokens is the "Number of tokens retrieved from the cache for this request", and "if both cache_creation_input_tokens and cache_read_input_tokens are 0, the prompt was not cached" (Anthropic prompt caching). Plot those fields by hour and the drop will line up with the deploy.
  • Explain the mechanism. The cache is a prefix match, and the prefix runs tools, then system, then messages in order. A date near the top of the system prompt means the prefix differs every day, or every request if it includes the time. That the date is the culprit is a deduction from the prefix rule, so confirm it by diffing two requests.
  • Fix it by moving anything volatile after the cache breakpoint, or into the user turn. Also check for other invalidations: the docs say "Modifying tool definitions (names, descriptions, parameters) invalidates the entire cache".
  • Know the lifetime: "By default, the cache has a 5-minute lifetime. The cache is refreshed for no additional cost each time the cached content is used." Low-traffic routes may never hit anyway, which is a different problem.

Follow-up: Hit rate recovered to 60%, not the previous 90%. What else changed? (Look for a second volatile field, a tool definition edit, or shorter prompts that fall under the minimum cacheable length: the docs say "Shorter prompts cannot be cached, even if marked with cache_control".)

Behavior Across Models, Languages and Turns

7. Does "You are a world-class expert" help? How would you find out for your task? (mid)

What it tests: whether you separate what feels right from what has been measured, and whether you would run the test.

Answer outline:

  • Quote the evidence. Zheng et al. found that "adding personas in system prompts does not improve model performance across a range of questions" and that "the effect of each persona can be largely random"; they also found that "automatically identifying the best persona is challenging, with predictions often performing no better than random selection" (Zheng et al., 2023).
  • Add the nuance. Battle and Gollapudi report that results "do not universally generalize across models", and for one model without chain-of-thought the best system message was none at all (Battle & Gollapudi, 2024). Anthropic's guidance frames the role as a tone lever: "Setting a role in the system prompt focuses Claude's behavior and tone for your use case" (Anthropic prompting best practices).
  • So the honest answer is: for accuracy, probably not; for tone and format, maybe. Test it the same way as any other change: the same eval set, with and without the role line, on the model you ship.
  • Explain what you would do instead of a persona if accuracy is the goal: concrete instructions, examples of good output, and the context the task needs.

Follow-up: Your test shows the persona helps by 2 points on 50 examples. Ship it? (Not on that evidence; 50 examples cannot separate 2 points from noise. Grow the set or treat it as neutral.)

8. A prompt tuned on one vendor's model fails after porting to another. What differs, and how do you port systematically? (mid)

What it tests: whether you know the vendor-specific mechanics that prompts quietly depend on.

Answer outline:

  • List the mechanics that move: how the system or instructions role is treated, whether assistant prefill exists, delimiter conventions, and whether the target is a reasoning model. OpenAI documents that instructions "take priority over user messages" (OpenAI prompt engineering). Anthropic documents that on its newer models "prefilled responses ... on the last assistant turn are no longer supported" and return a 400 error, while earlier models still accept them (Anthropic prompting best practices). A prompt that forced JSON with a prefilled brace breaks on the port.
  • Reasoning models are a different target. OpenAI's guidance: "our o-series models excel at different tasks and require different prompts" and "One model family isn't better than the other" (OpenAI reasoning best practices). See question 9.
  • Port systematically: keep a vendor-neutral spec of the task (inputs, constraints, examples, output schema), render it per vendor with that vendor's structure, and run the same eval against each. Both vendors recommend explicit delimiters: "Use delimiters like markdown, XML tags, and section titles to clearly indicate distinct parts of the input".
  • Expect to re-tune examples and thresholds; do not expect to re-tune the task definition. If you do, the original prompt was carrying hidden requirements.

Follow-up: The new vendor is 30% cheaper but scores 3 points lower. Who decides? (Not the engineer alone: present the cost and the error profile per category, and let the product owner choose.)

9. Your chain-of-thought prompt was ported to a reasoning model. Redundant or harmful? (mid)

What it tests: whether you know that models with built-in reasoning want different prompts, and what it costs to ignore that.

Answer outline:

  • State the vendor position. OpenAI says that for its reasoning models, "prompting them to 'think step by step' or 'explain your reasoning' is unnecessary", and to "Keep prompts simple and direct" (OpenAI reasoning best practices).
  • Name the cost. Anthropic warns that a model asked to reason heavily "might think extensively, which can inflate thinking tokens and slow down responses" (Anthropic prompting best practices). Redundant reasoning instructions can add latency and spend without adding accuracy.
  • Check the harm empirically: run the eval with and without the step-by-step scaffold, and record tokens and latency alongside accuracy. Where the scaffold forced a specific output structure, keep the structure and drop the "think" instruction.
  • Read the current docs for the model you use. Reasoning controls change between model versions, and a parameter that worked last quarter may be rejected now.

Follow-up: The team wants the reasoning text shown to users for trust. Where does that belong? (In the product decision, not the prompt: it costs tokens, may not be exposed by the API, and is not a faithfulness guarantee.)

10. Users write in Spanish, the system prompt is in English, and answers drift between languages. Fix it. (mid)

What it tests: whether you can state an output requirement explicitly and verify it, without inventing vendor behavior.

Answer outline:

  • This answer is engineering reasoning; we found no vendor document that specifies language behavior, so do not claim one. The likely cause is that nothing tells the model which language to answer in, so it follows whichever signal is strongest in the context: the English instructions, the Spanish message, or a retrieved English document.
  • Make the requirement explicit: "Answer in the language of the user's most recent message." If the product supports a fixed set, detect the language in code and inject it into the prompt as a variable.
  • Add a post-check with a language detector on the response, and retry once with the detected mismatch named in the retry prompt.
  • Evaluate it: a test set with the same intents in each supported language, scored on language match as well as correctness. Watch for partial drift (an English heading over a Spanish answer), which a whole-response detector can miss.

Follow-up: Retrieved documents are only in English. Does the answer language change? (No, but quoting policy might: decide whether quotes stay in the source language.)

11. Past 40 turns the assistant forgets a constraint set early in the chat. Summarize, truncate or pin? (senior)

What it tests: whether you can reason about trade-offs in context management and design the test that chooses between them.

Answer outline:

  • This is trade-off reasoning, not a vendor claim. Three options: truncate the oldest turns (cheap, loses constraints), summarize old turns into a running note (keeps gist, may drop a specific rule), pin durable constraints into a dedicated block that is re-sent every turn (reliable, costs tokens, needs code to decide what is durable).
  • Argue for a hybrid: user-stated constraints ("never suggest flights before 9am") are extracted into a pinned block, the rest of history is summarized, and the last few turns stay verbatim.
  • Design the eval: scripted conversations where a constraint is set at turn 2 and tested at turn 30, 40 and 60. Score constraint adherence per strategy, alongside tokens per turn.
  • Note the position effect. Microsoft's guide says "Models can be susceptible to recency bias, which in this context means that information at the end of the prompt might have more significant influence over the output than information at the beginning of the prompt" (Microsoft Learn prompt engineering). A pinned block belongs near the start or end, not buried in the middle of history.

Follow-up: The pinned block grows to 50 constraints. Now what? (Expire or merge them, confirm with the user, and treat the block as state with its own tests.)

12. The model copies a few-shot example's product name into real answers. Diagnose and fix the example set. (mid)

What it tests: whether you understand that examples teach patterns you did not intend.

Answer outline:

  • Diagnose by looking for the leak in production outputs: search responses for every literal that appears only in the examples. The rate tells you how often the model is copying rather than generalizing.
  • Apply the vendor guidance. Anthropic asks for examples that are "Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns" and "Relevant: Mirror your actual use case closely" (Anthropic prompting best practices). OpenAI's guide says to "show a diverse range of possible inputs with the desired outputs" (OpenAI prompt engineering).
  • Two more vendors name the same risk. Hugging Face's guide warns that "a model can learn unintended patterns from your examples", and Google's says to "Make sure that the structure and formatting of few-shot examples are the same to avoid responses with undesired formats" (Transformers prompting guide; Gemini prompting strategies).
  • Fix the set: replace realistic-looking literals with obvious placeholders, vary the entities across examples, and add one example that shows the model declining to name a product when none is in the input.
  • Prevent recurrence: the leak search from the first bullet becomes a check in the eval, and the example set gets a review step like any other code.

Follow-up: Placeholders made outputs stilted. Why, and what is the compromise? (Examples are also style guides: keep realistic prose, vary the facts.)

Measuring and Shipping Prompt Changes

13. You ask for a 0 to 10 quality score and 80% of answers come back 7 or 8. How do you get a useful score? (mid)

What it tests: whether you know that numeric outputs from a model are not calibrated measurements.

Answer outline:

  • This answer is practice, not a cited result. A bare numeric scale gives the model nothing to anchor on, so scores cluster. Reframe the task so each output is defined.
  • Options, from cheapest up: discrete labels with written criteria (pass, minor issues, fail); a rubric with one yes or no question per dimension, summed in code; pairwise comparison between two candidates, which asks "which is better" rather than "how good".
  • Check the result against people: label a sample by hand and measure agreement with the model's labels. Low agreement means the rubric is wrong, not that the model needs a longer scale.
  • Keep the raw labels, not a collapsed score, so you can see which dimension moved when a prompt changes.

Follow-up: The team still wants a single number on a dashboard. Fine, but what does it have to be derived from? (From the labeled dimensions, with the definition written down next to the chart.)

14. Gate a prompt change in CI: golden set, thresholds, flaky cases, cost of the run. (senior)

What it tests: whether you can treat a prompt as code with a test suite, and budget for the fact that the tests are probabilistic.

Answer outline:

  • Start from the vendor expectation. OpenAI's guide lists "Building tests and evaluation suites that measure prompt behavior so you can monitor performance as you iterate" (OpenAI prompt engineering). Anthropic's overview puts "A clear definition of the success criteria" and "Some ways to empirically test against those criteria" ahead of any prompt work (Anthropic prompt engineering overview).
  • The golden set: a few hundred labeled cases that cover the categories you care about, with the hard and rare cases over-represented. Store expected outputs or a grader, not just inputs.
  • Thresholds and flakiness (engineering judgment): score each case several times or at low temperature, mark cases that disagree with themselves as flaky, and gate on the stable set with a tolerance rather than an exact match. Fail the build on a drop in any category, not only in the total.
  • Cost: a 300-case set run 3 times on every pull request adds up. Run a small smoke subset on every push, the full set on merge to main and nightly, and cache results for unchanged prompts.

Follow-up: The gate passed and users complain within a day. What did the golden set miss? (Traffic drift: sample recent real inputs into the set on a schedule.)

15. When would you use automatic prompt optimization (OPRO, DSPy) instead of hand-tuning, and what do you need first? (senior)

What it tests: whether you know what these tools require and what they produce.

Answer outline:

  • Describe the methods briefly. OPRO treats the model as an optimizer: at each step "the new solutions are evaluated and added to the prompt for the next optimization step", and the paper reports prompts that "outperform human-designed prompts by up to 8% on GSM8K" (Yang et al., 2023). DSPy replaces hand-written templates with modules and "a compiler that will optimize any DSPy pipeline to maximize a given metric" (Khattab et al., 2023).
  • Name the prerequisites: a labeled eval set, a metric that can be computed automatically, and a token budget for the search. DSPy's own site states the contract in one line: "Give DSPy examples and a scoring function", then "Compile your program against a metric" (DSPy). Without all three you are not optimizing, you are guessing faster. That lines up with Anthropic's order of operations: success criteria and empirical tests before prompt work.
  • Note the downside. Battle and Gollapudi found that "the highest-scoring, automatically-optimized prompt exhibits a degree of peculiarity far beyond expectations", while also concluding that "employing an automated prompt optimizer emerges as the most effective method" they tried (Battle & Gollapudi, 2024). Optimized prompts can be strange to read and hard to maintain by hand.
  • When to use it: a stable task with a good metric, a pipeline with several prompts to co-tune, or a model migration where you need to re-tune quickly. When not to: a task whose requirements are still changing, or where no automatic metric reflects quality.

Follow-up: The optimized prompt gains 4 points on the eval set. What do you check before shipping? (Overfitting to the set: hold out a split the optimizer never saw, and read the prompt for anything a reviewer would not accept.)

More Prompt Engineering Interview Questions to Practice

These 15 cover the prompt itself. The debugging round usually continues into the system around it: retrieval misses, truncation, logprobs, judge drift and cost spikes are in our LLM interview questions guide, and the full loop by level and company type is in AI engineer interview questions.

How We Wrote This

We wrote these 15 questions for this page. None is a main question in the paid kit, and we checked that the question and answer text does not repeat the kit. Levels are our editorial judgment. Vendor and research claims link to pages we read on November 28, 2026; answers marked as engineering reasoning have no source and say so. Provider documentation changes without dates, so check model names, parameters and limits on the provider page before an interview. Research results are reported for the models and setups each paper tested.

FAQ

What prompt engineering interview questions do engineers actually get?

Fewer definitions than the online lists suggest. Applied rounds describe a prompt that fails in production (a brittle format, a cache hit rate that fell, an instruction that is ignored) and ask what you would measure, change and verify.

How should I answer a prompt engineering scenario question?

Name the likely causes, say which evidence tells them apart (usage fields, stop reasons, an eval across format variants), then say what you would change and how you would confirm it on a test set before and after.

Do prompt engineering interviews ask about research papers?

Sometimes. The format-sensitivity study, the persona study and the automatic prompt optimization papers come up because they explain things engineers see: outputs that change with a list style, role lines that do nothing, and optimized prompts that look odd but score well.

Where can I get more prompt engineering interview questions with answers?

The free AI Engineer Interview Kit sample has 12 questions with full answers and follow-ups. The full kit has 120 across 12 chapters, including a prompting chapter.

Advertisement

Corrections

No corrections to date Report an error

New · $49AI Engineer Interview KitQuestions, worked answers and a 2-week prep plan for AI/LLM engineering interviewsSee what's inside →
Advertisement