Inferensys

Prompt

Uncertainty Decomposition Prompt for Complex Queries

A practical prompt playbook for using Uncertainty Decomposition Prompt for Complex Queries in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Identify the ideal job-to-be-done, user, and preconditions for applying the Uncertainty Decomposition Prompt, and recognize when it will fail or add unnecessary complexity.

This prompt is for planning and reasoning system builders who need to break a complex, multi-part query into discrete sub-questions and assign a confidence estimate to each. Use it when a single monolithic answer would hide critical uncertainty, when you need to identify which parts of a query require clarification before proceeding, or when you are building an agent that must decide between autonomous completion and human escalation. This prompt belongs in the pre-execution phase of a reasoning pipeline, before tool calls or final answer generation. It assumes the input query is non-trivial and may contain nested dependencies, ambiguous references, or factual premises that require verification.

The ideal user is an AI engineer or product developer integrating a reasoning step into an agent harness, a RAG system, or a structured output pipeline. Required context includes the full user query, any available grounding documents, and a defined confidence schema. Do not use this prompt for simple factual lookups, single-intent queries with no ambiguity, or latency-sensitive real-time chat where decomposition overhead is unacceptable. It is also inappropriate when the downstream system cannot act on per-sub-question confidence signals, making the structured output wasted computation.

Before wiring this prompt into production, define what the consuming system will do with each confidence level. A sub-question with low confidence might trigger a clarification request, a human handoff, or a fallback model. Without that contract, the decomposition is just an academic exercise. Start with a small set of manually decomposed queries to calibrate your confidence thresholds, then automate. Avoid using this prompt as a substitute for proper retrieval when the query requires external facts the model cannot reliably self-assess.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Uncertainty Decomposition Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your workflow before integrating it into a planning or reasoning pipeline.

01

Strong Fit: Multi-Hop Reasoning Pipelines

Use when: A complex query requires synthesizing information across multiple documents, tools, or reasoning steps before a final answer can be formed. Guardrail: The decomposition output must be programmatically validated to ensure all sub-questions are necessary and non-redundant before execution.

02

Poor Fit: Simple Factual Lookups

Avoid when: The user query can be answered with a single retrieval call or a direct factual response. Risk: Decomposing a simple question adds latency, token cost, and unnecessary points of failure without improving answer quality. Guardrail: Implement a query-complexity classifier before the decomposition step.

03

Required Inputs: Structured Query and Context

What to watch: The prompt fails silently if the input query is ambiguous or if the provided context is insufficient to estimate confidence on sub-questions. Guardrail: Validate that the input includes a well-formed user query and a defined context window. If context is missing, route to a clarification prompt first.

04

Operational Risk: Cascading Confidence Errors

What to watch: A low-confidence estimate on an early sub-question can propagate through the entire reasoning chain, causing the final answer to be abandoned unnecessarily. Guardrail: Implement a confidence threshold that triggers targeted clarification for the specific weak sub-question rather than aborting the entire decomposition.

05

Operational Risk: Decomposition Drift

What to watch: The model may generate sub-questions that misinterpret the original intent or introduce unintended bias, leading to a correct answer for the wrong question. Guardrail: Run a semantic similarity check between the original query and the set of generated sub-questions. Flag decompositions below a similarity threshold for human review.

06

Poor Fit: Latency-Sensitive User-Facing Chat

Avoid when: The user is waiting for a synchronous, real-time response. Risk: Decomposition and sequential sub-question answering introduce multi-second delays that degrade the conversational experience. Guardrail: Reserve this prompt for asynchronous or background agent workflows where latency is acceptable.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready template that decomposes a complex query into sub-questions with confidence estimates and identifies which parts need clarification.

This template is designed to be copied directly into your prompt management system or codebase. It instructs the model to break a complex, multi-part query into discrete sub-questions, assign a confidence score to each, and flag any sub-question that requires further clarification before a reliable answer can be produced. The output is a structured decomposition that helps downstream routing logic decide whether to proceed, ask the user for clarification, or escalate to a human reviewer.

text
You are an expert query analyst. Your task is to decompose a complex user query into its constituent sub-questions. For each sub-question, assess whether you have sufficient information to answer it confidently and assign a confidence score.

## INPUT
[COMPLEX_QUERY]

## CONTEXT
[CONTEXT]

## CONSTRAINTS
- Decompose the query into the smallest set of independent, non-overlapping sub-questions that fully cover the original intent.
- For each sub-question, assign a confidence score between 0.0 and 1.0, where 1.0 means you are fully confident you can answer correctly with the available information.
- If a sub-question is ambiguous, missing critical parameters, or requires external knowledge not present in the context, mark it as `needs_clarification: true` and specify what is missing.
- Do not answer the sub-questions. Only produce the decomposition and confidence assessment.
- If the entire query is unanswerable or nonsensical, return a single entry with `confidence: 0.0` and a clear explanation.

## OUTPUT_SCHEMA
Return a valid JSON object with the following structure:
{
  "original_query": "string",
  "decomposition": [
    {
      "sub_question": "string",
      "confidence": number,
      "needs_clarification": boolean,
      "missing_information": "string | null",
      "rationale": "string"
    }
  ],
  "overall_assessment": {
    "average_confidence": number,
    "clarification_required": boolean,
    "recommended_action": "proceed | clarify | escalate"
  }
}

## EXAMPLES
[EXAMPLES]

## RISK_LEVEL
[RISK_LEVEL]

To adapt this template, replace the bracketed placeholders with your specific inputs. [COMPLEX_QUERY] is the user's original multi-part question. [CONTEXT] should contain any retrieved documents, conversation history, or system data the model can use to assess answerability. [EXAMPLES] should include 2-3 few-shot demonstrations of correct decompositions for your domain, showing both high-confidence and clarification-needed cases. [RISK_LEVEL] accepts values like low, medium, or high and should be used to adjust the confidence threshold for the recommended_action field in your post-processing logic. After copying, validate that the output JSON matches the schema before routing—schema violations should trigger a retry with the same prompt or a repair prompt from the Output Repair and Validation Prompts pillar. For high-risk domains, always route clarification_required: true outputs to a human reviewer rather than automatically asking the user.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Uncertainty Decomposition Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Validation notes describe how to check the input quality before execution.

PlaceholderPurposeExampleValidation Notes

[COMPLEX_QUERY]

The full user query that needs decomposition into sub-questions

Compare our Q3 revenue growth against the two previous quarters and explain the main drivers, then recommend whether we should increase ad spend in Q4

Check: string length > 20 chars. Reject empty or single-word inputs. Flag queries with >3 distinct clauses for decomposition coverage review.

[DECOMPOSITION_DEPTH]

Controls how granular the sub-question breakdown should be

2 (for high-level breakdown) or 4 (for fine-grained atomic sub-questions)

Check: integer between 1 and 5. Default to 3 if unset. Values above 4 risk over-decomposition on simple queries.

[CONFIDENCE_FORMAT]

Specifies how confidence estimates are expressed in the output

percentage (0-100) or categorical (high, medium, low, unknown)

Check: must match one of the allowed enum values. Reject free-text confidence formats. Use 'percentage' for downstream threshold comparisons.

[UNCERTAINTY_TYPES]

List of uncertainty categories the model should check for each sub-question

["missing_data", "ambiguous_terms", "conflicting_sources", "temporal_gaps", "causal_uncertainty"]

Check: must be a valid JSON array of strings from the allowed taxonomy. Empty array means no uncertainty typing requested. Validate against known taxonomy before prompt assembly.

[CLARIFICATION_THRESHOLD]

Confidence score below which a sub-question is flagged for human clarification

70

Check: integer 0-100. Must be lower than [ESCALATION_THRESHOLD]. If unset, default to 60. Values below 40 risk excessive clarification requests.

[ESCALATION_THRESHOLD]

Confidence score below which the entire query is escalated to human review

40

Check: integer 0-100. Must be lower than [CLARIFICATION_THRESHOLD]. If unset, default to 30. Values above 60 risk unnecessary escalations.

[OUTPUT_SCHEMA]

Expected structure for the decomposition output including sub-questions, confidence, uncertainty flags, and clarification needs

See output-contract table for full schema definition

Check: must be a valid JSON Schema object. Validate schema parse before prompt assembly. Reject schemas missing required fields: sub_question, confidence, uncertainty_type, needs_clarification.

[CONTEXT_WINDOW_BUDGET]

Maximum token allocation for the decomposition output to prevent overflow in long-context pipelines

2000

Check: integer > 500. Must leave room for the original query and system instructions. Flag if budget exceeds 50% of model context window. Default to 1500 if unset.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Uncertainty Decomposition Prompt into a production application with validation, retries, and observability.

The Uncertainty Decomposition Prompt is not a standalone chat interaction—it is a structured reasoning step inside a larger planning or QA pipeline. Wire it as a synchronous call within an orchestrator that first receives a complex user query, then invokes this prompt to produce a decomposition with per-sub-question confidence estimates. The orchestrator should parse the structured output (JSON with sub-questions, confidence scores, and evidence gaps) and branch: sub-questions above a configurable confidence threshold proceed to downstream retrieval or tool calls, while those below the threshold trigger clarification requests or human review. Store the full decomposition payload in your trace system so operators can audit which parts of a complex query were answered autonomously and which were escalated.

Validation must happen at two levels. First, validate the output schema: confirm the response contains a parseable JSON array where each element has a sub_question string, a confidence float between 0.0 and 1.0, and an evidence_gap string explaining what is missing or uncertain. Reject and retry if the schema is malformed or confidence values fall outside bounds. Second, validate decomposition coverage: check that the sub-questions collectively address all core entities and intents in the original query. A lightweight coverage check can prompt a second model call to compare the original query against the decomposition and flag missing aspects. If coverage is incomplete, append the missing sub-questions with low confidence and route them to clarification. For high-stakes domains, log every decomposition alongside the coverage check result for human audit before downstream actions execute.

Model choice matters. Use a model with strong reasoning and structured-output capabilities for the decomposition step. If latency permits, consider running the decomposition through two models and comparing confidence divergence as an additional uncertainty signal. Set a retry budget: if schema validation fails, retry up to two times with the validation error included in the retry prompt context. If coverage validation fails, do not retry blindly—escalate to a human reviewer with the original query, the partial decomposition, and the coverage gap report. Wire the entire harness into your observability stack: log decomposition latency, confidence distributions, retry counts, and escalation rates. Monitor for drift in average confidence scores over time, which can signal model behavior changes or shifts in query complexity that require threshold recalibration.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured JSON payload returned by the Uncertainty Decomposition Prompt. Use this contract to validate outputs before passing them to downstream planning, clarification, or escalation systems.

Field or ElementType or FormatRequiredValidation Rule

decomposition_id

string (UUID v4)

Must be a valid UUID v4 string. Reject if missing or malformed.

original_query

string

Must exactly match the [USER_QUERY] input. Reject if truncated or altered.

sub_questions

array of objects

Must contain at least 1 item. Reject if empty or null.

sub_questions[].id

string (e.g., SQ-01)

Must match pattern ^SQ-\d{2}$. Reject if duplicate IDs exist.

sub_questions[].text

string

Must be a non-empty, self-contained question. Reject if it references other sub-questions without their ID.

sub_questions[].confidence

number (0.0 to 1.0)

Must be a float between 0.0 and 1.0 inclusive. Reject if out of range or non-numeric.

sub_questions[].needs_clarification

boolean

Must be true if confidence < [CLARIFICATION_THRESHOLD], otherwise false. Flag for human review if mismatch detected.

overall_confidence

number (0.0 to 1.0)

Must be the minimum of all sub_questions[].confidence values. Reject if greater than any individual confidence.

escalation_recommendation

string (enum)

Must be one of: 'proceed_autonomously', 'request_clarification', 'escalate_to_human'. Reject if not in enum.

PRACTICAL GUARDRAILS

Common Failure Modes

Uncertainty decomposition prompts break in predictable ways. These failure modes cover the most common production issues and how to guard against them before they reach users.

01

Overconfident Sub-Question Estimates

What to watch: The model assigns high confidence to sub-questions it cannot actually answer from available context, producing a misleadingly confident overall decomposition. Guardrail: Require the model to cite specific evidence or reasoning gaps for each confidence estimate. Validate against a held-out set where ground-truth answerability is known.

02

Decomposition Scope Drift

What to watch: The model expands the query into sub-questions that drift away from the original intent, adding unnecessary dimensions or missing the core ask. Guardrail: Include the original query in the output schema and run a semantic similarity check between the original query and a reverse-summarization of the generated sub-questions. Flag decompositions below a similarity threshold for review.

03

Hallucinated Sub-Questions from Missing Context

What to watch: When context is insufficient, the model invents plausible-sounding sub-questions that assume facts not in evidence, leading downstream retrieval or reasoning steps astray. Guardrail: Add an explicit instruction to mark sub-questions as 'unanswerable' when supporting evidence is absent. Validate that every sub-question maps to at least one retrievable source chunk.

04

Confidence Score Inconsistency Across Similar Queries

What to watch: The same sub-question type receives wildly different confidence scores across similar inputs, breaking any threshold-based routing or escalation logic. Guardrail: Build a calibration set of query pairs with known similarity and test that confidence scores remain within an acceptable variance band. Log score distributions per sub-question type and alert on drift.

05

Silent Failure on Ambiguous Entity References

What to watch: The query contains pronouns, vague references, or domain shorthand that the model resolves incorrectly without flagging the ambiguity, producing a decomposition that answers the wrong question. Guardrail: Add a pre-decomposition ambiguity detection step. Require the model to list unresolved referents and either request clarification or document its resolution assumptions before generating sub-questions.

06

Runaway Decomposition Depth

What to watch: The model recursively breaks sub-questions into further sub-questions without a stopping condition, producing an unmanageable tree that exceeds token budgets and adds noise. Guardrail: Set an explicit maximum decomposition depth and a minimum confidence threshold for further splitting. If a sub-question falls below the threshold, mark it as atomic and stop recursing.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Uncertainty Decomposition Prompt before shipping. Each criterion targets a specific failure mode in complex query decomposition and confidence assignment.

CriterionPass StandardFailure SignalTest Method

Sub-Question Completeness

All atomic sub-questions collectively cover the full scope of [COMPLEX_QUERY] without gaps or overlaps

Missing a required dimension of the query; sub-questions that duplicate each other; sub-questions that introduce new topics not present in the original query

Run 20 complex queries through decomposition. Have two reviewers independently score coverage on a 1-5 scale. Pass threshold: mean score >= 4.0 with inter-rater agreement > 0.8.

Confidence Score Calibration

Each sub-question confidence score correlates with actual answerability from provided [CONTEXT]. High confidence (>0.8) only when evidence is explicit and unambiguous

High confidence assigned to sub-questions with missing or contradictory evidence; low confidence assigned to sub-questions with clear, direct evidence in context

Create 30 sub-questions with known ground-truth answerability labels. Compare model-assigned confidence against labels. Expected: Brier score < 0.15 and ECE < 0.10.

Uncertainty Source Attribution

Each low-confidence sub-question includes a specific uncertainty source label from the allowed enum: missing_evidence, ambiguous_evidence, conflicting_evidence, out_of_scope, or unclear_phrasing

Generic uncertainty labels like 'unsure' or 'low confidence'; mismatch between the label and the actual evidence state; missing uncertainty source on sub-questions with confidence < 0.6

Parse output for confidence < 0.6 entries. Verify uncertainty_source field is present and matches allowed enum. Spot-check 50 low-confidence items against context to confirm label accuracy. Pass: > 95% enum compliance and > 85% label accuracy.

Decomposition Granularity Control

Sub-questions are atomic enough to answer independently but not so fine-grained that they fragment a single fact across multiple sub-questions

Single sub-question requiring multi-hop reasoning that should have been decomposed further; three or more sub-questions all targeting the same single fact with different phrasing

Measure average sub-question count per query. Flag queries with > 10 sub-questions for over-decomposition review. Flag queries where any sub-question requires joining > 2 pieces of evidence. Pass: < 10% flagged in either direction on a 50-query test set.

Clarification Request Precision

When overall query confidence is below [CONFIDENCE_THRESHOLD], the output includes a clarification request that targets the specific ambiguity and suggests concrete disambiguation options

Clarification request that restates the original query without narrowing; asking the user to repeat themselves; requesting clarification on sub-questions that already have high confidence

Run 30 ambiguous queries designed to trigger clarification. Check that clarification_request field is present when aggregate confidence < threshold. Have reviewers score precision on 1-5. Pass: 100% presence compliance and mean precision >= 4.0.

Output Schema Compliance

Output strictly matches [OUTPUT_SCHEMA] with all required fields present, correct types, and no extra fields

Missing sub_questions array; confidence values as strings instead of floats; extra undocumented fields; malformed JSON that fails to parse

Validate output against JSON Schema for 100 test runs. Pass: 100% parse success and 100% schema compliance. Any schema violation is a hard fail.

Escalation Flag Correctness

Escalation flag is set to true only when aggregate confidence < [CONFIDENCE_THRESHOLD] or when any single sub-question confidence < [MIN_SUB_CONFIDENCE]

Escalation flag true when all sub-questions have high confidence; escalation flag false when a critical sub-question has confidence < min threshold

Run 50 queries with controlled confidence distributions. Compare escalation flag against threshold rules programmatically. Pass: 100% agreement between flag and threshold logic.

Hallucination Resistance in Sub-Questions

No sub-question presupposes facts not present in [CONTEXT] or [COMPLEX_QUERY]. Sub-questions ask about evidence rather than assuming answers

Sub-question like 'Why did X happen?' when context never establishes X occurred; sub-questions that embed false premises from the model's training data rather than the provided context

Have domain experts review 30 decomposition outputs against source context. Flag any sub-question that assumes unverified facts. Pass: zero hallucinated premises in sub-questions.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call. Accept free-text sub-questions and confidence labels without strict schema enforcement. Focus on whether the decomposition logic is directionally correct.

code
Decompose [COMPLEX_QUERY] into sub-questions.
For each sub-question, assign a confidence label (high/medium/low).
Identify which sub-questions need clarification before answering.

Watch for

  • Missing schema checks on confidence labels
  • Overly broad sub-questions that don't isolate uncertainty
  • Model skipping the clarification-required flag
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.