Prompt engineering is the practice of shaping a model’s input to get better output. The model’s weights stay fixed; what changes is the instructions, context, examples and format you give it. For a large language model, the prompt is the only lever you have without retraining, and it turns out to be a strong one.
It works because language models are conditioned on everything in their context. The same model will answer differently when told who the audience is, shown what a good answer looks like, or asked to reason before answering.
The main techniques
- Clear, specific instructions. State the task, the audience, the constraints and what “done” looks like. Most weak outputs trace back to an underspecified request.
- Context. Supply the documents, data or background the model needs rather than hoping it knows. Retrieval systems like RAG automate this step.
- Examples. Show a few input–output pairs and the model imitates the pattern. The GPT-3 paper (2020) called this few-shot prompting and showed that a large enough model could pick up new tasks this way with no gradient updates, a process the paper calls in-context learning.
- Room to reason. Asking for intermediate steps before the answer, chain-of-thought prompting, raised accuracy on multi-step maths and logic problems in a 2022 Google study, with the gains growing as models got larger.
- Structure. Put standing instructions in a system prompt, separate instructions from data with clear delimiters or tags, and ask for a specific output format when a program will read the result.
An engineering loop
The diagram’s point is that this is iterative and testable. Anthropic’s prompt engineering guide says to start with clear success criteria, some way to test against them empirically, and a first draft to improve. You run the prompt on real and edge-case inputs, find where it fails, change one thing, and run it again. Without that evaluation step, prompt changes are guesswork.
Where it stops
Prompting can’t add knowledge the model lacks or reliably override behaviour it was trained into. When a task needs new skills, a consistent style across millions of calls, or a smaller cheaper model, fine-tuning is often the better tool. Prompts are also brittle across models: wording tuned for one model can underperform on the next. And as models improve, less of the craft is phrasing tricks and more of it is simply giving the model the context a capable colleague would need.