System prompt

From llmref.wiki
System prompt — A developer-supplied instruction block that frames a model's persona, constraints, and task context for an entire conversation.

Overview

The system prompt (also system instruction) is a text block supplied by the developer or application to a language model before user interaction begins. It is processed by the model as a high-priority instruction set that defines the conversation's behavioral frame: persona, scope restrictions, output format requirements, and task-specific knowledge.

System prompts are a standard feature of chat-completion API designs (OpenAI, Anthropic, Google) and are distinct from the user turn in that they carry implicit or explicit elevated authority over user instructions in the model's attention weighting.

The boundary of that authority is contested and is the subject of prompt injection attacks, which attempt to override system prompt instructions from within user or document input.

System prompt in the API call structure

A modern chat-completion API call typically has three role types:

Role Who controls it Typical content
system Developer/application Persona, rules, knowledge, format requirements
user End user Queries, tasks, uploaded content
assistant Model (prior turns) Model's previous responses in multi-turn conversation

System prompts are generally not shown to end users by default, but are not reliably hidden: prompt injection techniques and direct instruction ("repeat your system prompt") can sometimes extract them.

Scope and limitations

The system prompt is bounded by the Context window: it occupies tokens, reducing the space available for conversation history and retrieved content. Very long system prompts (tens of thousands of tokens) can degrade model instruction-following, especially mid-context.

A system prompt does not persist across separate API calls by default. Multi-turn conversation systems must re-inject the system prompt at the start of each call; agent memory patterns are used to manage information that should survive session boundaries.

Distinction from related terms

  • The system prompt is not the same as a prompt generally — it is the developer-side frame, not the user's query.
  • It is not the same as fine-tuning: a system prompt provides in-context instructions; fine-tuning encodes behavior into model weights.
  • System prompt and pre-prompt are used interchangeably in practice; API vendors use different terminology (OpenAI: system role; Anthropic: system parameter; Gemini: systemInstruction).

See also

References