ArcLibrary

System Prompt

The model's global setup — identity, behaviour, and output format, set in stone for the conversation.

PromptSystem
核心 · Key Idea

In one line: The system prompt is the instruction that sits at the start of the conversation and stays in effect the whole time — it tells the model "who you are, what to do, how to sound, what format to emit." It is the single strongest lever on model behaviour.

What it is#

OpenAI / Anthropic / Chinese chat APIs all use three message roles:

[
  { "role": "system", "content": "You are a strict SQL reviewer..." },
  { "role": "user",   "content": "Please review this SQL: ..." },
  { "role": "assistant", "content": "This query has 3 issues..." }
]

The system message appears once (at the front), but its influence runs through the entire conversation. Whatever follows is filtered through the role the system prompt set.

Analogy#

打个比方 · Analogy

The system prompt is the character sheet handed to an actor: "you play a haughty 1920s British detective." Every line afterwards is bounded by that page. User messages are the audience's questions; assistant messages are the actor's reactions — change the character sheet and the whole show changes flavour.

Key concepts#

PersonaPersona
'You are a senior PM' / 'You are a finance lawyer' — sets the tone and knowledge bias.
ConstraintsHard constraints
'Always reply in JSON' / 'No more than 200 words' / 'Refuse politics.'
ContextBackground
'This is a SaaS company whose customers are…' so the model doesn't keep asking.
FormatOutput format
Schema, markdown, tables, field names — so downstream parsers don't break.

What a good system prompt looks like#

[Role]    You are a …
[Goal]    Your task is to …
[Constraints]
- Must …
- Never …
[Output format]
- Use markdown, with this structure:
  - Summary (≤ 50 words)
  - Detailed analysis (bulleted)
  - Recommendations (≤ 3 items)
[Fallback] If information is insufficient, reply "need more information" and list required fields.

Practical notes#

  • Specific beats vague. "Please use a professional tone" is worlds weaker than "use third person, avoid subjective adjectives, cite papers with DOI."
  • Don't stack instructions. Three to five core constraints work best. A dozen will fight each other and the model "obeys whichever it likes."
  • Format > prose. When you need JSON, paste an example schema — it's far more precise than describing it in words.
  • Add fallback branches. "If the user asks X, answer Y" is the most stable pattern, but don't overdo it or you'll induce hallucinations.
  • Sandbox the user input. Wrap user content in <input>...</input> style tags to defend against "ignore the previous instructions" prompt injection.

Easy confusions#

System Prompt
Conversation-level **global setup**.
Set once, governs the whole session.
User Prompt
A single-turn **concrete question**.
A fresh query every time.
System Prompt
Injected **at runtime** — free, flexible, **changeable any moment**.
Fine-tuning
Behaviour baked **into the weights** — more reliable but requires training + deployment.

Further reading#

  • Few-Shot — should examples go in the system or user message?
  • Temperature & Top-P — pair the system prompt with low temperature for stability
  • CoT — "let's think step by step" is the cheapest system-prompt boost there is