RetrievIQ

Static preview · why no live demo?
Demo video
0:00 / 0:00

Answers with their sources still attached.

Static preview

Try it locally

This is a static preview with no live backend attached. Run the project on your machine to ask questions.

  1. Clone the repo

    git clone https://github.com/amritkn2244/retrieviq.git
  2. Create and activate a virtual environment

    Windows

    python -m venv venv && venv\Scripts\activate

    macOS/Linux

    python -m venv venv && source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Start the backend

    uvicorn retrieviq.api.main:app --app-dir src --reload
  5. Open frontend/index.html in your browser

Pipeline

How an answer is built

  1. 01

    Retrieve

    Dense embeddings and BM25 each return their own shortlist.

  2. 02

    Fuse and rerank

    Reciprocal Rank Fusion merges both lists, then a cross-encoder reorders the pool.

  3. 03

    Answer with markers

    The model writes from those chunks only and tags each claim with a numbered source.

  4. 04

    Verify

    A judge model checks each citation against its chunk, then the answer gets one confidence score.

Refusing is a valid answer. The threshold is 0.60 by default.

About the project

Built to show its work

RetrievIQ is a hybrid retrieval-augmented generation engine built from scratch, dense + BM25 sparse retrieval fused with RRF, optional cross-encoder reranking, grounded generation with inline citations, a second model that verifies every citation actually supports its claim, and a CI gate that blocks code changes if retrieval quality regresses.

What I Learned

“Ran without errors” is never the same claim as “works correctly”, this showed up repeatedly: a chunking strategy that completed silently while massively over-splitting its output, a generation script that returned empty answers with no exception, and a CI gate that had never actually been watched fail until it was deliberately broken.

Hybrid retrieval (dense + BM25 + RRF) beat reranking on this corpus, reranking isn’t a free win and needs to be measured, not assumed.

Independent evaluation metrics (faithfulness, correctness, relevance) catch different failure modes than one blended score ever could.

What It Is

Retrieve from two independent rankings, fuse them by rank rather than by score, answer only from those chunks, then check every citation against the chunk it points at before anyone reads the answer.

Nothing on this page is a benchmark result. Every number shown with an answer is measured at request time - retrieval scores, judge verdicts, confidence - and the eval numbers live in eval/results/ in the repository.

Problems Faced, and How They Were Solved

  1. 01

    The semantic chunker quietly over-split

    The semantic chunker produced almost 2x more chunks than fixed or recursive chunking (1580 vs ~870) because its similarity threshold was too strict, closing a chunk after nearly every sentence. Caught by printing avg/min/max chunk size per strategy instead of trusting chunk counts alone.

  2. 02

    Generation came back empty, with no exception

    Early generation calls came back empty. The model (a reasoning model) was spending its entire token budget on hidden reasoning tokens before it could write an answer. Fixed by raising max_tokens and giving the model room to think and answer.

  3. 03

    Back-to-back citation markers broke verification

    A citation-verification bug: when the model wrote a claim ending in multiple citation markers back to back (e.g. “...sentence. [1][2]”), the claim-splitting logic isolated “[1][2]” as its own empty “claim,” which the judge model then scored as unsupported, silently tanking confidence scores on otherwise correct answers. Fixed the sentence splitter to not break before a citation marker group, and added a regression test.

  4. 04

    The CI gate was never proven until it was broken

    The CI gate was never proven until it was deliberately broken: raised the recall threshold above the maximum possible value, pushed to a test branch, and watched GitHub Actions actually fail (red X), confirming the gate genuinely blocks bad changes rather than just looking correct on paper.

About

Who built it, and who guided it

Amrit Kumar Nayak

About Me

I'm an aspiring AI engineer focused on building LLM applications people can trust - answers grounded in real sources, with quality that's measured instead of assumed.

Portfolio
Dr. Rajesh Kumar Tripathy

About My Guide

Dr. Rajesh Kumar Tripathy

  • HOD (CSE), Government College of Engineering, Keonjhar
  • Previously, Associate Professor, BITS Pilani, Hyderabad
  • Know more about his work, books and research papers - click on the links