Nearby lessons
30 of 49Prompt Engineering - Decomposition and Linear Pipelines
Why One Big Prompt Fails
A single prompt fails for big tasks because it mixes many tasks together and loses structure. "Explain Python, create a quiz, and generate a PPT" is too much for one prompt — the output becomes messy.
The fix is prompt chaining: break the big task into small connected prompts where the output of one becomes the input of the next.
| Single Prompt | Prompt Chaining |
|---|---|
| Messy output | Structured output |
| Hard to control | Easy control |
| Mixed formats | Clean format |
| Less reliable | More reliable |
The chai-shop example:
- Correct order: boil water → add tea powder → add milk → add sugar → serve.
- Done randomly → bad tea.
AI works the same way — the order and the steps decide the quality.
Chaining in Action
Each step has a clear job and a clear output:
- Step 1 → produces the explanation.
- Step 2 → uses it to produce a summary.
- Step 3 → uses the summary to produce a quiz.
Clean and controllable.
Decomposition — Input → Process → Output
Decomposition means breaking a big task into small, clear steps in the correct order. Use the framework Input → Process → Output:
- Each step receives an input.
- Does one process.
- Produces one useful output.
| Wrong Decomposition | Correct Decomposition |
|---|---|
| Big steps | Small steps |
| No output | Clear output |
| Random order | Correct order |
| Confusing | Structured |
The market example:
- "Go bring groceries" → confusion.
- Making a list, checking the budget, buying the items, and verifying → a clear process.
Break the task, define each step's output, and connect the outputs.
Linear Pipelines — Step-by-Step Workflow
A linear pipeline is a step-by-step workflow where each step depends on the previous step — straight-line execution.
- Step 1 output → Step 2 input.
- Step 2 output → Step 3 input.
- Travel example: book ticket → pack bag → reach station → board train — you cannot skip the order.
| Random Flow | Linear Pipeline |
|---|---|
| No order | Fixed order |
| Confusion | Clear flow |
| Mixed output | Structured output |
| Hard to debug | Easy to debug |
Format Locking Between Steps
Format locking means keeping the same structure across all steps:
- If Step 1 gives output as headings and bullets, Step 2 must receive and produce the same structure.
- Consistency between steps is what keeps a pipeline stable.
Notice each step tells AI exactly what format to produce — that stops the pipeline from drifting into a different structure halfway.
Real-World Use Cases
- Study assistant — chapter → notes → summary → quiz.
- Resume tools — resume → improve → rewrite → interview questions.
- Report generation — data → analysis → summary → final report.
- Content creation — idea → draft → polish → publish.
- Business workflows — any big task broken into reliable steps.
- One big prompt fails for complex tasks — chain small prompts instead.
- Chaining: output of one step becomes input of the next.
- Decomposition uses Input → Process → Output for every step.
- A linear pipeline runs steps in a fixed order, each depending on the last.
- Format locking keeps the same structure across all steps.
- Notes → summary → quiz is the classic beginner pipeline.