Inferensys

Prompt

Multi-Hop Question Decomposition Prompt Template

A practical prompt playbook for using Multi-Hop Question Decomposition Prompt Template in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job-to-be-done, the ideal user, required context, and the boundaries where this prompt should not be applied.

This prompt is for AI architects and RAG pipeline engineers who need to answer a single complex question that cannot be resolved with one retrieval round. The job-to-be-done is transforming a dense, multi-part user query into an ordered, dependency-aware decomposition plan. The ideal user is someone building a production system—such as a legal research assistant, a clinical evidence review tool, or a financial due diligence copilot—where missing a dependency or retrieving evidence in the wrong order produces an incomplete or factually incorrect final answer. You should use this prompt when the user's question contains implicit sub-questions, requires information that must be gathered sequentially, or spans multiple documents that cannot be assumed to coexist in a single retrieval context window.

Do not use this prompt for simple factoid lookups, single-hop questions, or queries that can be answered by a single well-constructed retrieval call. It is also the wrong tool when the system already has a static, pre-defined decomposition graph for known question types—hard-coded logic will be cheaper and more reliable. This prompt is a reasoning step, not a retrieval step; it produces a plan, not the final answer. If your system lacks a downstream executor that can run the sub-questions, retrieve evidence for each, and merge the results, the decomposition plan alone provides no user value. In high-stakes domains such as healthcare or legal, the decomposition plan itself should be reviewed or logged as part of the audit trail before any sub-question execution begins.

Before wiring this into your application, confirm that you have a clear merge strategy for the sub-answers and a defined stopping condition for recursive or sequential decomposition. The output of this prompt is structured JSON—validate it against a schema before using it to drive retrieval. If the decomposition plan contains circular dependencies, missing evidence types, or sub-questions that are not independently answerable, reject the plan and retry or escalate. Start by testing this prompt against a golden set of complex questions where you already know the correct decomposition, and measure whether the output plan covers all necessary information needs in the right order.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Multi-Hop Question Decomposition Prompt Template delivers value and where it introduces risk. Use these cards to decide if this pattern fits your RAG architecture before integrating it into a product pipeline.

01

Strong Fit: Complex Multi-Document Queries

Use when: a single user question requires synthesizing facts from multiple, distinct documents or knowledge base articles. Guardrail: confirm that your retrieval system can independently fetch relevant chunks for each sub-question before wiring decomposition into production.

02

Poor Fit: Simple Factoid Lookups

Avoid when: the answer is contained in a single passage or a direct keyword match. Guardrail: add a lightweight complexity classifier before the decomposition step to route simple questions directly to a standard RAG prompt, saving latency and cost.

03

Required Inputs: Retrieval-Ready Context

Risk: decomposition produces sub-questions that your retrieval pipeline cannot answer, leading to dead-end reasoning chains. Guardrail: validate that each sub-question maps to an existing document collection or API endpoint before executing the full plan.

04

Operational Risk: Cascading Retrieval Latency

Risk: sequential sub-question execution multiplies end-to-end latency, degrading user experience in synchronous chat. Guardrail: parallelize independent sub-questions, enforce a maximum hop depth, and set a total timeout budget for the decomposition chain.

05

Operational Risk: Decomposition Drift

Risk: the model generates sub-questions that misinterpret the original intent or introduce unsupported assumptions. Guardrail: include a post-decomposition validation step that checks each sub-question for semantic alignment with the user's original query before retrieval begins.

06

Architecture Fit: Agentic RAG Loops

Use when: your system supports iterative retrieval, where each sub-question answer can inform the next retrieval step. Guardrail: implement a termination condition based on evidence sufficiency, not just question count, to prevent infinite loops.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for decomposing complex questions into ordered, dependency-aware sub-questions with explicit evidence types and merge strategies.

This prompt template provides the core instruction set for transforming a single complex question into a structured decomposition plan. It is designed to be dropped into a system prompt or a user message in a RAG pipeline where the model must reason about what it needs to know before it can answer. The template uses square-bracket placeholders that you must replace with your specific inputs, output schema, constraints, and examples before use. The goal is to produce a plan that a downstream orchestrator can execute, not to answer the question directly.

text
You are a question decomposition specialist. Your task is to break a complex user question into a set of ordered, dependency-aware sub-questions that can be answered independently from a knowledge base. Do not answer the original question. Do not answer any sub-question. Produce only the decomposition plan.

## INPUT
User Question: [USER_QUESTION]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "original_question": "string",
  "decomposition_strategy": "string (e.g., sequential, parallel, hybrid)",
  "sub_questions": [
    {
      "id": "string (e.g., SQ1)",
      "question": "string (self-contained, answerable sub-question)",
      "depends_on": ["string (list of sub-question IDs this one requires before execution)"],
      "expected_evidence_type": "string (e.g., definition, numerical_data, event_description, policy_statement)",
      "purpose": "string (why this sub-question is necessary for the final answer)"
    }
  ],
  "merge_strategy": "string (description of how sub-answers should be combined into a final answer)",
  "estimated_retrieval_queries": ["string (suggested search queries for each independent retrieval step)"]
}

## CONSTRAINTS
[CONSTRAINTS]

## EXAMPLES
[EXAMPLES]

## CONTEXT (OPTIONAL)
[CONTEXT]

To adapt this template, start by replacing [USER_QUESTION] with the actual question your system receives. The [CONSTRAINTS] placeholder should be populated with domain-specific rules, such as 'Sub-questions must not introduce assumptions not present in the original question' or 'Limit decomposition to a maximum depth of 2 levels.' The [EXAMPLES] block is critical for few-shot performance; include at least two worked examples showing a complex question and its correct decomposition into the JSON schema. The optional [CONTEXT] field can carry document metadata, user profile information, or prior conversation turns that inform the decomposition strategy. After generating the plan, validate the output against your schema before passing sub-questions to your retrieval engine. For high-stakes domains, route the decomposition plan to a human reviewer or an LLM-as-judge evaluation step that checks for logical ordering, missing dependencies, and sub-question atomicity before execution.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Multi-Hop Question Decomposition Prompt Template. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.

PlaceholderPurposeExampleValidation Notes

[COMPLEX_QUESTION]

The user's original multi-hop question that requires decomposition into ordered sub-questions

What was the revenue growth rate of the company that acquired our largest competitor last year?

Must contain at least one dependency between facts. Parse check: question contains multiple clauses or entities. Reject single-fact lookup questions.

[AVAILABLE_DOCUMENTS]

List of document identifiers, titles, or summaries available in the retrieval corpus to ground decomposition feasibility

["sec-filing-2024-q4.pdf", "acquisition-press-release-2024-03.pdf", "competitor-annual-report-2024.pdf"]

Must be a non-empty array. Each entry should include enough metadata for the model to assess whether evidence likely exists. Null allowed if corpus is unknown.

[MAX_SUB_QUESTIONS]

Upper bound on the number of sub-questions the decomposition should produce to prevent over-fragmentation

5

Must be an integer between 2 and 10. Lower values force consolidation; higher values risk unnecessary decomposition. Default: 6.

[DECOMPOSITION_STRATEGY]

Instruction for how to structure the decomposition: sequential, parallel, tree, or hybrid

sequential

Must be one of: sequential, parallel, tree, hybrid. Sequential enforces strict ordering. Parallel allows independent sub-questions. Tree supports nested decomposition. Hybrid allows mixed dependencies.

[OUTPUT_SCHEMA]

Expected JSON structure for the decomposition plan including sub-questions, dependencies, expected evidence types, and merge strategy

{"sub_questions": [...], "dependencies": {...}, "merge_strategy": "..."}

Must be a valid JSON Schema or example object. Each sub-question entry requires: id, question_text, depends_on (array of sub-question ids or empty), expected_evidence_type, and priority. Schema check required before prompt assembly.

[DOMAIN_CONSTRAINTS]

Domain-specific rules that constrain what sub-questions are valid, such as temporal ordering requirements or entity resolution rules

All temporal comparisons must use fiscal years. Company names must be resolved to legal entities before financial lookups.

Optional. If provided, must be a non-empty string with actionable constraints. If null, model uses general decomposition logic. Approval required for regulated domains.

[FEW_SHOT_EXAMPLES]

One to three examples of correct decomposition for similar question types to anchor the model's output format and reasoning style

[{"question": "...", "decomposition": {...}}]

Optional. If provided, must be an array of 1-3 objects, each with question and decomposition fields matching OUTPUT_SCHEMA. Validate that example decompositions are logically correct before inclusion. Null allowed.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the decomposition prompt into a production RAG pipeline with validation, retries, and observability.

The Multi-Hop Question Decomposition prompt is rarely a standalone step. In production, it sits between the user's original question and a retrieval engine. The harness must accept a complex question, call the decomposition prompt, parse the structured decomposition plan, and then route each sub-question to the appropriate retrieval system. The output schema—typically a JSON object containing an ordered list of sub-questions with dependency labels and expected evidence types—must be strictly validated before any downstream retrieval begins. A malformed decomposition plan that passes through unchecked will cause silent failures in later pipeline stages, so the harness should reject any response that does not conform to the expected schema and trigger a retry or fallback.

Wire the prompt into an async pipeline or agentic loop. After receiving the decomposition plan, iterate through sub-questions in dependency order: independent sub-questions can fan out to parallel retrieval calls, while dependent sub-questions must wait for their prerequisite answers. For each sub-question, log the retrieval query, the retrieved context, and the sub-answer before feeding them into the merge step. Implement a circuit breaker: if any sub-question retrieval returns zero results or the sub-answer confidence score falls below a threshold, halt the chain and either re-plan with a revised query or escalate to a human reviewer. Model choice matters here—use a model with strong instruction-following and structured output capabilities (such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro) and set response_format to JSON mode with the decomposition schema enforced. For high-stakes domains like legal or clinical RAG, add a human-in-the-loop approval gate after decomposition before any retrieval executes.

Observability is non-negotiable. Log the original question, the full decomposition plan, the model and prompt version used, the latency of the decomposition call, and any validation errors or retries. This trace data is essential for debugging when the final answer is wrong—you need to know whether the error originated in the decomposition, the retrieval, or the synthesis. Build eval checks into the harness: after decomposition, run a lightweight LLM-as-judge check that scores the plan on completeness (are all aspects of the original question covered?), logical ordering (are dependencies correct?), and atomicity (is each sub-question independently answerable?). If the score falls below a threshold, re-prompt with the original question and the eval feedback. Avoid the temptation to skip validation in favor of speed; a bad decomposition plan poisons every downstream step and is far more expensive to fix after retrieval than before.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the structured decomposition plan produced by the Multi-Hop Question Decomposition Prompt. Use this contract to build a parser and validator in your application harness before passing sub-questions to retrieval.

Field or ElementType or FormatRequiredValidation Rule

decomposition_id

string (UUID v4)

Must parse as a valid UUID v4. Reject on format mismatch.

original_question

string

Must exactly match the [ORIGINAL_QUESTION] input. Fail if altered or truncated.

sub_questions

array of objects

Must be a non-empty array. Fail if array is missing, null, or length is 0.

sub_questions[].id

string (e.g., 'SQ1')

Must match pattern ^SQ\d+$. Must be unique within the array. Fail on duplicate or missing IDs.

sub_questions[].question

string

Must be a non-empty, self-contained question. Fail if it contains unresolved pronouns referencing other sub-questions.

sub_questions[].depends_on

array of strings (SQ IDs)

Must be an array of valid sub_question IDs from the same decomposition. Use empty array [] for independent questions. Fail if any referenced ID is missing.

sub_questions[].expected_evidence_type

string (enum)

Must be one of: 'definition', 'factoid', 'list', 'numerical_data', 'event_sequence', 'relationship', 'comparison', 'procedural_step'. Fail on unknown values.

merge_strategy

string (enum)

Must be one of: 'sequential_chain', 'parallel_aggregation', 'comparative_matrix', 'temporal_ordering', 'causal_chain'. Fail on unknown values.

PRACTICAL GUARDRAILS

Common Failure Modes

Multi-hop decomposition fails in predictable ways. Here are the most common failure modes and how to guard against them before they reach production.

01

Missing Dependency Ordering

What to watch: The decomposition produces sub-questions that are logically dependent but not ordered correctly, causing retrieval steps to execute in the wrong sequence. Sub-question 3 might need the answer from sub-question 1, but the plan lists them as parallel. Guardrail: Add an explicit dependency validation step. Require the prompt to output a depends_on field for each sub-question, and run a topological sort check before execution. Reject plans with circular or missing dependencies.

02

Over-Decomposition into Trivial Sub-Questions

What to watch: The model breaks the question into too many atomic pieces, generating sub-questions that are trivial, redundant, or answerable from a single sentence. This wastes retrieval calls and complicates the merge step. Guardrail: Set a minimum complexity threshold. Include a constraint like 'Each sub-question must require evidence from at least one full passage to answer.' Post-process to merge sub-questions that address the same evidence need.

03

Under-Decomposition and Implicit Multi-Hop

What to watch: The model produces a single 'decomposed' question that still requires multiple hops internally, or generates sub-questions that are just restatements of the original query. The decomposition provides no practical value. Guardrail: Validate that each sub-question is answerable from a single retrieval context. Use a self-check prompt: 'Can this sub-question be answered from one document? If not, decompose further.' Set a minimum sub-question count for complex inputs.

04

Hallucinated Sub-Questions Outside Evidence Scope

What to watch: The decomposition introduces sub-questions that assume facts not present in the original query or available context, fabricating intermediate steps. For example, asking 'What was the revenue impact of the 2022 acquisition?' when the original question never mentioned an acquisition. Guardrail: Ground each sub-question against the original user query. Add a constraint: 'Every sub-question must be directly derivable from the original question without introducing new entities, events, or assumptions.' Run a diff check between original and decomposed questions.

05

Merge Strategy Produces Contradictory Synthesis

What to watch: The merge step receives conflicting answers from different sub-questions and either picks one arbitrarily, averages incompatible claims, or produces a synthesis that contradicts one of the sub-answers. Guardrail: Require the decomposition plan to include a conflict resolution strategy. Add a post-merge validation step that checks the final answer against each sub-answer. Flag contradictions for human review or escalation rather than silent resolution.

06

Evidence Type Mismatch in Retrieval

What to watch: The decomposition specifies expected evidence types (e.g., 'financial report,' 'regulatory filing') that don't match what the retrieval system can actually find, causing downstream steps to operate on irrelevant or missing context. Guardrail: Include an evidence type taxonomy in the prompt that maps to your actual document corpus. Add a constraint: 'Expected evidence types must match available document categories.' After retrieval, validate that returned passages match the expected type before feeding them to sub-question answering.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of decomposed sub-questions before integrating the prompt into a production RAG pipeline. Each criterion targets a specific failure mode in multi-hop decomposition.

CriterionPass StandardFailure SignalTest Method

Decomposition Completeness

All atomic facts required to answer the original question are covered by at least one sub-question.

A required fact from the original question has no corresponding sub-question; the final answer would require hallucination.

Manual review: map each fact in the original question to a generated sub-question. Flag orphans.

Sub-Question Atomicity

Each sub-question can be answered from a single document or a single retrieval result without further decomposition.

A sub-question contains conjunctions or requires multi-hop reasoning itself; it is not a leaf node.

LLM-as-judge check: classify each sub-question as atomic or compound. Fail if any compound sub-question is not further decomposed.

Dependency Order Correctness

Sub-questions that depend on answers from other sub-questions are correctly ordered and marked with explicit dependencies.

A sub-question references an entity or concept not yet established; dependency graph contains cycles or missing edges.

Topological sort of the declared dependency graph. Fail if graph is cyclic or if a sub-question uses an undefined reference.

Expected Evidence Type Specification

Each sub-question includes a specific, plausible evidence type needed to answer it.

Evidence type is missing, generic, or implausible for the sub-question.

Schema check: verify [EVIDENCE_TYPE] field is present and non-empty for every sub-question. Spot-check plausibility.

Merge Strategy Validity

The merge strategy describes a concrete, executable method for combining sub-answers into the final answer.

Merge strategy is missing, circular, or describes only concatenation without conflict resolution.

Parse check: confirm [MERGE_STRATEGY] field exists and contains an actionable method. Reject strategies that only say 'combine' or 'merge'.

No Answer Hallucination in Decomposition

Sub-questions do not contain information that would answer the original question; they only ask for evidence.

A sub-question embeds an assumption or partial answer that was not provided in the original question.

LLM-as-judge pairwise check: compare each sub-question against the original question. Flag any sub-question that asserts a fact not present in the input.

Retrieval Query Readiness

Each sub-question is phrased as a self-contained retrieval query that would return relevant documents without additional rewriting.

A sub-question uses pronouns, unresolved references, or domain shorthand that would confuse a vector search.

Blind retrieval test: run each sub-question through a retrieval system. Fail if top-k results are off-topic due to ambiguous phrasing.

Output Schema Compliance

The decomposition output strictly matches the defined schema with all required fields present and correctly typed.

Missing required fields, extra undeclared fields, or type mismatches in the JSON output.

Automated schema validation against the [OUTPUT_SCHEMA] contract. Fail on any validation error.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Keep the decomposition plan structure but relax strict schema enforcement. Accept natural-language decomposition output and manually review the sub-question ordering before wiring into retrieval.

Prompt modification

Remove the [OUTPUT_SCHEMA] constraint and replace with: Return a numbered list of sub-questions in dependency order. For each, note what type of evidence is needed.

Watch for

  • Sub-questions that rephrase the original question instead of decomposing it
  • Missing dependency declarations between sub-questions
  • Overly broad sub-questions that can't be answered from a single retrieval
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.