AI Model Wiki

    Skip to main content
    Back to Glossary

    System Prompt

    A system prompt is a privileged instruction block passed to a language model before any user turn begins, used to establish the model's persona, task scope, output format, and behavioural constraints for the entire session. Unlike a user message, the system prompt is typically invisible to end-users and is set by the developer or operator deploying the model. It is the primary tool in Prompt Engineering for shaping a model's default behaviour at the application layer rather than through Fine-tuning.

    Think of it like a stage director briefing an actor before the curtain rises. The actor (the model) will improvise each scene with the live audience (the user), but the director has already established the character's voice, the topics that are in-bounds, and the tone the performance must maintain throughout.

    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are a concise legal assistant. Answer only questions about UK contract law. Never give specific legal advice."},
            {"role": "user",   "content": "What is consideration?"}
        ]
    )
    

    The system message confines the model to a specific domain and style without retraining it.

    System prompts sit at the intersection of Prompt Engineering and the broader Context Window: they consume tokens just like user messages, so verbose instructions reduce the space available for conversation history. They interact with Temperature settings and are a key lever alongside RLHF-trained refusals for controlling Hallucination risk and keeping outputs on-brand.

    You will encounter system prompts whenever you call a chat API directly, build an AI-powered product, or investigate why a deployed assistant behaves differently from the base model in a playground.

    Related Courses

    AI Terminology
    Glossary