System vs User vs Assistant Roles
Understand the three message roles in modern chat APIs and how they affect what the model trusts and obeys.
Three Roles, One Conversation
Every chat API uses three message roles:
- system — meta-instructions, persona, rules
- user — input from the human or upstream
- assistant — the model's output
Why Roles Exist
Models are trained to treat these roles differently. The system role gets the highest trust; user messages are the lowest.
This is how the model knows your instructions take priority over what an attacker types in user input.
All lessons in this course
- Zero-shot, Few-shot and Chain-of-Thought
- System vs User vs Assistant Roles
- Output Formatting (JSON, XML, Markdown)
- Avoiding Prompt Injection in Inputs