LearnThatStack Ace your next interview
RAG (Retrieval-Augmented Generation) · question
Question 5 of 56

Why do we chunk documents instead of embedding and retrieving whole documents?

beginner
← All RAG (Retrieval-Augmented Generation) questions
Re-explain

Chunking exists because an embedding is one fixed-size vector, no matter how long the input. A whole document collapses into a single point that averages all its topics, so the one relevant paragraph loses its signal.

Three forces make this concrete:

  • Dilution. A 40-page manual covering billing, refunds, and shipping matches a refund question only weakly. Most of its text is about something else.
  • Model limits. Embedding models cap input tokens. Text past the cap is truncated, so it never gets indexed at all.
  • Prompt budget. What you retrieve is what you paste into the prompt. Whole documents burn tokens and bury the answer among unrelated text.

So retrieve the smallest unit that still stands on its own.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for RAG (Retrieval-Augmented Generation) One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

What you can say

  1. We chunk because an embedding is one fixed-size vector however long the input is, so a whole document gets squeezed into a single point.
  2. That point averages every topic in the document, so the one paragraph that answers the question loses its signal. That's dilution.
  3. Say a 40-page manual covers billing, refunds and shipping. A refund question matches it only weakly, because most of the text is about something else.
  4. Embedding models also cap input tokens. Anything past the cap gets truncated, so it never gets indexed at all.
  5. Whatever you retrieve also goes into the prompt, so whole documents burn tokens and bury the answer in unrelated text.
  6. So I retrieve the smallest unit that still stands on its own. If you cut too small, a chunk loses the context it needs to make sense.

Weak answers to avoid

  • Only blames the token limit Truncation is real, but even a document that fits gets one vector that averages all its topics. Lead with dilution, then add the cap.
  • Says smaller chunks are always better A chunk that is too small loses the context it needs and can split an answer in two. Aim for the smallest unit that still stands on its own.
  • Treats it as a retrieval-only problem What you retrieve goes into the prompt. Whole documents burn tokens and bury the answer, so chunking helps the generation step too.
  • Says chunking makes search faster Chunking gives you more vectors to search, not fewer. The reasons are retrieval quality and model limits, not index speed.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the RAG (Retrieval-Augmented Generation) cheatsheet.

← Back to all RAG (Retrieval-Augmented Generation) questions
Pro · $10/mo

50 of 56 RAG (Retrieval-Augmented Generation) answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime