LLM Hallucination Beyond Fabrication: When Models Selectively Ignore Conflicting Context
This article examines a failure mode that is harder to catch than made-up facts: when a large language model sees two conflicting pieces of information in the context, silently picks one, and answers with high confidence. It breaks down three typical behaviors under conflicting input, explains the causes across training objectives, attention allocation, and alignment preferences, and presents a reproducible contradiction-injection test with sampling and logging discipline. It then covers practical mitigations across the prompt, structure, verification, workflow, and observability layers, helping developers turn consistency into a measurable quality baseline for AI coding tools.
1. The Problem: Not “I Don’t Know,” but “I Know and Won’t Say It”
In real-world AI-assisted development, a failure mode more troublesome than pure fabrication is showing up frequently: the context contains two conflicting pieces of information, the model sees both, adopts only one, and delivers a conclusion with very high confidence. It does not tell you that an ambiguity exists, does not ask for further confirmation, and packages an unverified inference as a definitive answer.
This is especially dangerous in the context of “wishful coding,” where developers describe intent in natural language and expect a tool to produce usable results in one shot. Once the model makes a one-sided choice on a key premise, the output is often grammatically perfect but semantically wrong, making review more expensive than writing the code by hand.
This article does not evaluate or recommend any specific product. Instead, it abstracts the phenomenon into a general engineering problem: the consistency defect of models under conflicting context, and discusses reproducible testing methods and practical mitigations.
2. Breaking Down the Behavior: Three Typical Responses to Conflicting Information
Once the original observation is abstracted, three typical model reactions to conflicting information emerge:
- Correct path: Detect the conflict, explicitly state that “two mutually exclusive premises exist,” and either ask for clarification or provide branch conclusions for both.
- Silent selection: Ignore one piece of information, continue reasoning from the other, and output a result with no risk warning.
- Mixed contamination: Stitch the two pieces of information into a third setting that does not exist, producing a more hidden error.
What engineering really needs to guard against is the second and third types. Their shared trait is the absence of uncertainty expression: the model’s confidence is decoupled from the sufficiency of its evidence.
3. Root Causes: Why Models “Selectively Ignore”
From general principles, there are at least three layers of causes:
- Training objective: Language models optimize for sequence likelihood, not factual consistency. When the context contains conflicts, the loss function does not explicitly penalize “taking a side.”
- Attention allocation: In long contexts, position, formatting, and wording all affect token weights. Constraints buried in the middle of a long paragraph, or presented as tables or notes, are naturally easy to dilute.
- Alignment preference: Instruction-tuned models tend to “give an answer” rather than “refuse or ask back,” because the latter is often scored low in human preference data. This directly incentivizes high-confidence silent selection.
Understanding these three points explains why the same prompt drifts across different times and sampling conditions: sampling randomness compounds with the tendencies above, making errors probabilistic rather than deterministic.
4. Reproducible Verification: The Contradiction Injection Test
Do not draw conclusions from “trying it twice.” Turn subjective impressions into a quantifiable experiment. The core idea is to build a minimal task containing an explicit contradiction, sample repeatedly, and measure the error rate.
Illustrative flow (pseudocode, vendor-agnostic):
# 1. Build a minimal context containing a contradictionprompt = build_prompt(facts_a="The pricing page shows: unit price is X",facts_b="The announcement shows: unit price is Y (conflicts with A)",question="Provide the unit price and explain your basis")# 2. Fix all variables except sampling, and repeat N roundsresults = [call_model(prompt, temperature=t) for _ in range(N)]# 3. Three-way classificationdef judge(r):if r.mentions_conflict: return "correct" # explicitly flags the conflictif r.answer in (X, Y): return "silent" # silent selectionreturn "polluted" # mixed contaminationstats = Counter(judge(r) for r in results)print(stats, "silent+polluted rate =", 1 - stats["correct"]/N)
Key experimental discipline:
- Sample size: 30 rounds can only reveal that “the problem exists,” and is not enough to support a proportion conclusion. For version comparisons, use no fewer than 100 rounds per configuration and report confidence intervals.
- Variable control: Fix temperature, maximum output length, system prompt, and context order; change only the object under test.
- Cross-entry sampling: The interactive web interface, batch API, and different access channels may run different service configurations. Sample each separately, and avoid representing the whole with a single entry point.
- Logging: Save the complete request and response logs for every run (for example, in a structured log file) to support post-hoc attribution instead of relying on memory.
5. Engineering Mitigations: Write “Don’t Lie to Me” into the Workflow
The probabilistic nature of models cannot be eliminated, but system design can push the risk into an acceptable range.
1. Prompt layer: Force uncertainty expression
Before answering, run a consistency check:- List all key constraints in the context;- If two or more mutually exclusive constraints exist, output a "conflict list" first, and do not give a single conclusion;- If a conclusion is required, label the premise you adopted and the premise you ignored.
2. Structure layer: Make key constraints hard to dilute
Put non-negotiable premises in system-level instructions and structured fields (such as a JSON constraints array), rather than burying them in long paragraphs or table notes; use dedicated fields for critical values instead of natural-language narration.
3. Verification layer: Independent review, not self-restatement
Use an independent checking step to judge the output. For example, require extracted results to include source evidence snippets and compare them programmatically:
def verify(answer, source_text):cited = extract_citations(answer)return all(c in source_text for c in cited) # fail if there is no source support
4. Workflow layer: Insert human confirmation before high-risk actions
For scenarios involving billing, permissions, data deletion, or production configuration changes, use a three-stage flow of “model draft + rule engine validation + human approval,” so that a single generation never directly triggers side effects.
5. Observability layer: Turn consistency metrics into a dashboard
Bring “conflict detection rate” and “unsupported assertion rate” into routine monitoring and alerting, segmented by version, channel, and prompt template dimensions, forming a continuously trackable quality baseline.
6. Conclusion
Whether “wishful coding” can hold depends on whether the model has an honest expression of its own uncertainty. Coding ability and cost-effectiveness are only the entry ticket; what really determines whether a task can be entrusted is consistency: when the information is right in front of it, is it willing to admit that a conflict exists. For developers, the practical path is not to wait for some version to “never make mistakes,” but to quantify defects with contradiction injection tests, compress risk with structured constraints and independent verification, and use monitoring to turn quality into a continuously trackable metric. Only then does an AI coding tool shift from “an assistant you must always watch” to “a collaborator you can hand tasks to.”
