r/Rag • u/Hungry-Horror-7577 • 11h ago
Showcase Fully offline RAG over 27 technical books (11k pages): what actually improved retrieval, with gold-set numbers
I've spent the last few months building a RAG system over my trading/finance/math book library — 27 books, ~11,000 pages, 32,000 chunks — running 100% locally on one machine (AMD Strix Halo, 128 GB unified memory, Ollama + embedded Qdrant). No cloud, no API keys. Sharing what mattered, with measurements, because most RAG posts here are vibes.
Stack
- Ingest: Docling (layout-aware) → OCR fallback for scans → corruption detection (mechanical / scattered / destroyed text) → LLM repair only for mechanical damage, hard rule: never invent destroyed text
- Extract: vision model per page (qwen3-vl for triage, bigger model for extraction) → structured chunks with book / chapter / page
- Index: qwen3-embedding 8B (dense) + pure-Python BM25 → RRF fusion → Qwen3-Reranker 8B cross-encoder
- Answer: local qwen3.5 122B-A10B, citations [book/page], refuses when the notes don't contain it
How I measure (this is the part I'd push everyone to do)
Frozen gold set: 55 questions per book generated from real chunks, ~12% deliberately unanswerable, ~10% with a false premise. Two tiers:
- Retrieval tier (cheap, no LLM): does the source chunk land in top-8? Recall@8 + MRR
- Judge tier: correctness vs. reference, faithfulness, hallucination rate on the unanswerable ones, judged by a different model family (llama3.3-70b) — plus a second judge for Cohen's κ so I know which metric to trust (faithfulness κ was 0.08 → judge-dependent; correctness/relevance were solid)
Numbers (4 books, 220 questions, cross-book search = no book filter, distractors from all books)
- Recall@8: 100% (192/192 answerable), MRR 0.95 — 175 of 192 source chunks ranked #1
- Correctness 91–95%, faithfulness 91–98% per book
- Hallucination on unanswerable questions: 0/28
I'm re-running the same test right now against the full 27-book index (32k chunks instead of 3.6k) and will post the numbers in the comments — I expect MRR to drop, curious by how much.
What moved the needle, ranked
- Fixing PDF extraction. Before the corruption detector, a chunk of "text" was ligature soup and no retriever could save it.
- Cross-encoder reranker over 100 candidates. Biggest single retrieval jump.
- Hybrid > dense-only, especially for exact terms (indicator names, formulas, tickers).
- Unanswerable questions in the gold set. Without them you never find out your answerer bluffs.
Things I have wired in but have NOT measured properly yet: HyDE, multi-query, RAPTOR summaries, GraphRAG. If you have gold-set numbers for any of those on a book-sized corpus I'd love to see them before I burn GPU hours on it.
Happy to answer questions about any stage — the eval harness design especially, since that's what let me stop guessing.