Inferensys

Prompt

Decomposition Quality Evaluation Prompt

A practical prompt playbook for using an LLM-judge to evaluate the quality of generated sub-questions in production AI workflows.
DevOps engineer deploying LLM to production on laptop, Kubernetes dashboards visible, late night deployment session.
PROMPT PLAYBOOK

When to Use This Prompt

Learn when to deploy an LLM judge for evaluating sub-question quality in retrieval pipelines and when simpler checks or human review are a better fit.

This prompt is for prompt engineers and QA teams who need an automated, model-graded evaluation of sub-question quality before those sub-questions enter a retrieval pipeline. Use it when you have a decomposition step that breaks a complex user query into smaller, independently answerable sub-questions and you need a production gate to catch incomplete, overlapping, or irrelevant decompositions. The prompt acts as an LLM judge, scoring the generated sub-questions on completeness, independence, and relevance against the original query. It is designed for RAG systems, agentic research workflows, and any multi-step retrieval architecture where bad sub-questions cause downstream answer failure.

The ideal deployment point is immediately after a decomposition prompt runs and before any retrieval calls are made. Wire the judge as a synchronous validation step: take the original user query and the list of candidate sub-questions, pass them through this evaluation prompt, and check the pass/fail score against your threshold. If the decomposition fails, you can trigger a retry with the decomposition prompt, fall back to a simpler single-query retrieval, or escalate for human review. For high-throughput systems, consider sampling evaluations rather than judging every decomposition, and log all scores to track decomposition quality drift over time.

Do not use this prompt for evaluating final answers, retrieval quality, or single-hop query rewrites. It assumes you already have a set of candidate sub-questions to evaluate. If your system generates only one rewritten query rather than multiple sub-questions, use a query validation prompt instead. For regulated or high-risk domains such as healthcare or legal workflows, the judge score should inform but not replace human review of the decomposition before retrieval executes. The rubric is designed for production gating, not for academic benchmarking, so calibrate the pass threshold against your own failure tolerance and observed retrieval outcomes.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Use these cards to decide if the Decomposition Quality Evaluation Prompt is the right tool for your pipeline stage.

01

Good Fit: Pre-Retrieval QA Gate

Use when: you need an automated quality check on generated sub-questions before they hit your retrieval indexes. Guardrail: Run this evaluator as a synchronous pre-flight step in your RAG pipeline. If the score falls below your threshold, route the original query for human review or fallback rewriting.

02

Good Fit: Regression Testing Decomposition Logic

Use when: you are iterating on your decomposition prompt and need to catch regressions. Guardrail: Maintain a golden dataset of complex queries and expected sub-question characteristics. Run this evaluator in your CI/CD pipeline to compare scores across prompt versions before release.

03

Bad Fit: Real-Time Chat with No Latency Budget

Avoid when: the user is waiting for a sub-second response in a synchronous chat interface. Guardrail: This evaluation adds a full LLM inference round. Reserve it for async or batch processing pipelines. For real-time paths, use a lightweight heuristic check (e.g., sub-question count, length) instead.

04

Bad Fit: Single-Hop Factoid Queries

Avoid when: the original query is a simple factoid lookup that does not require decomposition. Guardrail: Add a pre-classification step to detect multi-hop or compound queries. Bypass both decomposition and evaluation for simple queries to save cost and latency.

05

Required Inputs: Structured Sub-Question Set

Risk: The evaluator cannot assess decomposition quality if sub-questions are missing, malformed, or unstructured. Guardrail: Enforce a strict JSON input contract with fields for id, question_text, and dependency_ids. Validate the input payload before calling the evaluator. Reject empty arrays.

06

Operational Risk: Evaluator Hallucination on Scoring

Risk: The LLM judge may produce plausible but incorrect scores or justifications, especially on nuanced completeness checks. Guardrail: Never use the raw score for fully automated enforcement without sampling. Log a random subset of evaluations for human audit. Use score trends, not single-point thresholds, for pipeline gating.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable LLM-judge prompt for scoring generated sub-questions on completeness, independence, and relevance.

This prompt template acts as an automated evaluator for your query decomposition pipeline. It takes the user's original complex question and the set of sub-questions your system generated, then scores each sub-question against a defined rubric. The primary job is to gate production deployments: if the decomposition quality falls below a threshold, the system should fall back to a simpler retrieval strategy or escalate for human review rather than serving a bad multi-hop answer.

text
You are a strict evaluator of query decomposition quality. Your task is to score a set of generated sub-questions against the original user query.

# INPUT
[ORIGINAL_QUERY]: The user's complex, multi-part question.
[SUB_QUESTIONS]: A JSON array of generated sub-question objects. Each object has an "id" (string) and "question" (string) field.

# EVALUATION RUBRIC
For each sub-question, assign a score of 1 (pass) or 0 (fail) for each of the following criteria:

1. **Completeness**: Does the set of sub-questions, taken together, cover all distinct parts of the original query? No part of the original intent should be missing.
2. **Independence**: Can each sub-question be answered without requiring the answer to another sub-question first? Flag any sub-question that depends on the result of a sibling sub-question.
3. **Relevance**: Is every sub-question directly relevant to answering the original query? Flag any sub-question that introduces unrelated topics or unnecessary tangents.
4. **Granularity**: Are the sub-questions broken down to the right level of detail? They should be specific enough to retrieve focused evidence but not so granular that they become trivial keyword matches.

# OUTPUT SCHEMA
Return ONLY a valid JSON object with the following structure. Do not include any text outside the JSON.

{
  "overall_pass": boolean, // true only if ALL sub-questions pass ALL criteria
  "sub_question_evaluations": [
    {
      "id": "string",
      "completeness": { "score": 0 or 1, "reasoning": "string" },
      "independence": { "score": 0 or 1, "reasoning": "string" },
      "relevance": { "score": 0 or 1, "reasoning": "string" },
      "granularity": { "score": 0 or 1, "reasoning": "string" }
    }
  ],
  "missing_coverage": ["string"], // List any parts of the original query not covered by any sub-question
  "critical_failure": "string or null" // If a fatal flaw exists, describe it here; otherwise null
}

# CONSTRAINTS
- Do not answer the sub-questions. Only evaluate their quality as decomposition artifacts.
- If the original query is ambiguous, note it in `critical_failure` but still evaluate the sub-questions as provided.
- Be strict. A score of 1 means the criterion is fully satisfied with no significant issues.

To adapt this template, replace [ORIGINAL_QUERY] with the user's raw input and [SUB_QUESTIONS] with the JSON output from your decomposition prompt. The overall_pass boolean provides a simple gating signal: if false, block the multi-hop retrieval and either re-prompt for better decomposition or fall back to a single-shot RAG call. The missing_coverage array is particularly valuable for debugging—it tells you exactly which parts of the user's intent your decomposition prompt is systematically dropping. Store the full evaluation JSON in your trace logs to track decomposition quality over time and detect prompt drift.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required by the Decomposition Quality Evaluation Prompt to reliably score sub-question sets against the original query.

PlaceholderPurposeExampleValidation Notes

[ORIGINAL_QUERY]

The complex user question that was decomposed

Compare the security features of AWS and Azure for a SOC 2 environment

Must be non-empty string; check for truncation if sourced from chat history

[SUB_QUESTIONS]

The list of generated sub-questions to evaluate

["What are AWS's encryption standards?", "What are Azure's encryption standards?"]

Must be valid JSON array of strings; reject if empty array or contains non-string elements

[EVALUATION_RUBRIC]

The scoring dimensions and pass/fail criteria

completeness: all aspects of original query covered; independence: each sub-question answerable alone

Must be a valid JSON object with at least one criterion; schema check before prompt assembly

[CONTEXT_DOCUMENTS]

Optional retrieved evidence used during decomposition

["doc_id: aws_soc2_report.pdf", "doc_id: azure_compliance.pdf"]

Null allowed; if provided, must be array of objects with id and snippet fields

[DECOMPOSITION_METHOD]

The strategy used to generate sub-questions

parallel_decomposition

Must match one of: parallel_decomposition, sequential_chain, comparative_split, temporal_split; enum check

[MAX_SUB_QUESTIONS]

Upper bound on expected sub-question count for scoring context

5

Must be positive integer; if actual count exceeds this, flag as potential over-decomposition

[SCORE_THRESHOLD]

Minimum aggregate score required to pass the evaluation gate

0.8

Must be float between 0.0 and 1.0; scores below this trigger decomposition retry or human review

[OUTPUT_SCHEMA]

Expected JSON structure for the evaluation result

{"overall_score": float, "criteria_scores": object, "failed_sub_questions": array, "explanation": string}

Schema validation required before parsing downstream; reject malformed JSON

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Decomposition Quality Evaluation Prompt into a production RAG pipeline or QA workflow.

This prompt functions as an LLM judge and should be treated as a gating step in your query decomposition pipeline, not a one-off manual review. After your primary decomposition prompt generates a set of sub-questions, route the original query and the generated sub-questions to this evaluator before any retrieval is executed. The evaluator returns a structured score and a pass/fail decision, which your application harness must read to decide whether to proceed with retrieval, regenerate the sub-questions, or escalate for human review. The core integration point is a conditional branch: if pass is false or the completeness_score falls below your threshold (typically 0.8), do not waste compute on retrieval with broken sub-questions.

Wire the prompt into an async evaluation step with explicit retry logic. On a fail verdict, capture the failure_reasons array from the output and feed it back as context into a retry of your decomposition prompt, instructing the model to address the specific gaps identified (e.g., 'The previous decomposition missed the temporal constraint; regenerate sub-questions covering the Q3 2024 time range'). Implement a maximum retry loop of 2 attempts to prevent infinite regeneration cycles. If the evaluator still returns a fail after retries, escalate the original query to a human review queue with the failed sub-questions and failure reasons attached. Log every evaluation result—including scores, failure reasons, and the final disposition—as structured metadata on the query trace for observability. For model choice, use a fast, cost-effective model (such as GPT-4o-mini or Claude Haiku) for this evaluation step, as it is a classification and scoring task that does not require a frontier model. The evaluator should run with temperature=0 to ensure deterministic, repeatable judgments.

Before deploying, build a regression test harness around this evaluator. Create a golden dataset of 20–30 query-and-sub-question pairs with known expected verdicts: include cases that should pass (complete, independent, relevant sub-questions), cases that should fail due to missing coverage, cases with dependent sub-questions that cannot run independently, and edge cases with ambiguous queries. Run the evaluator against this dataset on every prompt change and assert that the pass/fail accuracy against your labels exceeds 90%. Monitor production drift by sampling evaluation verdicts weekly and checking for unexpected pass rate changes. Do not use this evaluator as the sole quality signal for user-facing answers—it gates decomposition quality, not final answer correctness. The downstream RAG answer must still pass through its own groundedness and factuality checks.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the decomposition quality evaluation prompt response. Use this contract to parse and validate the LLM judge output before accepting a score or triggering a retry.

Field or ElementType or FormatRequiredValidation Rule

overall_score

number (1-5)

Must be an integer between 1 and 5 inclusive. Reject if float, string, or out of range.

completeness_score

number (1-5)

Must be an integer between 1 and 5. Reject if missing or non-integer.

independence_score

number (1-5)

Must be an integer between 1 and 5. Reject if missing or non-integer.

relevance_score

number (1-5)

Must be an integer between 1 and 5. Reject if missing or non-integer.

pass_fail

string enum

Must be exactly 'pass' or 'fail'. Reject any other value. A 'pass' requires overall_score >= 3 and no individual score below 2.

failure_reasons

array of strings

If present, each element must be a non-empty string. Required when pass_fail is 'fail'. Validate array length >= 1 on fail.

missing_intent

array of strings

If present, each element must be a non-empty string describing an aspect of the original query not covered by any sub-question. Null allowed.

overlap_notes

array of strings

If present, each element must be a non-empty string identifying sub-question pairs with significant semantic overlap. Null allowed.

PRACTICAL GUARDRAILS

Common Failure Modes

When evaluating decomposition quality with an LLM judge, these failures surface first in production. Each card pairs a specific risk with a concrete guardrail you can implement before the eval gates your pipeline.

01

Judge Hallucinates Coverage

What to watch: The evaluator LLM declares a sub-question set 'complete' when it misses a core intent from the original query. This happens when the judge skips fine-grained comparison and defaults to a high score for fluent but incomplete output. Guardrail: Include a mandatory checklist in the judge prompt that maps each original intent clause to at least one sub-question, and require explicit 'missing intent' flags in the output schema.

02

Dependency Confusion

What to watch: The judge misclassifies independent sub-questions as dependent or fails to detect broken dependency chains, causing downstream retrieval to execute in the wrong order or block on non-existent prerequisites. Guardrail: Require the decomposition prompt to output explicit dependency IDs, and add a validator that checks for circular references and orphaned dependencies before the judge scores.

03

Relevance Drift in Scoring

What to watch: The judge rewards sub-questions that are topically adjacent but not directly answerable from the target retrieval corpus, inflating relevance scores for questions that will return noise. Guardrail: Ground the judge's relevance criteria with a sample of the actual retrieval schema or a few representative document titles so it can assess whether each sub-question is realistically answerable.

04

Over-Penalizing Granularity

What to watch: The judge marks a decomposition as 'overly granular' when it correctly splits a compound question into atomic retrieval units, causing the eval to reject valid, high-recall decompositions. Guardrail: Define granularity thresholds in the rubric with concrete examples of acceptable versus excessive splitting, and tie the threshold to the retrieval backend's chunk size and top-k limits.

05

Position Bias in Pairwise Comparison

What to watch: When comparing two decomposition variants, the judge consistently favors the first or last candidate regardless of quality, making A/B eval results unreliable for gating decisions. Guardrail: Run each pairwise comparison twice with swapped positions and require agreement across both runs. Flag any comparison where the judge's preference flips with position as low-confidence and escalate for human review.

06

Silent Schema Violations

What to watch: The decomposition output passes the judge's content eval but contains malformed JSON, missing required fields, or incorrect types that break downstream parsers after the eval gate approves it. Guardrail: Run a strict schema validator before the judge prompt executes. Reject and request regeneration for any output that fails structural validation, and log schema failures separately from content quality failures.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to programmatically gate whether a set of generated sub-questions is production-ready. Each criterion maps to a specific check that can be implemented in an eval harness.

CriterionPass StandardFailure SignalTest Method

Completeness

All key constraints, entities, and intents from [ORIGINAL_QUERY] are addressed by at least one sub-question

A named entity, temporal constraint, or explicit condition from the original query is absent from all sub-questions

LLM-as-judge pairwise check: list all atomic facts in [ORIGINAL_QUERY] and verify each maps to a sub-question

Independence

Each sub-question can be answered without requiring the answer to another sub-question, unless explicitly flagged in [DEPENDENCY_FLAGS]

A sub-question contains a pronoun or reference that resolves only to another sub-question's expected answer

Parse check: scan each sub-question for unresolved anaphora or cross-references not declared in dependency metadata

Relevance

Every sub-question directly contributes to answering [ORIGINAL_QUERY]; no off-topic or tangentially related questions

A sub-question addresses a topic not mentioned or implied by the original query

LLM-as-judge binary classifier per sub-question: 'Does this sub-question help answer the original query?' with threshold >= 0.9

Atomicity

No sub-question combines multiple independent retrieval targets into a single compound question

A sub-question contains 'and' or 'or' joining two distinct fact-seeking clauses

Regex scan for coordinating conjunctions joining independent clauses; flag for manual review if detected

No Hallucinated Constraints

Sub-questions do not introduce entities, date ranges, or conditions absent from [ORIGINAL_QUERY]

A sub-question adds a specific year, product name, or filter not present in the original query

Diff check: extract all named entities and constraints from sub-questions, subtract those in [ORIGINAL_QUERY], flag non-empty remainder

Output Schema Compliance

Every sub-question object matches the [OUTPUT_SCHEMA] with all required fields present and correctly typed

A required field such as sub_question_id or target_index is missing, null, or wrong type

JSON Schema validator run against the full output array; reject on any validation error

Dependency Graph Validity

All depends_on values reference valid sub_question_id values within the same output; no cycles exist

A dependency references a non-existent ID or a cycle is detected in the dependency graph

Graph check: build adjacency list from depends_on fields, verify all target IDs exist, run cycle detection algorithm

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single frontier model and manual review. Strip the JSON output schema to a simple numbered list for faster iteration. Replace the structured rubric with a 1-5 Likert scale comment at the end. Run on 10-20 examples and spot-check.

Watch for

  • The model skipping the independence check and marking all sub-questions as independent
  • Overly generous scoring when the original query is simple
  • No baseline comparison: always compare against a human-labeled set of 5-10 golden decompositions
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.