What chunking strategies do you know, and how do you pick one?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
From simplest to most sophisticated:
- Fixed-size: cut every N tokens with overlap. Trivial to implement, ignores meaning - splits sentences and tables mid-thought. Acceptable baseline, rarely the end state.
- Recursive: try splitting on big separators first (paragraphs), fall back to sentences, then tokens, until chunks fit the size limit. Respects natural boundaries; the sane default (LangChain's
RecursiveCharacterTextSplitterpopularized it). - Structure-aware: split along document structure - markdown headers, HTML sections, code functions - and attach the heading path ("Handbook > Benefits > Parental leave") to each chunk as context. Best choice whenever structure exists; the heading path alone fixes many retrieval misses.
- Semantic: embed sentences, split where cosine similarity between adjacent sentences drops below a threshold. Conceptually appealing; in practice gains are marginal over recursive+structure-aware and it adds embedding cost at ingest.
- Late chunking: embed the entire document with a long-context embedding model, then mean-pool token embeddings per chunk span afterward. Each chunk's vector is contextualized by the whole document - resolves pronouns and dangling references without an LLM call per chunk.
Full worked answer
From simplest to most sophisticated:
- Fixed-size: cut every N tokens with overlap. Trivial to implement, ignores meaning - splits sentences and tables mid-thought. Acceptable baseline, rarely the end state.
- Recursive: try splitting on big separators first (paragraphs), fall back to sentences, then tokens, until chunks fit the size limit. Respects natural boundaries; the sane default (LangChain's
RecursiveCharacterTextSplitterpopularized it). - Structure-aware: split along document structure - markdown headers, HTML sections, code functions - and attach the heading path ("Handbook > Benefits > Parental leave") to each chunk as context. Best choice whenever structure exists; the heading path alone fixes many retrieval misses.
- Semantic: embed sentences, split where cosine similarity between adjacent sentences drops below a threshold. Conceptually appealing; in practice gains are marginal over recursive+structure-aware and it adds embedding cost at ingest.
- Late chunking: embed the entire document with a long-context embedding model, then mean-pool token embeddings per chunk span afterward. Each chunk's vector is contextualized by the whole document - resolves pronouns and dangling references without an LLM call per chunk.
Selection logic: use structure-aware when documents have structure (most do); recursive as fallback; consider contextual enrichment (prepending an LLM-generated situating sentence) or late chunking when chunks are ambiguous out of context. Also decouple the retrieval unit from the generation unit: retrieve precise small chunks but hand the LLM the surrounding parent section ("small-to-big" / parent-document retrieval) - small vectors match precisely, big context reads coherently.
Chunking is set-and-forget only until quality plateaus; it's the first thing to revisit when recall@k is bad, before touching the embedding model.
What a good answer covers
- Fixed-size: cut every N tokens with overlap
- Recursive: try splitting on big separators first (paragraphs), fall back to sentences, then tokens,…
- Structure-aware: split along document structure - markdown headers, HTML sections, code functions - and…
- Semantic: embed sentences, split where cosine similarity between adjacent sentences drops below a threshold
- Late chunking: embed the entire document with a long-context embedding model, then mean-pool token…
Key terms: Fixed-size · Recursive · Structure-aware · Semantic · Late chunking
In the glossary: Cosine similarity · Late chunking · Chunking · Parent-document retrieval · Recall@k
Interviewer follow-ups to expect
How would you chunk source code differently from prose?
What breaks when you chunk a table row-by-row?
How do you A/B test two chunking strategies?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep