Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

A system prompt is a hidden or behind-the-scenes instruction that tells an AI chatbot how to behave before a user types a question. It can set the AI’s role, tone, safety rules, and task limits. This matters because the same user question can get different answers depending on the system prompt guiding the model.

Understanding system prompts helps students see that AI responses are shaped by design choices, not just by the words typed into the chat box.

A language model predicts likely next words using patterns learned from large amounts of text, but a system prompt gives it extra context for the current conversation. The model weighs the system prompt along with the user prompt and earlier messages when forming a response. In many chat systems, system instructions have higher priority than user instructions, so they help keep the AI focused, helpful, and safe.

This connects to computer science and statistics because the model uses probability, data patterns, and rules to choose an output.

Key Facts

  • A system prompt is an instruction given to an AI before the user prompt.
  • A user prompt is the question or command typed by the person using the AI.
  • In many systems, instruction priority is system prompt > developer prompt > user prompt.
  • A language model estimates probabilities for possible next tokens, such as P(next token | context).
  • A simplified scoring idea is best response = highest score(instructions + context + probability).
  • System prompts can guide style, role, safety limits, formatting, and what the AI should refuse to do.

Vocabulary

System prompt
A system prompt is a hidden instruction that sets the AI’s behavior, role, and limits before a user asks something.
User prompt
A user prompt is the message, question, or command that a person types into an AI system.
Language model
A language model is an AI program that generates text by predicting likely sequences of words or tokens from context.
Token
A token is a small piece of text, such as a word, part of a word, number, or symbol, that an AI model processes.
Context window
A context window is the amount of text the AI can consider at one time, including system instructions, user messages, and conversation history.

Common Mistakes to Avoid

  • Thinking the system prompt is the same as the user prompt. The system prompt is usually set by the app or developer before the conversation, while the user prompt is what the student types.
  • Assuming an AI answer is purely objective. The response is influenced by training data, probability, instructions, and the system prompt, so it should still be checked against reliable sources.
  • Ignoring instruction priority. If a user asks the AI to break its rules, the system prompt may override that request because it has higher priority in the chat setup.
  • Believing a longer prompt is always better. Extra words can confuse the task if they add unrelated goals, unclear constraints, or conflicting instructions.

Practice Questions

  1. 1 An AI chat has 120 total instruction tokens before the user message. The system prompt uses 45 tokens and the developer prompt uses 30 tokens. How many instruction tokens are left for other setup text?
  2. 2 A chatbot can consider 4,000 tokens in its context window. The system prompt uses 250 tokens, previous conversation uses 1,100 tokens, and the user prompt uses 150 tokens. How many tokens remain for the AI’s response and any additional context?
  3. 3 Two chatbots receive the same user question: Explain gravity. One system prompt says to answer like a kind middle school science tutor, and the other says to answer like a technical research assistant. Explain why their answers may be different even though the user prompt is identical.