Using AI tools

Prompt engineering

In short

Prompt engineering is the practice of wording the instructions you give an AI chatbot or model so it produces the answer you want. It covers what you ask, the examples you include and how you lay the request out.

Also called
Prompt design, Prompting
Topic
Using AI tools
Level
Beginner
First described
The practice took off with OpenAI's GPT-3 paper (Brown et al., May 2020), which showed tasks could be set purely in text; Liu and colleagues named and defined prompt engineering in a July 2021 survey23.

A large language model does not have settings for each task. You tell it what to do in plain text, and the wording changes the result. OpenAI's developer guide calls prompt engineering "the process of writing effective instructions for a model" and admits it is "a mix of art and science", because the output varies from run to run1.

The idea grew out of GPT-3. Its 2020 paper showed one model could translate, answer questions or do arithmetic with no retraining, purely from a task description and a few worked examples typed into the prompt2. A 2021 survey then defined prompt engineering as creating the prompt that gives the most effective performance on a task3.

Common techniques are simple. Give clear instructions. Show a handful of input and output examples, known as few-shot prompting1. Set a role, and separate instructions from documents with labels such as XML tags4. Asking a model to write out its reasoning step by step, called chain-of-thought prompting, took Google's PaLM 540B model to state-of-the-art accuracy on the GSM8K set of school maths word problems in 20225.

It is not the same as fine-tuning, which changes the model's weights. Prompting only changes the input. Anthropic's guide also notes that not every problem is a prompting problem: speed and cost are sometimes fixed more easily by picking a different model6.

Example

Asking "Write a complaint letter" gets a generic draft. Asking "Write a polite, 150-word letter to my energy supplier disputing a £240 estimated bill; I have a meter photo dated 3 March" gets something you can send.

Why it matters

The same tool can give a vague answer or a useful one depending on how you ask. Knowing a few prompting habits is the cheapest way to get better results from any chatbot.

Questions people ask

Is prompt engineering a real skill?

Yes, in the sense that wording measurably changes results. Research on chain-of-thought prompting found that showing a model worked reasoning steps sharply improved its maths scores5. But much of it is ordinary clear writing: say what you want, give context and show an example.

What is few-shot prompting?

Putting a few examples of inputs and the outputs you want into the prompt, so the model copies the pattern. OpenAI's guide recommends showing a diverse range of inputs with the desired outputs1. The GPT-3 paper used the term few-shot for this setting2.

What is the difference between prompt engineering and context engineering?

Anthropic describes context engineering as the next step on from prompt engineering. Prompt engineering is about writing the instructions. Context engineering is about everything else that goes into the model's working memory, such as documents, tool results and chat history7.

Related terms

Tools that use it

Sources

  1. OpenAI API docs, Prompt engineering guide
  2. Brown et al. (2020), Language Models are Few-Shot Learners, arXiv:2005.14165
  3. Liu et al. (2021), Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing, arXiv:2107.13586, section 4
  4. Anthropic Claude docs, Prompting best practices
  5. Wei et al. (2022), Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, arXiv:2201.11903
  6. Anthropic Claude docs, Prompt engineering overview
  7. Anthropic (2025), Effective context engineering for AI agents

Back to the glossary