Case study · Academic · 2025
Hybrid RAG Q&A
A question-answering system over a 500+ page corpus that fuses dense and keyword retrieval, evaluated across three open LLMs.
~25%better retrieval relevance after tuning
- Role
- Solo, academic project
- Status
- Live.
- Stack
- Python, FAISS, BM25, LLMs
The problem
Retrieval-augmented question answering depends on finding the right passages before the language model writes anything. Dense vector search finds passages that mean the same thing as the question, but it can miss exact terms such as names, codes and numbers. Keyword search has the opposite weakness.
What I built
A question-answering pipeline over a corpus of more than 500 pages, with chunking, embedding, retrieval, reranking and answer generation as separate stages.
Retrieval is hybrid. FAISS handles dense vector search and BM25 handles keyword search. Their two ranked lists are merged with reciprocal rank fusion, so a passage that either method ranks highly survives.
Measuring it
I built an evaluation framework that scores retrieval accuracy, faithfulness (does the answer stick to the retrieved text) and answer relevancy, and ran it across three open language models: Llama 3.2, Qwen 2.5 and Phi-2.
With that in place I tuned chunk size, the number of passages retrieved and the fusion weights. Retrieval relevance improved by about 25% over the starting configuration.

Try the system
DWG S-04 · Retrieval pipeline
Input
Retrieve
Fuse
Answer
Interactive · switch scenarios, hover a part, or break one