Purpose of the "system" role in OpenAI chat completions API

I know that the “system” role can be used to set the behavior of the “assistant” (see here).

But actually I can also set the “assistant” behavior with a “user” role message. So why is the “system” role needed?

1 Like

Welcome to the community, @markai.

It’s because newer models are trained to adhere to system messages.

A system message is never part of the conversation and never accessible to the end-user. Therefore, it can be used to control the scope of the model’s interactions with the end-user.

The user message can be used to ground the model into a specific behavior, but it cannot control it entirely.

During the conversation, the user can instruct the model to contradict the statement given by the role user, as they have the same role, and the model cannot deny user asking to override their previous instructions. However, if there’s a system message, the model will give precedence to it over the user message.

2 Likes