Role Prompting

Domain: Prompt Engineering

🎯 Motivation

Assigning a specific role to the LLM changes how it responds. A teacher explains simply; a lawyer cites laws; a debugger focuses on errors.

📋 Concrete Example

‘You are an experienced Python teacher explaining to a 14-year-old. Explain what a for loop is.’ vs ‘You are a senior software engineer. Review this code for performance issues.’ Different roles, different responses.

🔗 Analogy

Casting an actor in a role - the same actor plays a doctor differently than a villain. The role (prompt) shapes the performance (response). Role prompting casts the LLM in the right role for the task.