Prompt Engineering
Structuring the model's input — system, context, task, format, examples — to get reliable, high-quality outputs.
Preparing spaced-repetition scheduler…
A prompt is not just the user question. A well-shaped prompt has five named parts, and thinking in those parts makes the difference between a flaky demo and a production feature:
- System — persona, role, hard constraints, refusal policy, output schema. Sets the rules.
- Context — retrieved documents, prior turns, tool results, user data. Grounds the response.
- Task — the actual ask, phrased precisely with success criteria.
- Format — JSON shape, length, language, bullet vs prose, citation style.
- Examples — few-shot demonstrations of the desired behavior, especially for edge cases.
Key techniques:
- Be explicit about format. "Return a JSON object with keys {summary, references}" beats "summarize this".
- Show, don't tell. A two-line example of the desired output is more reliable than a paragraph of instructions.
- Order matters. Place the most important instructions at the start or end of the prompt; the middle is weaker (lost in the middle).
- Structured reasoning. For difficult multi-step work, provide clear success criteria and either use the model's reasoning controls or split the task into verifiable stages. A long reasoning trace is not proof of correctness.
- Verification. Ask the model to check the result against explicit criteria, and use external tools or tests when an answer can be measured.
Limits: a prompt can supply new facts for the current context, but it does not persistently update model weights. Retrieval can supply external evidence; fine-tuning changes parameters. Evaluate the simplest approach that meets the task.
Key takeaways
- A prompt = system + context + task + format + examples.
- Place key instructions at the start or end; the middle is weaker.
- Few-shot examples beat long instructions for format-sensitive tasks.
Self-check
Which part of a prompt defines persona, refusal policy, and output schema?
What is the strongest way to improve reliability on a multi-step task?
References
- Prompt Engineering Overview
Techniques for structuring prompts and tools.
- Function Calling Guide
Tool-use protocol for GPT models.
Last verified 2026-09-04.