This project presents a Context-Aware Hallucination Detection System designed to identify factual inconsistencies in LLM-generated text.
Unlike generic approaches, this system uses a news-domain knowledge base built from the CNN/DailyMail dataset, making it more robust for real-world scenarios.
The system combines:
Large Language Models (LLMs) often generate fluent but factually incorrect (hallucinated) content. This project aims to:
Detect whether a given text contains hallucinated claims by verifying it against trusted knowledge sources.
LLM Output
β
Claim Extraction
β
Evidence Retrieval (FAISS + Sentence Transformers)
β
NLI Verification (Transformer Model)
β
Hallucination Classification
Primary Dataset:
The dataset is used to:
hallucination_detector/
β
βββ training/
β βββ build_kb_and_index.py
β
βββ inference/
β βββ verifier_pipeline.py
β βββ app.py
β
βββ saved/
β βββ faiss.index
β βββ documents.pkl
β
βββ templates/
β βββ index.html
β
βββ requirements.txt
βββ README.md
git clone https://github.com/yourusername/hallucination-detector-news.git
cd hallucination-detector-news
pip install -r requirements.txt
python training/build_kb_and_index.py
This will:
/saved/cd inference
python app.py
Open in browser:
http://127.0.0.1:5000
Enter any text (e.g., LLM output)
System detects:
(Add screenshots here)
Example:
"The Eiffel Tower is in Berlin"
β HALLUCINATED β
Harsh Shaha
Feel free to fork, improve, and submit pull requests!
This project is for academic and research purposes.
This project presents a Context-Aware Hallucination Detection System designed to identify factual inconsistencies in LLM-generated text.
Unlike generic approaches, this system uses a news-domain knowledge base built from the CNN/DailyMail dataset, making it more robust for real-world scenarios.
The system combines:
Large Language Models (LLMs) often generate fluent but factually incorrect (hallucinated) content. This project aims to:
Detect whether a given text contains hallucinated claims by verifying it against trusted knowledge sources.
LLM Output
β
Claim Extraction
β
Evidence Retrieval (FAISS + Sentence Transformers)
β
NLI Verification (Transformer Model)
β
Hallucination Classification
Primary Dataset:
The dataset is used to:
hallucination_detector/
β
βββ training/
β βββ build_kb_and_index.py
β
βββ inference/
β βββ verifier_pipeline.py
β βββ app.py
β
βββ saved/
β βββ faiss.index
β βββ documents.pkl
β
βββ templates/
β βββ index.html
β
βββ requirements.txt
βββ README.md
git clone https://github.com/yourusername/hallucination-detector-news.git
cd hallucination-detector-news
pip install -r requirements.txt
python training/build_kb_and_index.py
This will:
/saved/cd inference
python app.py
Open in browser:
http://127.0.0.1:5000
Enter any text (e.g., LLM output)
System detects:
(Add screenshots here)
Example:
"The Eiffel Tower is in Berlin"
β HALLUCINATED β
Harsh Shaha
Feel free to fork, improve, and submit pull requests!
This project is for academic and research purposes.