Skip to content

Prompt Chaining

A technique in which a complex task is broken down into a sequence of prompts. The output of one step becomes the input of the next.

Why

One huge prompt for a complex task works poorly: the model gets confused and the answer becomes blurry. A chain gives control at every stage.

Example: Article from Idea

flowchart LR
    A[Plan] --> B[Draft]
    B --> C[Fact-check]
    C --> D[Style]
    D --> E[Final]
  1. Draw up an outline for the article.
  2. Write a draft following the outline.
  3. Check the facts.
  4. Improve the style.
  5. Put together the final version.

When to Use

  • the task has stages;
  • quality control is needed at every step;
  • intermediate results can be validated.

Trade-offs

A chain is longer and more expensive (several model calls), but the quality is higher and debugging is easier: you can see at which step it breaks.

See Also

← All Terms