Prompt Design for Language Models
A language model can be treated as a completion machine that continues a given prompt.
The Chat Window Assumption
Most people first meet a language model through a chat window. You type a question, and text comes back that looks like an answer. It is natural to assume the model is listening to you the way a person would, understanding your request and replying to it. That assumption shapes how people use these systems, and it is also the source of many surprising results. This article starts from that assumption, tests it, and then builds a more accurate picture of what the model is doing when it writes text.
The central idea is that a language model can be treated as a completion machine. It receives a piece of text, called the prompt, and produces the text that most plausibly follows. Everything else in this article is a consequence of that one framing.
Testing the Listening Assumption
Before reading on, make a prediction. Imagine a model that does nothing except continue whatever text it is given. You give it a question and nothing else. What does it do with that question?
What do you think happens?
A model that only continues text receives the bare question 'What is the boiling point of water?' and nothing else. What do you think it writes next?
Reveal answer
Another question, or more text in the same style, is a real possibility. A raw completion model does not necessarily answer.
The source notes that a raw model may respond with another question instead of an answer. Nothing in a bare question tells the model that it is supposed to reply. It only knows that text like this is often followed by more text of a similar kind, so the most plausible continuation may be a follow-up question, a list of similar questions, or a quiz-style line.
The surprise in that prediction is the point. A model that writes fluent replies in a chat window can still, under the same mechanism, produce a question in return. The fluency was never the same thing as understanding that you asked for an answer.
The Prompt as an Unfinished Passage
Think of the prompt as the start of a passage that someone has left unfinished. The model's job is to supply the continuation. It does this by estimating which pieces of text are likely to come next, given everything in the prompt. Those estimates are probabilities, so the model does not produce one fixed answer by rule. It produces a continuation that is likely given the input.
The same behavior works with a prompt that is not a famous quotation. If you begin a sentence such as 'The lighthouse keeper climbed the stairs and', the model's continuation depends on which words most commonly follow sentences like that. The model does not need to know a story about lighthouses to extend it. It needs only to predict the next text that fits.
The branches in the diagram are not all equally likely, and the source does not give a single rule that picks one of them. The model's output is one draw from a set of plausible continuations. Run the same prompt twice and a different branch can appear, because the output is a probabilistic prediction rather than a fixed lookup.
Watching a Completion Grow
A completion does not stop being part of the input once it is written. Each new piece of text the model produces becomes part of the text it reads next. The model then predicts the continuation of that longer passage, and so on. The prompt is the starting point of a loop, not a single question-and-answer step.
This loop explains why a small change in the prompt can change the whole output. The first continuation the model writes sets the context for everything after it. A prompt that leads toward a list will tend to produce a list, and a prompt that leads toward a question will tend to produce a question.
Completion Versus Holding a Conversation
The misconception to correct is this: a language model that produces fluent replies must be engaging with your request as a conversation partner. Completion is a different activity. A conversation requires the model to recognize that you asked something and to respond to that request. A completion does not require that at all.
The source notes that the step of shaping a model to respond appropriately to a user's request is handled in a later stage called post-training. The basic completion behavior comes first, and conversational behavior is a layer that has to be taught on top of it. When you see a model answer your question, you are seeing that layer working on top of the completion mechanism.
Predictions Are Not Guarantees
A completion is a prediction, and predictions can be wrong. A continuation can read smoothly and still be factually incorrect, because fluency and correctness are separate properties. The model is choosing text that fits the pattern of what usually follows, and a pattern can look right while being false.
The source describes this probabilistic character as what makes language models both exciting and frustrating to work with. The same mechanism that makes them flexible also makes their output uncertain. A model can produce a translation, a summary, or a label that looks authoritative, and still be a plausible guess rather than a verified result.
Reframing Tasks as Completion Tasks
Once you accept that a model completes text, many jobs can be restated as completion problems. The source highlights translation, summarization, coding, and solving math problems, along with spam classification. The trick is to write the prompt so that the most likely continuation is the output you want. The task is turned into a text prefix whose natural ending is the answer.
| Task | Prompt written as a prefix | Continuation that gives the answer |
|---|---|---|
| Translation | How are you in French is | Comment ça va |
| Spam classification | Is this email likely spam? followed by the email text, then a line asking for the label | Likely spam |
| Summarization | A passage of text, followed by the line: Summary: | A short restatement of the passage's main point |
| Coding | A comment describing a function, followed by the line: def function_name( | The body of a function matching the comment |
| Math | A worked problem, followed by the line: Answer: | The result of the calculation as the next line of text |
Each task becomes a passage that a model could plausibly finish with the desired output. Translation and spam classification are drawn from the source; the summarization, coding, and math rows are generated illustrations of the same pattern.
The translation row follows the source directly. The prompt 'How are you in French is' leaves a gap that a plausible continuation can fill with 'Comment ça va'. The model is not given a translation rule to execute. It is continuing a pattern in which a phrase is followed by its French rendering, so the translation appears as the completion.
Spam detection follows the same pattern. A prompt that asks 'Is this email likely spam?' and then includes the email text sets up a passage where 'Likely spam' is the plausible continuation. Seen this way, the language model becomes a spam classifier, because the label it writes is simply the continuation that fits the question.
Worked Example: Turning a Review Into a Label
Writing a prefix whose continuation is the label
You want a model to label a product review as positive or negative. Write a prompt so that the most likely continuation is the label.
- 1Name the task as a question about the text
Start from the question the output should answer, such as whether the review is positive or negative. This question will sit in the prompt, just as the spam question did.
- 2Include the text to be classified
Add the review itself after the question. The model needs the input text inside the passage it will continue.
- 3End with a cue that the label comes next
Finish the prompt with a line such as Label: so the most plausible next text is a single label word. Without a cue like this, the model may continue the review or ask a new question instead.
- 4Check what the most plausible continuation is
Read the prompt as if you were the model. If the natural next words are a label, the prefix is doing its job. If the natural next words are more review text, the prefix needs a clearer ending.
A prompt such as 'Is this review positive or negative? Review: The battery died after one day. Label:' has a most plausible continuation of a label word. The continuation is still a prediction and should be checked, but the task has been reframed as a completion.
Mistakes Beginners Make With Completion Prompts
Common mistake Treating a bare question as a request for an answer
What it looks likeSending only 'What is the boiling point of water?' to a raw completion model and expecting a direct reply.
Why it failsA completion model continues text. It may respond with another question or more text in the same style, because nothing in the prompt makes an answer the most plausible continuation.
Do this insteadWrite the prompt as a passage whose natural next text is the answer, for example by adding a cue such as Answer: after the question.
Common mistake Assuming a fluent output is a correct output
What it looks likeAccepting a confident, well-written summary or label without checking it against the source material.
Why it failsCompletions are probabilistic predictions. Fluency and correctness are separate properties, so a smooth continuation can still be wrong.
Do this insteadCheck outputs that matter, especially factual claims, numbers, and labels used for decisions.
Common mistake Ending the prompt before the answer slot
What it looks likeWriting a spam question and the email text but nothing after them, so the model keeps writing the email.
Why it failsThe model extends whatever the text suggests next. If the prompt does not make the label the natural next piece, the continuation may be something else.
Do this insteadEnd the prompt at the place where the answer should go, with a cue such as Label: or Summary:.
Common mistake Expecting the same prompt to always produce the identical continuation
Practice: Turn a Task Into a Prefix
A teacher wants a model to classify a short student comment as on-topic or off-topic. Write a prompt, built as a prefix of text, whose most plausible continuation is the classification. Include the question, the comment, and a final cue that the label comes next.
Hints
- Start from the question the output should answer, just as the spam example did.
- Put the comment inside the passage so the model has something to continue from.
- End at the slot where the label belongs, rather than at the end of the comment.
- After writing it, ask yourself whether a model reading only your prompt would most naturally write a label or more comment text.
Key Takeaways
- A language model can be treated as a completion machine that continues a given prompt, rather than as a listener that understands a request and replies to it.
- A raw completion model may respond to a question with another question, because completion and conversation are different activities. Conversational behavior is a later layer built on top of completion.
- Completions are probabilistic predictions. The output is a likely continuation, and fluency does not guarantee correctness.
- Translation, summarization, coding, math, and spam classification can be reframed as completion tasks by writing a prompt whose most plausible continuation is the desired output.