Talking to a Model

System prompts and roles

Who said what, and whose rules come first

Scroll

Who said what, and whose rules come first

A chat model does not receive one block of text. It receives a list of messages, each labeled with a role: a system message first, then alternating user and assistant turns.

The system message comes from whoever built the application and holds standing instructions: what the assistant is for, its tone, what it must not do. User messages are what people type. Assistant messages are the model's own earlier replies, sent back so it can see the conversation so far. In most setups the model keeps nothing between calls, and the application resends the whole list every turn. That is why long chats get slower and cost more.

Models are trained to give the system message more weight than the user's, which is how an app keeps an assistant on task. It is still only text in the same sequence, though. A user, or a document pasted into the chat, can sometimes talk the model out of it, so anything that must never happen needs a check outside the model. The page on prompt injection covers how that goes wrong.

Generation
THE CHAT, AS THE MODEL SEES IT system You are Acme’s support assistant. Answer questions about orders only. user Where is my order #4471? assistant It shipped Tuesday and arrives Friday. user Great. Can it come sooner? model sent together, on every turn The system prompt holds the app builder’s standing instructions. Models are trained to give it priority, but it is still text in the same sequence, not a locked rule.
Four messages, each labeled with a role, sent to the model together on every turn.