Skip to main content

AFLHR Lite

Adaptive Framework for LLM Hallucination Reduction — Lite Version

A two-layer verification pipeline that combines Retrieval-Augmented Generation (RAG) with Natural Language Inference (NLI) to detect hallucinations in LLM outputs. The core innovation is Confidence-Weighted CONLI (Cw-CONLI): the NLI verification threshold adapts dynamically based on retrieval confidence.

Quick Start

git clone https://github.com/shaunyogeshwaran/Shaun_FYP.git
cd Shaun_FYP
make install # installs pip + npm dependencies, creates .env
# Edit .env and add your GROQ_API_KEY (free at https://console.groq.com)
make start # starts backend (:8000) + frontend (:5173) + docs (:4000)

Open http://localhost:5173 to use the app.

Requirements

RequirementDetails
Python3.10+ with pip
Node.js18+ with npm
RAM24 GB recommended (ML models load into memory)
Disk~3 GB (models auto-download from HuggingFace on first run)
GPUOptional — CUDA auto-detected, falls back to CPU
Groq API keyOptional — offline mode works without it

Make Targets

make start      # starts backend (8000) + frontend (5173) + docs (4000)
make stop # stop all servers
make restart # bounce all servers
make status # check what's running
make install # install all dependencies
make smoke # smoke test (precompute 20 samples)

Frontend Pages

PageRouteDescription
Verify/Enter a claim, adjust thresholds, see the full pipeline and verdict
Explore/exploreBatch-run 7 pre-configured queries across domains
How It Works/aboutVisual walkthrough of the 4-stage pipeline

Troubleshooting

ProblemFix
make install fails on pipEnsure Python 3.10+ is on your PATH
Backend won't startCheck logs: tail /tmp/aflhr_backend.log
Frontend won't startCheck logs: tail /tmp/aflhr_frontend.log
Port in usemake stop first, or kill the process on that port
Models downloading slowlyFirst run downloads ~3 GB from HuggingFace
MPS/Apple GPU segfaultExpected — system auto-disables MPS and uses CPU