T1 · Beginner · 7 minStable · Last reviewed: 2026-08-19Early draft

Role & Persona — Tell It Who to Be

In one line · When you give the model a clear role ('you are an expert code reviewer'), it aligns its tone, level of detail, and priorities to that role.

Glossary:HallucinationLLMPrompt
Why it matters

The same question gets a very different reply if the model is 'a teacher for kids' or 'a lawyer'. The role sets the reply's angle and tone without you re-explaining each time — but keep expectations real: it shifts style and framing far more than it makes the model 'smarter' or more factually accurate.

Like asking the same question to a doctor, a pharmacist, and a nurse — each answers from their angle. The role tells the model which hat to wear.

An analogy

The role is like the session's initial config: you set it once, and every later reply comes out consistent with it.

'Explain recursion' gives a definition; but 'you are a teacher for a 10-year-old, explain recursion' gives a simple story with a concrete example.

How it works

The role usually lives in the system prompt, acting as a fixed frame for every reply in the session. Practically, it tilts the probability distribution toward that role's vocabulary, style, and priorities: a 'code reviewer' leans into security and performance, a 'teacher' simplifies and gives examples. Specific roles ('senior Python reviewer focused on security') work far better than generic ones ('you are an expert') — and a role adds no knowledge to the model; it steers how existing knowledge is presented.

System: You are a senior Python code reviewer. Focus on security
and performance. Be direct, cite the line, suggest a fix.

User: Review this function:
def load(path): return pickle.load(open(path, "rb"))

Without the role you get generic notes; with it, the reply zeroes in on the danger of pickle with untrusted input — same knowledge, different focus and priorities.

Practice

🧪 Try it yourself: take one question (say, 'review this function') and run it 3 times: with no role, with a generic role ('you are an expert'), and with a specific role with clear priorities. Compare what actually changed between the replies — style and focus, or the factual substance itself?

Common mistakes
  • Inflated roles ('the smartest expert alive') hoping for higher accuracy — a role shifts style and framing, not capability.
  • A role that contradicts the rest of the instructions: 'explain simply for beginners' alongside a request for a deep technical report — the reply ends up torn between the two.
  • Cramming the role into every user message instead of setting it once in the system prompt.
When to use it

A product needing a consistent voice across replies, a review from a specific lens (security, performance, UX), or simplification for a defined audience.

When NOT to use it

Don't lean on it as an accuracy or safety guarantee: 'you are a security expert' prevents no mistakes, and it substitutes for neither explicit constraints nor real review of the output.

LET'S BUILD ITDone reading — now build it yourself.Run one question under different roles