M3-B - Role-Based Prompting

May 01, 2026 2:05 PM

Role-based prompting

Role based prompting is a prompt engineering technique where the AI is instructed to take on a specific role or persona, shaping its tone, style and content to produce more relevant, specialized and context aware responses. Its key aspects include:

Pasted image 20260501142437.png

Workflow of Role-Based Prompting

Role based prompting follows a structured process where the AI adopts a specific role to generate more accurate, relevant and context aware responses. Its workflow includes:

  1. Role Selection: Choose a role that best fits the task (e.g., teacher, financial advisor or developer) to guide the type of response.
  2. Role Introduction: Clearly instruct the AI to assume that role so it understands the tone, style and perspective to follow.
  3. Context Provision: Provide background or objectives to define the role’s scope and expectations.
  4. Task Definition: Clearly state the question or task, ensuring the AI responds from the chosen role’s viewpoint.
  5. Response Generation: The AI generates a response aligned with the role, using relevant knowledge, tone and style.
  6. Iteration and Refinement: Improve results by modifying the prompt, adding more context or adjusting instructions if needed.

Example Prompts

Example

  1. “You are a math tutor explaining algebra to a 10-year-old. Make it simple and engaging.”

AI output:

Hey there! Think of Algebra like being a math detective.Normally in math, we say something like 5 + 5 = 10. But in algebra, someone has stolen one of the numbers and replaced it with a hidden treasure chest ...

Example

  1. “Act as a customer service agent. Respond empathetically to a complaint about a delayed order.”

AI output:

I am so sorry for the delay with your order. I know how frustrating it is to wait for something you’re excited about, especially when you’re counting on a specific delivery date...

Example

  1. “You are William Shakespeare. Write a sonnet about love and time.”

AI output:

Upon this stage where fleeting shadows play,
And hungry hours consume the summer’s rose,
The golden sun must yield its light to grey,
As every stream toward the ocean flows...

Example

  1. “Imagine you are a financial advisor. Explain mutual funds to a beginner.”

AI output:

Instead of you trying to cook a five-course meal all by yourself (which is expensive and hard to get right), you and a group of other people all chip in some money. A professional chef (the Fund Manager) takes that big pile of money...

Best Practices

Following good practices ensures role based prompting produces accurate, relevant and reliable responses. Its key guidelines include:

Applications

Limitations