If we split a large document into smaller chunks, how does the LLM understand the complete context? Doesn't it lose the connection between different parts of the document?
Let's understand this with a simple example.
1. Why do we split documents?
Imagine we have a company policy document containing 100 pages.
A user asks:
"How many days of leave can I carry forward?"
Instead of sending all 100 pages to the LLM, RAG splits the document into smaller pieces called chunks. This saves tokens, reduces costs and helps retrieve only relevant information.
2. But here's the problem!
Suppose our original document contains:
Chunk 1:
"Employees are entitled to 20 days of paid leave every year.…