Decomposition Techniques: Sequential, Parallel, Routing, Hierarchical
CoreApply decomposition techniques to make complex problems tractable · Difficulty 3/5
Explanation
Complex problems are made tractable by decomposition -- breaking one large, ambiguous task into smaller, well-scoped units.
The Four Decomposition Techniques
- Sequential decomposition -- break a task into ordered sub-steps (prompt chaining) when each depends on the last.
- Parallel decomposition -- split into independent subtasks that run concurrently and merge.
- Routing decomposition -- classify first, then send each class down a specialized path.
- Recursive / hierarchical decomposition -- an orchestrator spawns subagents that may themselves decompose further.
These four techniques map directly onto the workflow composition patterns and the multi-agent hierarchy pattern already covered in this domain: decomposition is the general design move, and prompt chaining / parallelization / routing / orchestrator-workers are its concrete implementations.
Why Decomposition Improves Reliability
Decomposition also improves reliability: smaller, well-scoped steps are easier to prompt, evaluate, and debug than one monolithic mega-prompt, and each boundary is a natural place for a gate check or validation. A single sprawling prompt asking a model to do everything at once is harder to test (which part failed?), harder to evaluate (what does "correct" mean for the whole output?), and harder to debug than a chain of smaller steps each with a clear input/output contract.
Choosing the Right Technique
| Situation | Technique |
|---|---|
| Each step needs the previous step's output | Sequential |
| Subtasks are independent and can run at once | Parallel |
| Inputs fall into distinguishable categories | Routing |
| The task needs an orchestrator that spawns subagents which may decompose further | Recursive / hierarchical |
Decomposition choice should follow directly from the dependency structure of the task: ask whether sub-steps depend on each other (sequential), are independent (parallel), differ by category (routing), or require open-ended delegation (recursive/hierarchical).
Key Takeaways
- Four decomposition techniques: sequential, parallel, routing, recursive/hierarchical
- Sequential decomposition (prompt chaining) fits ordered sub-steps that depend on the last
- Parallel decomposition fits independent subtasks that run concurrently and merge
- Routing decomposition classifies first, then sends each class down a specialized path
- Decomposition improves reliability: smaller steps are easier to prompt, evaluate, and debug, and boundaries are natural gate-check points
Glossary Terms
The practice of directing requests to different Claude model tiers based on assessed complexity and requirements. A common pattern uses a fast, cheap model (Haiku) to classify task complexity, then routes to Sonnet or Opus accordingly.
The process of breaking a complex task into smaller, independently executable subtasks that can be assigned to specialized subagents or processed sequentially. Good decomposition creates subtasks with clear boundaries, independent execution, and verifiable outputs.
A workflow composition pattern where a central LLM decides subtasks dynamically at runtime and delegates them to workers, in contrast to parallelization sectioning where the subtasks are already known in advance. It is still a workflow, not an agent, as long as the fact that delegation happens is fixed in code -- only the content of the subtasks is decided at runtime. This is the point where a workflow shades most closely into an agent, and the classic exam trap is confusing it with parallelization sectioning.
Related Concepts