How Does AI Follow Instructions? Instruction Tuning, System Prompts, and Rules

How AI assistants follow instructions: instruction tuning, system prompts, provider priority rules and app-level filters, and why compliance is never certain.

Ask a chat assistant to “summarize this email in three bullet points,” and it usually does. Yet a model that has only learned to predict text has no built-in reason to treat that sentence as a request, and other instructions and rules are quietly at work alongside yours.

An AI assistant follows instructions because of four layers working together. Training, including instruction tuning, makes a model much better at treating a request as a task to carry out [1]. System instructions written by the company or developer behind the app sit in front of your message and steer the model for the whole conversation [2]. Your own prompt adds the task at hand. Around all of this, the application can enforce rules in separate software outside the model, such as content filters and limits on what tools may do [3, 4]. None of these layers works like a switch: providers describe instruction following as behavior they train for and test, not something they can guarantee [5, 6, 2].

The previous guide, How Does AI Learn From Human Feedback?, showed how rankings and corrections shape a model’s behavior. This guide looks at the instructions that behavior is meant to serve.

TL;DR

  • A pretrained model continues text; it does not automatically treat a request as a task [1, 7].
  • Instruction tuning trains a model on many tasks phrased as instructions, helping it handle unfamiliar requests [1].
  • System instructions and your messages reach the model as one labeled sequence of text, so the model has to learn which instructions take priority [8, 9].
  • OpenAI publishes a ranked chain of command; Anthropic describes a rough ordering applied with judgment [5, 6].
  • Some of the firmest rules live outside the model, in classifiers and tool permissions run by the application [3, 10, 4].
  • Instruction following stays probabilistic, and providers say so themselves [5, 6, 2].

Four Layers Behind One Answer

Names vary by provider, but the division of labor is similar.

LayerWho sets itWhen it actsDoes it change the model?
Training, including instruction tuningThe model developerBefore releaseYes; it updates the model’s parameters [1]
System instructionsThe provider or app developerWith every requestNo; it is text supplied in context [2]
Your promptYouWith each messageNo; it is text supplied in context
Application rulesThe provider or app developerBefore or after the model runsNo; it is code and separate classifiers around the model [3, 10]

Why a Raw Pretrained Model Doesn’t Reliably Follow Instructions

Pretraining teaches a model to predict how text continues; How Does a Raw AI Model Become a Useful Assistant? maps where that stage ends and later training begins.

To such a model, an instruction is just more text to extend. Imagine handing it the line “Q: What is the capital of Peru?” It might answer. It might just as plausibly add “Q: What is the capital of Chile?”, because lists of quiz questions are a common pattern in written material. Nothing in prediction alone says the line is addressed to the model.

One explanation from Google researchers: without worked examples in the prompt, models found it harder to do well on prompts that did not resemble the format of their pretraining data [1]. Size alone does not close the gap; OpenAI’s InstructGPT work started from the point that a larger model is not automatically better at doing what a user intends [7].

Instruction Tuning: Practicing on Tasks Written as Instructions

Instruction tuning means continuing to train a pretrained model on a large collection of tasks, each written as a natural-language instruction paired with a good response [1]. The model sees one pattern again and again: a request, then a response that carries it out.

Google’s FLAN study, published in 2021, gave the method its name and an early test [1]. The researchers took a pretrained model with 137 billion parameters and tuned it on more than 60 language datasets, each rewritten with about ten instruction templates [1]. They then tested it on whole categories of tasks held out of the tuning data, and found substantial improvements on those unseen task types [1].

The study also carried a caution. Instruction tuning helped the largest models but hurt held-out performance for models of 8 billion parameters and smaller, possibly because the small models used up their capacity learning the training tasks [1]. Later Google work extended instruction fine-tuning to several model families, calling it a general way to make pretrained models perform better and easier to use [11].

Learning the shape of a conversation

For chat assistants, developers also fine-tune models on data formatted as conversations, where every message carries a role label such as system, user or assistant [8]. At use time, those labeled messages are converted into one continuous sequence of tokens, often with special marker tokens showing where each turn begins and ends [8, 9]. Different models use different markers, and feeding a model the wrong format can make it perform much worse [8].

Preference training, covered in the previous guide, can follow instruction tuning. Today’s commercial developers generally do not publish their full recipes, so FLAN illustrates the method rather than describing any current product.

System Instructions and Your Prompt

System instructions are the instructions an app’s builder places in front of your messages; you may also see system prompt or system message. Microsoft lists the usual jobs: defining the assistant’s role and boundaries, setting tone, specifying output formats and adding safety constraints [2].

Providers expose this layer differently:

  • Google lets developers pass a separate system_instruction parameter to guide how Gemini models behave [12].
  • Anthropic says setting a role in the system prompt focuses Claude’s behavior and tone for the developer’s use case [13].
  • Microsoft says the system message typically comes first in chat APIs and serves as the highest-level set of instructions for the conversation [2].

Consider a hypothetical recipe app whose system instructions say: discuss only cooking and use metric units. Ask for a vegetarian chili recipe with the spices listed first, and both sets of instructions can be satisfied. Ask it to draft a legal complaint, and the layers conflict; the model has to resolve them.

System instructions are simply text in the model’s context, alongside your messages and anything the app retrieves; the guide to context windows explains that shared space. Because everything arrives as one labeled token sequence, nothing mechanical stops a user message from contradicting a system instruction [9]. Which one prevails depends on training.

Who Wins When Instructions Conflict?

Providers’ published answers are similar in spirit but not identical. The documents below were accessed on November 10, 2026, and each describes only that company’s own models [5, 6, 12, 2].

OpenAI. The Model Spec, in its version dated October 29, 2026, labels messages by source: system messages from OpenAI, developer messages from the app builder, user messages from the person using the app, plus assistant and tool messages [5]. It sets a chain of command with default authority levels in this order: root, system, developer, user and guideline [5]. When instructions conflict, the model is told to favor higher authority and, at the same level, the more recent instruction [5]. Assistant messages, tool outputs and quoted or untrusted material carry no authority by default [5].

Anthropic. Claude’s constitution names three kinds of principals whose instructions Claude acts on: Anthropic, operators (the businesses and developers building on its platform, who usually instruct Claude through the system prompt) and users [6]. Trust runs roughly in that order, but Anthropic says explicitly that the ordering is not rigid, and users keep certain protections that operators cannot remove [6].

Microsoft. Azure OpenAI guidance treats the system message as the top-level instruction set but says it does not guarantee compliance and should be layered with filtering and evaluation [2].

Google. The Gemini API documentation presents system instructions as a way to configure model behavior [12]. A search of Google’s developer documentation for this guide did not find a published ranking of system instructions against user messages, so none is stated here.

The shared pattern: the app builder’s instructions generally outrank the user’s, and both outrank instructions merely appearing in content the model reads. How strictly varies by provider.

Priority is trained, not wired in

In a 2024 paper, OpenAI researchers argued that language models often gave a developer’s system prompt the same weight as text from untrusted users and third parties [9]. They generated examples showing which instruction should win when levels conflict and fine-tuned a model on them [9]. Robustness to attacks improved substantially, even against attack types not seen in training, but the model also became somewhat more likely to refuse harmless requests that resembled attacks [9]. A trained priority is a strong tendency with trade-offs, not a lock.

Rules That Live Outside the Model

Some rules are not left to the model at all; separate software checks requests or responses.

Filters and classifiers. Google says the Gemini API includes built-in content filtering with adjustable safety settings, and recommends that developers add blocklists, output filtering and trained classifiers that label prompts for potential harms [14]. Microsoft’s Prompt Shields is a classifier service that looks for attempts to get around system instructions and for instructions hidden in documents; with blocking turned on, inputs it flags as attacks are stopped before the model processes them [3]. Meta’s Llama Guard is a separate model that classifies both user prompts and model responses against a list of safety risk categories [15].

Tool permissions. When an assistant can search, send messages or edit files, the model only asks for an action and the application decides whether to carry it out. OpenAI describes function calling as the model passing data to the developer’s application, where the developer’s code takes the actions the model suggests [10]. Anthropic describes the same split: Claude returns a structured tool call that the developer’s application or Anthropic’s own infrastructure runs [16]. The tools guide covers that loop.

That handoff is where firm rules belong. OWASP security guidance recommends checking authorization in the connected systems rather than relying on the language model to decide whether an action is allowed, granting tools only minimum permissions and requiring a person to approve high-impact actions [4].

A system instruction saying “never delete files” asks the model to behave a certain way. A tool with no delete permission cannot delete anything, whatever the model outputs.

Why Instruction Following Can Fail

Every response is built by choosing likely next tokens, one after another; Why Does AI Predict the Next Token? explains that loop. Training shifts those likelihoods toward following instructions. It does not turn instructions into hard constraints.

Providers say this plainly. OpenAI states that its production models do not yet fully reflect the Model Spec [5]. Anthropic writes that Claude’s behavior might not always match its constitution’s ideals [6]. Behavior also shifts between versions: Anthropic notes that some newer Claude models respond more strongly to system prompts, so wording written for older models can overcorrect [13].

Outside testing points the same way. A 2023 benchmark of simple rule-following scenarios found that almost all the proprietary and open models evaluated struggled to follow the rules, even in straightforward cases [17]. Those were earlier models, so the result shows the shape of the problem, not how today’s systems would score.

Common reasons a model misses or bends an instruction:

  • Conflicts and ambiguity. Two instructions point different ways, or one can be read several ways.
  • Over-correction. Training a model to resist manipulation can make it refuse legitimate requests that look suspicious [9].
  • Injected instructions. Text in a web page, email or document can be written to look like a command.

That last failure is called prompt injection. Researchers showed in 2023 that applications feeding retrieved content to a model blur the line between data and instructions, letting attackers plant commands in material the model later reads [18]. OpenAI and Anthropic both say their models should treat instructions found in documents, tool results and similar inputs as information rather than orders [5, 6]. Because that too is a trained tendency, outside-the-model rules still matter; the security side belongs to BuildAIQ’s risk and safety coverage.

Even a faithfully followed instruction can yield different wording or emphasis on each run; the next guide explains why.

What We Know, What We Don’t, and Where Experts Disagree

What We Know

Instruction tuning measurably improves how pretrained models handle requests phrased as instructions [1, 11]. Chat models receive role-labeled messages as one token sequence and learn to treat the roles differently [8, 9]. OpenAI, Anthropic and Microsoft each give system-level instructions more weight than user messages and say compliance is not guaranteed [5, 6, 2].

What We Don’t Know

Published benchmarks cover particular rules and model versions, not every assistant or app [17].

What Experts Disagree About

Confidence: Expert Debate

One question is how rigid priority should be: OpenAI ranks authority levels in a fixed order, while Anthropic describes a rough ordering weighed with judgment and protections for users [5, 6]. There is broader agreement that model behavior is not a security boundary. Hierarchy training can make a model more robust [9], while external authorization and least-privilege controls keep permission decisions outside the model [4]. These are complementary defenses, not competing answers.

Practical Takeaways

  • Expect the app to shape the answer. Two tools built on the same model can behave differently because their system instructions and filters differ.
  • Treat compliance as likely, not certain. Check outputs that matter, especially formats, limits and constraints you set.
  • Restate key requirements when a conversation gets long or changes direction.
  • Ask where a rule is enforced. A promise that an app “can’t” do something is stronger if it comes from a permission setting than from a system instruction.
  • Be cautious about letting an assistant act on web pages or emails you haven’t read.
  • For writing better prompts, BuildAIQ’s Prompting + Working With AI chapter is the practical next step; this guide covers the mechanism.

Sources

  1. Finetuned Language Models Are Zero-Shot Learners. arXiv (Google Research); ICLR 2022, 2021-09-03, accessed 2026-11-10.
  2. System message design for Azure OpenAI – Microsoft Foundry. Microsoft Learn, 2026-05-13, accessed 2026-11-10.
  3. Prompt Shields in Azure AI Content Safety. Microsoft Learn, 2026-08-28, accessed 2026-11-10.
  4. LLM06:2025 Excessive Agency. OWASP Gen AI Security Project, 2025, accessed 2026-11-10.
  5. Model Spec (2026/10/29). OpenAI, 2026-10-29, accessed 2026-11-10.
  6. Claude's Constitution. Anthropic, accessed 2026-11-10.
  7. Training language models to follow instructions with human feedback. arXiv (OpenAI), 2022-03-04, accessed 2026-11-10.
  8. Chat templates. Hugging Face (Transformers documentation), accessed 2026-11-10.
  9. The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions. arXiv (OpenAI), 2024-04-19, accessed 2026-11-10.
  10. Function calling | OpenAI API. OpenAI, accessed 2026-11-10.
  11. Scaling Instruction-Finetuned Language Models. arXiv (Google), 2022-10-20, accessed 2026-11-10.
  12. Text generation – Gemini API | Google AI Studio. Google, accessed 2026-11-10.
  13. Prompting best practices – Claude Platform Docs. Anthropic, accessed 2026-11-10.
  14. Safety and factuality guidance – Gemini API | Google AI Studio. Google, accessed 2026-11-10.
  15. Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations. arXiv (Meta), 2023-12-07, accessed 2026-11-10.
  16. Tool use with Claude – Claude Platform Docs. Anthropic, accessed 2026-11-10.
  17. Can LLMs Follow Simple Rules?. arXiv (UC Berkeley, Center for AI Safety, Stanford, KACST), 2023-11-06, accessed 2026-11-10.
  18. Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. arXiv (CISPA Helmholtz Center / sequire technology), 2023-02-23, accessed 2026-11-10.