---
title: "What is prompt engineering? Definition and techniques"
description: "Prompt engineering is the practice of writing and structuring LLM instructions for reliable output. Core techniques, and how it compares to context engineering."
type: "glossary-term"
canonical_url: "https://theaiengineering.com/glossary/prompt-engineering"
markdown_url: "https://theaiengineering.com/glossary/prompt-engineering.md"
topic: "Prompt and context engineering"
author: "The AI Engineering Editors"
publisher: "The AI Engineering"
updated: "2026-11-06"
keywords: ["Prompt engineering","prompt design","prompting"]
citation: "The AI Engineering Editors. \"What is prompt engineering? Definition and techniques.\" The AI Engineering, updated Nov 06, 2026. https://theaiengineering.com/glossary/prompt-engineering"
---

# What is prompt engineering? Definition and techniques

Also called prompt design, prompting.

> **Definition of Prompt engineering:** 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](https://theaiengineering.com/glossary/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](https://theaiengineering.com/glossary/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](https://arxiv.org/abs/2005.14165) (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)](https://arxiv.org/abs/2201.11903) 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](https://theaiengineering.com/glossary/reasoning-model) 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](https://theaiengineering.com/glossary/structured-outputs).
- **Sampling settings.** Use a low [temperature](https://theaiengineering.com/glossary/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](https://theaiengineering.com/glossary/context-engineering) covers everything in the [context window](https://theaiengineering.com/glossary/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](https://theaiengineering.com/glossary/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](https://theaiengineering.com/articles/rag-vs-fine-tuning) comparison covers when retrieval is the better third option.

## Related terms

- [Context engineering](https://theaiengineering.com/glossary/context-engineering): Context engineering is the practice of selecting, structuring, and pruning all the information placed in an LLM's context window at each step, including instructions, retrieved data, tool results, and memory.
- [Fine-tuning](https://theaiengineering.com/glossary/fine-tuning): Fine-tuning is the process of further training a pretrained model on a smaller, task-specific dataset so its weights change to improve performance on a particular task, domain, style, or output format.
- [Structured outputs](https://theaiengineering.com/glossary/structured-outputs): Structured outputs is an LLM API feature that constrains generation so the model's response always conforms to a developer-supplied JSON Schema, producing output that code can parse without retries.
- [Temperature](https://theaiengineering.com/glossary/temperature): Temperature is a sampling parameter that rescales a language model's next-token probabilities: low values concentrate probability on the likeliest tokens, and high values flatten the distribution for more varied output.
- [Context window](https://theaiengineering.com/glossary/context-window): A context window is the maximum number of tokens a language model can take into account in a single request, including the system prompt, conversation history, tool results, and the generated output.
- [System prompt](https://theaiengineering.com/glossary/system-prompt): A system prompt is the set of developer-written instructions sent to a language model ahead of the conversation, defining its role, rules, output format, and tool use for every turn that follows.
- [Few-shot prompting](https://theaiengineering.com/glossary/few-shot-prompting): Few-shot prompting is a technique that puts a few example inputs paired with desired outputs in a prompt, so a language model infers the task, format, and labels without changing its weights.
- [Chain-of-thought prompting](https://theaiengineering.com/glossary/chain-of-thought): Chain-of-thought prompting is a technique that has a language model write intermediate reasoning steps before its final answer, which improves large models' accuracy on arithmetic, commonsense, and symbolic reasoning tasks.

## Guides that cover prompt engineering

- [What is context engineering? A practical guide for AI agents](https://theaiengineering.com/articles/context-engineering): Context engineering is the practice of choosing what fills an LLM context window. Learn its components, why context rot happens, and how to measure results.
- [RAG vs fine-tuning: how to choose for your LLM application](https://theaiengineering.com/articles/rag-vs-fine-tuning): RAG vs fine-tuning: RAG adds knowledge at query time, while fine-tuning changes model behavior. Compare freshness, cost, latency, data needs, LoRA, and hybrids.
- [What is tool calling? How LLM function calling works](https://theaiengineering.com/articles/tool-calling): Tool calling lets an LLM request actions from your code through structured calls. Learn the request loop, parallel calls, structured outputs, security, and MCP.
- [Reasoning models: how they work and when to use them](https://theaiengineering.com/articles/reasoning-models): Reasoning models explained: how test-time compute and reinforcement learning produce chain-of-thought reasoning, when to use them, and their cost and latency.

Part of the [Prompt and context engineering](https://theaiengineering.com/topics/prompt-engineering) topic hub.

## 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: 2026-11-06
- URL: https://theaiengineering.com/glossary/prompt-engineering
- Markdown: https://theaiengineering.com/glossary/prompt-engineering.md
