Chat APIs split input into roles: system for persistent instructions and persona, user for the human turn, assistant for model turns, and, in OpenAI's API, developer for app-owner rules ranked above the user. Anthropic's API takes the system prompt as a separate top-level system parameter instead of a message role.
Role precedence in a shared context window
All roles sit in one context window and all of them can influence the response. The roles carry a priority: system and developer instructions are meant to outrank user text. If the system role says to withhold personal data and a user asks for it, the model is trained to follow the system instruction, though this is not guaranteed.
The model is trained to treat each role differently, so it can serve the user's question inside the limits the application owner set.
- Put durable rules in
system. - Put app-owner policies in
developer. - Put requests and untrusted data in
user. - Keep secrets out of prompts.
The boundary is learned behavior
Privilege levels in software, such as root configuration against user input, are enforced by permission checks. The role boundary has no such check. It is a soft boundary shaped by the model's training, which means a determined user can still craft inputs that get an unintended result.
Prompt injection when everything is one blob
A common first design concatenates all inputs into one block of text and treats it equally. That loses the priority signal between user requests and system instructions, and it leaves the model open to prompt injection: a user, or content the user supplies, can craft text that the model follows as an instruction.
Separating roles gives the model a way to resolve conflicts between user text and the system or developer policy. It improves the odds and must still be paired with application-side controls.
Enforce trust boundaries in application code
Use system and developer to set durable rules, define the persona and state the output contract. Do not place sensitive information or hard trust boundaries in the prompt. Enforce those in your application code, where a permission check is an actual check.
Example scenario: an ambiguous system role
Suppose error rates rise 40% after a release (an illustrative figure) because the system role is ambiguous or set wrongly, so the model produces off-topic replies or loses the thread of the conversation.
- Check how the system role is configured in the API settings.
- Review recent failing interactions (for example the last 100) for patterns.
- A/B test a clearly defined system role against the ambiguous one.