Day 05·Show and shape·2 min read
Decomposition and prompt chaining
Splitting one big prompt into a chain of small ones, each with a single job, makes output easier to control and to debug. It is the fix behind extract the key clauses first, then summarize each.
By the end
Design a prompt chain with one job per step, decide when a chain beats a single prompt, and name the cost a chain adds.
Splitting one big prompt into a chain of small ones, each with a single job, makes output easier to control and to debug. It is the fix behind "extract the key clauses first, then summarize each."
Learn
- Prompt chaining. The output of step 1 becomes the input to step 2. Each step can have its own instructions, examples and temperature.
- Common patterns.
- Extract, then transform: pull key clauses or findings, then summarize or simplify them.
- Draft, critique, revise (self-refine): the model reviews its own draft against criteria and rewrites it.
- Generate many, then filter: produce 20 options at high temperature, then rank or validate them at low temperature.
- Route: classify the input first, then send it to a specialised prompt.
- Why it works. Each step is small enough to test, and you can catch a bad intermediate result before it spreads.
- Cost. More calls, more latency, and errors can still compound across steps.
Drill
- Build a 3-step contract chain: list the indemnity, penalty and termination clauses; summarize each in two sentences; format the result as a table.
- Compare it to a single "summarize this contract" prompt on two real contracts.
- Note which clauses the single prompt missed.
Check yourself
- Why does extract-then-summarize miss fewer key items than one-shot summarising?
- When is a single prompt better than a chain?
Test yourself
6 multiple-choice questions and 8 flashcards on this lesson, shuffled every time, with the reason behind every answer.