Search portfolio

All projects

Generative AI / Completed

Hybrid RAG & Evaluation Engine

A document question-answering workbench that compares keyword and semantic retrieval, reranks results and traces answers to their sources.

  • Python
  • FastAPI
  • Qdrant
  • PyTorch
  • Ragas

System architecture

Parse supported files, create overlapping chunks and store text and source metadata in SQLite.

Benchmark results

88.6%Hybrid Recall@5
0.838Reranked nDCG@5
69.7 msHybrid P95 retrieval
Dataset and benchmark methodology

Problem and motivation

Keyword retrieval works well for exact identifiers and names. Semantic retrieval finds related passages even when they use different words. This workbench compares those approaches on the same corpus and makes the source of each answer inspectable.

Implementation decisions

The FastAPI service extracts text and tracks source metadata in SQLite. It uses BM25 for term matching and Qdrant for cosine similarity over MiniLM embeddings. Reciprocal rank fusion combines the rankings without making the two raw scoring scales comparable first. An optional cross-encoder scores the shortlist against the query. The dashboard shows retrieved passages, citations and benchmark reports.

Evaluation

The Ops handbook dataset covers eight fictional operational guides and 18 questions, including two without supporting evidence. The held-out SciFact subset covers 60 test queries and 500 abstracts. The reported retrieval figures above come from the SciFact subset with a warm, single-process workload.

Hybrid retrieval improved Recall@5 over BM25 alone on that run (88.6% versus 85.3%). Reranking raised nDCG@5 from 0.830 to 0.838 and increased P95 retrieval time from 69.7 ms to 1,864.2 ms.

Limitations and future improvements

Scanned documents require OCR before ingestion. The extractive baseline can abstain on paraphrased questions, and citation validation checks the presence of the quoted text. Future work includes OCR, harder negative sampling and labeled entailment checks.

Project screenshots