Prompt & Context Engineering·Question 47 of 68Advanced

The system prompt says one thing, the user asks for another, and a retrieved document says a third. How do you design conflict resolution?

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

Start by splitting the conflicts into two categories, because they have completely different answers.

Full worked answer with diagram

Start by splitting the conflicts into two categories, because they have completely different answers.

Policy conflicts must never reach the model. If the rule is "only admins issue refunds" or "never spend over $500" or "never expose another tenant's rows", that is authorisation, and it belongs in code at the tool boundary. Implementing it as a system prompt sentence means implementing it as a request. The model resolving it correctly 99% of the time is a 1% breach rate.

Preference conflicts are the model's job. Tone, format, verbosity, which of two reasonable framings to use. Those you resolve in the prompt.

For those, models are post-trained with a privilege ordering: system and developer instructions outrank user turns, which outrank tool results and retrieved content. OpenAI formalised this as the instruction hierarchy. It is a learned prior, so it is probabilistic, it weakens as the conversation grows, and it weakens with distance in a long context. Treat it as a strong default, not a guarantee.

What I do concretely:

  • State precedence explicitly rather than assuming it, and state the behaviour on conflict: refuse, ask, or prefer the standing rule. Then include one worked example of a conflict resolved correctly, because the boundary is easier shown than described.
  • Untrusted content is never an instruction source, and that is enforced by which tools exist, not by the model's obedience.
  • Handle legitimate user conflicts gracefully. A user asking for something the system forbids should get a specific explanation and an alternative, not a wall.

The conflict that actually bites is the silent one: 40 accumulated rules where rule 7 contradicts rule 31, nobody noticed, and the model picks non-deterministically. That shows up as ~5% inexplicable weirdness that no single fix explains. Audit for it, put contradiction cases in the eval, and note a model is quite good at finding contradictions in your own prompt if you ask it to.

Also decide explicitly how long a user instruction persists. "Always answer in French" at turn 2 outliving the session surprises people.

Worth sketching. The split at the top is the answer: one branch never reaches the model at all.

flowchart TD
    A["Conflicting instruction"] --> B{"Is it authorisation<br/>or preference?"}
    B -->|"authorisation"| C["Enforced in code<br/>at the tool boundary"]
    C --> D["A leaked or overridden<br/>prompt changes nothing"]
    B -->|"preference"| E["Instruction hierarchy:<br/>system, user, then content"]
    E --> F["State precedence and the<br/>behaviour on conflict"]
    F --> G["One worked conflict<br/>example in the prompt"]
    E --> H["Retrieved content is<br/>never an instruction source"]

What a good answer covers

  • Start by splitting the conflicts into two categories, because they have completely different answers
  • Policy conflicts must never reach the model
  • If the rule is "only admins issue refunds" or "never spend over $500" or "never expose another tenant's…
  • Implementing it as a system prompt sentence means implementing it as a request
  • The model resolving it correctly 99% of the time is a 1% breach rate

Key terms: State precedence explicitly · Handle legitimate user conflicts gracefully · silent

Interviewer follow-ups to expect

  1. How would you build eval cases for instruction conflicts?

  2. Why does instruction-hierarchy adherence degrade over a long 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