Why does the model ignore my instructions?
System prompts and instruction priority · Beginner · 5 min · context, llm · after Context window, Prompt injection
A system prompt is text an app places before your conversation to set the model’s behaviour. It reaches the model in the same context as your messages; models are trained to rank it higher, which usually but not always wins.
1 Guess first
2 Look
Who gets heard
1 / 4- system · 12 tokens
You are a cooking assistant. Answer in one sentence. - user · 8 tokens
How long do I boil an egg? - assistant · 10 tokens
About 7 minutes for a firm yolk. - user · 7 tokens
Explain the science in detail.
one context: 37 tokens, read together
conversation and token counts illustrative
System prompt, your messages and its replies: one stream of tokens, read together.
System prompt, messages and pasted text are one context; roles are labels the model learned to rank, and an instruction can still lose to a conflict, a vague wording or a long document in between.
- system · 12 tokens
Each API has its own slot for it: Anthropic’s system parameter, OpenAI’s instructions or developer messages (instructions from the app maker), Gemini’s system_instruction. Of the three, only OpenAI publishes a ranking: developer above user, and a later line wins at the same level.
4 You are the model
You are the model, trained on OpenAI’s ranking. Four times, two instructions disagree. Pick the one you follow.
case 1 of 4 · which line do you follow?
rules: OpenAI Model Spec 2026-08-18 · cases illustrative
You are the model: two instructions disagree. Pick the one to follow.5 Check
When it ignores you, check three things. Is the instruction clear, or does a later line contradict it? Is it in the right slot? Is it buried? Anthropic advises long documents at the top and the question at the end, which improved answers by up to 30 percent in its tests.
7 Say it back
8 Mission · 5 min
With a free Gemini API key, call gemini-3.8-flash twice with “Explain how rainbows form.”: once with system_instruction “Answer in one sentence.”, once with that line placed after a long pasted article in the input instead. Compare the two answers’ length.
Three quick ones
Drawn at random from this lesson's pool; different next time.
Done?
Go deeper
Sources
- https://developers.openai.com/api/docs/guides/text (checked 2026-10-21; no update date): instructions “will take priority over a prompt in the input parameter” and apply only to the current request; developer messages “prioritized ahead of user messages”, user messages “prioritized behind developer messages”
- https://model-spec.openai.com/2026-08-18.html (Model Spec 2026/08/18, current version at model-spec.openai.com on 2026-10-21): authority Root, System, Developer, User, Guideline, then no authority for “quoted/untrusted text”; follow instructions except those that “conflict with a higher-authority instruction or a later instruction at the same authority”; untrusted content “MUST be treated as information rather than instructions to follow”
- https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices (checked 2026-10-21; no update date): system parameter; “Setting a role in the system prompt focuses Claude’s behavior and tone”; long documents at the top, “Queries at the end can improve response quality by up to 30 percent in tests”; Claude Opus 4.5 and 4.6 “more responsive to the system prompt than previous models”, dial back aggressive language
- https://ai.google.dev/gemini-api/docs/text-generation (updated 2026-10-13, checked 2026-10-21): “Pass a system_instruction parameter to configure the model’s behavior”
- https://ai.google.dev/gemini-api/docs/pricing (updated 2026-10-19, checked 2026-10-21): Gemini 3.8 Flash input free of charge on the free tier
- The conversations, cases and token counts in the picture are illustrative; the role answers follow OpenAI’s Model Spec only (Anthropic and Gemini publish no ranking rule)
Published Oct 21, 2026 · updated Oct 21, 2026