Debug Report Chunking Before LlamaIndex
A finance assistant indexes 200-page reports whose first page says every amount is in thousands.
Splitting a long report into pieces that can be read alone
A chunk is retrieved on its own and read on its own. Anything the surrounding document was carrying — the unit the figures are in, the heading that says which quarter they belong to — is gone unless the chunker puts it in the chunk. Cutting on a word count is what produces half a sentence and a page of contents at the top of the results.
Your task
Explain what each bug does to a retrieved answer, reproduce all three with the visible test, then repair chunk without changing the contract.
Pairing tasks
- Reproduce all three failures with the visible test before editing anything.
- Pack whole sentences up to the limit instead of cutting on a word count.
- Carry the document note and the section heading onto every chunk.
- Stop indexing a heading that has no body of its own.
State what the token limit costs you at each end — what a chunk too large does to precision and what a chunk too small does to the context an answer needs — and say why the overlap is measured in sentences rather than in words.
Interviewer follow-up questions
- Your chunks are clean, and a query for revenue still returns the table of contents. Why, and what do you change?
- What would you measure to choose the token limit, rather than picking one?
- When would you keep a chunk that is longer than the limit?
- The report is revised and one section is deleted. What has to happen to the index?
Skills: LlamaIndex · Chunking · Retrieval quality · Document structure · RAG indexing