# mangalisathwika/hybrid-hallucination-detection-system architecture

> Architecture diagram of the GitHub repository mangalisathwika/hybrid-hallucination-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mangalisathwika/hybrid-hallucination-detection-system
- Repository: https://github.com/mangalisathwika/hybrid-hallucination-detection-system

## Overview

This is a post-hoc LLM factuality verification and correction tool. Reference material is parsed and chunked into semantic vectors stored in a searchable index; at query time, the system obtains an LLM answer and retrieves relevant evidence, then cross-evaluates the answer against that evidence. The UI presents the original response, high-risk spans, and an accuracy index. The tree contains no implementation excerpts, and README-mentioned app.py is absent, so paths are null; relationships below are documented in the README only.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Reference Ingestion"]
  node_source_text["Reference Text"]
  node_extraction["Context Extraction"]
  node_chunking["Semantic Chunking"]
  node_vector_store[("Vector Index")]
end

subgraph group_runtime["Query Verification"]
  node_interception["Query Interception"]
  node_llm["LLM Agent"]
  node_cross_eval["Hybrid Evaluation"]
end

subgraph group_presentation["Results Presentation"]
  node_ui["Streamlit UI"]
  node_accuracy["Accuracy Index"]
end

node_user(("User"))

node_source_text -->|"parses"| node_extraction
node_extraction -->|"breaks down"| node_chunking
node_chunking -->|"stores vectors"| node_vector_store
node_user -->|"queries"| node_interception
node_interception -->|"requests answer"| node_llm
node_interception -->|"queries evidence"| node_vector_store
node_llm -->|"supplies response"| node_cross_eval
node_vector_store -->|"supplies evidence"| node_cross_eval
node_cross_eval -->|"flags spans"| node_ui
node_ui -->|"presents index"| node_accuracy

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_source_text,node_extraction,node_chunking,node_vector_store,node_user toneBlue
class node_interception,node_llm,node_cross_eval toneAmber
class node_ui,node_accuracy toneMint
```

## Components

### Reference Ingestion

- **Reference Text**
- **Context Extraction**
- **Semantic Chunking**
- **Vector Index**

### Query Verification

- **Query Interception**
- **LLM Agent**
- **Hybrid Evaluation**

### Results Presentation

- **Streamlit UI**
- **Accuracy Index**

### Other components

- **User**

## Connections

- Reference Text → Context Extraction: parses (evidence: `README.md`)
- Context Extraction → Semantic Chunking: breaks down (evidence: `README.md`)
- Semantic Chunking → Vector Index: stores vectors (evidence: `README.md`)
- User → Query Interception: queries (evidence: `README.md`)
- Query Interception → LLM Agent: requests answer (evidence: `README.md`)
- Query Interception → Vector Index: queries evidence (evidence: `README.md`)
- LLM Agent → Hybrid Evaluation: supplies response (evidence: `README.md`)
- Vector Index → Hybrid Evaluation: supplies evidence (evidence: `README.md`)
- Hybrid Evaluation → Streamlit UI: flags spans (evidence: `README.md`)
- Streamlit UI → Accuracy Index: presents index (evidence: `README.md`)
