← Back to projects Shipped

RAG Compliance & Incident Intelligence Assistant

A question-answering system over UK health and safety guidance, where every answer carries citations back to the source section, and an answer that cannot be cited becomes a refusal. The differentiator is the evaluation harness: retrieval quality is measured as a CI quality gate, not assumed.

Why this project

I have spent the last three years working in security and compliance roles alongside my studies, and I have seen how much time goes into looking up what the regulations actually require. An LLM that paraphrases regulation from memory is dangerous in that setting; an answer is only useful if it cites the exact clause it came from. That constraint, groundedness over fluency, is what this project is built around.

What it does

Architecture

IngestionParagraph-aware chunking with section labels and stable chunk ids
IndexEmbeddings (SQLite + exact vector search; pgvector-shaped interface) plus BM25
RetrievalHybrid search fused with reciprocal rank fusion
GenerationGrounded answer with inline citations; OpenAI, Ollama or offline extractive mode
VerificationCitation markers checked against sources; cite or refuse
EvaluationGolden-set harness in CI: vector vs BM25 vs hybrid comparison table

The evaluation harness

Most RAG demos show a chat box. This one ships a comparison table: the same 16-question golden set run against vector-only, BM25-only and hybrid retrieval. Current results: hybrid hits the correct source on 100% of questions (MRR 0.938) and 100% of answers carry valid citations. It also produced a real finding: BM25 alone wins on this corpus because compliance questions reuse the regulations' exact vocabulary, which is precisely the kind of trade-off the harness exists to catch.

Skills demonstrated