RAG Formation · Reference
Chunking and document structure
A standalone cheat sheet for learning and testing RAG quality on this site.
$ reference --status
▸ course RAG Formation
▸ mode standalone reference
▸ status Complete
● learn → test → verifyReference sheet
Chunking and document structure
The guided RAG Formation course content is complete; this reference is available for self-directed practice.
One-line rule
Change one window setting, measure whether the fact and source identity stay together, then test the hypothesis with a separate live retrieval evaluation.
Glossary
| Term | Meaning |
|---|---|
| Source window | A repeatable, bounded slice of synthetic Markdown used in the offline lab. |
| Chunk size | The maximum number of characters allowed in one source window. |
| Chunk-size profile | Not one universal setting — Qdrant/Meilisearch index at ~500 tokens, LightRAG deliberately uses ~1200 for better entity extraction. --profile chunk/graph approximate the two in characters. |
| Overlap | Characters copied from the end of one window into the next. |
| Co-location | The expected reference and every required fact term appear in the same window. |
| Proxy metric | A directional signal—not a live retrieval or answer-quality result. The graph profile's rate looks better almost by construction, since a big enough window trivially fits the whole document. |
Controlled experiment card
| Step | Do | Don't claim |
|---|---|---|
| Baseline | Run q24 with --profile chunk (~500 tokens, the Qdrant/Meilisearch size). | That this is the best production setting. |
| One change | Keep everything else and rerun q24 with --profile graph (~1200 tokens, LightRAG's size). | That several changes caused the result. |
| Measure | Compare the co-location count/rate and the readable window text. | That the live index has improved, or that the bigger window is simply better. |
| Verify | Reindex the isolated demo, then run the retrieval evaluation again. | That a source-window proxy can replace evaluation. |
Question map
| Question | Why it is useful | Source(s) |
|---|---|---|
| q24 | Checks whether a revised deadline stays linked to the current procedure identity. | PR-QA-MRD-009 |
| q30 | Shows that one window may still not contain enough for an answer that needs two sources. | PR-QA-MRD-001 + PR-QA-MRD-009 |
| q52 | Checks a short factual answer against the continuity-plan identity. | PR-EXM-MRD-014 |
Commands and conclusion frame
cd demo
python3 chunk_lab.py --question q24 --profile chunk --output-dir reports/lesson-06-chunk-profile
python3 chunk_lab.py --question q24 --profile graph --output-dir reports/lesson-06-graph-profile
Conclusion frame: “With the ___ profile (___ characters, ___ overlap), ___ of ___ windows kept the required fact and source identity together. This supports the hypothesis that ___. It does not prove live retrieval quality, and it does not mean the bigger window is simply better; next, I would weigh that against LightRAG's real extraction cost and reindex-plus-retrieval check.”
Local pointers
demo/chunk_lab.pydemo/eval_set.yamldemo/corpus/md/
Continue learning: Open the matching standalone lesson · Course roadmap