Prompt Decomposition
Breaking complex tasks into chained subtasks
Complex tasks that exceed a single prompt's reliable capability should be decomposed into a sequence of simpler prompts. Each step produces an intermediate output that feeds the next. Decomposition trades latency for reliability — each subtask is easier for the model and easier to debug when something goes wrong.
When a single prompt tries to do too much — "read this document, extract all entities, classify each entity, resolve duplicates, and produce a summary table" — failure modes multiply. The model may skip steps, confuse intermediate results, or produce output that is hard to parse because it mixes multiple structured and unstructured sections. Prompt decomposition breaks this into a pipeline of focused prompts: extract → classify → deduplicate → format. Each step has one job, one output format, and one failure mode to debug.
The design of the intermediate representation between steps is critical. It must be structured enough for the next prompt to parse reliably, but rich enough to carry all necessary information forward. JSON is the default choice. Each step should validate its input (did the previous step produce the expected schema?) and its output (does my result conform to what the next step expects?). This validation pipeline catches errors early rather than letting them propagate silently through the chain.
Decomposition also enables selective optimisation. You can use a cheaper, faster model for simple extraction steps and a more capable model for the reasoning-heavy classification step. You can cache intermediate results so that re-running the pipeline after a prompt change only re-executes downstream steps. And you can run independent subtasks in parallel — if entity extraction and sentiment analysis are independent, run them concurrently and merge results. The architecture of a prompt pipeline is, in many ways, the architecture of a data pipeline.
Key Concepts
- Decompose complex tasks into a pipeline of focused prompts — one job per step
- Design intermediate representations (JSON) that carry all info the next step needs
- Validate input and output schemas at each step to catch errors early
- Use cheaper models for simple steps and capable models for reasoning-heavy steps
- Independent subtasks can run in parallel — prompt pipelines mirror data pipelines