# Guardrails and safe deployment interview questions

> 6 guardrails and safe deployment interview questions for AI and ML engineer roles, each with a model answer.

Canonical: https://llmdojo.dev/interview/topic/guardrails
Last updated: 2026-10-23

6 questions: 1 junior, 3 mid-level and 2 senior. Taught in [Guardrails and Safe Deployment](https://llmdojo.dev/learn/production-ai-systems/guardrails-and-safe-deployment).

## [What are input and output guardrails?](https://llmdojo.dev/interview/q/what-are-input-and-output-guardrails)

Level: Junior

Input guardrails stop **private data leaking** to external APIs and **bad prompts** compromising the system. Output guardrails **catch failures** (format, facts, toxicity, private data, brand risk) and apply a **policy**: retry, repair, block or hand to a person.

**Diagram: Guardrails on the way in and out**

1. AI Engineering: input guardrails protect against two risks: leaking private information to external APIs, and executing prompts that compromise your system.
2. The model runs on whatever passes.
3. Output guardrails have two jobs: catch output failures, and specify the policy for handling each kind.

## [How do you keep users' personal data out of a third-party model API?](https://llmdojo.dev/interview/q/how-do-you-keep-users-personal-data-out-of-a-third-party)

Level: Mid-level

Detect it in the assembled prompt, including retrieved passages and tool results, then block or **mask** it with placeholders, keeping a **reverse map** to restore values in the reply. It isn't airtight: detectors miss things, and the model can't use what it can't see.

## [How do you choose an output guardrail's threshold?](https://llmdojo.dev/interview/q/how-do-you-choose-an-output-guardrail-s-threshold)

Level: Mid-level

Count both errors on a labelled sample: harmful outputs let through and **good outputs blocked**. The book stresses tracking false refusals: a system can be too secure. Pick the threshold whose mistakes you can best afford.

## [Why don't output guardrails mix well with streaming?](https://llmdojo.dev/interview/q/why-don-t-output-guardrails-mix-well-with-streaming)

Level: Mid-level

Partial responses are hard to evaluate, so an unsafe part may already be on screen; holding the answer for a check gives up streaming's fast first token. Choose per feature: stream casual chat, hold back high-stakes answers.

**Diagram: Guardrails and streaming pull in opposite directions**

1. AI Engineering: in streaming mode, partial responses are hard to evaluate, so unsafe content may reach users before a guardrail can block it.
2. Checking the full response first is safer but slower. The book reports some teams skip guardrails because of the latency.
3. The choice can differ by feature: stream a casual chat, hold back a medical summary until it's checked.
4. Providers ship guardrails of their own, which reduces what you must build on third-party APIs; self-hosting removes some input risks (nothing leaves) but means building more yourself.

## [How would you ship a prompt change safely?](https://llmdojo.dev/interview/q/how-would-you-ship-a-prompt-change-safely)

Level: Senior

Offline evaluation and regression suite; behind a **feature flag** so turning it off is seconds, not a deploy; **shadow** on copies of traffic; a small **canary** compared with control on a few user-facing metrics; then ramp in steps.

## [Why canary, and how many users does it protect?](https://llmdojo.dev/interview/q/why-canary-and-how-many-users-does-it-protect)

Level: Senior

Exposure scales with share: the workbook's example is a 5% canary at 20% errors adding about **1%** overall. Comparing canary with control on the same days also catches problems sooner. In the course's illustrative example, 25 extra bad answers instead of 1,500.

## Related
- [All interview questions](https://llmdojo.dev/interview)
