Inferensys

Prompt

Evidence Gap Report Generation Prompt

A practical prompt playbook for using Evidence Gap Report Generation Prompt 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

Identifies the ideal operational context, required inputs, and clear boundaries for deploying the Evidence Gap Report Generation Prompt.

This prompt is designed for AI operations teams and knowledge-base maintainers who need to systematically identify what evidence is missing from their retrieval pipeline. It generates a structured gap report that documents missing facts, explains why those gaps degrade answer quality, and recommends specific remediation actions. Use this prompt when you are auditing retrieval quality, planning knowledge-base expansion, or building continuous improvement workflows for RAG systems. The output is not an answer to a user query; it is an internal-facing diagnostic report for the team that owns the retrieval pipeline.

To use this prompt effectively, you must provide the original user query and the full set of retrieved passages or context that was available to the model. The prompt works best when the retrieval set has already been filtered for relevance, as it focuses on identifying what is missing rather than what is irrelevant. You should also specify the expected output schema, such as a structured JSON report with gap categories, severity ratings, and remediation actions. For high-stakes domains like healthcare or finance, always route the generated gap report through a human review step before committing to knowledge-base changes or pipeline reconfiguration.

Do not use this prompt when you need a real-time answer to a user query, when you are evaluating the relevance of retrieved passages, or when you need a binary answerable/unanswerable decision. For those tasks, use the RAG Sufficiency Gate Prompt or the Context Adequacy Binary Classifier Prompt instead. This prompt is specifically for post-hoc diagnostic analysis and continuous improvement workflows. Avoid running it on every query in production; it is designed for sampling, auditing, and periodic quality reviews where the cost of a detailed report is justified by the operational insight gained.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence Gap Report Generation Prompt works and where it does not. Use these cards to decide if this prompt fits your workflow before you integrate it.

01

Good Fit: Continuous Knowledge-Base Improvement

Use when: You have a RAG system in production and need a structured, repeatable way to identify missing evidence across many queries. Guardrail: Schedule gap reports weekly and feed them into a documented KB update process with clear ownership.

02

Bad Fit: Real-Time Answer Guardrail

Avoid when: You need a low-latency check to block a single bad response before it reaches the user. This prompt is designed for offline analysis and reporting, not per-request gating. Guardrail: Use a lightweight sufficiency classifier or binary gate prompt for real-time checks instead.

03

Required Inputs

Risk: Garbage-in, garbage-out gap reports if inputs are incomplete. Guardrail: Ensure every call includes the original user query, the full retrieved context set, and any generated answer that was produced. Missing any of these degrades the report's actionability.

04

Operational Risk: Actionless Reports

Risk: Teams generate gap reports that no one acts on, creating documentation debt without improving the system. Guardrail: Integrate the prompt output into a ticketing system or KB backlog. Every gap should have an owner and a review cadence, not just a report.

05

Operational Risk: Over-Reporting Minor Gaps

Risk: The prompt flags every minor missing detail, overwhelming the team with low-priority gaps and causing alert fatigue. Guardrail: Add a severity threshold in the prompt instructions. Only report gaps that materially impact answer correctness or user trust.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your orchestration layer. Replace square-bracket placeholders with live data before each call.

This template generates a structured Evidence Gap Report from a user query and a set of retrieved passages. It is designed to be called after retrieval but before answer generation, acting as a diagnostic gate. The prompt forces the model to identify what information is missing, explain why that missing information matters for answer quality, and recommend concrete remediation actions for the retrieval pipeline or knowledge base maintainers. Use this when you need to move beyond a simple 'I don't know' and produce actionable documentation for continuous improvement of your RAG system.

text
You are an evidence quality auditor for a RAG (Retrieval-Augmented Generation) system. Your task is to analyze the provided context against the user's query and produce a structured Evidence Gap Report.

## INPUTS
**User Query:** [USER_QUERY]
**Retrieved Context:** [RETRIEVED_CONTEXT]
**Knowledge Base Scope:** [KNOWLEDGE_BASE_DESCRIPTION]

## TASK
1.  **Decompose the Query:** Break the [USER_QUERY] into discrete information needs.
2.  **Map Evidence:** For each information need, identify which parts of the [RETRIEVED_CONTEXT] address it, partially address it, or fail to address it.
3.  **Identify Gaps:** List specific facts, entities, data points, or document types that are missing from the [RETRIEVED_CONTEXT] and are required to fully answer the query.
4.  **Assess Impact:** For each gap, explain how its absence would degrade the quality, accuracy, or completeness of a generated answer.
5.  **Recommend Remediation:** Propose concrete actions to fill each gap. These actions should be one of three types:
    *   **Query Rewrite:** A new search query to retrieve the missing information.
    *   **Knowledge Base Update:** Specific content, documents, or metadata that should be added to the [KNOWLEDGE_BASE_DESCRIPTION].
    *   **Clarification Question:** A question to ask the user to resolve an ambiguity.

## CONSTRAINTS
- Do not answer the [USER_QUERY]. Only report on evidence gaps.
- Base all analysis strictly on the [RETRIEVED_CONTEXT] provided. Do not use external knowledge.
- If no gaps exist, state that the evidence is sufficient and explain why.
- If the query is ambiguous, identify the ambiguity as a gap and recommend a clarification question.

## OUTPUT_SCHEMA
Respond with a single JSON object conforming to this schema:
{
  "query_decomposition": [
    {
      "information_need": "string",
      "status": "fully_addressed | partially_addressed | not_addressed",
      "supporting_context_ids": ["string"]
    }
  ],
  "evidence_gaps": [
    {
      "gap_id": "string",
      "missing_information": "string",
      "severity": "critical | high | medium | low",
      "impact_on_answer": "string",
      "remediation": {
        "action_type": "query_rewrite | knowledge_base_update | clarification_question",
        "action_content": "string"
      }
    }
  ],
  "overall_sufficiency_assessment": "sufficient | insufficient | partially_sufficient",
  "summary": "A concise executive summary of the findings."
}

To adapt this template, start by populating the [USER_QUERY] and [RETRIEVED_CONTEXT] placeholders with live data from your application. The [KNOWLEDGE_BASE_DESCRIPTION] is a static string that describes the scope of your indexed documents (e.g., 'Internal product documentation for Acme Corp's Widget API'). For high-stakes applications, integrate a post-generation validation step that checks the JSON schema and verifies that the supporting_context_ids in the output actually exist in the input context. This prevents hallucinated citations within the gap report itself. If the overall_sufficiency_assessment is insufficient, your orchestration layer should route the request to a human review queue or a clarification flow, rather than proceeding to answer generation.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the Evidence Gap Report Generation Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to check the input quality and format at runtime.

PlaceholderPurposeExampleValidation Notes

[QUERY]

The original user question or information need that triggered the retrieval.

What are the side effects of Drug X in elderly patients with renal impairment?

Must be a non-empty string. Check for minimum length of 10 characters. Reject if only stop words or punctuation.

[RETRIEVED_PASSAGES]

The set of passages returned by the retrieval pipeline, each with source metadata.

[{"id": "doc_1", "text": "...", "source": "...", "date": "..."}]

Must be a valid JSON array. Each object requires 'id' and 'text' fields. Reject if array is empty; warn if fewer than 3 passages.

[EXPECTED_ANSWER_TYPE]

The type of answer expected: factual, list, summary, comparison, yes/no, or procedure.

factual

Must match an allowed enum: factual, list, summary, comparison, yes_no, procedure. Default to factual if null.

[DOMAIN]

The knowledge domain for terminology and authority calibration.

clinical_medicine

Must match an allowed enum: clinical_medicine, legal, finance, scientific_research, technical_docs, general. Reject if unrecognized.

[REQUIRED_FACTS]

A list of specific facts or entities that must be present in the evidence for the answer to be considered grounded.

["contraindications", "dosing adjustment for renal impairment", "adverse event rate"]

Must be a valid JSON array of strings. Each string must be non-empty. Warn if array is empty, as this disables fact-level gap detection.

[AUTHORITY_THRESHOLD]

The minimum source authority score required for evidence to be considered reliable.

0.7

Must be a float between 0.0 and 1.0. Reject if outside range. Default to 0.5 if null.

[RECENCY_CUTOFF_DATE]

The date before which evidence is considered potentially stale.

2023-01-01

Must be a valid ISO 8601 date string (YYYY-MM-DD). Reject if unparseable. Null allowed if recency is not a concern.

[OUTPUT_SCHEMA]

The expected JSON schema for the gap report output.

{"type": "object", "properties": {...}}

Must be a valid JSON Schema object. Validate with a schema parser before use. Reject if schema is invalid or missing required fields.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Evidence Gap Report prompt into a production RAG pipeline or knowledge-base maintenance workflow.

The Evidence Gap Report prompt is designed to run as an asynchronous, post-retrieval analysis step, not as a real-time user-facing generation. It should be triggered by a monitoring job, a scheduled pipeline, or a manual review queue after a batch of queries has been processed. The primary consumer is an AI operations engineer or knowledge-base maintainer, so the output must be logged to an observability platform, written to a database, or rendered in a dashboard—not streamed directly to an end user. The prompt requires a query, the retrieved context set, and any existing answer or confidence score as inputs. Without these, the gap analysis will be speculative and unactionable.

To wire this into an application, wrap the prompt in a function that accepts a query_id, query_text, retrieved_passages (list of objects with content, source_id, and score), and an optional generated_answer. The function should construct the prompt by injecting these values into the [QUERY], [RETRIEVED_CONTEXT], and [GENERATED_ANSWER] placeholders. Before calling the model, validate that the retrieved context is not empty; if it is, log a NO_EVIDENCE event and skip the gap analysis. After receiving the model response, parse the structured JSON output and validate it against a schema that requires missing_evidence (array), impact_assessment (string), and remediation_actions (array). If parsing fails, retry once with a stricter output format instruction. Log the validated report to your observability stack with the query_id and a timestamp. For high-stakes knowledge bases (e.g., medical, legal, financial), route the report to a human review queue before any automated remediation is triggered.

Model choice matters here. Use a model with strong instruction-following and structured output capabilities, such as gpt-4o or claude-3.5-sonnet. Set temperature to 0.0 or near-zero to maximize consistency across runs. If you are processing a large backlog of queries, batch the requests and use prompt caching for the static system instructions to reduce latency and cost. Do not use this prompt as a real-time guardrail before answer generation; it is too slow and verbose for that. Instead, pair it with a lightweight sufficiency classifier (see the RAG Sufficiency Gate Prompt) that runs inline, and reserve the Evidence Gap Report for offline analysis and continuous improvement of your retrieval pipeline or knowledge base. The remediation actions in the output—such as 'add documentation for X' or 're-index source Y'—should be fed into your knowledge-base update workflow, not executed automatically without review.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the structure and content of the generated evidence gap report before it enters your knowledge-base maintenance pipeline or retrieval improvement workflow.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID)

Must parse as valid UUID v4; reject if missing or malformed.

generated_at

string (ISO-8601)

Must parse to a valid UTC timestamp within the last 24 hours; reject future dates.

query_summary

string

Length between 10 and 500 characters; must not be identical to [QUERY] placeholder if [QUERY] is a single short sentence.

overall_sufficiency_score

number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive; reject if score > 0.7 but gap_list contains critical-severity items.

gap_list

array of objects

Must be a non-empty array if overall_sufficiency_score < 1.0; each object must contain gap_id, severity, and description fields.

gap_list[].severity

enum string

Must be one of: critical, high, medium, low; reject any unrecognized value.

gap_list[].recommended_action

string

Must be one of: re_retrieve, expand_kb, clarify_query, accept_gap; reject if action is clarify_query but no clarification question is provided in the parent object.

remediation_priority_order

array of strings (gap_ids)

Must contain only gap_ids present in gap_list; order must match severity descending (critical first).

PRACTICAL GUARDRAILS

Common Failure Modes

Evidence Gap Reports fail in predictable ways. Here's what breaks first and how to guard against it.

01

Vague Gap Descriptions

What to watch: The model produces generic gaps like 'more evidence needed' or 'insufficient context' without specifying what exact information is missing. This makes the report useless for remediation. Guardrail: Require the output schema to include a missing_specifics field with enumerated entities, facts, or data points. Validate that gap descriptions contain at least one concrete, query-specific noun phrase before accepting the output.

02

False-Positive Sufficiency Claims

What to watch: The model declares evidence sufficient when retrieved passages only partially cover the query, missing critical temporal, entity, or relational information. This masks real gaps and leads to overconfident downstream answers. Guardrail: Decompose the query into sub-questions before sufficiency assessment. Require the prompt to check coverage per sub-question and flag any with low confidence. Pair with a separate sufficiency gate prompt for independent verification.

03

Gap Report Drift Over Retrieval Updates

What to watch: When the knowledge base is updated, previously generated gap reports become stale. Teams ship remediation based on old gap data, wasting effort on already-resolved issues or missing new gaps. Guardrail: Include a knowledge_base_version or index_timestamp field in every gap report. Automate gap report regeneration on retrieval index updates. Version reports alongside the retrieval snapshot they reference.

04

Remediation Actions Without Prioritization

What to watch: The model lists ten remediation actions with equal weight. Teams can't distinguish critical gaps blocking answer quality from nice-to-have improvements. Guardrail: Require a severity or impact_score field for each gap. Define severity in terms of answer degradation risk, not just missing word count. Sort remediation actions by impact and include a blocking boolean for gaps that should prevent answer generation entirely.

05

Hallucinated Missing Information

What to watch: The model invents specific missing facts that were never actually required by the query, leading teams to add unnecessary or misleading content to the knowledge base. Guardrail: Ground every reported gap in explicit query sub-components. Require the prompt to cite which part of the decomposed query creates the information need. Validate that each gap traces back to a query element before filing remediation tickets.

06

Over-Reporting on Ambiguous Queries

What to watch: For vague or multi-intent queries, the model generates an exhaustive gap list covering every possible interpretation, producing an unactionable report. Guardrail: Add a pre-processing step that classifies query ambiguity. For ambiguous queries, generate clarification questions first, then run gap analysis only on the disambiguated intent. Cap the number of reported gaps per query to force prioritization.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Evidence Gap Report before shipping. Each criterion targets a specific failure mode in gap identification, severity rating, or remediation actionability.

CriterionPass StandardFailure SignalTest Method

Gap Completeness

All missing evidence categories from the ground-truth gap set are identified in the report

Report omits a known gap that prevents answering the query

Compare report gaps against human-annotated gap set; require recall >= 0.90

Gap Precision

No hallucinated gaps that are actually covered by the provided evidence passages

Report claims a gap for information present in [RETRIEVED_CONTEXT]

Spot-check each reported gap against [RETRIEVED_CONTEXT] spans; require precision >= 0.85

Severity Rating Accuracy

Each gap severity matches the rubric definition: Critical blocks answer; High degrades core claim; Medium affects nuance; Low is cosmetic

Critical gap rated as Low, or cosmetic gap rated as Critical

Sample 20 gaps and compare severity labels to rubric definitions; require agreement >= 0.90

Remediation Actionability

Each recommended action specifies what to retrieve, where to look, or what to add to the knowledge base

Action is vague such as 'get more data' or 'improve retrieval' without specific target

Check that every action row contains a concrete retrieval query, source type, or KB update instruction

Source Attribution

Each gap is linked to the specific query sub-component or evidence passage where the deficiency was detected

Gap listed without traceability to which part of [USER_QUERY] or [RETRIEVED_CONTEXT] triggered it

Verify each gap row includes a query_sub_component or source_reference field; require 100% attribution

Confidence Calibration

Report-level confidence score correlates with actual gap count: high confidence when 0-1 gaps, low confidence when 3+ gaps

Report assigns high confidence despite listing 4+ critical gaps

Run 50 test cases; check that confidence_score decreases monotonically as gap_count increases

Output Schema Compliance

Report matches [OUTPUT_SCHEMA] exactly: all required fields present, no extra fields, correct types

Missing required field such as gap_list or remediation_plan; string where array expected

Validate output against JSON Schema; require zero schema violations

Refusal Handling

When [RETRIEVED_CONTEXT] is empty or entirely irrelevant, report indicates insufficient input rather than fabricating gaps

Report generates plausible-sounding gaps when no evidence was provided

Test with empty context set; expect insufficient_input flag set to true and gap_list empty

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt\nUse the base prompt with a single model call and no schema enforcement. Replace the structured output requirement with a free-text request for a gap report. Remove the `[OUTPUT_SCHEMA]` placeholder and ask for a bulleted list instead.\n\n### Watch for\n- Inconsistent formatting across runs\n- Missing severity ratings on gaps\n- Gaps described vaguely without specific missing entities or facts\n- No distinction between critical and minor evidence gaps

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.