
Lesson 3: Prompt Decomposition
Master the strategy of 'Multi-step Prompting'. Learn how to break a single complex prompt into a chain of simpler, linked instructions to increase reasoning accuracy and reduce model fatigue.
Module 7: Prompt Engineering for Architecture
Lesson 3: Prompt Decomposition
In Module 3, we discussed Task Decomposition for agentic systems. Now, we apply the same logic to the Prompt itself. A single prompt that asks a model to "Think, Research, Write, and Audit" is likely to fail at least one of those steps.
In this lesson, we learn how to chain prompts together so that each turn of the interaction is mathematically simpler for the model to handle.
1. The "Cognitive Load" of a Prompt
Every variable or constraint you add to a prompt takes up "Space" in the model's active reasoning.
- If you have 20 instructions, the 20th instruction is significantly less likely to be followed than the 1st.
The Architect's Fix: Sequential Chaining. Instead of 1 prompt with 20 steps, use 4 prompts with 5 steps each.
2. Pattern: The "Bridge" Prompt
When you decompose a prompt, you must pass the State from one turn to the next.
Example: The "Review-Edit" Chain
- Prompt 1 (The Critic): "Audit this code for performance issues. Output a list of bullet points."
- Prompt 2 (The Coder): "Based on the bullet points from the CRITIC (Turn 1), rewrite the code to fix the issues. Output only the code."
By separating the "Criticism" from the "Action," the model doesn't have to "Think and Type" at the same time. This is a massive reliability boost.
3. Pattern: The "Filter-to-Focus" Chain
This is used for long documents.
- Prompt 1: "Scan this 50-page document. Identify the 3 pages relevant to Security."
- Prompt 2: "Now, analyzing ONLY those 3 specific pages, identify the firewall rules."
This prevents the model from being "Drowned" in the 47 irrelevant pages.
4. Visualizing Prompt Chains
graph LR
P1[Identify Goal] --> S1[JSON State]
S1 --> P2[Execute Goal]
P2 --> S2[Raw Output]
S2 --> P3[Audit Output]
P3 --> S3[Verified Result]
5. Summary
- Decompose a single complex prompt into multiple specific turns.
- Keep the "State" between turns as lean as possible.
- Use specialized prompts for "Thinking" vs. "Doing" vs. "Auditing."
In the next lesson, we will look at how to protect these chains from bad data: Guardrails and Constraints.
Interactive Quiz
- Why does a model follow the 1st instruction of a prompt more reliably than the 20th?
- What is a "Bridge" prompt?
- How does decomposition improve the "Auditability" of an AI system?
- Take a prompt: "Write a 500-word blog post about AWS, include 3 code examples, and finish with a summary." Decompose this into a 2-step chain.
Reference Video: