An Overview of System Messages
A system message is provided to a model at the beginning of a conversation to dictate how it should behave throughout the rest of the conversation. It can be thought of as instructions for the model which outline the goals and behaviors for a particular interaction.
Writing a custom preamble
While prompting is a natural way to interact with and instruct an LLM, writing a custom system message is a shortcut to direct the model’s behavior. Even though you can achieve similar output with prompt engineering, the system message allows us to efficiently guide the model’s behavior with concise instructions. Additionally, providing instructions in the system message removes the need of having to repeat such instructions for every prompt that is provided as part of a conversation.
Default system messages differ from model to model. For example, the default system message in the Command A model is:
As can be seen, this contains a System Preamble
and a Default Preamble
section. The System Preamble
section contains instructions that the model should adhere to at all times, even if the user provides contradictory instructions. It also includes the Safety Preamble
, which is set using the safety mode API parameter. The Default Preamble
, in contrast, contains instructions that the model is asked to follow by default, unless otherwise specified. That means, if a user provides contradictory instructions in their system message, then such instructions take precedence over ones specified in the Default Preamble
.
The default system message for Command R and Command R+, by contrast is:
To set a custom system message, use the messages
parameter’s “system” role in the Chat API. This would append a new section called Developer Preamble
to the system message above.
Here’s an example output:
Under the hood, the following full system message would be created and sent to the model:
Writing a System Message
Please see the following example of writing system messages with Command A:
Obtaining non-interactive behavior
The Default Preamble
presented above contains instructions explicitly targeted at increasing interactivity:
- You reply conversationally with a friendly and informative tone and often include introductory statements and follow-up questions.
- If the input is ambiguous, ask clarifying follow-up questions.
- Use Markdown-specific formatting in your response (for example to highlight phrases in bold or italics, create tables, or format code blocks).
- Use LaTeX to generate mathematical notation for complex equations.
- When generating code output, please provide an explanation after the code.
These instructions are useful in conversational settings. However, in other use cases a non-interactive model behavior might be more desired (e.g., when asking the model to generate structured data formats that are directly parsed automatically).
The preamble can be used to achieve such non-interactive behavior. For example, when asking the model to “Please generate a JSON summarizing the first five Wes Anderson movies”:
Here’s an example response:
For this prompt, the preamble can be used to change the model behavior such that the completion only contains the JSON object, without any Markdown code block markers:
And here’s a sample output:
Specifying a Date
Adding the date to the system message can be useful for handling time-sensitive tasks, such as “Who won the game last night?“. We recommend formatting the date to be as human readable as possible. Here is an example system message including the date:
Here’s an example response: