AI glossary

What is Prompt engineering?

Also called Prompt design ·

Prompt engineering is the practice of writing and refining the instructions, examples and structure you give a language model so it produces accurate, consistent output for a specific task, and testing those prompts against real cases.

How it works

A prompt is everything the model reads before it answers. Prompt engineering improves that input with a small set of well-tested techniques, which both OpenAI's and Anthropic's guides recommend:

  • Be clear and specific. State the task, the audience, the format and the constraints. Models do not guess intent well.
  • Give examples (few-shot prompting). Showing two or three input/output pairs is often more effective than describing the format. The GPT-3 paper showed models can learn a task from examples in the prompt alone.
  • Assign a role in the system prompt, for example "You are a senior tax accountant reviewing invoices".
  • Structure the input. Separate instructions from data with headings or XML-style tags so the model knows what to follow and what to read.
  • Ask for reasoning when it helps. Asking the model to work step by step (chain of thought) improves multi-step problems.
  • Specify the output. Ask for JSON, a table or a fixed set of labels when code will read the result.

The engineering part is the testing: keep a set of real inputs, run each prompt version against them, and compare the results instead of judging from one lucky reply.

Why it matters

The same model can be useless or excellent depending on the prompt. Good prompts reduce hallucinations, make outputs predictable enough to automate, and are much cheaper to change than switching or fine-tuning a model. As apps become agents that run for many steps, the discipline has widened into context engineering, which manages everything in the model's context, not only the instruction text.

Example

A weak prompt: "Summarise this contract." A stronger one: "You are a contracts lawyer. Summarise the contract below for a non-lawyer in five bullet points. Cover payment terms, termination, liability caps and renewal. If a clause is missing, write 'not stated'. Contract: ...". The second gives the role, audience, scope, format and a rule for missing information.

Questions people ask

What will a prompt engineer do?+

A prompt engineer designs, tests and maintains the prompts an AI product depends on: writing instructions and examples, building evaluation sets, and fixing failures. In most teams it is now a skill inside engineering or product roles rather than a separate job.

Is ChatGPT prompt engineering?+

No. ChatGPT is a product; prompt engineering is how you write the instructions you give it or any other model. Writing a clear, specific request in ChatGPT is a simple form of prompt engineering.

Sources

  1. Prompt engineering overview, Anthropic
  2. Prompt engineering, OpenAI
  3. Language Models are Few-Shot Learners, arXiv (Brown et al., 2020)

Back to the AI glossary