Google Cloud defines a system instruction as a set of instructions the model processes before it processes the prompt. These instructions can specify the model’s role, provide context, and define the response format. Once set, a system instruction applies to the entire request. When included in the prompt, it can also apply across multiple user and model turns.
Anthropic recommends stating the expected output format and constraints explicitly. If the order of the steps matters or every step must be completed, the instructions can be written as a numbered or bulleted list. Anthropic also recommends asking directly for anything you expect the model to do beyond the task’s explicit requirements.
Defining the role and task
According to Anthropic, assigning a role in the system prompt helps tailor Claude’s behavior and tone to the use case. Google Cloud also lists defining a chatbot’s persona or role as a use case for system instructions. The same instruction can specify the goals and rules for the task.
In Google Cloud’s translation example, the system instruction defines the model as a translator. A separate statement specifies its task of translating English text into French. The user input supplies the text to translate. The role and task are defined in the system instruction, while the text to process is provided in the prompt.
OpenAI describes the identity section of a developer message in terms of the assistant’s purpose, communication style, and high-level goals. The instructions section can specify how the model should produce its response and which rules it should follow. It can also include subsections tailored to the use case. OpenAI gives guidance on calling custom functions as an example of what a subsection might cover.
In Google Cloud’s code generation example, the model takes the role of an expert who writes code for front-end interfaces. The system instruction asks for the necessary HTML and CSS when the user describes a website component. It also asks for interface design suggestions and directs the model to omit explanations of the code. The same instruction defines what to generate and what the response should cover.
Scope and message priority
In Google Cloud, the system instruction is separate from the prompt content. It remains part of the overall prompt and is subject to standard data use policies. In a multi-turn conversation, a system instruction included in the prompt can apply across both user and model turns.
In the OpenAI API, the instructions parameter carries high-level instructions that govern the model’s behavior as it generates a response. OpenAI lists tone, goals, and examples of correct responses among the things this parameter can contain. These instructions take precedence over user messages in input.
In OpenAI’s description of message roles, developer messages carry instructions from the developer and take precedence over user messages. The user messages contain instructions from the end user. Messages generated by the model use the assistant role. A multi-turn conversation can contain these message types alongside other types of content.
OpenAI compares the relationship between developer and user messages to that between a function and its arguments. The developer message supplies the system’s rules and business logic. The user message supplies the inputs and configuration to which those instructions apply. The two roles let developers express the system’s rules and the end user’s inputs in separate messages.
Output format, language, and style
According to Google Cloud, a system instruction can specify an output format such as Markdown or YAML. It can also define stylistic preferences such as response length, level of formality, and target reading level. A task rule might also ask the model to return a code snippet without additional explanation.
In Google Cloud’s recipe example, the assistant’s role is to help home cooks. It is asked to generate a list of recipes from the ingredients the user provides. The system instruction also says to list recipes that require no additional ingredients first. The task definition therefore includes a rule for ordering the results.
The same example requires the response to be a JSON object, with specific fields for each recipe object. The name field holds the recipe’s name, and usedIngredients lists the ingredients from the user’s list that the recipe uses. The otherIngredients field lists ingredients the user did not provide and is omitted if there are none. The description field contains a short description of the recipe.