Hook
Imagine you're asking a friend for directions to a restaurant, and they confidently tell you it's on Main Street. Then another friend—equally confident—tells you it's on Oak Avenue. Your first friend doesn't acknowledge the disagreement. They don't say "Wait, I think I heard it was somewhere else." They just double down and act like they were right all along.
That's what most RAG systems do when they encounter contradictory source documents.
They pull conflicting information from your knowledge base, mash it together, and generate an answer that sounds authoritative while potentially being incomplete or misleading. The system doesn't hallucinate facts from thin air—it hallucinates *confidence* about which contradictory source is actually right.
This is a real problem. Healthcare systems cite conflicting guidelines. Legal systems have outdated regulations that contradict newer ones. Policy databases have regional variations. Corporate knowledge bases have information that's been superseded but never fully removed.
But here's the thing: your RAG system doesn't have to choose. It can be honest about contradictions. And we're going to walk through exactly how to build that.
What You Will Learn
By the end of this post, you'll understand:
This isn't theoretical. We're going to look at real code patterns, real problems, and real solutions you can implement this week.
Simple Explanation (Analogy First)
Think of a standard RAG system like a research intern who gets nervous around contradictions.
You ask the intern: "When did Company X go public?" They retrieve five documents. Three say 2015. Two say 2016. Instead of saying "I found conflicting info," they get nervous. They think *you* want a confident answer, so they pick the majority and hand it to you with full certainty: "2015."
Now imagine a better intern. Same five documents. Same conflict. But this intern says: "Three sources say 2015. Two sources say 2016. Here's who says what and why there might be a discrepancy—maybe one source is talking about IPO filing vs. trading start date."
That's the difference. The first intern hallucinates confidence. The second handles reality.
Building this better system means:
That's it. Not complicated. Just different.
How It Works
Layer 1: Contradiction Detection (Before the LLM)
This is where most people get it wrong. They throw all the retrieved documents at the LLM and hope it figures it out. Instead, you want to detect contradictions *before* you do generation.
Here's the pattern:
Step 1: Extract atomic claims from each document.
Don't just throw paragraphs at the system. Parse them into discrete claims. "Company X went public in 2015" is a different claim than "Company X filed for IPO in 2014." Your detection system needs to work at this granularity.
Step 2: Create a contradiction detection function.
This doesn't need to be complex. You can use embedding similarity to find semantically opposite claims, or a smaller LLM to do pairwise comparison. The goal: identify which documents contradict each other.
Something like:
For each pair of retrieved documents:
- Extract main claims
- Check if they assert opposite things about the same fact
- Flag as CONTRADICTORY if confidence > threshold
- Store which specific claims conflict
Step 3: Mark your retrieval results.
Don't just return `[doc1, doc2, doc3]`. Return something like:
[
{doc: doc1, claims: [...], conflicts_with: [doc2]},
{doc: doc2, claims: [...], conflicts_with: [doc1]},
{doc: doc3, claims: [...], conflicts_with: []}
]
Now your system *knows* there's a contradiction before the LLM ever sees it.
Layer 2: Routing (Conditional Paths)
Once you know there's a contradiction, you don't use the same pipeline as when everything agrees.
If no contradictions exist: Use your standard RAG pipeline. Retrieve, synthesize, generate. Normal behavior.
If contradictions exist: Switch to a conflict-aware pathway:
The key is: *different pathways for different situations*. Standard RAG for consensus. Conflict-aware RAG for contradictions.
Layer 3: Prompt Engineering for Conflicts
Your prompt needs to explicitly handle this case. Something like:
You are analyzing source documents to answer a question.
Some of these documents contain contradictory information.
Your job:
If sources disagree about a core fact:
This prompt is doing the opposite of the standard approach. It's *rewarding* honesty about contradictions instead of punishing it.
Layer 4: User-Facing Display
Finally, you need to actually show the user what's happening.
Instead of:
"Company X went public in 2015."
Show:
"Sources disagree about this:
Users actually prefer this. It's honest. It explains uncertainty instead of hiding it.
Real World Example
Let's walk through a concrete example: a healthcare RAG system answering questions about medication dosing.
The Scenario:
User asks: "What's the correct dose of Drug X for condition Y?"
Your retrieval system finds:
What a standard RAG does:
Picks one (usually the first), buries the others, generates: "The recommended dose is 10mg daily." Confident. Wrong. Dangerous.
What our improved system does:
Step 1 - Detection:
The system extracts claims:
It runs contradiction detection and finds: these are conflicting claims about the same fact.
Step 2 - Routing:
Because contradictions exist, it switches to conflict-aware mode.
Step 3 - Generation:
With the special prompt, the LLM generates:
Dosing recommendations vary by region and recent evidence:
OFFICIAL GUIDELINES:
RECENT EVIDENCE:
RECOMMENDATION:
Consult prescribing information for your region. FDA dosing (10mg) is more conservative; European dosing (15mg) may be appropriate depending on patient factors.
Step 4 - Display:
The system shows the user this conflict explicitly, with sources cited, so they can make an informed decision.
This is more helpful, more honest, and ironically more trustworthy than confidently picking one answer.
Why It Matters in 2026
Here's why this is becoming critical:
1. RAG systems are everywhere now.
Every company is deploying knowledge bases with LLMs on top. More systems means more conflicts waiting to be hallucinated away.
2. Regulations are starting to care.
In regulated industries (healthcare, finance, law), hallucinating confidence about conflicting sources is becoming a liability. Systems that admit uncertainty are actually safer.
3. Users are getting smarter.
People are starting to catch when AI systems BS them. Honesty about contradictions is becoming a competitive advantage, not a weakness.
4. Real-world knowledge is messy.
Federal vs. state laws. Old guidance vs. new. Different expert opinions. Contradictions aren't edge cases—they're normal. Your system needs to handle them.
Common Misconceptions
Misconception 1: "If we show conflicts, users will lose trust."
Opposite is true. Users lose trust when you confidently give them incomplete or wrong answers. Admitting "sources disagree" and explaining why is *more* trustworthy.
Misconception 2: "Detecting contradictions requires perfect semantic understanding."
No. You don't need to perfectly understand everything. You can be conservative: only flag clear, high-confidence contradictions. Ambiguous cases can go through normal RAG. Better to miss some than false alarm constantly.
Misconception 3: "This is too complex to implement."
It's genuinely not. You need: (a) a function that compares document claims, (b) a conditional in your pipeline, (c) a different prompt. That's most of it. You can build this in a weekend.
Misconception 4: "The LLM should figure out contradictions on its own."
It should, but it often won't—especially if contradictory sources are far apart in the context window, or if the conflict is subtle. Building it explicitly gives you control and reliability.
Misconception 5: "We need to resolve contradictions, not surface them."
Sometimes, sure. But most often, *you can't*. Different regions have different rules. Different experts have different opinions. Different time periods have different facts. The honest move is to surface the contradiction and let the human decide.
Key Takeaways
What To Do Next
This week:
Next month:
Start small. Pick one use case. Build it right. Then expand.
Your RAG system can be honest. It's not hard. It's just a different approach than the standard "pick a source and sound confident" pipeline.
Let me know what you find when you test this on your own systems.