Inferensys

Prompt

Evidence Chain Construction Prompt for RAG

A practical prompt playbook for using Evidence Chain Construction Prompt for RAG 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

Defines the core job, the ideal user, required inputs, and the boundaries where this prompt should not be applied.

This prompt is designed for AI architects and engineers building auditable Q&A systems on top of Retrieval-Augmented Generation (RAG). Its core job is to force the model to construct an explicit, step-by-step reasoning chain that links specific retrieved passages to intermediate conclusions before producing a final answer. The ideal user is someone who needs a traceable, debuggable reasoning path—not just a correct answer—to satisfy internal QA, compliance, or user-trust requirements. You should use this prompt when the cost of an incorrect or unverifiable answer is high, such as in legal research, clinical decision support, or financial analysis, and when you need to programmatically verify that every inferential hop is grounded in a source.

To use this prompt effectively, you must provide a set of pre-retrieved document chunks as [CONTEXT]. The prompt is not a retrieval planner; it assumes the evidence is already gathered and deduplicated. It works best when the question requires synthesizing information from multiple documents or when the answer depends on a logical chain rather than a single extracted fact. Do not use this prompt for simple factoid lookups where a single passage contains the answer, as the overhead of constructing a chain adds latency and token cost without proportional value. Similarly, avoid it in low-latency, high-throughput chat systems where a verbose reasoning trace would degrade the user experience.

The primary output is a structured reasoning chain—a sequence of claims, each explicitly citing a source passage—followed by a final answer. This output is designed to be machine-parsed for downstream evaluation. Before deploying, you must pair this prompt with an evaluation harness that checks for chain completeness, source fidelity, and logical validity. A common failure mode is the model fabricating a plausible-sounding logical connection that is not actually stated in the provided context. Your eval must catch this. Proceed by integrating this prompt into a pipeline where the output is logged, audited, and potentially reviewed by a human before being surfaced in high-risk applications.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence Chain Construction Prompt delivers auditable value and where it introduces unacceptable risk or operational overhead.

01

Good Fit: Compliance and Audit Workflows

Use when: you need a traceable, step-by-step justification linking every factual claim to a specific source passage for internal or external review. Guardrail: The explicit chain format is a feature, not overhead. Pair with a schema that requires a source_id and excerpt for each hop.

02

Good Fit: Complex Multi-Document Synthesis

Use when: answering a question requires combining facts from three or more retrieved chunks where the logical connection is non-trivial. Guardrail: The prompt forces the model to externalize its reasoning, making cross-document contradictions visible before the final answer is generated.

03

Bad Fit: Simple Factoid Lookups

Avoid when: the answer is a single, unambiguous fact found in one passage. Risk: The overhead of constructing a multi-hop chain adds latency and token cost without improving accuracy. Guardrail: Use a lightweight citation prompt instead and route to this prompt only when a complexity classifier triggers.

04

Required Inputs: Ranked and Deduplicated Context

What to watch: Feeding raw, noisy retrieval results directly into this prompt produces bloated, confusing chains that cite irrelevant passages. Guardrail: Pre-process context with a deduplication and relevance-ranking step. The prompt expects a curated set of passages, not a dump of top-k vectors.

05

Operational Risk: Latency and Cost Amplification

Risk: Generating an explicit reasoning chain before the final answer significantly increases output tokens and time-to-first-token. Guardrail: Set a strict max_tokens budget for the chain, implement streaming to show progress, and monitor chain length to detect runaway reasoning loops.

06

Operational Risk: Hallucinated Reasoning Steps

Risk: The model can fabricate a plausible-sounding logical hop that is not actually supported by the cited source. Guardrail: Never trust the chain implicitly. Implement a post-generation audit step that verifies each inferential leap against the provided excerpt using a separate verification prompt or structured comparison.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for constructing an explicit, step-by-step evidence chain that links retrieved passages to intermediate conclusions and a final answer.

This template is the core instruction set for an LLM to act as an auditable reasoning engine. It forces the model to externalize its reasoning by building a chain where each step is a discrete conclusion explicitly grounded in one or more source passages. The primary goal is traceability: a human or an automated evaluator must be able to follow the path from the question, through the evidence, to the final answer without guessing which source supports which claim. Use this template when the cost of an incorrect or unverifiable answer is high, such as in compliance, legal research, or clinical decision support.

code
You are an expert reasoning engine. Your task is to answer a complex question by constructing an explicit, step-by-step evidence chain from the provided context.

# INPUT
Question: [QUESTION]
Retrieved Context:
---
[RETRIEVED_CONTEXT]
---

# INSTRUCTIONS
1. **Analyze the Question:** Identify the core entities, events, and relationships required to answer the question.
2. **Construct the Evidence Chain:** Build a numbered list of reasoning steps. Each step must be a single, logical inference.
3. **Ground Every Step:** For each step, you MUST cite the specific source passage(s) from the context that support it using the format `[Source: <source_id>]`. If a step combines multiple sources, cite all of them.
4. **Identify Gaps:** If the context is insufficient to complete a necessary step, explicitly state the gap as a step: "GAP: Information about [missing fact] is not present in the provided context."
5. **Synthesize Final Answer:** After the chain, provide a concise final answer that directly addresses the question. The answer must be fully supported by the preceding evidence chain.

# OUTPUT FORMAT
```json
{
  "question": "[restate the original question]",
  "evidence_chain": [
    {
      "step_number": 1,
      "inference": "[a single logical conclusion drawn from the context]",
      "source_ids": ["source_1", "source_2"]
    },
    {
      "step_number": 2,
      "inference": "GAP: [description of missing information]",
      "source_ids": []
    }
  ],
  "final_answer": "[concise answer grounded in the chain]",
  "confidence": "high|medium|low",
  "uncertainty_notes": "[optional explanation if confidence is not high]"
}

CONSTRAINTS

  • Do not include any information in the final answer that is not justified by a step in the evidence chain.
  • If a gap prevents a high-confidence answer, set confidence to 'low' or 'medium' and explain why in uncertainty_notes.
  • Never fabricate source IDs. Only use IDs exactly as they appear in the provided context.

To adapt this template, start by replacing the [RETRIEVED_CONTEXT] placeholder with your actual retrieval results. Ensure each passage has a unique, stable source_id that survives across your pipeline. The [QUESTION] placeholder should receive the user's original, unmodified query. The JSON output schema is designed for programmatic consumption; you can validate it in your application layer before showing the answer to a user. For high-risk domains, add a [RISK_LEVEL] placeholder and a corresponding instruction to escalate to human review if confidence is 'low' or if more than a specified number of gaps are detected. The [CONSTRAINTS] section is your primary lever for policy: you can add rules like 'Do not speculate about medical diagnoses' or 'Limit final answer to 100 words' without altering the core reasoning structure.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Evidence Chain Construction Prompt. Each variable must be populated before the prompt is sent. Validation notes describe how to check the input quality programmatically.

PlaceholderPurposeExampleValidation Notes

[USER_QUESTION]

The complex question requiring multi-hop reasoning and an explicit evidence chain.

What were the root causes of the Q3 latency incident, and which mitigation had the largest measured impact?

Must be a non-empty string. Check length > 20 chars. Reject simple factoid questions that do not require chaining.

[RETRIEVED_PASSAGES]

An ordered list of text chunks retrieved from the knowledge base, each with a unique ID and metadata.

PASSAGE[0]: '...' (source: incident_report_2024-09.pdf, page 4)

Must be a valid JSON array of objects with 'id', 'text', and 'source' fields. Reject if array is empty or 'text' fields are blank.

[PASSAGE_METADATA]

A mapping of passage IDs to source metadata including document title, date, and page number.

{'p0': {'doc': 'incident_report.pdf', 'date': '2024-09-15', 'page': 4}}

Must be a valid JSON object. Every key must match an 'id' in [RETRIEVED_PASSAGES]. Warn if 'date' field is missing for temporal reasoning tasks.

[REASONING_HOP_LIMIT]

Maximum number of inferential steps allowed in the evidence chain to prevent runaway reasoning.

5

Must be an integer between 2 and 10. Default to 5 if not provided. Reject values below 2 as insufficient for multi-hop reasoning.

[OUTPUT_SCHEMA]

The exact JSON schema the evidence chain output must conform to, defining the structure of hops, citations, and the final answer.

{'hops': [{'step': int, 'claim': str, 'source_ids': [str], 'confidence': float}], 'final_answer': str}

Must be a valid JSON Schema object. Validate with a schema validator before prompt assembly. Reject if 'hops' array is not defined as required.

[CONFIDENCE_THRESHOLD]

Minimum confidence score (0.0 to 1.0) required for a hop to be included in the final chain.

0.6

Must be a float between 0.0 and 1.0. Hops below this threshold should be omitted or flagged. Default to 0.5 if not provided.

[ABSTENTION_RULES]

Explicit conditions under which the model should refuse to construct a chain and instead return an abstention message.

Abstain if fewer than 2 relevant passages are found, or if a critical logical gap cannot be bridged.

Must be a non-empty string. Validate that it contains clear, actionable conditions. Log a warning if the string is generic (e.g., 'be careful').

PRACTICAL GUARDRAILS

Common Failure Modes

Evidence chain construction fails in predictable ways. Here are the most common failure modes and the specific guardrails to embed in your harness before shipping.

01

Hallucinated Intermediate Conclusions

What to watch: The model fabricates a logical connection or invents a fact not present in any retrieved passage to bridge a gap in the evidence chain. This is especially common when the required connection is plausible but unsupported. Guardrail: Implement a post-hoc ReasoningChainAudit step that verifies each inferential hop against the provided source context. Flag and retry any step where a claim cannot be matched to a specific passage.

02

Citation Drift Across Hops

What to watch: An early reasoning step correctly cites Source A, but a later step reuses that conclusion and accidentally attributes it to Source B or drops the citation entirely. The final answer appears grounded but the evidence trail is broken. Guardrail: Require the prompt to output a structured object with explicit source_ids at every hop. Validate that each cited ID exists in the retrieved context and that the cited text actually contains the claimed information.

03

Premature Final Answer

What to watch: The model short-circuits the reasoning chain and jumps directly to a final answer after only one or two hops, ignoring evidence gaps that require additional retrieval or sub-questions. The answer sounds confident but is built on incomplete evidence. Guardrail: Add a MissingEvidenceDetection check after the chain is constructed. If the audit identifies unresolved sub-questions or logical leaps without source support, trigger a retry or escalate for additional retrieval before accepting the answer.

04

Spurious Correlation as Causation

What to watch: When chaining evidence across documents, the model treats temporal sequence or correlation as causal proof. Two events from different sources are linked with causal language despite no document establishing causation. Guardrail: Include an explicit constraint in the prompt: 'Distinguish correlation from causation. Only assert a causal relationship if a source document explicitly states it. Otherwise, describe the relationship as temporal or correlational.' Validate with a CausalClaimCheck eval.

05

Silent Source Conflict Suppression

What to watch: The model encounters contradictory evidence across documents but resolves the conflict by ignoring one side entirely, producing a clean but misleading chain that hides disagreement. Guardrail: Instruct the prompt to explicitly flag contradictions in a conflicts array within the output schema. If contradictions exist and the output contains none, fail the response and trigger a ContradictionResolution sub-prompt to surface the conflict before synthesis.

06

Context Window Truncation of Late-Stage Evidence

What to watch: Long reasoning chains with many cited passages exceed the context window, causing the model to lose access to early evidence. Late-stage conclusions become unmoored from their original sources. Guardrail: Implement context budget monitoring. If the combined prompt plus retrieved passages exceeds a safe threshold, compress earlier reasoning steps into a structured summary with preserved citations before continuing. Test with maximum-length chains in your eval suite.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of evidence chains produced by the prompt. Each criterion should be tested with a representative set of multi-hop questions before shipping.

CriterionPass StandardFailure SignalTest Method

Chain Completeness

Every sub-question required to answer the user query is addressed by at least one reasoning step

The chain omits a necessary sub-question, leaving a logical gap between steps

Compare the chain's steps against a pre-defined gold decomposition for 20 test queries

Source Grounding

Every factual claim in the reasoning chain is accompanied by a citation to a specific retrieved passage

A step makes an unsupported assertion or cites a passage that does not contain the claimed fact

Automated NLI check: for each claim-citation pair, verify the passage entails the claim

Logical Coherence

Each step follows from the previous step and the cited evidence without non-sequiturs

A step introduces a conclusion that cannot be derived from the prior step plus the cited evidence

LLM-as-judge pairwise comparison against a human-written reasoning chain for logical flow

Citation Accuracy

All citations point to the correct document ID and passage text that supports the specific claim

A citation references a passage that is irrelevant to the claim or belongs to a different document

Parse citations, retrieve the referenced passage, and run a fact-verification prompt on the claim-passage pair

Step Necessity

No step is redundant, circular, or restates a previous step without adding new evidence or inference

The chain contains filler steps that do not advance the reasoning toward the final answer

Ablation test: remove the step and check if the final answer can still be reached from the remaining steps

Conflict Handling

When sources disagree, the chain explicitly notes the conflict and does not silently pick one side

The chain presents a single conclusion while ignoring contradictory evidence present in the retrieved context

Inject conflicting passages into the context and verify the chain surfaces the disagreement

Final Answer Fidelity

The final answer is fully supported by the reasoning chain and contains no claims absent from the chain

The final answer introduces new facts, speculations, or qualifiers not derived in the chain

Extract all claims from the final answer and verify each appears in at least one reasoning step

Abstention Discipline

When evidence is insufficient to answer the query, the chain concludes with an explicit abstention rather than fabricating

The chain constructs a plausible-sounding answer from weak or unrelated evidence

Provide context that lacks the necessary facts and assert that the output contains an abstention statement

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Evidence Chain Construction Prompt into a production RAG application with validation, retries, and observability.

The Evidence Chain Construction Prompt is not a standalone endpoint—it is a reasoning engine that sits between retrieval and the final answer. In a production harness, this prompt should receive a pre-assembled context block containing all retrieved passages relevant to the user's question, along with any previously established intermediate facts. The application layer is responsible for calling retrieval, deduplicating and ranking passages, and injecting them into the [RETRIEVED_CONTEXT] placeholder. Do not rely on the model to decide which documents to use; that selection should happen in the retrieval pipeline before this prompt is invoked.

Wire this prompt into a multi-step workflow: (1) retrieve candidate passages, (2) rank and filter to a manageable context window, (3) invoke the evidence chain prompt to produce a structured reasoning trace, (4) validate the output against a schema that requires each reasoning step to include a source_id matching a passage in the input, and (5) pass the validated chain to a final synthesis prompt or directly to the user if the chain itself is the desired output. For high-stakes domains, insert a human review step between steps 4 and 5 when the model's confidence markers or the validator's source-coverage score fall below a defined threshold. Log every invocation with the prompt version, retrieved passage IDs, generated chain, and validation result for auditability.

Validation is the critical harness component. Implement a post-generation check that parses the JSON output and verifies: every evidence object references a source_id present in the input passages, no step contains claims absent from its cited source, and the final conclusion is reachable by following the chain. Use a secondary LLM call with a dedicated faithfulness evaluation prompt for automated checks, but keep a deterministic structural validator as a fast first pass. Set a retry budget of 2 attempts with escalating temperature (0.0 then 0.2) if validation fails. If the chain still fails after retries, fall back to a simpler direct-answer prompt and flag the interaction for review. Avoid wiring this prompt into synchronous user-facing flows without a timeout and a degraded-mode fallback—multi-hop reasoning can be slow.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single retrieval step and a small set of 3-5 documents. Remove strict output schema requirements and allow the model to produce a free-text reasoning chain. Focus on testing whether the chain logic holds before adding production constraints.

Simplify the prompt to:

code
Given the following documents, construct a step-by-step evidence chain that leads to an answer for the question: [QUESTION]

Documents:
[DOCUMENTS]

For each step, cite the source document.

Watch for

  • Chains that skip logical steps or make unsupported leaps
  • Citations that point to the wrong document
  • The model fabricating evidence when documents are insufficient
  • Overly verbose chains that bury the reasoning in prose
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.