All Collections
Writing Prompts
Understanding System Messages and Their Functionality
Understanding System Messages and Their Functionality
Promptitude Team avatar
Written by Promptitude Team
Updated over a week ago

In the world of AI chat models, system messages play a crucial role in guiding the AI's behavior and shaping its responses. They are a powerful tool for prompt engineers and developers, providing context, guidance, and directions to the AI model.

This article will help you understand what system messages are, how they work, and how they can be used to improve prompt security and yield more specific results.

What is a System Message?

A system message is a hidden instruction that tells the AI how to behave. It's one of the three roles available in conversational AI, alongside the user role (what the person using the AI says) and the assistant role (what the AI says back). For instance, a system message might instruct the AI to behave like an assistant that gives weather updates.

Writing an effective system message is similar to writing an effective prompt. The principles of clarity, specificity, relevance, and iteration apply to both. System messages are typically used to guide the AI's behavior with a specific persona or focus. However, in some cases, a user may bypass these guidelines, intentionally or not.

Using System Messages to Improve Prompt Security

System messages can be used to improve prompt security by reinforcing boundaries and guidelines. This reduces the risk of undesired outputs or behavior from the AI system.

For instance, you can append a system message at the end of the conversation to reiterate your most important constraints. This helps keep the AI in line and makes your prompts more secure.

Application of System Messages

The application of system messages covers four main concepts:

  • Defining the model’s profile, capabilities, and limitations for your scenario: This helps the AI understand what it can and cannot do in a given context.

  • Defining the model’s output format: This guides the AI on how to structure its responses.

  • Providing examples to demonstrate the intended behavior of the model: This gives the AI a clear idea of what is expected of it.

  • Providing additional behavioral guardrails: This helps prevent the AI from straying off course.

The Impact of System Messages on AI Responses

Adding even just a little context in a system message can lead to much more specific responses. In fact, context provided in a system message yields more specific results than context provided in a user message. However, different models interpret the system message differently, which is why it's important to always test across models.

System messages can be interlaced throughout a conversation to help avoid prompt injections and undesired outputs. They are a powerful tool for shaping the AI's behavior and improving the specificity and security of its responses.

Testing and iterating on your prompts with various system messages is key to achieving the best results.

Did this answer your question?