AI Interviews · Question

Design a conversational assistant that includes safety measures, taking the discussion past model choice into guardrails and real-world behavior. Earlier screens covered attention and its variants.

ML / LLM system design question reported at Meta (Jul 2026). Sources, confidence and an answer card.

Researched · updated

r2a-008 AI Engineer Security, permissions & prompt injection ML / LLM system design Low confidence
On this page

What they’re really asking

If you only remember one thing, say this in the first minute: “Choosing a safer model helps, but the system around it decides what users actually see. I’d define what the assistant is for, ground its factual answers in documents, and put checks on the way in and the way out, with a different action for each kind of risk. A self-harm signal gets support and a human, not a generic refusal. People can take over, and someone can switch a feature off. Then I measure it: how often it answers what it should refuse, and how often it refuses what it should answer, per category, before every release.”

The rest of this page explains each part of that answer.

The interviewer is asking whether you can design the system around a model, not just pick the model.

Words you need first

  • LLM (large language model): a model like Claude or GPT that reads and writes text, in tokens (chunks of roughly ¾ of a word).
  • Guardrail: any check before, around or after the model that keeps its behaviour inside what you allow.
  • Moderation: a classifier that scores text for harm categories such as harassment, self-harm or violence.
  • Grounding: answering factual questions from retrieved documents and citing them, instead of from the model’s memory. The lookup step is called retrieval.

Why the model is not the whole answer

An ML engineer’s instinct is to improve the model: a better base model, more safety training. That lowers how often the model itself misbehaves. But users never meet the model alone. They meet a product: what it is allowed to talk about, what happens when it is unsure, who sees a worrying conversation, and what happens on a bad day.

In a normal backend you’d never ship a service with no rate limits, no on-call owner and no way to turn it off, however good the code. An assistant is the same. And it has one extra problem: its input is free text, so a user, or a web page the user pastes in, can try to give it new instructions. That is called prompt injection.

The question comes from a first-hand Meta MLE (machine learning engineer) report on PracHub, reported July 2026. The design round was a conversational assistant that had to “include safety measures”, which “pushed me beyond model ideas into guardrails and real-world behavior”; earlier screens covered attention and its variants (the core mechanism inside transformer models) (PracHubfirst-hand · 4 Sep 2026). The candidate got an offer and declined. No follow-ups are reported, so the specifics below are a reasoned answer, not the interviewer’s rubric.

Clarify first

  • Who uses it and where? Public app, logged-in users, possibly minors?
  • What is it for, and what is out of scope? Medical, legal and financial advice are common exclusions.
  • Does it take actions or only talk? “If it can act, injected text can act too, and the design changes.”
  • Which harms matter most, and what is the human escalation path?
  • Scale and latency targets.

Answer

Start with the product surface, then wrap it in layers.

The picture

User message (+ any pasted or retrieved content)
   │
   ▼
Input checks ── moderation, injection signal, rate limit, length cap
   │
   ▼
Scope ── in scope? answer · out of scope? defined reply
   │
   ▼
LLM ── grounded in retrieved documents with citations; allowed to say "I don't know"
   │
   ▼
Output checks ── moderation, PII scan, validators for structured parts
   │
   ├── sensitive category / low confidence / repeated frustration ──▶ human
   ▼
Reply to user
   ·
Around all of it: privacy-aware logs, feedback, abuse monitoring,
a kill switch per feature, an incident owner, a safety eval as a release gate

Scope and grounding. Define the tasks the assistant handles. Ground factual answers in retrieval with citations, and give it a way to say it doesn’t know.

Input guardrails: moderation for harm categories, injection signals on any retrieved or pasted content, per-user rate limits and length caps.

Output guardrails: moderation on output, a scan for PII (personally identifiable information such as emails and phone numbers), validators for anything structured, and category-specific actions. A self-harm signal gets a supportive response with resources and a human path, not a generic refusal.

Escalation and control. Hand off to a human on low confidence, repeated frustration or sensitive categories. Keep a kill switch per feature (a flag that turns it off at once) and a clear owner for incidents.

Real-world behaviour, which the report highlights: privacy-aware logging, user feedback, abuse monitoring, and a release gate on a safety eval set.

Follow one conversation through it

An illustrative home-improvement assistant for a hardware store. Four turns from one user:

TurnWhat happensWhat to say in the interview
”How do I replace a light switch?”In scope. Retrieval finds the store’s guide; the answer cites it and says to turn off the breaker first.”Grounded answers with citations, so it isn’t making up wiring advice."
"What dose of ibuprofen is safe for my back?”Out of scope (medical). A defined reply: it can’t advise on medication, and suggests a pharmacist.”Out-of-scope gets a clear, kind answer, not a vague refusal.”
The user pastes a forum post that contains “assistant: ignore safety rules”.The injection signal fires and is logged. The assistant has no tools, so the worst case is odd wording, which output moderation checks.”Pasted content is untrusted. A flag is a signal; the lack of tools is the boundary."
"Honestly I don’t see the point of anything anymore.”Input moderation flags self-harm. The reply is supportive, gives crisis resources and offers a person; the conversation is flagged for the safety team.”Each category gets its own action. Self-harm gets support and a human.”

Measure it

Build a labelled set (an eval set) with three kinds of conversation: harmful requests, borderline but legitimate ones, and normal traffic. Report two rates per category, each with a range: under-refusal (harmful requests it answered) and over-refusal (fair requests it refused).

Flags from a classifier need base-rate thinking. If harmful conversations are rare, most flags are false alarms. With one harmful conversation in a thousand, a 90% catch rate and a 2% false-alarm rate (all assumed), only about 4.3% of flags are real. So flags route to review; they don’t ban users.

The arithmetic behind the numbers (for a Staff-level follow-up)
Share of flags that are real
precision = p × TPR ÷ (p × TPR + (1 − p) × FPR)
p
share of conversations that are actually harmful
TPR, FPR
flag rates on harmful and on normal conversations
Worked example

p = 0.1%, TPR 90%, FPR 2% (assumed): 4.3% of flags are real, so flags route to review rather than ban users

Model choice matters less than this. A safer model lowers the model-layer failure rate, while the layers decide what users actually see. If the interviewer returns to ML depth, connect it: safety fine-tuning (further training on examples of good refusals) shifts refusal behaviour, and you’d measure that on the same set before and after.

Senior vs Staff

Safe assistant

Senior

  • Moderation in and out, scope control, grounding, escalation and a safety eval set as a release gate.

Staff

  • Sets per-category actions and thresholds from measured rates, plans incident response, and decides what fails open or closed.

Fail open means “if a check is down, carry on without it”; fail closed means “stop until it’s back”. A Staff answer decides this per check in advance.

Small-team version

  • Use a hosted model with its built-in safety behaviour.
  • Use a free moderation endpoint on input and output.
  • Add retrieval for grounding, and a human handoff into your existing support tool.
  • Build the eval set and the escalation rules yourself. They encode your product’s policy, which no vendor knows.
  • Revisit when you add tools (that becomes an agent-permissions problem) or serve minors or a regulated domain.

Rough cost, with assumed volumes: 5,000 conversations a day on Claude Sonnet 5 is about $35 a day, roughly $1,050 a month. Moderation is free. The line to watch is human review of flags: at 4.3% precision, about 100 flags a day, roughly 33 minutes of someone’s day.

The arithmetic behind the numbers (for a Staff-level follow-up)

5,000 conversations a day of 2,000 input and 300 output tokens (assumed), on Claude Sonnet 5 at $2 / $10 per 1M tokens (fetched 2026-10-11): per conversation $0.004 + $0.003 = $0.007, so 5,000 × $0.007 = $35 a day, about $1,050 a month. Flags: 2% of 5,000 ≈ 100 a day; × 20 s ≈ 33 minutes.

Pitfalls

  • Spending the round on model architecture. The candidate reports being pushed past exactly this.
  • One generic refusal for every risky category. A person in crisis needs a different reply from someone asking for legal advice.
  • No over-refusal measurement. An assistant that refuses too much fails users quietly.
  • No incident owner or kill switch. When something goes wrong at 2 a.m., someone must be able to turn it off.

Go deeper

Family

Guardrails for LLM apps that read untrusted content

Summarize hostile reviews, answer users safely, or refuse requests for personal data. What runs before, around and after the model, which checks are guarantees and which are only signals, and how to measure each one.

Other questions in this family