Skip to main content

Prompt

The whole text of instructions and questions you give an LLM; the mix of instructions, material, constraints, and format shapes the answer.

A prompt is the whole text of instructions and questions you give an LLM. A one-line question typed into a chat box, pasted documents, and requests about the form of the answer are all part of the prompt. Because the model reads this text and writes its answer from it, the quality of answers from the same model can change a lot with how the prompt is written. The basics are to state the goal, material, and answer format clearly, then test and fix where the answers drift. A longer prompt is not automatically better; what matters is whether everything needed is there.

A Prompt Is the Whole of Instructions and Material

A prompt is the whole text of instructions and questions you give an LLM. A one-line question typed into a chat box, pasted documents, and requests about the form of the answer are all, together, the prompt. The model reads this text and writes its answer as a continuation of it.

An LLM reads a prompt split into tokens (small units of text). The more documents you paste, the more tokens there are, and through an API the cost and waiting time also grow. Anything beyond the length the model can read at once cannot be passed in. In apps, there is often a hidden instruction written by the developer placed before the text the user types.

The Components of a Prompt

Google's guide lists components like the following as the parts of a prompt.

  • Instructions (what you want done, written as a question or as steps)
  • Material (the text or documents the answer should be based on)
  • Constraints (what you want and do not want, such as length or tone)
  • Answer format (a fixed form such as a bulleted list, a table, or JSON)

You do not need every component. But the model fills in missing components by guessing. Where the guess is wrong is where the answer drifts from what you expected.

Three Points of a Good Instruction

A good instruction meets the following three points.

  1. The goal is clear (write who the answer is for and what it is for)
  2. The material is provided (the model does not know things after its knowledge cutoff or the circumstances on your side)
  3. The answer format is set (stating the length and form cuts the work of fixing it)

Anthropic recommends deciding, before you revise a prompt, what counts as a good answer and how you will test for it. The reliable way is to try the same question several times and add one instruction at a time where the answers drift.

Was this page helpful?

Related Use Cases

  • Chatbots Ranked by human ratings on conversations with more than one turn.
  • Writing Ranked by human ratings on creative requests (such as stories and poems).