Advanced Reasoning Strategies / Reasoning Decomposition

Decomposed Prompting

Advanced [4/5]
Task decomposition Problem breakdown Modular approach

Definition

Decomposed prompting breaks tasks into modular components and assigns them to appropriate handlers. Unlike simple step-by-step reasoning, decomposed prompting may route different subtasks to different models, tools, or specialized prompts.

This technique enables complex workflows where each component can be optimized independently.

Key Concepts

  • Task segmentation: Dividing complex tasks into discrete units
  • Handler routing: Assigning subtasks to appropriate processors
  • Modular prompts: Specialized prompts for each subtask
  • Result aggregation: Combining outputs into final answer

Examples

Multi-Handler System
Question Answering Pipeline
Task: "What was the stock price of Apple when the iPhone was announced?" Decomposition: ├── Subtask 1 → Date Handler │ "When was the first iPhone announced?" │ → January 9, 2007 │ ├── Subtask 2 → Stock Data Handler │ "What was AAPL price on January 9, 2007?" │ → $85.47 (adjusted) │ └── Subtask 3 → Synthesis Handler "Combine: iPhone announced Jan 9, 2007, AAPL was $85.47" → Final formatted answer
Code Example
Routing Logic
def decomposed_qa(question): # Decompose into subtasks subtasks = decomposer.identify_subtasks(question) results = {} for task in subtasks: if task.type == "factual_lookup": results[task.id] = knowledge_base.query(task) elif task.type == "calculation": results[task.id] = calculator.compute(task) elif task.type == "reasoning": results[task.id] = llm.reason(task) # Synthesize final answer return synthesizer.combine(results)

Interactive Exercise

Design a Decomposition

Decompose this task into subtasks with appropriate handlers:

Task: "Summarize the top 3 news articles about AI from today and translate the summary to Spanish."

Pro Tips
  • Use specialized models for specialized tasks
  • Consider parallelizing independent subtasks
  • Design clear interfaces between handlers
  • Build in error handling for failed subtasks

Related Terms