Building RAG Systems That Handle Contradictory Sources Without Hallucinating


Hook


Imagine you're asking your AI assistant: "When was the company founded?" It retrieves documents that say both "1995" and "1998." What does it do?


Most RAG systems panic. They either:

  • Pick one randomly and confidently lie
  • Hallucinate a third date that sounds reasonable
  • Freeze up and give a useless answer

  • But here's the thing: contradictions aren't the problem. Ignoring them is.


    This is exactly what we're solving today. By the end of this post, you'll know how to build RAG systems that actually *use* conflicting sources as a feature, not a bug. Your AI won't hallucinate. It'll be honest.


    What You Will Learn


    In the next 15 minutes, you'll understand:


  • **Why contradictions happen** in RAG systems (spoiler: it's not the AI's fault)
  • **The core mistake** everyone makes when handling conflicts
  • **A step-by-step framework** to detect, evaluate, and present contradictions
  • **How to implement source confidence scoring** so your system knows what to trust
  • **Real code patterns** you can use right now
  • **Common pitfalls** that trip up most developers
  • **Why this matters** for reliability in production systems

  • Let's get into it.


    Simple Explanation (With an Analogy First)


    Imagine you're a journalist writing about a historical event. You interview five witnesses.


  • Two say the accident happened at 3 PM
  • Two say it was 4 PM
  • One says 2:30 PM

  • What does a good journalist do? They *document the disagreement*. They might write: "According to two eyewitnesses, the accident occurred at 3 PM, though two others reported 4 PM. One source suggested 2:30 PM."


    A bad journalist would either:

  • Pick one randomly and pretend it's fact
  • Make up a time that sounds like a compromise ("About 3:30 PM")
  • Just ignore the witnesses and guess

  • Your RAG system should be the good journalist.


    Instead of forcing agreement where there is none, your system should:

  • **Identify the conflict** clearly
  • **Evaluate each source's credibility** (Is this witness reliable? Is this document authoritative?)
  • **Present the conflict honestly** to the user
  • **Explain why the sources disagree** if you can figure it out
  • **Never hallucinate** a fake consensus

  • That's the entire philosophy. Everything else is just details.


    How It Works


    Let's break down a working system into pieces you can understand and build.


    Step 1: Detect Contradictions


    First, you need to know when sources actually disagree. This is harder than it sounds.


    "Founded in 1995" and "Founded in 1995 in San Francisco" aren't contradictions—they're compatible. But "Founded in 1995" and "Founded in 1998" are contradictory.


    You have two approaches:


    Semantic approach: Use an LLM to understand if two claims are actually contradictory. Ask it: "Do these two statements contradict each other?" This works well but costs tokens and latency.


    Structural approach: Look for claims about the same entity or attribute. If you extract "Company.founded_year = 1995" from document A and "Company.founded_year = 1998" from document B, you have a conflict. This is faster but requires structured extraction.


    Most production systems use both. Start with structural detection (fast) and escalate to semantic detection (accurate) when needed.


    Step 2: Score Source Credibility


    Not all sources are equal. A Wikipedia article about a company isn't as reliable as the company's official SEC filing.


    Create a credibility scoring system:



    Official source (company website, SEC filing): 0.95

    Major news outlet (Reuters, AP): 0.85

    Specialist publication: 0.75

    Wikipedia: 0.65

    Blog post: 0.40

    Forum discussion: 0.20

    Random internet comment: 0.05



    But also consider:

  • **Recency:** Is this source dated? Older sources about fast-moving topics matter less
  • **Consistency:** Does this source contradict itself? Does it contradict other high-credibility sources?
  • **Authority:** Is the author an expert? Does the organization have domain expertise?

  • You can weight these together:



    credibility_score = (

    source_type_score * 0.5 +

    (1 - age_decay) * 0.2 +

    consistency_score * 0.2 +

    authority_score * 0.1

    )



    Tune the weights for your use case.


    Step 3: Resolve Conflicts Intelligently


    When you have conflicting claims with credibility scores, you have options:


    Option A: Majority Vote

    If 3 sources say 1995 and 2 say 1998, go with 1995. But weight by credibility scores, not just count.



    weight_1995 = sum of credibility scores for sources saying 1995

    weight_1998 = sum of credibility scores for sources saying 1998


    if weight_1995 > weight_1998:

    answer = 1995 (with confidence)

    else:

    answer = 1998 (with confidence)



    Option B: Consensus with Doubt

    If credibility scores are close (within 10%), don't pick a winner. Instead, tell the user: "Multiple sources report different founding years. The most reliable sources suggest 1995, but some sources indicate 1998. We can't determine which is correct from available information."


    Option C: Find the Real Answer

    Sometimes the contradiction reveals a gap in your knowledge. Maybe one source is talking about when the company was founded, and another is talking about when it was incorporated. These could both be true. Ask the LLM: "Why might these sources disagree?" and see if it can find a real difference rather than a contradiction.


    Step 4: Present Results Transparently


    This is the critical part most systems skip.


    Instead of giving the user a confident answer when you're not sure, give them something like:



    Question: When was Company X founded?


    Most likely answer: 1995

    Confidence: 78%

    Based on: 3 sources (official company page, SEC filing, news archive)


    Alternative information: 2 sources mention 1998

    These sources are: (blog post from 1999, forum discussion)


    Why the disagreement?

    We cannot determine the reason from available sources.


    Recommendation:

    Verify with the company directly, as this appears to be a genuine discrepancy.



    This is honest. It gives the user what they asked for but also tells them exactly why they should or shouldn't trust it.


    Real World Example


    Let's walk through a concrete scenario: building a RAG system for a customer support tool that answers questions about product features.


    The Setup:

    A customer asks: "Does your product support API integration?"


    Your RAG system retrieves:

  • Document A (official docs, updated 2 months ago): "Yes, full REST API"
  • Document B (older blog post from 6 months ago): "No API support yet"
  • Document C (support article from 1 month ago): "Limited API support via webhooks"

  • A Bad System Would:

    Pick one randomly and say "No API support" with confidence. The customer gets wrong information.


    Your System Does:


  • **Detect conflicts:** Check if these are contradictory. They are—one says yes, one says no, one says partial.

  • **Score sources:**
  • - Official docs: 0.95 (authoritative, recent)

    - Blog post: 0.50 (old, less authoritative now)

    - Support article: 0.80 (recent, authoritative)


  • **Weighted analysis:**
  • - "Yes" gets 0.95 points

    - "No" gets 0.50 points

    - "Partial" gets 0.80 points

    - Winner: "Yes" (official docs)


  • **Explain the discrepancy:** The system notes that old sources say no, but recent sources confirm yes. This suggests the feature was added.

  • **Present to user:**

  • Yes, we support API integration via REST API.


    Details:

    - Full REST API available (official documentation)

    - Also supports webhooks for event-driven integration

    - Note: Older sources mention limited support. This was expanded 2 months ago.


    Confidence: 95% (based on official documentation)

    Last updated: 2 months ago



    The customer gets the right answer, context about why sources might differ, and confidence level. No hallucination. No guessing.


    Why It Matters in 2026


    Here's why this isn't theoretical:


    1. Real-World Data Is Messy

    Every organization has:

  • Multiple documentation sources (some outdated)
  • Conflicting internal records
  • Information that changed over time
  • Different interpretations of the same facts

  • Ignoring this doesn't make it go away. It makes your system unreliable.


    2. Legal and Compliance Risk

    If your AI gives wrong information with high confidence because it picked the wrong source, that's a liability. If it explains the contradiction and lets the user decide, you're much safer.


    3. User Trust

    Users don't trust systems that are confidently wrong. They *do* trust systems that say "here's what I found, here's where uncertainty exists, here's why I'm unsure."


    Confidence without certainty destroys trust. Uncertainty with explanation builds it.


    4. Business Intelligence

    Contradictions aren't noise—they're signal. When sources disagree, you've found something worth investigating. A good RAG system flags this for your team.


    Common Misconceptions


    Misconception 1: "Just Use a Better LLM"


    No. A bigger LLM is better at writing, not at detecting contradictions. If your source documents contradict each other, no amount of model size fixes that. You need better *architecture*, not better *weights*.


    Misconception 2: "Retrieve More Documents to Resolve Conflicts"


    Wrong direction. Retrieving more documents when you have conflicting ones just gives you more conflict. You need *better evaluation of the documents you have*, not more documents.


    Misconception 3: "Contradictions Mean Your RAG System Is Broken"


    No. Contradictions mean your *source data* contains different information. That's not a failure—that's reality. Your system should handle it gracefully.


    Misconception 4: "You Should Always Go With the Majority"


    Not if the majority sources are low-credibility. If 10 blog posts say "1998" but the official company website says "1995," trust the official source.


    Misconception 5: "Transparency Means Admitting Defeat"


    Complete opposite. Saying "we found conflicting information and here's what we learned" is strong. Confidently giving wrong information is weak.


    Key Takeaways


    1. Contradictions Are Normal

    Stop treating them as bugs. They're features. They tell you something interesting about your data.


    2. Build a Credibility System

    Not all sources are equal. Weight them by type, recency, consistency, and authority. Make it explicit and tunable.


    3. Detect Conflicts Early

    Use both structural extraction (fast) and semantic checking (accurate) to find real disagreements, not just surface-level differences.


    4. Score, Don't Pick

    Instead of choosing one source, score all of them and let the scores decide. This is objective and explainable.


    5. Show Your Work

    Tell users what you found, why it matters, and where uncertainty exists. This builds trust in a way that confident-but-wrong answers never will.


    6. Flag for Review

    When contradictions exist between high-credibility sources, flag this for human review. Sometimes that's how you discover real errors.


    7. Update Dynamically

    As new sources come in, reevaluate. Old contradictions might be resolved by newer, better information.


    What To Do Next


    This Week:

  • Pick one RAG system you own or work with
  • Manually test it with questions that have contradictory answers in your source docs
  • Notice what it does (confident wrong answer? Hallucination? Evasion?)
  • Document the failure mode

  • Next Week:

  • Implement basic source credibility scoring
  • Start with just source type (official vs. not)
  • Add recency scoring (newer = more credible, with decay)
  • Test it on your contradiction cases

  • This Month:

  • Add semantic contradiction detection
  • Build a confidence score that reflects uncertainty
  • Add explanation output that shows conflicting sources
  • Test with real users and iterate on what they trust

  • The Right Way Forward:

    You don't need to solve this perfectly. You just need to:

  • Detect when you're unsure
  • Tell the user you're unsure
  • Explain why you're unsure
  • Give them the best answer you can, qualified by your confidence

  • That's how you build RAG systems people actually trust.


    ---


    Questions to consider:

  • What contradictions do you actually have in your data?
  • Which sources do you trust most?
  • What would change if you showed users your uncertainty?

  • Start there. Build from there. Your users will thank you.