Decomposition turns one problem that is too large, too varied or too risky for a single reliable model call into steps you can inspect, test and, where possible, run in parallel. It is not free. Every boundary adds latency and tokens and risks losing information, so the architect's questions are: which technique fits this problem's shape, where should the boundaries go, and what verifies each step. Lesson 2.3 covers choosing between workflow and agent, and lesson 2.4 covers multi-agent orchestration; this lesson is the toolbox inside those choices.
Four techniques and when each fits
| Technique | Structure | Use when | Main risk |
|---|---|---|---|
| Prompt chaining | Fixed sequence; each call processes the previous output, optionally with programmatic gates between steps | The task cleanly splits into fixed subtasks; you accept latency for accuracy and inspectability | Errors compound; the path cannot adapt to surprises |
| Sectioning | Independent subtasks run concurrently and their outputs are aggregated | Subtasks do not depend on each other, or a concern (such as a safety check) should run separately from the main answer | Aggregation logic; inconsistent standards across sections |
| Routing | Classify the input, then send it to a specialised prompt, toolset or model | Distinct categories are better handled separately; you want to send easy inputs to a cheaper model | The classifier's accuracy is a ceiling; needs a fallback route |
| Plan-then-execute | A planner drafts steps from what it finds, an executor performs them, the plan is revised as facts emerge | The scope is unknown up front: unfamiliar codebase, incident investigation | Variable cost and time; harder to debug; plan quality decides everything |
These map onto Anthropic's workflow patterns: chaining, routing, and parallelization in its sectioning form. Parallelization also has a voting form (run the same task several times for diverse attempts or a consensus). Plan-then-execute is the dynamic end of the spectrum, close to Anthropic's orchestrator-workers pattern, where subtasks are not predefined but determined by the orchestrator (lesson 2.4). An evaluator-optimizer loop is a related tool for the verification step below.
Match the technique to the problem's characteristics, not to what sounds most advanced. Known steps and structured inputs point to chaining or sectioning; distinct input categories point to routing; an open-ended investigation points to plan-then-execute. Offering a fixed pipeline for an open-ended investigation, or dynamic planning for structured document processing, is the mismatch to watch for.
Choosing the boundaries
A boundary earns its cost when at least one of these holds:
- You can verify what crosses it. A step whose output cannot be checked is a black box, whatever its size.
- The step needs different context, tools or instructions. This is the separation-of-concerns benefit Anthropic cites for routing and chaining.
- The work is independent and can run in parallel.
- One pass is overloaded. When a single call processes many items, depth becomes inconsistent: thorough on early items, thin on later ones, and the same pattern judged differently in two places. Anthropic's context-engineering guidance explains the underlying pressure: as the number of tokens in the context grows, the model's ability to recall information from it decreases, so context should be treated as a scarce resource. The structural fix is per-item passes plus a separate cross-item integration pass. A larger window or a longer, more insistent prompt does not change the structure, so confirm the diagnosis and the fix with an eval rather than assuming.
Equally important, do not split more than the evidence supports. Anthropic's guidance on multi-agent design favours context-centric decomposition over problem-centric: dividing purely by type of work creates constant coordination overhead, and work should be split when its context can genuinely be isolated. Design the interface between steps as deliberately as the steps: pass structured data that keeps content and metadata (source, confidence, item ID) so later steps can cite and cross-check, rather than passing prose summaries that lose them.
Common exam distractor
For inconsistent depth across many items in one request, the distractors are a bigger context window, a more detailed prompt, a more capable model, or batching items into groups with no integration pass. The structural answer is per-item analysis passes followed by a cross-item integration pass. The second family of distractors is technique mismatch: a rigid pipeline for open-ended investigation, or a free-roaming planner for a fixed, structured extraction.
Verification between steps
In a chain, per-step reliabilities multiply: an unnoticed error at step 2 becomes the input, and the confident premise, of every later step. So put a check at each boundary, cheapest first:
- Programmatic gates. Schema validation, required fields, allowlists, arithmetic and cross-reference checks. Anthropic's chaining pattern explicitly includes gates between calls. Code is deterministic, cheap and fast, so it comes first.
- Model-based review. The common chain is self-correction: generate a draft, have Claude review it against explicit criteria, then refine. Because each step is a separate call you can log, evaluate or branch at any point.
- Voting or independent verification for high-stakes judgements, and human review where the cost of error justifies it (lesson 4.3).
A failing gate needs a route: repair with the specific error, retry with a changed input, or escalate. It must never simply continue. Evaluate each step on its own dataset and the pipeline end to end, so that when the final output is wrong you can locate the step that introduced the defect. Finally, note Anthropic's caution that with adaptive thinking and native subagent orchestration, Claude handles much multistep reasoning internally. Chain for control, inspection, parallelism or a required pipeline structure, not merely to make the model think in stages.
Key concept: a boundary must earn its cost
Every extra step costs latency, tokens and information. Justify each boundary by what it buys: a verifiable output, a different context, parallelism, or relief for an overloaded pass. If you cannot name the benefit, merge the steps. If you cannot name the check, you have a black box in the middle of the pipeline.
Worked example: contract portfolio review
Thirty vendor contracts need a comparative risk summary. A single call with all thirty produces uneven depth and inconsistent judgements. A decomposed design: a router tags each contract by type so a specialised prompt is used; a sectioned per-contract pass extracts indemnity, termination and liability terms into a schema, running in parallel; a gate validates the schema and checks that every quoted clause exists in the source text; an integration pass then compares the structured findings across contracts for cross-contract issues; a human reviews only items the gates flagged. Note that the integration pass reads the compact structured findings, not thirty raw documents, so it avoids recreating the overloaded pass it was meant to fix.