Skip to content

[Bug] RAG System Doesn't Handle Out-of-Domain Queries - Hallucinated Results #97

Description

@anshul23102

Description

RAG system does not handle out-of-domain queries gracefully. Users receive irrelevant or hallucinated results when asking questions outside document scope. No confidence threshold or fallback mechanism.

Steps to Reproduce

  1. Document collection contains only HR policies
  2. User asks "What is quantum computing?"
  3. System attempts to answer from HR documents
  4. Results are nonsensical or hallucinated
  5. User receives incorrect information

Environment Information

  • RAG confidence: Not measured
  • Fallback mechanism: None
  • Threshold handling: Not implemented
  • Error handling: Insufficient

Expected Behavior

  • System detects out-of-domain queries
  • Returns "No relevant documents found"
  • Confidence threshold prevents low-quality results
  • Clear message when knowledge gap exists
  • User directed to appropriate resources

Actual Behavior

  • Attempts to answer anyway
  • Hallucinated or irrelevant results
  • No confidence checking
  • Misleading information

Code Reference

  • File: src/retrieval/confidence_checker.py
  • Missing: Confidence threshold checking
  • Missing: Out-of-domain detection
  • Missing: Fallback response handling

Additional Context

This is a Level 2 reliability issue. Fix requires:

  • Adding confidence threshold (e.g., 0.7)
  • Implementing out-of-domain detection
  • Clear error messaging
  • Fallback response handling

Suggested Labels

bug, reliability, hallucination-prevention, confidence-scoring, error-handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions