Chunking
Chunking divides documents into retrievable units. Useful boundaries preserve enough context for an answer without filling the prompt with unrelated text.
Before you start: Review Document parsing first. Python-like examples use variables, lists and functions.
Follow the mechanism
Structure
Find headings, paragraphs and tables.
Start with an everyday explanation
Cutting a textbook into study cards works when a definition stays with its example. Cutting halfway through the definition can make both cards misleading.
See a concrete example
For 2,000 tokens, size 500 and overlap 100 give a stride of 400 and roughly five chunks, depending on the final boundary policy. Larger overlap increases storage and duplicate retrieval.
A claim to question
There is no universally best chunk size or overlap percentage.
Try before revealing the answer
Design a comparison of 256, 512 and 1,024-token chunks with and without overlap.
Show the worked answer
Hold documents, queries and embedding model fixed. Compare recall@k, answer correctness, duplicated context, latency and cost on a held-out set; inspect boundary failures.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
Compare fixed-token, sentence-aware and structure-aware boundaries. Overlap can preserve context but duplicates tokens and evidence.
Tune on a labeled retrieval and answer set with realistic questions. Record chunk size, overlap, embedding model and evaluation version together.
Reason through the example
For 2,000 tokens, size 500 and overlap 100 give a stride of 400 and roughly five chunks, depending on the final boundary policy. Larger overlap increases storage and duplicate retrieval.
Implement and test
Design a comparison of 256, 512 and 1,024-token chunks with and without overlap.
Inspect the reasoning and expected result
Hold documents, queries and embedding model fixed. Compare recall@k, answer correctness, duplicated context, latency and cost on a held-out set; inspect boundary failures.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
How did you validate chunk size and overlap?
A defensible answer
Describe the dataset, candidate settings, fixed variables and metrics. Include retrieval misses and final answer support, then justify the chosen setting with evidence and operational cost.
Prepare the follow-up
How would tables or code change your boundary strategy?
Show follow-up reasoning
Preserve table headers with rows, avoid splitting code constructs blindly and use structure-aware sections where useful. Token limits still apply. Compare whether the chosen chunks retain the information needed to answer realistic questions, not merely whether their lengths are uniform.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define chunking with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…