Excellent question! This gets to the very core of how we structure conversations with Large Language Models.
Let's break it down.
How the Three Standard Roles Are Used
The system, user, and assistant roles are a standardized way to structure a conversation for an LLM. Think of it like a script for a play, where each character has a distinct part. This structure is fundamental because the models are specifically fine-tuned on vast amounts of data formatted this way.
Here’s a detailed look at each role:
1. The system Role (The Director / The Rule-Setter)
The system message is the most powerful and important for controlling the LLM's behavior. It's the "meta-instruction" that governs the entire conversation.
Purpose: To set the context, persona, constraints, and rules for the assistant. It tells the AI how to behave.
When to Use It: At the very beginning of a conversation. It's usually a single message that remains constant.
Key Characteristics:
Persona Setting: "You are a sarcastic pirate who helps with coding problems."
Rule Definition: "You must always answer in JSON format. Do not use any markdown. Your responses must be under 100 words."
Providing High-Level Context: "You are an expert on ancient Roman history. The user is a high school student preparing for an exam."
Safety & Constraints: "Do not provide financial advice. If asked, gently decline and explain you are an AI."
Example:
json
[
{
"role": "system",
"content": "You are a helpful assistant that translates English to French. You only provide the French translation, with no extra explanation."
},
{
"role": "user",
"content": "Hello, how are you?"
}
]
In this case, the LLM knows its one and only job is to translate. Its response should be Bonjour, comment ça va? and nothing more.
2. The user Role (The Human / The Prompter)
This role represents the input from the person (or system) interacting with the model.
Purpose: To ask questions, give commands, or provide information for the assistant to process.
When to Use It: Every time the end-user sends a message.
Key Characteristics:
Direct Questions: "What is the capital of Mongolia?"
Commands: "Write a Python script to sort a list of numbers."
Providing Data: "Here is an article. Please summarize it for me: [long text...]"
Example (continuing the conversation):
json
[
{ "role": "system", "content": "..." },
{ "role": "user", "content": "Hello, how are you?" },
{ "role": "assistant", "content": "Bonjour, comment ça va?" },
{ "role": "user", "content": "Thank you very much." } // New user turn
]
3. The assistant Role (The LLM / The Responder)
This role represents the LLM's own previous responses. It might seem strange to feed the model its own answers, but this is absolutely critical for maintaining conversational context.
Purpose: To show the model the history of the conversation from its own perspective. It helps the model remember what it has already said and maintain a coherent flow.
When to Use It: To log the model's past responses in a multi-turn conversation. The full history (system + all user/assistant pairs) is typically sent with each new request.
Key Characteristics:
Forms the Conversation History: The alternating user and assistant messages create a turn-by-turn dialogue that the model follows.
Enables Few-Shot Prompting: You can "prime" the model by providing example user/assistant interactions to show it a desired format or style, even before the real user question is asked.
Example of Few-Shot Priming:
json
[
{ "role": "system", "content": "You extract keywords from text." },
{ "role": "user", "content": "The sun is shining and the birds are singing." },
{ "role": "assistant", "content": "sun, shining, birds, singing" }, // Example output
{ "role": "user", "content": "I need to go to the grocery store to buy milk and eggs." } // Real question
]
The model sees the example exchange and understands the expected output format.
Is It Possible to Use More Roles?
Generally, no, you cannot arbitrarily invent new roles like "moderator" or "editor".
The models are specifically trained to recognize the tokens for system, user, and assistant. An unknown role will likely be ignored, cause an error, or confuse the model, leading to poor performance.
However, there is a major exception for a specific, pre-defined fourth role used in "Tool Use" or "Function Calling."
The "Fourth" Role: tool / function
Some models and APIs (notably OpenAI's) have introduced a fourth role to handle interactions with external tools.
Purpose: This role is used to provide the output of a tool or function that the assistant decided to call.
The Workflow:
User: Asks a question that requires external data (e.g., "What's the current weather in London?").
Assistant: Responds not with an answer, but with a special message indicating it wants to call a function (e.g., call_tool('get_weather', location='London')).
Your Code: You detect this, execute the get_weather function in your own code, and get the result (e.g., {"temperature": "15°C", "condition": "Cloudy"}).
tool Role: You send this result back to the model in a new message with the tool role.
Assistant: The model receives the tool's output, processes it, and generates a natural language response for the user (e.g., "The current weather in London is 15°C and cloudy.").
So, while you can't create custom roles, you can use the specially designed tool (or function) role if the model and API support it.
Simulating Roles with Formatting
If you need to represent other information sources without a dedicated role, the best practice is to embed them inside the user or system message using clear formatting like XML tags, Markdown, or JSON.
Example: Simulating a "Code Linter" Role
Instead of creating a linter role, you would do this:
json
[
{
"role": "system",
"content": "You are an expert code reviewer. The user will provide a code diff and a static analysis report. Your task is to synthesize this information into a comprehensive code review."
},
{
"role": "user",
"content": "Please review the following changes.\n\n<ANALYSIS_REPORT>\n[Warning] Line 15: Unused variable 'x'.\n[Error] Line 22: Division by zero possible.\n</ANALYSIS_REPORT>\n\n<CODE_DIFF>\n+ new_code_line_1\n- old_code_line_2\n</CODE_DIFF>"
}
]
Here, you've effectively created "sub-roles" (ANALYSIS_REPORT, CODE_DIFF) that the model can understand because you've defined the structure in the system message. This is a very powerful and flexible technique.
User
is there any LLM that are trained without these fixed roles
Assistant
Yes, absolutely. The models that are trained without these fixed roles are typically known as base models or foundation models.
This distinction is one of the most important concepts in understanding the landscape of modern LLMs.
Let's break down the two types of models:
1. Base Models (No Roles)
These are the "raw" LLMs that are the product of the initial, massive pre-training phase.
How They Are Trained: They are trained on a vast corpus of text from the internet, books, code, etc. Their sole objective is incredibly simple: predict the next word. They learn grammar, facts, reasoning, and context by internalizing the statistical patterns of how words follow each other.
How You Interact with Them: They operate on a "text-in, text-out" or text completion basis. You provide a single string of text (a prompt), and the model completes it. There are no predefined roles.
Simulating Roles: To get them to behave like a chatbot, you have to manually create the conversational structure within the prompt itself. You show it a pattern and expect it to continue it.
Example of Prompting a Base Model for a Chat:
You would provide a single text block like this:
code
The following is a conversation between a User and an AI Assistant. The Assistant is helpful and concise.
User: Hello, what is the capital of France?
AI: Paris.
User: And what is its population?
AI: The city of Paris has a population of about 2.1 million people.
User: What should I see if I visit?
AI:
The model sees the pattern (User: ... \n AI: ...) and the initial instructions. When it starts generating text after the final AI:, it will do its best to "complete" the pattern by generating an appropriate response, such as If you visit Paris, you should definitely see the Eiffel Tower, the Louvre Museum, and the Notre-Dame Cathedral.
Examples of Base Models:
GPT-2
The original GPT-3 (text-davinci-003 was a late-stage instruction model, but the very first versions were base).
The base versions of open-source models like Llama-3-8B, Mistral-7B, or (as opposed to their or variants).
Gemma-7B
-Instruct
-Chat
2. Instruction-Tuned / Chat Models (With Roles)
These are the models we most commonly interact with today (like ChatGPT, Claude, and Gemini). They start as a base model and then go through a second stage of training.
How They Are Fine-Tuned: After pre-training, they are fine-tuned on a large dataset of high-quality examples of "instructions" and "good responses." This dataset is formatted with the specific roles (system, user, assistant). This process, often involving techniques like Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO), teaches the model to be more helpful, follow instructions, refuse harmful requests, and "understand" the conversational turn-taking that the roles represent.
How You Interact with Them: You use the structured system, user, assistant format. The roles are not just text; they are often special tokens that the model has been explicitly trained to recognize and react to. The system role triggers its "instruction-following" behavior, and the user/assistant roles trigger its "conversational" behavior.
Comparison Table
Feature
Base Models (No Roles)
Instruction/Chat Models (With Roles)
Primary Task
Text Completion (predicting the next word)
Instruction Following & Conversation
How to Prompt
A single block of text. You create the structure manually within the text.
A structured list/JSON of messages with system, user, assistant roles.
Role Structure
No built-in roles. Any roles are simulated with text formatting (e.g., User:).
Built-in, special tokens for roles that the model is trained to recognize.
Best For...
Creative writing, few-shot learning for custom tasks, fine-tuning for specific non-chat purposes.
Harder. Requires careful "prompt engineering" to guide the model.
Easier. More reliable and predictable for conversational tasks.
Safety & Control
Less "obedient" and less safe by default. More likely to generate undesirable text.
Significantly more aligned and safer due to the fine-tuning process.
Example
Llama-3-8B (the base model)
Llama-3-8B-Instruct (the chat model)
Conclusion
So, to answer your question directly: Yes, many LLMs are trained without these fixed roles. These "base models" are the foundation upon which the more user-friendly "chat models" are built.
The industry has largely moved towards providing instruction-tuned models for public use because they are far more reliable, safe, and easy to control for the vast majority of applications. However, researchers and developers often use base models for more advanced customization and fine-tuning.