Splitting documents so retrieval returns whole ideas.
Made for you now: slide lessons from basics to production, usually with code and a quiz. See a finished one
Embedding a whole document blurs many topics into one vector, and a model prompt has limited room. Splitting documents into chunks lets retrieval return only the passage that answers the question.
Too small and a chunk loses its context; too large and it mixes topics and wastes the prompt. A common starting range is a few hundred tokens with a small overlap so a sentence cut at a boundary still appears whole in one chunk. Treat it as a starting point and measure on your own questions.
Prefer boundaries the author made: headings, paragraphs, list items, code blocks. Fall back to fixed size only when structure is missing. Keep the section title with each chunk as metadata so the passage is understandable alone.
Step 1
Document
PDF, page or note, cleaned to text.
Step 2
Split
By headings and paragraphs, then by size.
Step 3
Overlap + metadata
Add boundary overlap, source and section title.
Step 4
Embed
One vector per chunk.
Step 5
Index
Store vector and text in a vector database.