VFlash: Fast, Accurate Visual Planning via Flash Primitive Decoding
u_Unrolled
Build Atlas

Part 7 of 9 · project Unrolled Pro

Ground it in your documents

Chunk the lessons by structure, search them with BM25 and dense vectors, fuse the rankings, and measure retrieval apart from answers.

5 steps · about 10 min atlas/rag.py scripts/part7_rag.py

Before you start

This page builds the code. The ideas behind it are taught in the Library lessons listed at the end; read them first if a step uses something you haven't met. Inspect and copy the complete code in the Atlas Codebase Browser and run each step as you read.

Part 5 showed that a small model can't remember the lessons. Part 6 showed that the same answerer goes from 0% to its best only when it's handed the right text. This part does the handing automatically: retrieval-augmented generation. Atlas cuts the lessons into chunks, searches them two different ways, fuses the results, and passes the top chunks into Part 6's prompt with citations. Then it measures the search and the answers separately, which turns out to be the most important decision in the part.

lessons are chunked by heading; a question is scored by BM25 and by LSA vectors; reciprocal rank fusion merges the two rankings; the top three chunks go into the prompt; retrieval is scored with recall@5 and MRR, answers with the Part 6 harness.
Diagram— lessons are chunked by heading; a question is scored by BM25 and by LSA vectors; reciprocal rank fusion merges the two rankings; the top three chunks go into the prompt; retrieval is scored with recall@5 and MRR, answers with the Part 6 harness.

Step 1 · Chunk by structure

Fixed-size windows cut sentences in half and lose context. Atlas chunks along the lessons' own structure: one chunk per section, long sections split at paragraph boundaries around 180 words, and every chunk keeps its heading path. The heading is indexed together with the text, so a paragraph that never says "asyncio" can still be found under Async and concurrency > 1. The event loop.

Skipping the "Check yourself" sections matters: the evaluation questions come from there, and retrieving them would make the scores meaningless.

That's the preview. Build Atlas Parts 1 and 2 are free; the full walkthrough of Part 7 is part of Unrolled Pro.
Staff AI & Pro Tier Lesson

Unlock "Build Atlas, Part 7: Ground it in your documents"

The foundations are free forever. Unrolled Pro unlocks the complete lesson, production architectures, and 55 battle-tested ML system design case studies.

Everything included with Pro:
All 234+ Deep-Dive Lessons across transformer internals, inference, RAG & agents
55 Staff-Level ML & System Design Case Studies with mathematical capacity estimates
AI Engineer Sheet & Exercises with worked solutions, self-checks, and code
100 Landmark Research Papers guided walkthroughs & progress tracking
14-Day Money-Back Guarantee — 100% full refund if you aren't satisfied
View Plans & Unlock All Lessons

From ₹167/mo (~$2/mo) · Cancel anytime · Instant activation

100% Risk-Free: 14-day no-questions-asked money-back guarantee

Go deeper in the Library

The lessons that teach the ideas this part uses, in the order to read them.