Last updated
Chunking Your Documents
Definition: Chunking is splitting long documents into smaller passages before embedding them. You retrieve and feed the model chunks, not whole documents.
Why chunk at all?
- Models have a limited context window — you cannot paste a 300-page manual
- Smaller chunks give more precise retrieval — you fetch the exact relevant paragraph, not a whole chapter
- It keeps prompts shorter and cheaper
Run it yourself
The demo splits text into chunks of a fixed number of words. Try changing the chunk size and watch how the passages change.
Getting chunk size right
Too small and a chunk loses context; too large and retrieval gets fuzzy and expensive. Real systems often use a few hundred words per chunk, with a little overlap between chunks so ideas are not cut in half.
💡 Tip: chunking strategy is one of the biggest levers on RAG quality — more on that later.
Try it Yourself
Output
Ad · responsive