This prompt is designed for safety-critical evaluation pipelines where a model-generated output must be audited against a known-correct reference answer. Unlike general factual consistency checks, this prompt focuses specifically on direct contradictions: statements in the candidate output that assert the opposite of what the reference states. In domains like healthcare, legal review, and compliance, a contradiction is more dangerous than an omission. An incomplete answer can be escalated; a confidently wrong answer can cause harm. Use this prompt when your evaluation system needs to produce a structured contradiction report with severity levels, evidence spans, and actionable flags for human review.
Prompt
Contradiction Detection Against Known-Correct Answer Prompt Template

When to Use This Prompt
Understand the job-to-be-done, required context, and safety boundaries for the contradiction detection prompt.
The ideal user is an evaluation engineer or AI safety lead building automated regression gates, content verification pipelines, or model-output auditing systems. You need a known-correct reference answer—this prompt is not for open-ended generation where no ground truth exists. The reference must be authoritative and span the claims the candidate output attempts to make. Required context includes: the candidate output to evaluate, the reference answer, a severity taxonomy (e.g., critical, major, minor), and an output schema for the contradiction report. The prompt works best when contradictions are semantically clear rather than matters of interpretation; ambiguous cases should be flagged for human review rather than auto-classified.
Do not use this prompt when the reference answer is incomplete, when the candidate output covers topics outside the reference scope, or when you need to measure omissions rather than contradictions. This prompt will not detect missing information—it only flags statements that directly conflict with the reference. For coverage gaps, use a separate completeness evaluation prompt. Do not use this prompt as a standalone safety gate in regulated domains; always pair it with human review for critical-severity contradictions and maintain an audit trail of contradiction reports over time. If your evaluation needs include hallucination detection without a reference, use a groundedness evaluation prompt instead.
Before deploying, calibrate the severity taxonomy against your domain's risk tolerance. A contradiction about dosage in a clinical summary is critical; a contradiction about formatting preferences is minor. Run this prompt against a labeled dataset of known contradictions and non-contradictions to measure precision and recall before wiring it into a production pipeline. Expect false positives on statements that appear contradictory but are actually paraphrases or context-dependent clarifications—build a human review queue for medium-confidence flags.
Use Case Fit
Where this prompt works, where it fails, and what you must provide before using it in a production evaluation pipeline.
Strong Fit: Safety-Critical Regression Gates
Use when: A known-correct reference answer exists and contradiction is more dangerous than omission. Guardrail: Run this prompt as a blocking gate in CI/CD before any model upgrade or prompt change reaches production.
Strong Fit: Golden Dataset Benchmark Maintenance
Use when: You maintain a curated set of authoritative answers and need automated flagging of outputs that directly conflict with them. Guardrail: Pair with a semantic similarity prompt to catch paraphrased correct answers that this prompt might miss.
Poor Fit: Creative or Subjective Tasks
Avoid when: The reference answer is one of many valid responses, such as summarization style, tone, or open-ended analysis. Guardrail: Use a rubric-based judge instead. Reserve contradiction detection for factual, objective claims where deviation is a defect.
Required Input: Authoritative Reference Answer
Risk: Without a verified reference, the prompt has no ground truth to compare against and will produce meaningless or misleading contradiction flags. Guardrail: Require human review of every reference answer before it enters the golden dataset. Automate freshness checks when source documents change.
Required Input: Span-Level Evidence Mapping
Risk: The prompt may flag contradictions without citing exactly where in the model output and reference the conflict occurs, making results unactionable. Guardrail: Design the output schema to require evidence spans from both the model output and the reference for every flagged contradiction.
Operational Risk: False Positives on Implicit Knowledge
Risk: The model output may contain correct information not explicitly stated in the reference, triggering false contradiction flags. Guardrail: Add a severity tier distinguishing direct contradictions from statements absent in the reference. Route absence flags to human review, not automated rejection.
Copy-Ready Prompt Template
A reusable contradiction detection prompt with square-bracket placeholders that you can copy into your evaluation harness and adapt with production data.
This prompt template is designed to detect contradictions between a model-generated output and a known-correct reference answer. It is built for safety-critical domains—such as healthcare, legal review, finance, and compliance—where a confident contradiction is more dangerous than an omission. The prompt instructs the model to perform a claim-by-claim comparison, flag only direct conflicts (not differences in style or omission), assign severity levels, and provide evidence spans from both the output and the reference. Copy the template below into your evaluation harness, replace each square-bracket placeholder with production data, and run it as part of your regression or pre-release gate suite.
textYou are a contradiction detection evaluator. Your task is to compare a model-generated [OUTPUT] against a known-correct [REFERENCE_ANSWER] and identify statements in the output that directly conflict with the reference. ## INPUT [OUTPUT]: [OUTPUT_TEXT] [REFERENCE_ANSWER]: [REFERENCE_TEXT] ## CONSTRAINTS [CONSTRAINTS] - Only flag direct factual contradictions. Do not flag differences in wording, style, level of detail, or information present in the reference but absent from the output (omissions are not contradictions). - For each contradiction, provide an evidence span from both the output and the reference that demonstrates the conflict. - Assign a severity level to each contradiction: CRITICAL (safety, legal, or compliance impact), HIGH (material factual error), MEDIUM (misleading but not dangerous), LOW (minor inaccuracy). - If no contradictions are found, return an empty contradictions array and set has_contradictions to false. - Do not evaluate the quality of the output beyond contradiction detection. ## OUTPUT_SCHEMA Return a JSON object with the following structure: { "has_contradictions": boolean, "contradictions": [ { "severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW", "output_claim": "The contradictory statement from the output.", "output_span": "Exact text from [OUTPUT] that contains the contradiction.", "reference_claim": "The correct statement from the reference.", "reference_span": "Exact text from [REFERENCE_ANSWER] that contradicts the output.", "explanation": "Why these statements conflict." } ], "summary": "Brief summary of findings." } ## EXAMPLES [EXAMPLES] ## RISK_LEVEL [RISK_LEVEL] ## INSTRUCTIONS 1. Parse the [OUTPUT] and [REFERENCE_ANSWER] into individual claims. 2. For each claim in the output, check if it directly contradicts any claim in the reference. 3. For each contradiction found, extract the exact evidence spans and assign a severity level. 4. Return the results in the specified JSON schema.
Adapting the template: Replace [OUTPUT_TEXT] with the model-generated text under evaluation and [REFERENCE_TEXT] with the known-correct answer. Use [CONSTRAINTS] to add domain-specific rules—for example, in healthcare you might add 'Flag contradictions involving medication dosage, allergy status, or critical lab values as CRITICAL.' Use [EXAMPLES] to provide few-shot demonstrations of contradictions at each severity level, which significantly improves calibration. Set [RISK_LEVEL] to HIGH for regulated domains to trigger downstream human review of all CRITICAL and HIGH findings. For production pipelines, validate the output JSON against the schema before accepting results, and log any parse failures for retry or escalation.
What to do next: After copying the template, wire it into your evaluation harness with schema validation and retry logic. Run it against a golden dataset of known contradiction and non-contradiction pairs to calibrate severity thresholds. Monitor for false positives—the model may flag stylistic differences as contradictions if the instructions are too loose. If you observe over-flagging, tighten the constraints to emphasize that only factual conflicts count. For high-stakes domains, always route CRITICAL contradictions to human review before taking action on the findings.
Prompt Variables
Inputs the contradiction detection prompt needs to work reliably. Validate each before sending to the model. Missing or malformed inputs are the most common cause of false negatives and unhelpful severity ratings.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MODEL_OUTPUT] | The generated text to audit for contradictions against the reference | The patient's blood pressure was 140/90 and no medication was prescribed. | Must be non-empty string. Truncate if longer than model context window minus reference and instruction length. Null or whitespace-only input should abort before model call. |
[REFERENCE_ANSWER] | The known-correct or authoritative answer to compare against | Blood pressure reading: 138/88. Medication: Lisinopril 10mg prescribed. | Must be non-empty string. Validate source provenance before use. If reference is uncertain or contested, flag for human review rather than running contradiction detection. |
[DOMAIN] | The subject area or professional context for severity calibration | clinical_notes | Must match an allowed enum value. Use to adjust severity thresholds. Unknown domains should default to general with a warning logged. |
[SEVERITY_LEVELS] | The classification tiers for contradiction severity | critical, major, minor, negligible | Must be a non-empty list of ordered labels. Critical should represent contradictions that would cause harm if acted upon. Validate that at least one severity level is defined. |
[EVIDENCE_SPAN_REQUIRED] | Whether the output must quote the exact contradictory text spans | Boolean. When true, the model must return character offsets or quoted spans. When false, summaries are acceptable. Set to true for regulated domains. | |
[MAX_CONTRADICTIONS] | Upper bound on contradiction findings to prevent runaway reports | 10 | Integer greater than 0. Prevents the model from over-flagging. If the count exceeds this, truncate and add a warning that the report is incomplete. |
[OUTPUT_SCHEMA] | The expected JSON structure for the contradiction report | {"contradictions": [{"severity": "string", "claim": "string", "reference_evidence": "string", "output_span": "string"}]} | Must be a valid JSON Schema or example structure. Validate that the schema includes severity, claim, reference_evidence, and output_span fields at minimum. Parse and confirm before sending. |
Implementation Harness Notes
How to wire contradiction detection into an evaluation pipeline with validation, retries, and human review gates.
The contradiction detection prompt is not a standalone tool—it's a component that must be wired into a broader evaluation harness. The prompt expects a [MODEL_OUTPUT] and a [REFERENCE_ANSWER] and returns a structured contradiction report. In production, these inputs typically come from an upstream generation step and a golden dataset or knowledge base. The harness is responsible for supplying both inputs, parsing the JSON response, validating the schema, and routing the result to the appropriate downstream action: pass, retry, or escalate for human review.
Schema validation is the first gate. The prompt instructs the model to return JSON with a specific structure: a contradictions array containing objects with severity, claim_from_output, conflicting_reference, evidence_spans, and explanation fields. Before trusting the output, validate that the response parses as valid JSON and that all required fields are present. Use a lightweight validator—Pydantic in Python, Zod in TypeScript, or a JSON Schema assertion in your test runner—to catch malformed responses. If validation fails, retry once with an explicit error message appended to the prompt: Your previous response was not valid JSON or was missing required fields. Return ONLY the contradiction report in the exact schema specified. If the second attempt also fails, log the failure and escalate. Do not silently accept malformed contradiction reports in safety-critical domains.
Severity routing determines what happens next. The prompt defines three severity levels: direct_contradiction, partial_contradiction, and potential_conflict. Your harness should treat these differently. direct_contradiction findings should block deployment or trigger immediate review—the model output directly conflicts with a known-correct answer on a material fact. partial_contradiction findings may be acceptable depending on your tolerance; consider threshold-based gating where more than N partial contradictions triggers review. potential_conflict findings are informational and can be logged for trend analysis without blocking the pipeline. Implement this routing in application code, not in the prompt, so the logic is auditable and adjustable without changing the model's instructions.
Human review integration is mandatory for high-risk domains. If you're using this prompt in healthcare, legal, finance, or safety contexts, every direct_contradiction finding must be reviewed by a qualified human before any action is taken. The harness should queue flagged outputs with the full contradiction report, the original model output, and the reference answer. Present evidence spans side-by-side so reviewers can quickly verify whether the contradiction is real or a false positive. Track review outcomes to measure the judge's precision and calibrate severity thresholds over time.
Model choice matters for judge reliability. This prompt requires careful reading and precise span extraction. Use a model with strong instruction-following and JSON output capabilities—GPT-4o, Claude 3.5 Sonnet, or Gemini 2.0 Flash are reasonable defaults as of early 2025. Avoid using smaller or older models as judges for contradiction detection unless you've calibrated them against human judgments and confirmed acceptable false-positive and false-negative rates. If cost is a concern, consider using a stronger model for direct_contradiction detection and a lighter model for potential_conflict screening, with the stronger model as the final arbiter on escalated cases.
Log everything for observability and calibration. For every contradiction check, log: the prompt version, model version, input lengths, raw response, validation status, contradiction counts by severity, and the routing decision. This data is essential for detecting judge drift, calibrating severity thresholds, and debugging false positives. If you're running this prompt at scale, aggregate contradiction rates by source, topic, or model to identify systemic issues. A sudden spike in direct_contradiction findings may indicate a problem with the upstream generation model, not the judge.
What to avoid: Do not use this prompt as a real-time guardrail in user-facing chat without human review for direct_contradiction findings. Do not treat the contradiction report as ground truth—it is a model's judgment and can be wrong. Do not skip schema validation; malformed JSON from the judge is a common failure mode. Do not use this prompt to compare two model outputs without a known-correct reference; it is designed for reference-guided evaluation, not pairwise comparison. For pairwise comparison, use a dedicated preference prompt from the Pairwise Comparison and Preference Prompts content group.
Expected Output Contract
Defines the structure, types, and validation rules for the contradiction report. Use this contract to parse the model output, validate it before downstream consumption, and detect malformed or incomplete responses.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
contradiction_report | object | Top-level key must exist and be a valid JSON object. Reject if missing or not an object. | |
contradiction_report.contradictions | array | Must be a JSON array. If no contradictions found, use empty array []. Reject if null or missing. | |
contradiction_report.contradictions[].statement | string | Must be a non-empty string quoting the exact text from [MODEL_OUTPUT] that contradicts [REFERENCE_ANSWER]. Reject if empty or not a string. | |
contradiction_report.contradictions[].reference_evidence | string | Must be a non-empty string quoting the exact text from [REFERENCE_ANSWER] that is contradicted. Reject if empty or not a string. | |
contradiction_report.contradictions[].severity | string | Must be one of the allowed enum values: 'critical', 'major', 'minor'. Reject if value is not in the enum set. | |
contradiction_report.contradictions[].explanation | string | Must be a non-empty string explaining why the statement contradicts the reference. Reject if empty or not a string. | |
contradiction_report.no_contradictions_found | boolean | Must be true when contradictions array is empty, false otherwise. Reject if value does not match array state. | |
contradiction_report.analysis_confidence | number | If present, must be a float between 0.0 and 1.0 inclusive. Null allowed. Reject if outside range or wrong type. |
Common Failure Modes
Contradiction detection fails silently when the model agrees with a false statement, misses an implicit conflict, or cannot locate the exact evidence span. These failure modes break trust in safety-critical domains where contradiction is worse than omission.
False Negative: Missed Contradiction
What to watch: The model fails to flag a statement that directly conflicts with the reference answer. This often happens when the contradiction is implicit, requires multi-hop reasoning, or involves numeric values with different units. Guardrail: Decompose the reference answer into atomic claims before comparison. Require the model to extract and enumerate each claim from both the candidate and reference before declaring contradiction status.
False Positive: Spurious Contradiction
What to watch: The model flags a contradiction where none exists, often due to paraphrasing differences, synonym mismatches, or overly strict literal matching. This erodes trust and creates unnecessary review burden. Guardrail: Add explicit instruction distinguishing semantic equivalence from contradiction. Require the model to justify each flagged contradiction with direct quotes from both texts and explain why the meanings conflict rather than just the words.
Severity Inflation or Deflation
What to watch: The model assigns inconsistent severity levels—marking minor wording differences as critical or treating factual errors as cosmetic. This breaks downstream triage and review prioritization. Guardrail: Define severity levels with concrete examples in the prompt. Use a rubric like: Critical (safety, legal, numeric), Major (factual claim), Minor (wording, emphasis). Include few-shot examples for each tier.
Evidence Span Grounding Failure
What to watch: The model claims a contradiction exists but cannot point to the exact sentence or phrase in the reference that supports the claim. This makes verification impossible and hides hallucinated contradictions. Guardrail: Require the output schema to include mandatory reference_span and candidate_span fields with verbatim quotes. Add a post-processing check that rejects any contradiction without both spans present and extractable.
Omission Misclassified as Contradiction
What to watch: The model conflates missing information with conflicting information, flagging statements the reference simply doesn't address as contradictions. This is dangerous when the prompt treats contradiction as worse than omission. Guardrail: Add a triage step before contradiction detection that classifies each candidate statement as Addressed, Omitted, or Contradicted relative to the reference. Only run contradiction analysis on the Addressed subset.
Context Window Truncation Artifacts
What to watch: When the reference answer is long, the model may lose access to relevant sections near the middle or end of the context window, producing false negatives or hallucinated evidence spans. Guardrail: Chunk the reference answer into overlapping sections and run contradiction detection per chunk. Aggregate results with deduplication. Set a maximum reference length and escalate to human review when exceeded.
Evaluation Rubric
Use this rubric to test the contradiction detection prompt's output quality before shipping. Each criterion targets a specific failure mode in safety-critical domains where contradiction is worse than omission.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Contradiction Recall | All direct factual conflicts between [MODEL_OUTPUT] and [REFERENCE_ANSWER] are flagged with severity and evidence spans | A contradiction present in the output is missing from the report or marked as no_conflict | Run against 20 known-contradiction test pairs; require 100% recall on direct contradictions |
False Positive Rate | No statement is flagged as contradictory when it is a paraphrase, elaboration, or semantically equivalent to the reference | A semantically equivalent statement is flagged as contradiction with medium or high severity | Run against 20 known-correct paraphrase pairs; require zero false positives at medium+ severity |
Severity Classification Accuracy | Direct factual reversals are classified as high severity; partial mismatches as medium; minor wording differences as low or no_conflict | A direct factual reversal receives low severity or a minor wording difference receives high severity | Spot-check 10 severity-labeled examples against human expert labels; require 90% agreement on high vs low distinction |
Evidence Span Grounding | Each flagged contradiction includes exact text spans from both [MODEL_OUTPUT] and [REFERENCE_ANSWER] that conflict | A contradiction is flagged without source spans, or spans point to non-conflicting text | Parse output JSON; verify every contradiction object has non-empty output_span and reference_span fields that map to the source texts |
Omission Handling | Statements in [REFERENCE_ANSWER] absent from [MODEL_OUTPUT] are noted as omissions, not contradictions | An omission is incorrectly classified as a contradiction or assigned a severity level | Run against 10 pairs with deliberate omissions; verify omission_count field increments and no omission appears in contradictions array |
Output Schema Compliance | Response is valid JSON matching the contradiction_report schema with all required fields present and correctly typed | JSON parse fails, required fields are missing, or severity values are outside the allowed enum | Validate output against JSON Schema; reject on parse error, missing contradictions array, or invalid severity enum values |
Uncertainty Flagging | Ambiguous cases where contradiction status is unclear are marked with confidence below threshold and flagged for human review | An ambiguous case receives high confidence and no review flag, or a clear case is unnecessarily flagged | Run against 10 borderline examples; verify confidence scores correlate with ambiguity and human_review_recommended is true when confidence < 0.7 |
Multi-Statement Handling | Each independent contradictory statement is reported as a separate entry in the contradictions array, not merged into one | Multiple distinct contradictions are collapsed into a single entry with vague spans | Feed outputs with 3+ known contradictions; verify contradictions array length matches expected count and each entry has distinct spans |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a small set of 5–10 known-correct reference pairs. Use a frontier model (GPT-4o, Claude 3.5 Sonnet) with default temperature 0. Remove the severity classification and evidence-span requirements initially—just ask for a binary contradiction_found flag and a one-line explanation. Validate output shape manually before adding complexity.
Watch for
- The model marking stylistic differences as contradictions
- Missing the distinction between omission (not covered) and contradiction (directly opposed)
- Overly verbose explanations that bury the actual contradiction signal

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us