How to Evaluate an LLM's Contradiction Detection: Why Wishful Prompting Is Unreliable
This article explains why large language models often ignore explicit contradictions in context and confidently give wrong answers, presents a multi-sampling test methodology for measuring this failure mode, analyzes the technical root causes, and offers engineering practices—explicit verification steps, citation-grounded outputs, consistency voting, and refusal-aware evaluation—to build reliable AI-assisted development workflows.
1. A Real-World Scenario
When using large language models for coding assistance, many developers have had this experience: you hand the model a set of materials that contain an obvious information conflict—for example, a pricing page states one rule while an announcement states another. A trustworthy assistant should at least point out the contradiction, or explicitly say “there isn’t enough information to decide.” Instead, the model casually picks one side and gives you an answer with complete confidence, in a tone so assured that you never realize it skipped the critical information.
This is the flip side of so-called “wishful programming”: you assume that stating your wish makes it instantly come true, but in reality the model may not have fully read your original request at all.
I recently ran a small-scale but worth-sharing test focused on one core question: When there is an obvious contradiction in the context, will the model ignore it and directly give an unverified answer?
2. Test Design: Never Test Only Once
Many developers evaluate a model by casually asking a single question and seeing how well it answers. This single-sample evaluation approach is exactly how “sometimes good, sometimes bad” models trap you.
My testing methodology:
- Fixed input: Prepare a source document containing an explicit contradiction (for example, a pricing page that conflicts with an announcement). The task itself requires no difficult reasoning—the conflict can be found simply by carefully cross-referencing the materials.
- Multiple sampling rounds: For each model under test, run at least 30 rounds with identical environment and parameters.
- Quantified statistics: Record the rate of “ignoring the contradiction and giving a confidently wrong answer,” rather than simply counting right versus wrong.
- Cross-validation: Test through both official channels and third-party hosting channels (given consistent model fingerprints) to rule out deployment-side differences.
- Evidence retention: Save the complete JSONL logs of every round so each output can be reviewed afterward, distinguishing “misunderstanding” from “selective ignoring.”
Why multiple rounds? Because single-run performance is highly random. In the morning, 30 rounds produced only one error—seemingly decent. In the evening, a casual two-round test produced two errors. Checking the logs revealed the same flaw: selective ignoring of the contradiction. This shows the problem is not “I don’t know how to prompt,” but rather that the model’s output is significantly unstable: with the same input, accuracy fluctuates wildly across time windows and samples.
The results themselves were interesting: one model maintained a 0% error rate across 30 rounds; another showed roughly a 60% error rate even at a higher reasoning setting; while the “sometimes good, sometimes bad” model distributed correct and incorrect answers almost randomly.
3. Why “Ignoring Contradictions” Is a Fatal Flaw
Weak capability alone is acceptable—if you know a model is weak, you will manually double-check it. What truly destroys developer trust is the unpredictable failure mode:
- The errors are confident. The model doesn’t say “I’m not sure.” It wraps an unverified conclusion in fluent, well-structured prose.
- The failures are intermittent. If the same task succeeds seven times out of ten and fails three, you cannot form a stable “trust budget.” Either you fully review everything every time (zeroing out the AI’s efficiency gains), or you occasionally skip review (and those three failures explode in production).
- What gets ignored is critical information. Once the model “hallucinates” details about pricing, billing rules, or API constraints, downstream code inherits and amplifies the error.
From a technical perspective, these problems usually stem from several sources:
- Training objectives favor “giving an answer.” A preference for “helpful” output suppresses behaviors that should refuse or question.
- Attention decay in long contexts. The longer the material, the more easily conflicting information in the middle gets diluted.
- Sampling randomness amplifies edge behavior. When the probabilities of “pointing out the contradiction” and “directly answering” are close, output becomes inconsistent—sometimes right, sometimes wrong.
4. Engineering Countermeasures: How Not to Get Stabbed in the Back
Rather than hoping a model upgrade will fully solve the problem, build defenses at the engineering level:
4.1 Make contradiction detection an explicit first step
Don’t let the model jump straight to a conclusion. Insert a verification step first, for example by requiring in the prompt:
Step 1: List every source passage in the materials related to "pricing/billing rules."Step 2: Determine whether these sources conflict with each other.Step 3: If a conflict exists, output [INFORMATION CONFLICT] and stop; if not, proceed to the conclusion.
Forcing the model to “cite first, reason second” significantly reduces the probability that it skips key information and answers directly.
4.2 Use structured output to constrain confidence
Require the model to attach citation IDs referencing the original text to its final answer. Any conclusion that cannot be backed by a citation should be treated as untrustworthy.
4.3 Don’t rely on a single sample for critical decisions
For high-risk information such as billing, permissions, and amounts, use multi-sample consistency voting: if N runs produce inconsistent results, treat the output as untrusted and escalate to human review. The cost is slightly higher, but far lower than the price of a wrong decision.
4.4 Include “refusal to answer” in evaluation metrics
In your internal evaluation system, don’t just track “accuracy”—also track the “refusal rate when refusal is warranted” and the “false refusal rate when it isn’t.” A model that dares to say “the materials contradict each other; I cannot determine this” is far more valuable in real production than one that is “smart but occasionally confidently wrong.”
5. Final Thoughts: Capable, Yet Unusable
To be fair, models of this kind are not weak at coding, their cost-performance is competitive, and they can be genuinely impressive when they are at their best. The problem is: being smart and being reliable are two different things. Instead of feeling that AI is doing the work for you, you feel you are teaching it to work while constantly guarding against a knife in the back—and that experience makes any team afraid to let go in exactly the scenarios that need automation most.
What we should expect from a model release is not just “a higher ceiling of intelligence,” but “a more stable floor of foolishness.” If official releases, together with the evaluation community, could incorporate “contradiction detection,” “instruction conflict handling,” and “output stability (multi-sample variance)” into public benchmark metrics and continuously optimize against these weaknesses, developers might finally be able to hand over tasks with confidence.
Until then, remember one plain engineering principle: Every critical conclusion a model delivers with confidence must be independently verified by humans or code outside the model. Wish away—but check every item on the wish list.
