Brain labTry it → read → next · ~8 min

Tutorials · Chapter C (3/4) · ~8 min

Chunking for RAG quality

Try it → see it → read → next

Split documents into right-sized pieces — too small loses context, too large retrieves noise.

On paths: Builder · Student

Try yourself

Playground

Chunk size changes retrieval

Pick a chunk size, then ask about annual plan refunds. Medium chunks usually win.

Question: Can I get a refund on an annual plan?

Chunk 1Section A: General terms apply to all plans.
Chunk 2Section B: Annual subscriptions may receive a prorated refund within 14 days of purchase if no premium features were used.
Chunk 3Section C: Monthly plans renew automatically.

Recap

What you just did

You changed chunk size and watched which piece similarity search retrieved for the same question.

Teach

How it works

Chunking breaks long docs into embeddable pieces. Good chunks:

  • Fit one idea or section when possible
  • Include overlap so sentences split across boundaries still retrieve
  • Carry metadata (source, page, heading)

Too tiny → fragments without context. Too huge → wrong section wins. Start around 300–800 tokens and tune with real questions.

Use it

When you'd use this

  • PDF handbooks, wikis, support libraries
  • Debugging “it answered from the wrong section”
  • Before blaming the LLM for RAG mistakes

Watch out

Watch out

Tables and lists often need to stay in one chunk. Always test with your user questions, not generic ones.

Try next

Try this next

Open the How to chunk documents for RAG recipe on the reference shelf.