Inferensys

Prompt

Conversation Contradiction Detection Prompt Template

A practical prompt playbook for QA engineers and evaluation teams to detect, map, and score self-contradictions in multi-turn chat logs using an LLM judge.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, the ideal user, and the operational boundaries for the Conversation Contradiction Detection Prompt.

This prompt is a batch audit tool for QA engineers and evaluation pipeline owners who need to detect self-contradiction in multi-turn chat logs. Its primary job is to produce a structured contradiction map that links conflicting statement pairs, identifies the turn indices where each statement occurred, labels the type of contradiction (e.g., factual, logical, policy), and assigns a severity score. Use it when single-turn evaluation passes each response in isolation but misses cross-turn inconsistencies that degrade user trust—such as an assistant giving contradictory instructions in turns 2 and 7, or reversing a stated policy without acknowledgment. The ideal user is someone responsible for offline quality gates, regression testing, or pre-release evaluation of conversational AI systems.

You should not use this prompt as a real-time guardrail in a production chat pipeline. It is designed for thorough, comparative analysis across a full session log, which makes it too slow and token-intensive for synchronous interception. It is also not a replacement for a general factual accuracy check; it specifically targets internal consistency within the assistant's own responses, not alignment with external ground truth. The prompt requires the full conversation transcript as input, along with a defined output schema and contradiction taxonomy. The output is a JSON object containing a list of contradiction pairs, each with turn_a, turn_b, statement_a, statement_b, contradiction_type, severity, and a brief explanation. This structured output is designed to be consumed by an automated evaluation pipeline, not read as a standalone narrative.

Before using this prompt, ensure you have a clear definition of what constitutes a contradiction in your product context. A legitimate topic shift or a clarification that refines a previous statement is not a contradiction. The prompt includes instructions to distinguish these cases, but you should calibrate it with your own labeled examples to control the false-positive rate. After running the audit, always review a sample of flagged contradictions to confirm they represent genuine user-facing problems. The next step is to integrate this prompt into your offline evaluation harness, where it can be run against golden datasets and used to gate releases when contradiction scores exceed a defined threshold.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Conversation Contradiction Detection prompt delivers reliable signal—and where it introduces noise, false positives, or operational risk.

01

Good Fit: Structured QA Audits

Use when: QA engineers systematically audit chat logs with clear turn boundaries and speaker labels. The prompt excels at producing contradiction maps with turn indices, type labels, and severity scores. Guardrail: Provide the full transcript with turn metadata; the model needs explicit turn numbering to produce accurate pair linking.

02

Bad Fit: Real-Time Streaming Chat

Avoid when: You need contradiction detection on incomplete, streaming conversations where later turns haven't arrived yet. The prompt assumes a complete session and will flag legitimate topic evolution as contradiction when context is partial. Guardrail: Buffer complete sessions before evaluation; use a separate real-time coherence check for in-progress conversations.

03

Required Inputs

What you must provide: Full conversation transcript with turn indices, speaker labels, and timestamps. Without turn numbering, the contradiction map can't link statement pairs reliably. Guardrail: Pre-process transcripts to add turn IDs before passing to the prompt; validate that turn count matches expected session length.

04

Operational Risk: False Positives on Topic Shifts

What to watch: The prompt can misclassify legitimate topic transitions or user corrections as contradictions. A user saying 'actually, I meant X not Y' is a correction, not a contradiction. Guardrail: Include explicit instructions distinguishing user self-corrections from assistant contradictions; add a contradiction type label for 'legitimate topic shift' to filter false positives in post-processing.

05

Operational Risk: Severity Score Inflation

What to watch: Minor phrasing inconsistencies can receive disproportionately high severity scores, creating alert fatigue for QA teams. Guardrail: Calibrate severity thresholds against human-reviewed samples; implement a minimum severity filter before surfacing contradictions to reviewers; track false positive rates per severity tier.

06

Not a Replacement for Factual Accuracy Checks

What to watch: This prompt detects self-contradiction within a conversation, not factual errors relative to external ground truth. An assistant can be perfectly consistent while being completely wrong. Guardrail: Pair this prompt with a groundedness evaluation prompt that checks claims against source documents; use contradiction detection as a consistency layer, not a truth layer.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for detecting contradictions across conversation turns, ready to paste into your evaluation harness.

This prompt template is designed to be dropped directly into your evaluation pipeline. It expects a full conversation transcript and a configuration block that defines your contradiction taxonomy and severity scale. Replace every square-bracket placeholder with your actual data before running the prompt. The template is self-contained: it includes the role definition, output schema, scoring rules, and an explicit request for structured JSON output that your application can parse and log.

text
You are a conversation quality auditor. Your task is to analyze the provided conversation transcript and identify every pair of statements made by the assistant that contradict each other across different turns.

[CONVERSATION_TRANSCRIPT]

[CONTRADICTION_TAXONOMY]

[SEVERITY_SCALE]

For each contradiction found, produce a JSON object with the following fields:
- contradiction_id: a unique string identifier for this contradiction pair (e.g., "C001")
- statement_a: the exact text of the first contradictory statement
- statement_a_turn: the turn index where statement_a appears
- statement_b: the exact text of the second contradictory statement
- statement_b_turn: the turn index where statement_b appears
- contradiction_type: one of the types defined in [CONTRADICTION_TAXONOMY]
- severity: one of the levels defined in [SEVERITY_SCALE]
- explanation: a one-sentence explanation of why these statements conflict

Return a single JSON object with a "contradictions" array containing all detected contradictions. If no contradictions are found, return an empty array.

[OUTPUT_SCHEMA]

Do not flag legitimate topic shifts, user corrections that the assistant acknowledges, or clarifications that resolve apparent conflicts. Only flag unresolved factual or logical contradictions.

To adapt this template, start by defining your [CONTRADICTION_TAXONOMY]. Common types include factual_inconsistency (two statements assert different facts), policy_reversal (the assistant changes a rule or constraint mid-conversation), logical_contradiction (one statement negates the logical consequence of another), and identity_mismatch (the assistant claims different capabilities or attributes). Your [SEVERITY_SCALE] should map to your team's risk tolerance—a typical scale is critical (the contradiction would cause user harm or system failure), major (the contradiction undermines trust or task completion), minor (the contradiction is noticeable but low-impact), and cosmetic (stylistic or phrasing inconsistency with no factual weight). The [OUTPUT_SCHEMA] placeholder should contain the full JSON Schema you expect, including required fields, types, and enum constraints. Wire this schema into your post-processing validator so malformed outputs are caught before they reach your dashboard. If you are evaluating conversations in a regulated domain, add a [RISK_LEVEL] field and route critical contradictions for human review before acting on the results.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Conversation Contradiction Detection Prompt Template. Each variable must be populated before the prompt is assembled and sent. Missing or malformed inputs are the most common cause of false negatives in contradiction detection.

PlaceholderPurposeExampleValidation Notes

[CONVERSATION_LOG]

Full multi-turn conversation transcript to audit for contradictions

User: I need a refund for order #1234. Assistant: Order #1234 was delivered on March 3rd. User: I never received it. Assistant: Your refund for order #1234 has been processed.

Must be valid JSON array of turn objects with role, content, and turn_index fields. Empty array fails validation. Single-turn conversations return null contradictions.

[TURN_SCHEMA]

Expected structure of each conversation turn object

{"role": "user|assistant|system", "content": "string", "turn_index": 0, "timestamp": "ISO8601"}

Schema must include role enum constraint. Missing turn_index field causes span-linking failures. Validate with JSON Schema before prompt assembly.

[CONTRADICTION_TYPES]

Taxonomy of contradiction categories the detector should label

["factual_contradiction", "policy_contradiction", "identity_contradiction", "temporal_contradiction", "logical_inconsistency"]

Must be non-empty array of strings. Unknown types in output indicate hallucination. Cross-reference output labels against this list in eval step.

[SEVERITY_SCALE]

Ordinal scale for ranking contradiction impact

{"levels": ["critical", "high", "medium", "low"], "definitions": {"critical": "Contradiction makes the assistant untrustworthy for this session", "high": "Contradiction changes a material fact or commitment", "medium": "Contradiction creates confusion but is resolvable", "low": "Minor phrasing inconsistency without factual impact"}}

Must be a valid JSON object with levels array and definitions map. Missing definitions cause inconsistent severity assignment. Validate scale completeness before use.

[OUTPUT_SCHEMA]

Target JSON schema for the contradiction map output

{"contradictions": [{"id": "string", "statement_a": {"turn_index": 0, "content": "string"}, "statement_b": {"turn_index": 0, "content": "string"}, "type": "string", "severity": "string", "explanation": "string"}], "session_id": "string", "total_contradictions": 0}

Schema must include required fields: id, statement_a, statement_b, type, severity, explanation. Parse output against this schema. Retry on schema validation failure.

[FALSE_POSITIVE_RULES]

Heuristics for distinguishing legitimate topic shifts from actual contradictions

["Topic change with explicit signaling is not a contradiction", "User correction that the assistant acknowledges is not a contradiction", "Conditional statements with different premises are not contradictions", "Time-bound statements where the time window has changed are not contradictions"]

Must be non-empty array. Vague rules produce high false positive rates. Test against a golden set of known topic-shift examples. Update rules when false positive rate exceeds 10%.

[SESSION_ID]

Unique identifier for the conversation being audited

"session_abc123_2025-03-15"

Required string. Used to correlate contradiction maps across batch runs. Null or missing session_id breaks downstream aggregation. Validate non-empty string before prompt assembly.

[CONTEXT_WINDOW_LIMIT]

Maximum number of turns to analyze in a single prompt call

50

Integer between 10 and 200. Exceeding model context window causes truncation and missed contradictions. For longer conversations, implement sliding window with overlap and deduplication of contradiction IDs.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the contradiction detection prompt into a reliable evaluation pipeline with validation, retries, and human review gates.

The contradiction detection prompt is designed to operate as a batch evaluation step within a QA pipeline, not as a real-time chat interceptor. The typical integration pattern involves pulling completed conversation logs from your data warehouse or logging system, formatting each session into the [CONVERSATION_LOG] placeholder, and submitting batches through an async evaluation job. Because the prompt produces structured JSON with turn indices, contradiction types, and severity scores, the output is immediately ingestible by downstream dashboards, alerting systems, or regression test suites. The primary integration surface is the contradiction map schema—every consuming system should validate against this schema before trusting the results.

Validation and retry logic must be layered around this prompt because LLM outputs can drift in structure or miss required fields. Implement a JSON schema validator that checks for the required top-level keys: contradictions (array), each containing turn_pair, statement_a, statement_b, contradiction_type, severity, and explanation. If validation fails, retry up to two times with the same input and an explicit format correction instruction appended to the prompt. If the third attempt still fails validation, log the raw output and flag the session for human review rather than silently dropping it. For severity scores, enforce that values fall within the expected range (1-5) and that contradiction_type matches the allowed enum values defined in your rubric. False positive mitigation is critical: implement a secondary lightweight check that compares flagged contradiction pairs against a list of known legitimate topic shifts or clarifications. If a flagged pair matches a known safe pattern, downgrade the severity or suppress the alert. This two-stage approach—structural validation followed by semantic false-positive filtering—catches most production failures before they reach a human reviewer.

Model choice and cost considerations matter here because contradiction detection across long conversations requires strong reasoning and large context windows. Use a model with at least 128K context and strong instruction-following capabilities. For high-volume QA pipelines processing thousands of sessions daily, consider routing low-risk sessions (short conversations, low-severity historical patterns) through a faster, cheaper model and reserving the full-capability model for sessions exceeding a turn-count threshold or flagged by upstream risk classifiers. Logging and observability should capture the prompt version, model identifier, input conversation ID, output contradiction count, validation status, retry count, and latency per session. This telemetry lets you track prompt drift over time and detect when model behavior changes introduce new false positive patterns. Human review integration is essential for high-severity contradictions (severity >= 4) and for any session where the contradiction map contains more than three flagged pairs. Route these to a review queue where QA engineers can confirm or reject each flagged contradiction, providing ground-truth labels that feed back into your evaluation calibration process.

What to avoid: Do not deploy this prompt as a real-time guardrail that blocks assistant responses mid-conversation. The latency and cost profile is wrong for synchronous use, and the false positive rate—while manageable in batch QA—would create unacceptable user friction if used to interrupt live chats. Do not skip the false-positive filtering step; legitimate topic shifts, user corrections that the assistant acknowledges, and clarifications of earlier ambiguous statements will otherwise generate noise that erodes trust in the pipeline. Finally, do not treat the contradiction map as the final word without human calibration. Run a monthly alignment check where you sample 50-100 flagged sessions, have human reviewers label them independently, and compare against the prompt's output to detect drift in contradiction sensitivity or type classification accuracy.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the exact fields, types, and validation rules for the contradiction map returned by the Conversation Contradiction Detection Prompt. Use this contract to parse, validate, and store the model response before surfacing results in a QA dashboard.

Field or ElementType or FormatRequiredValidation Rule

contradiction_map

Array of objects

Must be a non-null array. If no contradictions found, return an empty array [].

contradiction_map[].statement_a

String

Exact quote from the earlier turn. Must be a substring matchable in [TURN_A_INDEX] text. If not matchable, flag as hallucinated evidence.

contradiction_map[].statement_b

String

Exact quote from the later turn. Must be a substring matchable in [TURN_B_INDEX] text. If not matchable, flag as hallucinated evidence.

contradiction_map[].turn_a_index

Integer

Must be a valid turn index from the [CONVERSATION_LOG]. Must be strictly less than turn_b_index.

contradiction_map[].turn_b_index

Integer

Must be a valid turn index from the [CONVERSATION_LOG]. Must be strictly greater than turn_a_index.

contradiction_map[].contradiction_type

Enum string

Must be one of: 'direct_negation', 'factual_inconsistency', 'value_shift', 'identity_swap', 'temporal_conflict'. Reject any value outside this enum.

contradiction_map[].severity

Enum string

Must be one of: 'critical', 'major', 'minor'. 'critical' reserved for safety or factual contradictions that change outcomes. 'minor' for stylistic or preference shifts.

contradiction_map[].explanation

String

Must be 1-3 sentences explaining why the pair contradicts. Must reference specific semantic conflict, not just restate the quotes. Null or empty string is invalid.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when detecting contradictions across conversation turns and how to guard against it.

01

False Positives on Legitimate Topic Shifts

What to watch: The model flags statements as contradictory when the user or assistant legitimately changes topic, updates preferences, or provides new information that supersedes earlier turns. This inflates contradiction counts and erodes trust in the detector. Guardrail: Include explicit instructions distinguishing contradiction from topic change, preference update, or correction. Require the model to label the relationship type (contradiction vs. revision vs. topic-shift) and only flag true logical incompatibility.

02

Missed Implicit Contradictions

What to watch: The model catches explicit 'X then not-X' patterns but misses contradictions that require inference—such as claiming a feature exists in turn 2 but describing behavior in turn 5 that is impossible if the feature existed. Guardrail: Add few-shot examples demonstrating implicit contradiction detection. Include a reasoning step in the output schema that requires the model to explain the logical incompatibility before assigning a severity score.

03

Severity Score Inflation on Minor Inconsistencies

What to watch: The model assigns high severity to trivial wording differences or minor numerical rounding while missing critical factual contradictions. This creates noisy alerts that desensitize reviewers. Guardrail: Define a clear severity rubric with concrete anchors—e.g., 'Critical: contradicts a safety claim or binding commitment; Minor: wording variation without factual difference.' Include calibration examples at each severity level.

04

Context Window Truncation Dropping Early Turns

What to watch: Long conversations exceed the context window, causing early turns to be silently dropped. Contradictions between turn 2 and turn 20 become undetectable because turn 2 is no longer visible to the model. Guardrail: Implement sliding window or chunked comparison strategies. For sessions exceeding token limits, run pairwise comparisons across turn clusters and merge results. Log a 'context-truncated' flag when full-session analysis is impossible.

05

Assistant Self-Contradiction vs. User Correction Confusion

What to watch: The model conflates assistant self-contradiction (the assistant said X then later said not-X unprompted) with legitimate assistant responses to user corrections (the user corrected the assistant, and the assistant acknowledged the correction). Guardrail: Require the output schema to distinguish contradiction source: 'assistant-self', 'assistant-vs-user', 'user-self'. Apply different severity thresholds per source type. Assistant self-contradiction is typically higher severity.

06

Contradiction Propagation Across Linked Claims

What to watch: A single contradiction in turn 3 spawns multiple downstream contradictions in turns 4-7 because later responses build on the incorrect claim. The detector reports six contradictions when only one root cause exists, overwhelming reviewers. Guardrail: Add a contradiction grouping step that clusters related contradictions sharing a root cause. Output a 'root contradiction' flag and link dependent contradictions. Report both raw count and grouped count in the summary.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing output quality of the Conversation Contradiction Detection Prompt before production deployment. Use these standards to calibrate the detector, measure false positive rates, and ensure the contradiction map is actionable for QA engineers.

CriterionPass StandardFailure SignalTest Method

Contradiction Recall

All 5 seeded contradictions in a 10-turn test log are detected with turn-index pairs

Fewer than 5 seeded contradictions found; missed contradictions in turns with explicit factual reversals

Run prompt against a golden dataset of 10 annotated chat logs with known contradictions and count true positives

False Positive Rate on Topic Shifts

Zero false positives on 3 legitimate topic shifts where context naturally changes

Any flag raised on a turn where the user explicitly introduced a new topic or corrected themselves

Inject 3 conversation logs with deliberate topic shifts and no factual contradictions; verify no flags

Severity Score Calibration

Severity scores for seeded contradictions are within 1 point of human-assigned scores on a 1-5 scale

Severity score deviates by 2 or more points from the reference; minor phrasing changes scored as critical

Compare model-assigned severity scores against 3 human raters' scores on 20 contradiction pairs; compute MAE

Contradiction Type Accuracy

At least 90% of detected contradictions are assigned the correct type label from the defined taxonomy

Type label mismatch in more than 1 out of 10 detections; factual contradiction labeled as a logical inconsistency

Classify 30 known contradiction pairs with pre-labeled types; measure exact-match accuracy against ground truth

Output Schema Validity

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

Missing contradiction_list array; turn_index fields are strings instead of integers; severity_score is null

Validate output against the JSON schema using a programmatic validator; reject on any schema violation

Hallucinated Contradictions

Zero contradictions detected that link statements from different speakers or non-contradictory statements

Flag raised pairing a user statement with an assistant statement as contradictory; fabricated statement text

Audit 20 outputs manually; check each detected pair against the original transcript to confirm both statements exist and conflict

Edge Case: Single-Turn Conversations

Returns empty contradiction_list for a single-turn conversation with no prior context to contradict

Returns a non-empty list or errors out when [CONVERSATION_HISTORY] contains only one turn

Submit 5 single-turn transcripts; verify output is valid JSON with an empty contradiction_list array

Latency and Token Efficiency

Processes a 20-turn conversation in under 15 seconds and uses fewer than 2000 output tokens

Exceeds 30 seconds or 4000 output tokens for a standard-length chat log; verbose justifications for every pair

Benchmark 10 runs on a 20-turn sample; measure end-to-end latency and token usage; flag if thresholds exceeded

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the severity scoring schema and contradiction type taxonomy. Ask for a simple bullet list of conflicting statement pairs with turn indices.

code
Analyze this conversation log and list any pairs of statements where the assistant contradicts itself across turns. For each pair, output the turn numbers and the conflicting statements.

[CONVERSATION_LOG]

Watch for

  • False positives on legitimate topic shifts or clarifications
  • Missing turn indices when contradictions span more than two turns
  • The model flagging user contradictions instead of assistant self-contradictions
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.