Inferensys

Prompt

Evidence Gap Report Generation Prompt Template

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

Understand the ideal job-to-be-done, required inputs, and operational boundaries for the Evidence Gap Report Generation Prompt Template.

This prompt is designed for AI engineers and RAG pipeline operators who need a structured, auditable artifact that documents the boundaries of retrieved knowledge. The core job-to-be-done is not to answer a user's question, but to produce a machine-readable report detailing what the context covers, what information is missing, the impact of those gaps on answer quality, and recommended remediation steps. The ideal user is building an internal observability system, a retrieval debugging workflow, or a human review queue where traceability and structured evidence are required. The prompt expects a user question and a set of retrieved context chunks as input, and it outputs a gap report with explicit categories, severity assessments, and actionable next steps.

This prompt should be deployed in backend diagnostic pipelines, not in customer-facing latency paths. Use it when you need to log evidence gaps for dashboarding, trigger re-retrieval with modified queries, or populate a review queue for knowledge base curators. The output schema is designed to be consumed by downstream systems—logging platforms, alerting rules, and retrieval optimization scripts—rather than by end users. Do not use this prompt for real-time answer generation, for directly responding to users, or as a simple pass/fail sufficiency check. It is intentionally verbose and structured for auditability, which makes it unsuitable for low-latency conversational flows. Pair it with the Pre-Answer Sufficiency Check Prompt Template if you need a lightweight gate before generation, and reserve this report for post-hoc analysis, pipeline improvement, and compliance logging.

Before wiring this prompt into your application, ensure you have a clear contract for the input context format—typically an array of objects with chunk_id, text, and optional metadata fields. The prompt's value scales with the quality of your retrieval pipeline: if your retriever consistently returns irrelevant chunks, the gap report will correctly identify widespread insufficiency but won't fix the underlying retrieval problem. Start by running this prompt against a golden dataset of known-sufficient and known-insufficient context sets to calibrate your expectations. Then integrate the structured output into your observability stack, setting alerts on recurring gap categories or high-severity missing entities. The next step after reading this section is to copy the prompt template, adapt the output schema to match your logging infrastructure, and build a validation harness that checks for schema compliance before the report enters your review queue.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence Gap Report Generation Prompt Template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before you integrate it.

01

Good Fit: Auditable RAG Pipelines

Use when: you need a structured, machine-readable gap report for logging, dashboards, or downstream review queues. The prompt produces a consistent schema that operations teams can query. Guardrail: validate the output against a defined JSON schema before ingestion to catch format drift.

02

Good Fit: Retrieval Tuning Feedback Loops

Use when: you are iterating on chunking strategies, embedding models, or search parameters and need systematic feedback on what the retriever misses. The gap report becomes a debugging artifact. Guardrail: aggregate gap categories across a golden dataset to identify systemic retrieval weaknesses, not just anecdotal misses.

03

Bad Fit: Real-Time User-Facing Answers

Avoid when: the primary goal is to generate a direct answer for an end user in a chat interface. This prompt produces a meta-analysis report, not a synthesized response. Guardrail: use the Answer Abstention or Partial Answer with Caveats templates for user-facing flows; reserve this prompt for backend diagnostics.

04

Bad Fit: Low-Latency, High-Throughput Systems

Avoid when: you are under strict latency budgets (e.g., sub-second responses) or processing high volumes of simple lookups. The report generation requires additional reasoning tokens. Guardrail: gate this prompt behind a complexity classifier or sampling rate; do not run it on every query in a high-QPS system.

05

Required Inputs: Question and Retrieved Context

Risk: running the prompt without the original user question or with empty context produces a meaningless report. Guardrail: implement a pre-flight check that verifies both [USER_QUESTION] and [RETRIEVED_CONTEXT] are non-empty and that context chunks contain actual text, not just metadata.

06

Operational Risk: Gap Report Blind Trust

Risk: treating the model's gap analysis as ground truth without human review can lead to over-investment in fixing phantom gaps or ignoring real ones. Guardrail: periodically sample gap reports and manually verify against source documents. Track gap-to-resolution conversion rates to measure report utility.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating structured evidence gap reports from retrieved context and a user question.

This template is the core instruction set for an LLM to produce an auditable Evidence Gap Report. It is designed to be pasted directly into a system or user message. The prompt forces the model to separate what the context covers from what is missing, assess the impact of each gap, and recommend concrete remediation steps. All dynamic inputs are represented as square-bracket placeholders. Replace these with live data from your retrieval pipeline, application state, and output schema requirements before sending the request.

text
You are an evidence auditor for a Retrieval-Augmented Generation (RAG) system. Your task is to analyze the provided context against the user's question and produce a structured Evidence Gap Report. You must strictly separate facts present in the context from information that is missing, unclear, or contradictory.

## INPUTS
**User Question:** [USER_QUESTION]
**Retrieved Context:** [RETRIEVED_CONTEXT]
**Required Output Schema:** [OUTPUT_SCHEMA]
**Confidence Threshold:** [CONFIDENCE_THRESHOLD]

## INSTRUCTIONS
1.  **Parse the Question:** Decompose the user's question into discrete information needs or sub-questions.
2.  **Map Evidence:** For each information need, identify which parts of the retrieved context provide supporting, contradictory, or no evidence.
3.  **Identify Gaps:** For each unmet information need, classify the gap type:
    - `missing_fact`: The context does not contain the required information.
    - `stale_information`: The context contains information that may be outdated relative to the question's temporal frame.
    - `source_conflict`: Multiple sources in the context provide contradictory information.
    - `insufficient_detail`: The context touches on the topic but lacks the specificity required to answer.
    - `entity_not_found`: A specific entity mentioned in the question is absent from the context.
4.  **Assess Impact:** For each gap, rate the impact on answer quality as `critical`, `high`, `medium`, or `low`.
5.  **Recommend Remediation:** For each gap, suggest a concrete action to resolve it (e.g., a specific query rewrite, a new data source to query, a metadata filter to apply).
6.  **Generate Report:** Output a single JSON object conforming to the provided [OUTPUT_SCHEMA]. Do not include any text outside the JSON object.

## CONSTRAINTS
- Do not invent information to fill gaps. If the context is silent, the gap status is `missing_fact`.
- If the overall confidence in the available evidence is below the [CONFIDENCE_THRESHOLD], set the top-level `answerable` field to `false`.
- Cite specific context snippets by their `source_id` when mapping evidence.

To adapt this template, start by defining your [OUTPUT_SCHEMA]. A robust schema should include a top-level answerable boolean, an array of information_needs with their status and evidence_map, and a separate gaps array containing the structured gap objects. The [CONFIDENCE_THRESHOLD] is a critical business logic parameter that should be tuned in your eval harness, not hardcoded in the prompt. For high-stakes domains, always route reports where answerable is false or where critical gaps exist to a human review queue before any downstream action is taken.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Evidence Gap Report Generation Prompt Template. Each variable must be populated before the prompt is sent to the model. Missing or malformed inputs are the most common cause of silent failures in gap reports.

PlaceholderPurposeExampleValidation Notes

[USER_QUESTION]

The original question the user asked before retrieval

What are the side effects of Drug X in patients over 65?

Required. Must be non-empty string. Check for truncation if question exceeds 2000 characters. Log original question for audit trail.

[RETRIEVED_CONTEXT]

The full set of retrieved passages, chunks, or documents returned by the retrieval pipeline

Passage 1: Drug X clinical trial data shows... Passage 2: Elderly patients may experience...

Required. Must be non-empty string or array of passages. Validate that context includes source identifiers. Null or empty context should trigger abstention, not gap report generation.

[RETRIEVAL_METADATA]

Metadata about the retrieval process including source count, retrieval method, and timestamp

{"source_count": 5, "method": "hybrid_search", "timestamp": "2025-01-15T10:30:00Z"}

Optional but recommended. If provided, validate JSON structure. Missing metadata should not block generation but should be logged as a warning. Include retrieval method for debugging gap patterns.

[EXPECTED_ANSWER_SCOPE]

Description of what a complete answer should cover, used to calibrate gap severity

A complete answer should cover: efficacy in elderly, common side effects, drug interactions, and dosing adjustments

Required. Must be non-empty string. Defines the benchmark against which gaps are measured. Vague scope descriptions produce unreliable gap reports. Test with 3-5 known gap scenarios.

[DOMAIN_CONSTRAINTS]

Domain-specific rules about what evidence is required before answering

Clinical answers require peer-reviewed sources published within 5 years. Anecdotal evidence is insufficient.

Optional. If provided, use to weight gap severity. If null, model will apply default completeness standards. Domain constraints should be reviewed by subject matter expert before production use.

[OUTPUT_SCHEMA]

The expected JSON structure for the gap report output

{"covered_topics": [], "gaps": [{"topic": "", "severity": "", "impact": "", "remediation": ""}], "overall_assessment": ""}

Required. Must be valid JSON schema or example structure. Validate that output conforms to this schema post-generation. Schema mismatch is the most common integration failure. Include enum values for severity field.

[MAX_GAPS]

Maximum number of gaps to report, preventing verbose outputs that overwhelm review queues

5

Optional. Default to 5 if not provided. Must be positive integer between 1 and 20. Values above 20 risk diluting actionable signal. Validate type before prompt assembly.

[CONFIDENCE_THRESHOLD]

Minimum confidence score required for the model to claim a gap exists, reducing false-positive gap flags

0.7

Optional. Default to 0.7 if not provided. Must be float between 0.0 and 1.0. Lower thresholds increase gap sensitivity but produce more false positives. Calibrate against human-reviewed gap reports.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Evidence Gap Report into a production RAG pipeline with validation, retries, and logging.

The Evidence Gap Report prompt is designed to be called after retrieval but before answer generation in a RAG pipeline. It acts as a diagnostic gate that produces a structured JSON report. The primary integration point is a post-retrieval hook that receives the user's question and the top-k retrieved chunks, then decides whether to proceed with generation, trigger re-retrieval, or escalate for human review. This prompt is not a user-facing answer generator—it is an internal observability and control-plane component.

Wire the prompt into your application with a strict JSON output contract. The model must return a valid JSON object matching the [OUTPUT_SCHEMA] you define, typically including fields like coverage_summary, identified_gaps (array of objects with gap_description, severity, impact_on_answer), overall_sufficiency_score, and recommended_action (enum: proceed, re_retrieve, escalate). Implement a validation layer that parses the JSON response, checks for required fields, validates enum values, and confirms the overall_sufficiency_score is within the expected numeric range. If validation fails, retry once with the validation error message appended to the prompt as feedback. After two consecutive failures, log the raw output and escalate to a human review queue rather than silently proceeding with a potentially misleading gap report.

For model choice, prefer models with strong instruction-following and structured output capabilities (e.g., GPT-4o, Claude 3.5 Sonnet) because the gap report requires precise enumeration of missing evidence rather than fluent prose. Set temperature low (0.0–0.2) to maximize consistency across repeated runs on the same input. If your pipeline uses a cheaper model for answer generation, you can still route the gap report to a more capable model since this step is a gating decision that affects downstream safety and correctness. Log every gap report alongside the retrieval query, retrieved chunk IDs, and the final answer (if generated) to create an audit trail. This enables retrospective analysis of whether gaps were correctly identified and whether proceed decisions led to hallucinated answers.

The recommended_action field is your primary routing signal. Map proceed to your answer generation step, re_retrieve to a retrieval expansion module (which may rewrite the query, broaden search parameters, or query alternative indexes), and escalate to a human review queue with the full gap report attached. For re_retrieve actions, implement a loop limit (maximum 2–3 retrieval rounds) to prevent infinite cycles when the knowledge base genuinely lacks the needed information. After the loop limit is exhausted, force an escalate path. Test the harness with a golden dataset of questions where you know the knowledge base's coverage boundaries—questions fully covered, partially covered, and entirely outside scope—and measure whether the gap report's recommended_action aligns with ground truth. Track false-positive proceed decisions (gaps missed) and false-positive escalate decisions (unnecessary human review) as your primary quality metrics.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the Evidence Gap Report. Use this contract to parse, validate, and log structured gap reports before routing to review queues or retrieval pipeline improvement workflows.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Parse check: must match UUID v4 regex. Generate server-side if missing.

generated_at

string (ISO 8601 UTC)

Parse check: must be valid ISO 8601 datetime in UTC. Reject if future-dated beyond 5-minute clock skew tolerance.

question

string

Schema check: must be non-empty string. Compare against logged user input for drift detection.

context_summary

string

Schema check: must be non-empty string. Max 500 characters. Truncation allowed but must be logged.

covered_topics

array of strings

Schema check: must be array with at least 1 item. Each item must be non-empty string. Empty array triggers retry.

evidence_gaps

array of objects

Schema check: must be array. Each object must contain gap_description (string, required), severity (enum: critical|major|minor, required), impact_on_answer (string, required), and recommended_remediation (string, required). Empty array allowed only if covered_topics fully addresses question; log for audit.

answerability_assessment

enum: answerable|partially_answerable|unanswerable

Schema check: must match enum exactly. Cross-validate: if unanswerable, evidence_gaps must contain at least one critical gap. If answerable, evidence_gaps must be empty or contain only minor gaps. Mismatch triggers human review.

retrieval_recommendations

array of strings or null

Schema check: if present, must be array of non-empty strings. null allowed when no recommendations exist. Each string should be actionable (query rewrite, source expansion, metadata filter change).

PRACTICAL GUARDRAILS

Common Failure Modes

Evidence gap reports are only as good as their failure-handling design. These cards cover the most common production failure modes when generating structured gap documentation and how to guard against them before they reach downstream systems.

01

False Completeness Claims

What to watch: The model declares context is sufficient when critical entities, temporal ranges, or sub-questions are actually missing. This is the most dangerous failure mode because it suppresses retrieval expansion and lets gaps reach users silently. Guardrail: Require the prompt to enumerate specific sub-questions and mark each as covered or missing before producing a final sufficiency decision. Add an eval check that compares claimed coverage against a human-annotated entity list.

02

Gap Category Drift

What to watch: The model invents gap categories that don't match your retrieval pipeline's actual expansion capabilities, producing reports that suggest unactionable fixes. For example, reporting 'missing external API data' when your system only supports keyword and vector retrieval. Guardrail: Constrain the output schema to a closed enum of gap categories that map directly to your retrieval strategies. Validate that every gap category in the output exists in the allowed enum before accepting the report.

03

Overconfident Severity Scoring

What to watch: The model assigns high severity to minor gaps or low severity to gaps that would materially change the answer. Severity inflation triggers unnecessary re-retrieval; severity deflation lets important gaps through. Guardrail: Include severity calibration examples in the prompt that show the difference between 'missing a date by one day' and 'missing the entire regulatory requirement.' Run periodic human audits comparing severity scores to actual downstream impact.

04

Remediation Hallucination

What to watch: The model recommends retrieval strategies, query rewrites, or data sources that don't exist in your system. It may suggest 'search the internal policy database' when no such database is connected, producing remediation steps that mislead pipeline operators. Guardrail: Restrict remediation suggestions to a pre-defined list of available retrieval actions. Use a post-generation validator that rejects any remediation step referencing tools or sources outside your approved registry.

05

Context-Answer Mismatch

What to watch: The gap report correctly identifies missing information but fails to connect those gaps to specific answer claims that would be affected. Operators see a list of gaps but can't prioritize which ones would change the user-facing response. Guardrail: Require the output to link each gap to at least one specific sub-question or answer dimension. Include a field that states 'if this gap were filled, the answer would change in the following way' to make impact traceable.

06

Silent Abstention Bypass

What to watch: The gap report correctly identifies that evidence is insufficient but the downstream answer generation system ignores the report and produces an answer anyway. The gap documentation exists but has no operational effect. Guardrail: Wire the gap report's sufficiency decision directly into the answer generation gate. If the report flags critical gaps, block answer generation and route to a human review queue or a clarification response. Log every instance where a gap report was generated but overridden for audit.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Evidence Gap Report output before shipping. Each criterion targets a specific failure mode common to gap analysis prompts. Run these checks in your eval harness after every prompt or pipeline change.

CriterionPass StandardFailure SignalTest Method

Gap Completeness

Report identifies all major information categories missing from [CONTEXT] that are required by [QUESTION]

Report omits a clearly missing entity, timeframe, or constraint present in the question but absent from context

Diff extracted gap list against a human-annotated ground-truth gap set; require recall >= 0.90

Coverage Accuracy

Every item listed under 'What the Context Covers' is directly supported by a passage in [CONTEXT]

Coverage claim references a fact, figure, or event not present in any retrieved passage

For each coverage claim, run a citation verification prompt that checks if the claim can be located verbatim or paraphrased in [CONTEXT]; flag any unsupported claim

Gap-Impact Linkage

Each identified gap includes a specific, non-generic explanation of how it affects answer quality or decision risk

Impact statement is vague, circular, or identical across multiple gaps

Check that each gap's impact field contains a unique phrase referencing a concrete downstream consequence; reject if more than one impact statement is a near-duplicate

Remediation Actionability

Every recommended remediation step names a specific retrieval strategy, query rewrite, or data source

Remediation is generic advice such as 'get more data' or 'improve retrieval' without a concrete action

Validate that each remediation string contains at least one of: a suggested query, a named data source, a metadata filter, or a retrieval parameter change

No Fabricated Gaps

Report does not invent gaps when [CONTEXT] actually contains sufficient evidence to answer [QUESTION]

Report flags a gap for information that is clearly present in the provided context passages

Run a reverse verification prompt: for each reported gap, ask whether [CONTEXT] already contains the missing information; fail if any gap is contradicted by the context

Output Schema Compliance

Report strictly follows the [OUTPUT_SCHEMA] with all required fields present and no extra top-level keys

Missing required field, extra field, or field with wrong type

Parse output with a JSON schema validator configured to reject additional properties; fail on any validation error

Severity Calibration

Gap severity ratings are consistent with the question's risk profile and the gap's impact on answerability

Critical severity assigned to a minor missing detail, or low severity assigned to a gap that makes the question unanswerable

Run a pairwise comparison eval: present two gaps from the same report and ask an LLM judge which is more severe; compare against the model's own severity labels; flag inversions

Abstention Alignment

Report recommends abstention or escalation when evidence is insufficient for a reliable answer

Report recommends proceeding with an answer despite acknowledging critical gaps that make the question unanswerable

Check consistency between the gap severity summary and the final recommendation; fail if 'critical' gaps exist but recommendation is 'proceed'

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call and minimal post-processing. Focus on getting the gap report structure right before adding validation. Replace [DOMAIN] with a narrow scope like 'internal knowledge base' or 'product documentation.' Start with 3-5 retrieved passages and a single question.

Prompt modification

  • Remove the [EVIDENCE_GROUNDING] constraint and rely on the model's internal assessment
  • Simplify [OUTPUT_SCHEMA] to covered_topics, missing_topics, and impact_assessment only
  • Drop the remediation_priority field until you've calibrated severity scoring

Watch for

  • Overly broad gap categories that don't help retrieval debugging
  • Missing distinction between 'context absent' and 'context insufficient'
  • Model fabricating missing evidence instead of reporting true 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.