OpenAI: prompt engineering best practices
Official guidance on writing instructions, supplying context, specifying format, and using examples.
Compute College
How clear instructions, examples, constraints, and output formats help an AI model complete a task.
Prompt engineering is writing the instructions that tell an AI model what to do, what information to use, what rules to follow, and what a useful answer looks like. A prompt may include the task, background, constraints, examples, format, and acceptance criteria. It does not retrain the model; it changes the instructions and information supplied for this request or workflow.
Memory trick: Prompt engineering tells the model what job to do and what a successful result looks like.
A capable model can still produce a weak answer when the request is vague, contradictory, or missing necessary information. Prompt design also affects compute economics: longer prompts consume more input tokens, uncontrolled responses generate unnecessary output tokens, and repeated attempts to correct a poor result add more token usage, latency, and cost. The objective is not the longest possible prompt — it is the smallest set of clear instructions needed to produce a reliable result.
Consider the request "Review this report." The model does not know what kind of review is needed, who will read it, which risks matter, or what format to produce. A more useful prompt: "Review the attached report for an executive audience. Identify the three most important findings, two material risks, and any unsupported claims. Return a short executive summary followed by a table of findings and evidence."
Example figures are illustrative calculations, not current quoted market prices.
Current example
OpenAI publishes prompt-engineering guidance describing the practice as designing and refining the inputs that guide a model’s response, with clear instructions, relevant context, a desired format, and examples as the levers that improve results. Use these as terminology references; they are vendor guidance, not independent measurements of any specific workload.
Official guidance on writing instructions, supplying context, specifying format, and using examples.
A longer walkthrough of structuring a prompt and refining it against real tasks.
The Compute College lesson that converts prompt size and response length into a priced unit.
Source discipline: prompt-design guidance is vendor documentation. Cost and latency effects vary by workload, model, and provider — measure your own before generalizing.
Prompt engineering is not a collection of magic phrases. Instructions such as "act as an expert" or "think carefully" cannot replace missing data, unclear requirements, or a definition of success. Excessively long prompts create the opposite problem: they can introduce contradictions, distract the model from the main task, and increase input-token cost on every call.
Practical takeaway
Use a repeatable prompt structure — task, context, constraints, output, examples, success criteria — and test it against a small set of representative tasks rather than judging it from one successful response.
Decision check: a prompt is effective when it reliably produces a useful result without unnecessary instructions, tokens, or retries.
Compute College track
Step 1 of 18: What is prompt engineering