What is prompt engineering? Definition and techniques
Also called prompt design, prompting
Definition
Prompt engineering is the practice of designing the instructions, examples, and formatting given to a large language model so it produces accurate, consistent output for a task, without changing model weights.
Prompt engineering is the work of shaping a model's input so its output meets a specification. The practice covers the system prompt, the wording of the task, worked examples, output format instructions, and the order in which those pieces appear. Because it changes only the input, prompt engineering is the fastest and cheapest way to change the behavior of a large language model, and usually the first lever teams try.
How prompt engineering works#
Most prompting techniques fall into a few families:
- Clear instructions and context. State the task, the audience, the constraints, and what to do when information is missing.
- Few-shot examples. Include input and output pairs in the prompt. The GPT-3 paper (Brown et al., 2020) showed that a 175-billion-parameter model could perform new tasks from a few in-prompt demonstrations, without gradient updates or fine-tuning.
- Chain-of-thought. Ask for intermediate reasoning steps. Wei et al. (2022) found that eight chain-of-thought exemplars let a 540-billion-parameter model reach state-of-the-art accuracy on the GSM8K math benchmark. Reasoning models now generate this kind of reasoning without being asked.
- Structure and delimiters. Separate instructions from data with headings or XML-style tags, and request a fixed format or enforce one with structured outputs.
- Sampling settings. Use a low temperature for extraction and classification, and a higher one for open-ended writing.
In production, prompts behave like code: they need version control and a regression test set, because a wording change that fixes one case can break another.
Prompt engineering vs context engineering#
Prompt engineering focuses on the instructions. Context engineering covers everything in the context window at inference time, including retrieved documents, tool definitions and results, memory, and conversation history. Anthropic describes context engineering as the natural progression of prompt engineering. The distinction matters most for agents, whose context changes on every step.
Prompt engineering vs fine-tuning#
Fine-tuning changes the model's weights with training data; prompt engineering leaves the weights untouched. Prompting is quicker to iterate on and needs no training infrastructure. Fine-tuning suits behavior that is hard to describe but easy to demonstrate with many examples, or cases where a long prompt makes every request slower and more expensive. The RAG vs fine-tuning comparison covers when retrieval is the better third option.
Related terms
Guides that cover prompt engineering
Cite this definition
The AI Engineering Editors. "What is prompt engineering? Definition and techniques." The AI Engineering, updated Nov 06, 2026. https://theaiengineering.com/glossary/prompt-engineering
- Title
- What is prompt engineering? Definition and techniques
- Author
- The AI Engineering Editors
- Publisher
- The AI Engineering
- Updated