Prompt Engineering
Prompt engineering is the practice of designing the inputs to a language model — instructions, examples, role definitions, output formats, and constraints — to reliably produce a desired output without changing the model's weights.
Full definition
Effective prompts typically combine: a clear role and task, relevant context, illustrative examples (few-shot), explicit output format, and edge-case rules. Advanced techniques include chain-of-thought reasoning, ReAct (reason + act for tool use), and self-consistency (sampling multiple answers and majority-voting). Prompt engineering is the first thing every team should master before considering fine-tuning.
Why it matters
Prompt engineering converts a generic foundation model into a specific, dependable production component. Rigorous prompt engineering, plus eval-driven iteration, can match fine-tuned model quality at zero training cost — and is reversible the next time a better foundation model ships.
Example
A support team rewrites their classification prompt to include 5 examples, an explicit JSON output schema, and a "if uncertain, return UNKNOWN" rule. Accuracy rises from 78% to 94%; downstream parsers stop crashing.
Related terms
- Large Language Model (LLM)A Large Language Model (LLM) is a deep neural network — almost always a transformer — trained on hundreds of billions to trillions of words to predict the next token, and to generate, summarize, translate, or reason over text.
- Few-shot / Zero-shot LearningFew-shot learning is the ability of a model to perform a new task given only a handful of examples at inference time; zero-shot learning is the same idea with no examples — the model relies entirely on its pretraining and the natural-language instruction.
- Chain-of-Thought (CoT)Chain-of-Thought (CoT) is a prompting and training technique in which a language model is encouraged to reason step-by-step before producing its final answer — improving accuracy on math, logic, and multi-hop reasoning by 10-40 percentage points on standard benchmarks.
- Context WindowA context window is the maximum amount of text — measured in tokens — a language model can read and reason over in one inference call, equivalent to the model's working memory for that turn.
- Retrieval-Augmented Generation (RAG)Retrieval-Augmented Generation (RAG) is a technique where a language model retrieves relevant documents from an external knowledge base before generating a response, reducing hallucination by 30-60% and enabling citation of sources.
Source & further reading
Primary source: OpenAI — "Prompt engineering" (official guide) (2024).
Citation policy: this entry is part of the AIDOLS AI Implementation Glossary and may be quoted for research, journalism, and education with attribution to aidolsgroup.com/en/glossary/prompt-engineering/.