AskGraham
Hybrid RAG search and chat over 233 essays
Built a FastAPI and pgvector RAG backend combining vector, keyword, and title search with reciprocal rank fusion, a reranker, and a 40-case evaluation suite.
Impact
I built the 40-case evaluation harness that made ranking changes measurable — recall@k, MRR, nDCG, and citation accuracy are tracked at temperature zero, so every improvement is proven, not guessed.
What I owned
Solo project. I designed and built the full stack: a FastAPI RAG backend with hybrid pgvector, keyword, and title retrieval, a local ONNX reranker, paragraph-level citations, the Next.js UI, and the evaluation suite.
Context
I built AskGraham to test RAG retrieval quality properly. It indexes all 233 Paul Graham essays and answers questions with paragraph-level citations.
Problem
Vector search alone often misses exact keywords or essay titles. And without an evaluation set, you can't tell if changing chunk sizes or adding a reranker actually improves results.
What I built
Hybrid retrieval with RRF
I combined pgvector dense search, PostgreSQL full-text search, and title matching using weighted reciprocal rank fusion, followed by a local ONNX cross-encoder reranker.
Paragraph citations
I made streamed answers cite the exact paragraph ([slug#paragraph]) so the reader can verify every claim against the original text.
40-case evaluation suite
I track recall@k, MRR, nDCG, and citation accuracy across 40 test questions at temperature zero, with baseline results committed in the repo.

Decisions & tradeoffs
01
Local ONNX models for embeddings
I run embeddings and reranking locally with ONNX, which keeps hosting free and removes external API calls during search.
02
Cite paragraphs, not whole essays
I chose paragraph citations over whole-essay links — pointing to a full essay doesn't prove the answer is accurate, while paragraph citations make hallucinations obvious right away.
Results
- 233
- essays indexed
- 40
- eval test cases
- 3-way
- hybrid retrieval
- $0
- embedding cost
In hindsight
Writing good evaluation questions took longer than building the retrieval pipeline, but it saved time later whenever I tuned ranking weights.
Stack & links
Next case study
Amharic dictation on CPU, with phone-to-desktop pairing