Chunk so each piece can answer a question on its own. Start by splitting on the document's own structure, headings, sections and list items, then cap chunk size so no piece mixes unrelated topics, with a little overlap where sentences run across boundaries. Attach the heading path and source to each chunk. Then test sizes against real queries rather than picking a number from a blog post, because the right size depends on your documents.
Why interviewers ask this
Chunking quietly sets the ceiling on retrieval quality, and it is one of the few levers fully under the engineer's control. The interviewer wants to hear that you treat it as an empirical choice driven by document structure and query type, not a default token count. They also listen for the trade off: chunks too small lose context, chunks too large dilute the embedding and waste prompt space. Testing against a labelled query set is the answer that shows experience.
How to structure your answer
- State the goal: each chunk should stand on its own.
- Prefer structure aware splitting over fixed windows.
- Explain the size trade off and where overlap helps.
- Say how you would test the choice against real queries.
Example answer
My rule is that a chunk should make sense if someone read it with nothing else around it. So I start from the document's own structure. For a policy handbook that means splitting on headings and keeping each section together, and if a section is long I split it further on paragraphs, with a sentence or two of overlap so an answer that runs across a boundary is not cut in half. I prepend the heading path to every chunk, something like leave policy, parental leave, eligibility, because a paragraph that just says employees qualify after six months is useless without knowing what it is about. Size is a trade off. Small chunks embed precisely but lose context; big ones carry context but blur the embedding and burn prompt space. I do not trust a number from a tutorial, so I build a small set of real questions with the passages that answer them and compare a few strategies on retrieval recall. On one project that test moved us from fixed windows to heading based chunks, and recall improved noticeably.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How would you chunk a long table or a spreadsheet?
- What changes when the documents are call transcripts rather than written pages?
- Would you ever store the same content at more than one chunk size?
Related ai engineer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions