Explain the system, user, and assistant roles. What belongs in each?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The roles are contract layers, not decoration - models are post-trained to treat them with different authority.
Full worked answer
The roles are contract layers, not decoration - models are post-trained to treat them with different authority.
System: standing policy that shouldn't change per request - persona and scope ("you are a support agent for X, you only discuss X"), behavioural rules, tool-usage policy, output contract, safety constraints. Models are trained to weight system instructions above user content and to keep following them across turns. Two practical reasons to keep it stable: instruction persistence across long conversations, and prompt caching - a static system prompt is your cacheable prefix.
User: the task and the data for this turn - the question, retrieved documents, form contents. Anything that varies per request belongs here, clearly delimited so instructions and data can't be confused.
Assistant: the model's outputs - but also a steering surface. Historical assistant turns in few-shot dialogues teach by demonstration. Some APIs have also let you prefill the assistant turn (start it with { to force JSON, or with a fixed preamble to skip throat-clearing), but support is shrinking: Anthropic's newest models reject prefill, and it was never available everywhere. Treat it as a legacy trick and use native structured outputs for format control.
Common mistakes interviewers listen for:
- Per-request data interpolated into the system prompt (kills caching, blurs the policy/data boundary).
- Standing policy sent as a user message ("from now on, always respond in JSON") - it decays as the conversation grows and later user turns override it.
- Treating role separation as a security boundary. It's an authority hint, not a guarantee - a user message saying "ignore previous instructions" often fails, but well-crafted injection inside pasted content can still succeed. Real defences are layered: delimiting, output validation, least-privilege tools.
Note that under the hood, roles are just special tokens in one flat sequence - the separation is learned behaviour from post-training (and provider-specific instruction hierarchies), not an architectural wall.
What a good answer covers
- The roles are contract layers, not decoration - models are post-trained to treat them with different…
- System: standing policy that shouldn't change per request - persona and scope ("you are a support agent…
- Models are trained to weight system instructions above user content and to keep following them across turns
- Two practical reasons to keep it stable
- User: the task and the data for this turn - the question, retrieved documents, form contents
Key terms: System · User · Assistant · prefill
In the glossary: Prompt caching · Few-shot · Prefill · Structured output
Interviewer follow-ups to expect
When would you deliberately fabricate an assistant turn in the prompt?
How do OpenAI's developer role and instruction-hierarchy training relate to this?
What happens to system-prompt adherence over a 50-turn conversation?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep