Prompt engineering
Structuring the text given to a language model so its output meets a stated success criterion — and, for anyone measuring AI answers, the variable that decides what the measurement is of.
Karl-Gustav Kallasmaa, Founder & CEOLast updated Prompt engineering is the practice of structuring the text sent to a language model — instructions, context, examples, formatting — so that its output meets a success criterion you defined in advance. It is an empirical activity, not a stylistic one: without a criterion and a way to test against it, a prompt change cannot be evaluated, because the same prompt run twice does not return the same text.
Anthropic's prompt engineering overview makes that precondition explicit. Its guide assumes you already have a clear definition of the success criteria for your use case, some way to test empirically against those criteria, and a first draft prompt you want to improve. It also says plainly that not every failing evaluation is best solved by prompt engineering — latency and cost, for instance, are often fixed more cheaply by selecting a different model.
The techniques operators actually document
The published guidance from the two largest providers converges, which is useful, because it means these are properties of the systems rather than folklore.
- Be explicit and sequential. Anthropic recommends giving instructions as numbered lists or bullet points when the order or completeness of steps matters.
- Use examples, and few of them well. Anthropic calls examples one of the most reliable ways to steer output format, tone and structure, and recommends 3-5 examples that are relevant, diverse and structured. OpenAI's prompting guide gives the same instinct: include a handful of input/output examples showing a diverse range of possible inputs with the desired outputs.
- Delimit the parts. Anthropic recommends XML tags —
<instructions>,<context>,<input>— so a prompt mixing instructions, context, examples and variable input is parsed unambiguously. OpenAI recommends Markdown headers and lists, or XML tags, to delineate where one piece of content begins and ends. - Put long inputs first. For inputs of 20k+ tokens, Anthropic advises placing longform documents near the top of the prompt, above the query and instructions, and wrapping each document in
<document>tags with<document_content>and<source>subtags. - Order for caching. OpenAI advises keeping content you expect to reuse at the beginning of the prompt, for cost and latency savings.
- Separate roles. OpenAI describes
developer,userandassistantmessages as carrying differing levels of authority, so where an instruction sits changes how strongly it binds. - Chain when you need to inspect the middle. Anthropic notes that current models handle most multistep reasoning internally, and that explicit chaining is still worth it when you need to log or branch on an intermediate output — most commonly draft, review against criteria, refine.
Why this term belongs in a GEO glossary
Because the prompt is the measurement instrument, and instruments are not neutral.
An AI-visibility number is a count over a set of prompts someone wrote. Change the wording — "best CRM for startups" versus "CRM tools comparison" — and the retrieval step matches different documents, so a different set of brands gets named. The reported rate moved; nothing about the brands did. This is why two tools can report different figures for the same brand in the same week without either of them being wrong, and why a prompt set is the first thing to inspect when a number surprises you.
The practical consequence is that a prompt set should be treated like a schema: written down, versioned, and changed deliberately. Editing prompts mid-window breaks the comparison you were trying to make, and no statistical test downstream can repair it, because the denominator changed meaning rather than size.
Failure modes
- Tuning without an eval. Models are non-deterministic. One better-looking output after a prompt change is a single draw, not evidence. Fix the criterion first, then measure over repeats.
- Prompting around a retrieval failure. If the document was never fetched into the context window, rewording the question cannot surface it. That is a retrieval problem, and it is solved upstream.
- Overstuffing the window. More context is not free: accuracy and recall degrade as a window fills, so an indiscriminately packed prompt can perform worse than a selective one, even when everything fits within the token budget.
- Confusing compliance with correctness. A well-structured prompt makes output well-formed. It does not make it true — a confidently formatted hallucination is the standard result of a good prompt over bad context.
- Silently changing the prompt set. The most common measurement error in this field is not a bad prompt. It is a prompt edited between two readings that are then compared to each other.
Frequently asked questions
What has to exist before tuning a prompt?
A success criterion and a way to test against it empirically. Anthropic's guide assumes both.
How many few-shot examples?
Anthropic documents 3-5, structured in <example> tags.
Where do long documents go?
Near the top, above the query and instructions, for inputs of 20k+ tokens.
Does a better prompt make an answer true?
No. Structure controls form. Truth depends on what was retrieved and whether the model read it correctly.
Terms related to Prompt engineering
The token budget a model can reference in one request, what counts against it, and why a bigger window does not remove the need to retrieve selectively.
The units a language model actually reads and writes, why they are not words, and why every limit and price you meet is denominated in them.
The architecture that retrieves documents at query time and has a model write from them, and the reason your page can be quoted without ever being trained on.
When a language model states something false with the same fluency it states something true — why the training pipeline produces it, and what it means for a brand being described by a model.