Table of Contents
System Prompts
A system prompt is a set of hidden instructions provided to a Large Language Model (LLM) before it interacts with a user. These instructions define the AI's role, behavior, priorities, and operational constraints. Unlike user prompts, system prompts are typically invisible to the end user and have the highest priority within the model's instruction hierarchy.
System prompts are widely used in AI assistants, chatbots, autonomous agents, customer support systems, and role-playing characters.
Purpose
A system prompt can instruct an AI to:
- Define its personality or role.
- Set the tone of conversation.
- Establish safety and ethical boundaries.
- Control formatting and response style.
- Determine how the AI should use external tools.
- Provide domain-specific expertise.
- Enforce company or application policies.
Instruction Hierarchy
Modern LLMs generally process instructions in a priority order similar to:
- System Prompt
- Developer Prompt
- User Prompt
- Previous conversation context
When instructions conflict, higher-priority instructions typically override lower-priority ones.
Typical Components
A system prompt may include sections such as:
Identity
Defines who or what the AI is.
Example:
You are an experienced Linux system administrator.
Personality
Controls writing style and tone.
Examples:
- Professional
- Friendly
- Humorous
- Formal
- Technical
- Educational
Capabilities
Describes what the AI should help with.
Examples include:
- Programming
- Technical support
- Creative writing
- Tutoring
- Data analysis
Behavioral Rules
Specifies how the AI should interact.
Examples:
- Ask clarifying questions when necessary.
- Explain reasoning clearly.
- Admit uncertainty when appropriate.
- Avoid making unsupported claims.
Formatting Rules
Defines how responses should be presented.
Examples:
- Markdown
- JSON
- XML
- Tables
- Step-by-step instructions
Safety Policies
Limits the types of content the AI should generate.
These may include restrictions involving:
- Dangerous activities
- Illegal behavior
- Privacy violations
- Harassment
- Sensitive personal information
Example
A simplified system prompt might look like:
You are a cybersecurity instructor. Provide clear technical explanations suitable for beginners. When discussing offensive security techniques, emphasize defensive uses, legal considerations, and responsible disclosure. Format responses using Markdown.
Common Uses
System prompts are commonly used for:
- AI assistants
- Customer service bots
- Coding assistants
- Technical documentation
- Educational tutors
- Virtual companions
- Role-playing characters
- Research assistants
Security Considerations
Because system prompts influence an AI's behavior, they are valuable targets for security researchers and prompt engineers.
Related concepts include:
- Prompt Injection
- Jailbreaking
- Prompt Leakage
- Indirect Prompt Injection
Modern AI systems are generally designed to resist attempts to reveal or ignore their system prompts.
Limitations
A system prompt does not provide absolute control over an LLM.
Other factors also influence responses, including:
- The model's training
- Safety mechanisms
- Tool availability
- Conversation history
- Runtime policies
