Inferensys

Prompt

Evidence-Answer Contradiction Detection Prompt Template

A practical prompt playbook for using Evidence-Answer Contradiction Detection 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 specific job this contradiction detection prompt performs and the production contexts where it prevents harm.

This prompt is designed for safety-critical AI applications where a generated answer must be verified against source evidence before it reaches a user. It detects direct contradictions, subtle inconsistencies, and polarity reversals between an answer and the provided evidence. Use this prompt as a guardrail in RAG pipelines, medical summarization, legal analysis, financial reporting, or any system where a contradiction could cause harm. It is not a general-purpose hallucination detector; it focuses specifically on contradiction, not on unsupported claims or fabrications.

The prompt assumes you already have a generated answer and a set of evidence passages. It returns structured contradiction spans with the conflicting evidence excerpts, making it suitable for automated blocking, human review queues, or audit logging. You should wire this prompt into your output validation pipeline after answer generation but before the response reaches the user. For systems with strict latency requirements, consider running this check asynchronously and flagging the response for retrospective review if a contradiction is found after delivery.

Do not use this prompt when you need to detect unsupported claims that lack evidence entirely—that requires a separate faithfulness audit prompt. Do not use it when you need to verify citation accuracy or check whether a specific source actually says what the answer claims. This prompt is also not a substitute for human review in regulated domains; it should feed into a review queue with clear escalation paths. If your evidence set is large, pre-filter to the most relevant passages before running contradiction detection to avoid diluting the model's attention across irrelevant context.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence-Answer Contradiction Detection prompt delivers value and where it introduces risk. Use these cards to decide if this prompt belongs in your pipeline.

01

Good Fit: Safety-Critical Output Review

Use when: generated answers must be verified against source evidence before reaching users in healthcare, legal, or financial applications. Guardrail: Run this prompt as a blocking gate in your output pipeline; only release answers that pass contradiction checks.

02

Good Fit: RAG Pipeline Quality Monitoring

Use when: you need production observability over whether your RAG system is generating answers that contradict retrieved context. Guardrail: Sample outputs and run contradiction detection as a periodic quality metric, not a real-time gate, to avoid latency spikes.

03

Bad Fit: Open-Domain Creative Generation

Avoid when: the task is creative writing, brainstorming, or subjective analysis where there is no single ground-truth evidence set. Guardrail: Use faithfulness checks only when explicit source documents exist; otherwise, switch to policy-based safety review.

04

Bad Fit: Real-Time Chat Without Evidence

Avoid when: latency budgets are under 500ms and no retrieved context is available for comparison. Guardrail: Defer contradiction detection to an async post-processing step or use a lightweight classifier for real-time flagging.

05

Required Inputs: Answer-Evidence Pairs

Risk: running contradiction detection without both a generated answer and the source evidence produces meaningless results. Guardrail: Validate that both [ANSWER] and [EVIDENCE] fields are populated and non-empty before invoking the prompt; abort with an error code if either is missing.

06

Operational Risk: Subtle Inconsistency Misses

Risk: the model may catch direct contradictions but miss polarity reversals, temporal mismatches, or implied contradictions that require multi-hop reasoning. Guardrail: Pair this prompt with a sentence-level attribution verification step for high-stakes domains; never rely on contradiction detection alone for regulated outputs.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for detecting contradictions between a generated answer and its source evidence, with square-bracket placeholders for your application data.

This template is designed to catch contradictions before they reach users in safety-critical applications. It compares a generated answer against provided evidence passages and returns a structured report identifying direct contradictions, subtle inconsistencies, and polarity reversals. The prompt expects you to supply the answer text, the evidence passages, and your desired output schema. It is not a general-purpose fact checker—it only detects contradictions between the answer and the specific evidence you provide, not contradictions within the evidence itself or against external knowledge.

text
You are a contradiction detection system. Your task is to compare a generated answer against provided source evidence and identify any statements in the answer that directly contradict, reverse, or are inconsistent with the evidence.

## INPUT

**Generated Answer:**
[ANSWER_TEXT]

**Source Evidence Passages:**
[EVIDENCE_PASSAGES]

## INSTRUCTIONS

1. Decompose the generated answer into individual factual claims.
2. For each claim, search the evidence passages for supporting or contradicting information.
3. Flag any claim that contradicts the evidence. A contradiction occurs when:
   - The answer states a fact that is the opposite of what the evidence says (polarity reversal).
   - The answer asserts a value, date, name, or quantity that differs from the evidence.
   - The answer draws a conclusion that the evidence explicitly rules out.
   - The answer implies a relationship or causation that the evidence denies.
4. Do NOT flag claims that are merely absent from the evidence. Only flag contradictions.
5. For each contradiction found, extract the exact span from the answer and the exact span from the evidence that conflict.

## OUTPUT SCHEMA

Return a JSON object with this structure:
{
  "contradictions_found": boolean,
  "contradictions": [
    {
      "answer_span": "exact text from the answer that contradicts evidence",
      "evidence_span": "exact text from the evidence that conflicts",
      "contradiction_type": "polarity_reversal | value_mismatch | ruled_out_conclusion | relationship_conflict",
      "severity": "critical | major | minor",
      "explanation": "one-sentence description of the contradiction"
    }
  ],
  "claims_without_contradiction": integer,
  "claims_checked": integer
}

## CONSTRAINTS

- Only report contradictions where the evidence directly conflicts with the answer.
- Do not hallucinate contradictions. If unsure, do not flag.
- If the evidence is insufficient to verify a claim, do not flag it as a contradiction.
- Preserve exact text spans. Do not paraphrase the answer_span or evidence_span fields.
- If no contradictions are found, return an empty contradictions array and set contradictions_found to false.

To adapt this template, replace [ANSWER_TEXT] with the full generated answer you need to verify and [EVIDENCE_PASSAGES] with the retrieved or provided source documents. Format evidence passages with clear identifiers (e.g., [Source 1] ..., [Source 2] ...) so the model can reference them precisely in evidence_span fields. If your application requires a different output schema—such as inline annotations instead of a JSON report—modify the OUTPUT SCHEMA section accordingly. For high-stakes domains like healthcare or legal review, add a [RISK_LEVEL] parameter that adjusts the severity thresholds and consider routing critical contradictions to human review before any automated action is taken.

Before deploying, validate that the model returns parseable JSON matching the schema. Run this prompt against a golden dataset of known contradiction and non-contradiction pairs to measure precision and recall. Common failure modes include the model flagging unsupported claims as contradictions (false positives) and missing subtle polarity reversals in long answers (false negatives). If false positives are high, strengthen the CONSTRAINTS section. If false negatives are high, add few-shot examples of subtle contradictions in an [EXAMPLES] section. Always log contradiction detection results alongside the original answer and evidence for auditability.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Evidence-Answer Contradiction Detection prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.

PlaceholderPurposeExampleValidation Notes

[ANSWER_TEXT]

The generated answer to audit for contradictions against source evidence

The patient's blood pressure was elevated, indicating a hypertensive crisis requiring immediate intervention.

Must be non-empty string. Check length > 0. If answer was generated by a prior model call, verify it completed without truncation.

[EVIDENCE_PASSAGES]

One or more source passages the answer should be grounded in

Passage 1: Vital signs showed BP 140/90. Passage 2: Patient reported mild headache. No acute distress noted.

Must be non-empty array or concatenated string with passage delimiters. Validate that each passage has a source identifier if citation tracing is required downstream.

[EVIDENCE_METADATA]

Optional source metadata for authority weighting and contradiction severity classification

{"source": "clinical_notes_2025-03-15", "authority": "attending_physician", "recency_days": 2}

If provided, must parse as valid JSON object. Null allowed. When present, authority and recency fields should be used to adjust contradiction severity in the output.

[CONTRADICTION_TYPES]

Taxonomy of contradiction categories the model should detect

["direct_contradiction", "polarity_reversal", "temporal_mismatch", "quantitative_discrepancy", "unsupported_intensification"]

Must be a valid JSON array of strings. Each type should have a clear definition in the system prompt. Empty array means detect all default types.

[SEVERITY_THRESHOLD]

Minimum severity level for including a contradiction in the output

medium

Must be one of: low, medium, high, critical. Validate against allowed enum. Use to filter noise in production; set to low for safety-critical audits.

[OUTPUT_SCHEMA]

Expected structure for the contradiction detection result

{"contradictions": [{"answer_span": "...", "evidence_excerpt": "...", "type": "...", "severity": "...", "explanation": "..."}], "contradiction_count": 0, "is_fully_grounded": true}

Must be a valid JSON Schema or example object. Validate that downstream parsers can consume this shape. Schema mismatch is the most common integration failure.

[MAX_CONTRADICTIONS]

Upper bound on returned contradictions to control output length and latency

10

Must be positive integer. Default to 20 if not specified. Set lower for real-time guardrails, higher for offline audits. Validate that the model does not silently truncate beyond this limit.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the contradiction detection prompt into a production validation pipeline with retries, structured parsing, and human escalation.

This prompt is designed as a safety gate, not a user-facing response generator. It should sit between answer generation and delivery in your inference pipeline. The model receives a generated answer and the source evidence used to produce it, then returns a structured contradiction report. The application layer must parse this report and decide whether to block, rewrite, or escalate the answer before it reaches the user. For safety-critical domains—clinical documentation, legal analysis, financial reporting—this gate should be mandatory and its decisions logged for audit.

Wire the prompt into a post-generation validation step with the following contract. Inputs: [ANSWER] (the full generated text), [EVIDENCE] (the source passages with identifiers), and [CONTRADICTION_THRESHOLD] (the minimum severity that triggers a block). Output: a JSON object containing a contradictions array, each entry with answer_span, evidence_excerpt, contradiction_type (direct, polarity_reversal, temporal_mismatch, subtle_inconsistency), and severity (critical, high, medium, low). Parse this output with a strict schema validator. If parsing fails, retry once with a repair prompt that includes the raw output and the expected schema. If the retry also fails, log the failure and escalate to human review. For model choice, use a capable instruction-following model (GPT-4, Claude 3.5 Sonnet, or equivalent) with low temperature (0.0–0.1) to maximize consistency. Do not use smaller or faster models for this task—contradiction detection requires careful comparative reasoning that weaker models perform poorly on.

Build decision logic around the parsed output. If any contradiction has severity critical or high, block the answer and either regenerate with corrected grounding or escalate. If only medium or low contradictions exist, flag the answer for review but optionally allow delivery with a confidence warning. Log every contradiction detection result—including negative results (no contradictions found)—for monitoring drift in your generation or retrieval quality over time. Common failure modes to watch for: the model flagging stylistic differences as contradictions (tune your prompt's definition of contradiction to exclude phrasing variations), missing contradictions when evidence is long (chunk evidence and run detection per chunk if context windows are tight), and producing unparseable JSON under pressure (add a repair step and monitor parse failure rates). For regulated use cases, retain the full prompt input, output, and decision trail as audit evidence. This prompt is a detection tool, not a correction tool—when contradictions are found, use a separate rewriting or regeneration step to fix the answer rather than asking this prompt to do both jobs at once.

IMPLEMENTATION TABLE

Expected Output Contract

The output contract defines the exact structure, types, and validation rules for the contradiction detection response. Use this table to build a parser, validator, or retry guard before integrating the prompt into a production pipeline.

Field or ElementType or FormatRequiredValidation Rule

contradictions

array of objects

Must be present; empty array allowed if no contradictions found

contradictions[].answer_span

string (exact text from answer)

Must be a verbatim substring of the provided answer; reject if span not found in answer

contradictions[].evidence_excerpt

string (exact text from evidence)

Must be a verbatim substring of the provided evidence passages; reject if excerpt not found in evidence

contradictions[].contradiction_type

enum: direct_negation | polarity_reversal | numerical_conflict | temporal_mismatch | entity_confusion | scope_error

Must match one of the defined enum values exactly; reject unknown types

contradictions[].severity

enum: critical | major | minor

Must be one of the three severity levels; critical indicates safety or factual reversal risk

contradictions[].explanation

string (1-3 sentences)

Must be non-empty; should explain why the answer span contradicts the evidence excerpt in plain language

contradictions[].confidence

number (0.0 to 1.0)

Must be a float between 0 and 1 inclusive; values below 0.7 should trigger human review for critical severity

no_contradiction_found

boolean

Must be true when contradictions array is empty; must be false when contradictions array contains entries; mismatch triggers validation failure

PRACTICAL GUARDRAILS

Common Failure Modes

Evidence-answer contradiction detection fails in predictable ways. These are the most common failure modes and the guardrails that catch them before they reach production.

01

Polarity Reversal Blindness

What to watch: The model confirms consistency when the answer directly negates the evidence (e.g., evidence says 'increased by 10%' but answer says 'decreased by 10%'). Negation and sentiment flips are the hardest contradictions for LLMs to detect. Guardrail: Add explicit polarity-check instructions in the prompt template. Require the model to extract numeric values and directional claims separately before comparing. Pair with a lightweight regex validator on extracted numbers.

02

Partial Match Overconfidence

What to watch: The model marks an answer as consistent when only part of the claim is supported. For example, evidence supports 'revenue grew' but the answer claims 'revenue grew 15%' and the 15% is fabricated. The model latches onto the supported portion and overlooks the unsupported detail. Guardrail: Decompose the answer into atomic claims before comparison. Require the prompt to check each claim independently and flag any claim without exact evidence support, even if other claims are grounded.

03

Implicit Contradiction Miss

What to watch: The model misses contradictions that require inference. Evidence states 'the system was deployed in Q3' but the answer says 'the system went live in September.' These are not direct contradictions but may be inconsistent if Q3 ended in August. The model treats them as compatible because the contradiction is implicit. Guardrail: Include temporal and logical consistency checks in the prompt. Ask the model to extract dates, sequences, and logical relationships from both evidence and answer, then compare the inferred timelines rather than just surface text.

04

Evidence Boundary Confusion

What to watch: The model treats information from its own pretraining knowledge as evidence, flagging contradictions that don't exist in the provided sources or missing contradictions because it 'knows' something the evidence doesn't state. This is especially dangerous when the provided evidence is incomplete or outdated. Guardrail: Add a strict instruction that only the provided evidence block is authoritative. Explicitly instruct the model to ignore external knowledge and flag any claim that cannot be verified within the provided evidence span, even if the claim is factually correct.

05

Synonym and Paraphrase Mismatch

What to watch: The model flags a contradiction when the answer paraphrases the evidence using different terminology. 'The patient exhibited tachycardia' vs 'The patient had an elevated heart rate' may be flagged as inconsistent when they are medically equivalent. This produces false-positive contradiction alerts that erode trust in the detection system. Guardrail: Include a semantic equivalence check before contradiction detection. Ask the model to first determine if the answer and evidence express the same meaning using different words, and only proceed to contradiction analysis if they are semantically distinct.

06

Multi-Source Aggregation Error

What to watch: The answer correctly synthesizes information from multiple evidence passages, but the contradiction detector compares against each passage individually and flags the combined claim as unsupported. For example, evidence A says 'budget was $2M' and evidence B says 'spend was $1.8M,' but the answer says 'the project came in $200K under budget.' The detector sees neither passage alone supports the $200K figure. Guardrail: Instruct the prompt to consider the full evidence set holistically before flagging contradictions. Require it to identify when an answer claim is a valid inference or calculation from multiple evidence sources rather than a direct quote from a single passage.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the output quality of the Evidence-Answer Contradiction Detection prompt before shipping. Each criterion targets a specific failure mode in contradiction detection.

CriterionPass StandardFailure SignalTest Method

Direct Contradiction Recall

All direct factual contradictions (polarity reversals, numerical mismatches) are identified with exact evidence spans.

A direct contradiction is missed in the output; the model reports 'no contradictions' when a clear reversal exists.

Run against a golden set of 20 answer-evidence pairs containing 5 known direct contradictions. Require 100% recall.

Subtle Inconsistency Detection

At least 90% of subtle inconsistencies (tense shifts, scope changes, qualifier omissions) are flagged.

The model only catches blatant contradictions and ignores nuanced mismatches like 'may' vs 'will' or 'some' vs 'all'.

Use a curated set of 15 pairs with subtle inconsistencies. Measure precision and recall against human annotations.

False Positive Rate

Fewer than 5% of aligned answer-evidence pairs are incorrectly flagged as contradictory.

The model over-flags stylistic differences or paraphrases as contradictions, generating noise.

Run against 50 aligned pairs known to be faithful. Count false positives. If rate exceeds 5%, adjust [CONTRADICTION_THRESHOLD].

Evidence Span Accuracy

Each flagged contradiction includes a direct quote from the evidence that is the exact source of the conflict.

The model cites a passage that does not actually contradict the answer or cites a hallucinated source.

Spot-check 30 flagged contradictions. Verify the cited evidence span directly supports the contradiction claim.

Output Schema Compliance

The output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed.

The output is missing required fields, contains malformed JSON, or uses incorrect types for contradiction spans.

Validate output with a JSON Schema validator. Reject if parsing fails or required fields are null when they should be populated.

Polarity Reversal Handling

Negations and antonym substitutions are correctly identified as contradictions with high confidence.

The model treats 'not recommended' and 'recommended' as equivalent or assigns low confidence to clear reversals.

Test with 10 pairs containing explicit polarity reversals. Require confidence scores above 0.9 for each detection.

Abstention on Insufficient Evidence

When evidence is too sparse or off-topic to assess contradiction, the model returns an appropriate abstention flag.

The model confidently reports 'no contradictions' when the evidence is irrelevant or too thin to make any determination.

Provide 10 answer-evidence pairs where the evidence is clearly insufficient. Verify the model abstains rather than guessing.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single evidence-answer pair and request a simple JSON output. Remove strict schema enforcement and accept free-text contradiction descriptions. Start with a frontier model (GPT-4o, Claude 3.5 Sonnet) for highest accuracy during experimentation.

code
System: You are a contradiction detector. Compare the answer against the evidence and identify any contradictions.

Evidence: [EVIDENCE]
Answer: [ANSWER]

Return JSON with "contradiction_found" (boolean) and "explanation" (string).

Watch for

  • Overly sensitive detection flagging stylistic differences as contradictions
  • Missing polarity reversals (e.g., "increased" vs "decreased")
  • Single-sentence evidence failing to capture full context
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.