Module 2 Lesson 4: Instruction Following and Role Prompts
Why 'Act as a Senior Engineer' works. The psychology and technicality of role-based prompting.
Instruction Following and Role Prompts
One of the most effective ways to improve ChatGPT's performance is by giving it a Role or Persona. This isn't just "magic"—it's a way to narrow down the model's prediction space.
1. Why Role-Playing Works
When you ask a general question, the model considers all of the "internet knowledge." When you say "Act as a world-class chef," you are effectively telling the model to prioritize tokens and patterns that appear in culinary texts.
2. The Anatomy of a Role Prompt
A good role prompt includes three things:
- The Role: Who is the AI? (e.g., Senior Software Architect)
- The Context: What is the situation? (e.g., Reviewing a new feature)
- The Objective: What is the goal? (e.g., Finding security vulnerabilities)
graph TD
General[General Query] --> Broad[Broad Search Space]
Broad --> Med[Average Result]
Role[Role Prompt] --> Narrow[Specific Pattern Search]
Narrow --> High[Expert Result]
3. Common Personas that Work
- The Critic: "Find the flaws in my logic."
- The Socratic Tutor: "Don't give me the answer; ask me questions to lead me to it."
- The Translator: "Act as a native Spanish speaker with a focus on Colombian slang."
Hands-on: The Persona Shift
Compare these two prompts:
- "How can I improve my workout?"
- "Act as an Olympic Powerlifting Coach. Review my current routine: [Insert your routine]. Focus on maximizing explosive power while minimizing injury risk."
The second prompt will provide much more specific, actionable, and "expert" advice.
Key Takeaways
- Persona = Prioritizing specific data patterns.
- High-quality roles lead to higher-quality outputs.
- Be as specific as possible about the expertise you want the AI to simulate.