In short
A prompt is all the text the model reads before it answers. In a chat app that's more than your message, and every word in it changes what the model is likely to write next.
You send your friend a WhatsApp message: "Is it worth it?"
If you were talking about the new metro pass five minutes ago, she knows exactly what you mean. If she has just woken up and this is the first message she sees, she has no idea. Is what worth it? Worth what? For whom?
A chatbot is always in the second situation. It can't see you, doesn't know your city, your budget or what you tried yesterday, and can't read your mind. All it has is the text in front of it. In this lesson you'll see exactly what that text is, run a real test of how the words in it change what a model writes, and find out why the same question can get different answers.
A prompt is the text the model reads
A prompt is the input you give an AI model to guide what it produces. For a chatbot, that's text. (Some models also take images or sound, but this track is about text.)
In Predicting the next word you saw what a language model does with text: it reads all of it, gives every possible next token a chance of coming next, picks one, adds it and repeats. A token is a small piece of text, often a word or part of a word, as Tokens: the LLM's alphabet showed.
So a model's answer is a continuation of its prompt. Change the prompt and you change the chances of every token that follows. That one idea is behind everything else in this track.
What the model actually sees
When you type into ChatGPT, Gemini or Claude, your message isn't the whole prompt. The app wraps it in more text before the model reads it:
- A system prompt: instructions from the company that made the app, added before your first message. You never see it, but the model does.
- Everything said so far in this chat: your earlier messages and the model's earlier replies.
- Your new message.
- A cue that marks where the assistant's reply starts, so the model answers you instead of carrying on with your message.
All of this is joined into one piece of text, using a chat template: a fixed pattern of special markers that shows the model who said what. Each family of models has its own markers. Here's a short chat written out in the template of Zephyr, a small open model, as shown in Hugging Face's guide to chat templates:
What you see
- You: I'm opening a chai stall outside a college in Pune.
- Assistant: That sounds like a great spot! How can I help?
- You: Suggest a name for it.
What the model reads
- The app's system prompt, hidden from you<|system|> You are a helpful assistant. Today's date is 22 November 2026.</s>
- Earlier messages, sent again<|user|> I'm opening a chai stall outside a college in Pune.</s> <|assistant|> That sounds like a great spot! How can I help?</s>
- Your new message<|user|> Suggest a name for it.</s>
- The cue: the assistant's turn starts here<|assistant|>
Zephyr's end-of-message marker is </s>. Three things in Figure 1 are worth noticing.
The system prompt is real, and long. Anthropic publishes a version of the system prompt its Claude apps add at the start of every conversation. It runs to thousands of words, and it includes today's date, which is how a chatbot knows what day it is. Apps built by other companies on the same model can use a completely different system prompt, which is one reason the same model can behave differently in two apps. You'll learn to write your own in Roles and system prompts.
The whole chat is read again for every reply. "Suggest a name for it" only makes sense because the message about the chai stall is still in the text. The model doesn't remember your chat on its own; the app sends it all again each time. Start a new chat and that earlier message is gone, so "it" means nothing. Some apps add more, such as files you've attached or notes they've saved about you, but it all arrives the same way: as part of the text.
The cue matters. You saw in From base model to assistant that a model trained only to continue text will happily carry on writing your question for you. The marker at the end, <|assistant|>, is how a chat model knows that it's now its turn to answer.
A real test: same words, more context
To see how much the words around a question matter, we ran GPT-2 on two prompts with exactly the same ending. GPT-2 is the small, older model from the How AI works track: it's free, and anyone can run it again and get the same numbers. Both prompts end with "I had a cup of", and we asked for GPT-2's chances for the next word.
No context
I had a cup of ___
- ·coffee38.2%
- ·tea27.0%
- ·water1.4%
- ·jo1.2%
- ·wine1.0%
- ·milk0.9%
- every other token30.3%
Five draws, weighted by these chances
- coffee
- coffee
- water
- spice
- tea
A little context
Every morning at the chai stall near the station, I had a cup of ___
- ·tea49.6%
- ·coffee16.7%
- ·water3.1%
- ·milk1.8%
- ·hot1.8%
- ·soup1.2%
- every other token25.8%
Five draws, weighted by these chances
- tea
- coffee
- water
- Coffee
- tea
With no context, GPT-2 thinks "coffee" is the most likely next word, at 38.2%, with "tea" at 27.0%. With nothing else to go on, it falls back on whatever was most common in the English web pages it learned from.
Add "Every morning at the chai stall near the station," and the picture flips: "tea" jumps to 49.6% and "coffee" drops to 16.7%. Nothing about the model changed. Only the text did.
The five draws show the other half of the story. Even with the context, picking at random by those chances gave "tea" twice, "coffee" twice and "water" once. Better context makes the answer you want more likely. It doesn't make it certain.
Today's chat models are far bigger and better than GPT-2, but they work the same way: every word you add changes the chances of every word that comes after it.
Why the same question gets different answers
There are two reasons, and you've now seen both.
1. The wording is the input. Two wordings of the same question are two different strings of tokens, so they lead to two different sets of chances. Even changes that don't change the meaning can matter. In one 2023 study, researchers changed only the formatting of prompts, such as capital letters, spacing and the punctuation between parts, and kept the meaning the same. With one open model, Llama 2 (13B), accuracy on the same task varied by up to 76 percentage points. A percentage point is the plain difference between two percentages: going from 20% to 96% is a rise of 76 percentage points.
2. The pick is random. As you saw in Predicting the next word, most chatbots pick each token at random, weighted by the chances, so even exactly the same prompt can get a different answer next time. Researchers at Wharton asked GPT-4o each of 198 hard, four-option science questions 100 times. It didn't always give the same answer. When a question only counted as solved if GPT-4o got it right all 100 times, it did only about 5 percentage points better than picking answers at random, too small a gap to be sure it was more than luck.
The same study tested politeness. Starting with "Please answer the following question" instead of "I order you to answer the following question" changed the share of right answers on some single questions by around 60 percentage points, up for some questions and down for others. Across all 198 questions, the differences cancelled out.
So small changes can matter a lot, and you can't always tell in advance which way. That's why this track ends with Test and improve your prompts: the only way to know if a prompt works is to try it more than once.
So what is prompt engineering?
Prompt engineering is the process of writing a prompt, seeing what the model does with it, and improving it, again and again, until the answers are what you need. It isn't a list of magic words. It's mostly about giving the model what it needs to know, clearly, because the text is all it has.
Anthropic's prompting guide describes a model in almost the same way, as "a brilliant but new employee who lacks context on your norms and workflows", and suggests a simple test for any prompt: show it to a colleague who knows little about the task and ask them to follow it. If they'd be confused, the model will be too.
Your first prompt pattern: let it ask you
You won't always know what context the model needs. So ask it. Add this to the end of a request, and the model will ask you for the missing details before it starts:
Before you answer, ask me up to 3 questions about anything you need to know to do this well. Wait for my answers, then answer.It works because the model's questions become part of the chat, and your answers become part of the text it reads when it finally writes its reply. You fill the gaps you didn't know were there. You'll learn to write that context in yourself in Say exactly what you want and Give context and the reason why.
Key takeaways
- A prompt is all the text the model reads before it answers, and the answer is a continuation of it.
- In a chat app, the prompt is more than your message: a hidden system prompt, the whole chat so far and a cue for the reply, joined into one text with a chat template.
- Anything that isn't in the text doesn't exist for the model. If it matters, write it down.
- Every word changes the chances of what comes next: a little context flipped GPT-2's top guess from "coffee" to "tea".
- The same question can get different answers because the wording is the input and the pick is random. So test a prompt more than once before you trust it.
Check your understanding
Sources and further reading
- The Prompt Report: A Systematic Survey of Prompt Engineering Techniques, paper (opens in a new tab)Paper · A 2025 survey of the research on prompting, with definitions of a prompt, prompt engineering and 58 prompting techniques.
- Chat templates, docs (opens in a new tab)Docs · Hugging Face's guide to how a chat is turned into one piece of text for the model, including the Zephyr format in this lesson's Figure 1.
- System prompts, docs (opens in a new tab)Docs · Anthropic publishes the hidden instructions its Claude apps add at the start of every chat. Open one to see how long a real system prompt is.
- Prompting best practices, docs (opens in a new tab)Docs · Anthropic's guide to writing prompts, including the "new employee" way of thinking about a model and a simple test for any prompt.
- Prompting Science Report 1: Prompt Engineering is Complicated and Contingent, paper (opens in a new tab)Paper · A 2025 Wharton study that asked GPT-4o every question 100 times, and found that saying "please" helped on some questions and hurt on others.
- Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design, paper (opens in a new tab)Paper · A 2023 study (published at ICLR 2024) showing that small formatting changes, with the meaning kept the same, can change a model's accuracy a lot.