Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.27 KB

File metadata and controls

40 lines (28 loc) · 1.27 KB

Document Chunking

The most basic strategy: treat the entire document as a single chunk. No splitting, no overlap. The whole text goes into the vector index as one unit.

It sounds too simple to be useful — and for most RAG use cases it is. But understanding it is important because it sets the baseline. Every other chunking technique is a trade-off against this one.

How it works

  1. Document loaded as-is
  2. Entire text stored as a single node/chunk
  3. That one chunk is embedded and indexed
  4. Any query retrieves the whole document

When to use

  • Very short documents (under 500 tokens) where splitting adds no value
  • You want to understand what your document actually contains before deciding a chunking strategy
  • Testing — baseline to compare chunk quality against

When NOT to use

  • Documents longer than ~1000 tokens — LLMs hit context limits and accuracy drops
  • Multiple topics in one document — retrieval can't differentiate
  • Almost any real RAG use case

Trade-offs

Speed Fastest — zero splitting overhead
Accuracy Low on long documents — too much noise in context
Cost High — large context = more tokens sent to LLM
Use case Baseline only

Run it

# No API key needed
python document_chunking.py