What Is Chunk Overlap?
What chunk overlap is, why it keeps a split rule whole, and what it costs, explained simply for your AI interview.
In short
Chunk overlap is text repeated at the edge of two neighbouring chunks, so an idea cut at a boundary still appears whole in one of them. It helps retrieval, but repeated text is stored and searched twice, so the value needs testing.
10 min readBeginnerCommon · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Chunk overlap means the end of one chunk is repeated at the start of the next. When I split a long document for search, a cut can land in the middle of a rule, and the exception ends up in the next chunk. Overlap copies the words around the cut into both pieces, so the search can return the whole rule. The price is more text to store, repeated results, and a fuller prompt. I'd set a starting value and test it on questions with known answers.
Chunking cuts a long document into pieces before we store it for search. Each piece is embedded, which turns its text into numbers that stand for its meaning, and the search hands back whole pieces. If a cut lands in the middle of a rule, the rule can split across two chunks, and neither one reads as a full answer. Chunk overlap helps with that by repeating a little text at each boundary.
Take a bank's card fee policy. One chunk ends with the cash advance rate, and the next starts with the exception for Premier accounts. Without overlap, a customer who asks about that exception can get a chunk with half the rule. With 50 characters of overlap, the next chunk starts before the cut, so the whole rule sits in one piece.
The cost is real. The repeated text is stored and embedded twice, so the search index (the stored collection of pieces) grows, and the top results can repeat the same passage. LangChain gives a common starting point of 10% to 20% of the chunk size. I would treat that as a place to start testing, then check the failures against questions with known answers.
Overlap doesn't fix everything. A rule spread over a long section, or a fact far from the rule it changes, needs another fix, such as splitting on headings or keeping whole sections together.
What is chunk overlap, in plain words?
A search system usually hands back whole chunks. So where a document is cut decides what the model can see when it answers. Chunk overlap is a small, deliberate repeat: the end of one chunk is copied to the start of the next.
Think of a hospital shift handover. The night nurse repeats the last hour of her shift to the day nurse, even though the day nurse can read the chart. The first minutes of a shift need that context. Overlap works the same way. The next chunk opens with the words the cut would otherwise have left behind.
Now a real case. A bank's card fee policy says cash advances cost a percentage, and the exception for Premier accounts sits right after it. If the cut falls between the two, the search can return a chunk that gives the rate and misses the exception. The customer then hears the wrong fee.
Key words
- Chunk
- One piece of a document, stored and searched as a single unit.
- Chunk size
- How big each piece is, counted in characters, or in tokens (the small units of text a model reads).
- Chunk overlap
- Text repeated at the edge of two neighbouring chunks.
- Boundary
- The point where one chunk ends and the next begins.
- Retrieval
- Finding the chunks to show the model when a question comes in.
How does overlap work, and where does it help?
The fixed-size chunker in the code below cuts the text and steps forward by the chunk size minus the overlap. With 100 characters per chunk and 50 repeated, each new chunk starts 50 characters after the last one, so it begins inside the chunk before it. The overlap has to reach back past the start of the rule, and the next chunk has to be long enough to hold all of it.
Overlap keeps a rule and its exception together
Fee policy
a rule and its exception, side by side
Cut at a fixed length
Cut in the middle
the exception lands in the next chunk
Cut with 50 characters repeated
Repeat the edge
the next chunk starts before the cut
Rule and exception apart
neither chunk answers in full
Rule whole in one chunk
the search can return it
- 1A plain cut falls wherever the length runs out.
- 2Overlap starts the next chunk early, so the cut is repeated.
- 3The cut falls in the middle of the rule, so the rule breaks.
- 4The repeated edge keeps the rule and its exception together.
“Chunk overlap repeats a portion of text between adjacent chunks so that an idea split at a boundary still appears whole in at least one chunk.”
LangChain, chunking guide
“The choice of chunk size, chunk boundary, and chunk overlap can affect retrieval performance”
Anthropic, on contextual retrieval
Microsoft's guidance describes the same method for fixed-size cuts, where you pick both the size and the amount of overlap.
Here is the idea in code. It is a made-up bank fee policy, cut into 100-character chunks, using only the standard library.
# A made-up bank fee policy, cut into 100-character chunks. Overlap repeats the edge of each cut.
POLICY = (
"Cash advances cost 4% of the amount, minimum 10 units. "
"Premier accounts pay no cash advance fee in the first 30 days. "
"Disputed charges are paused until the bank decides."
)
RULE = "Premier accounts pay no cash advance fee in the first 30 days."
def chunk(text, size, overlap):
if overlap >= size:
raise ValueError("overlap must be smaller than size")
step = size - overlap
starts = [i for i in range(0, len(text), step) if i == 0 or i + overlap < len(text)]
return [text[i:i + size] for i in starts]
for overlap in (0, 50):
parts = chunk(POLICY, 100, overlap)
whole = any(RULE in p for p in parts)
stored = sum(len(p) for p in parts)
print(f"overlap {overlap}: {len(parts)} chunks, {stored} characters stored, rule whole: {whole}")
for p in parts:
print(" |" + p + "|")Output
overlap 0: 2 chunks, 169 characters stored, rule whole: False |Cash advances cost 4% of the amount, minimum 10 units. Premier accounts pay no cash advance fee in t| |he first 30 days. Disputed charges are paused until the bank decides.| overlap 50: 3 chunks, 269 characters stored, rule whole: True |Cash advances cost 4% of the amount, minimum 10 units. Premier accounts pay no cash advance fee in t| |its. Premier accounts pay no cash advance fee in the first 30 days. Disputed charges are paused unti| |he first 30 days. Disputed charges are paused until the bank decides.|
The first run cuts the rule in two, so the check says no. The second repeats 50 characters at each cut, and the rule sits whole in one chunk. The price is visible too: 269 characters are stored instead of 169.
What does overlap cost, and what does it not fix?
- 1
More to store and embed
Repeated text is stored and embedded again, so the index grows. In the example, 50 characters of overlap adds about 59% more text to store.
- 2
Repeated search results
Two neighbouring chunks share words, so the top results can hold the same passage twice and push out a second source.
- 3
A fuller prompt
Each retrieved chunk brings its repeat into the prompt, which uses up the space the model reads at once, its context window.
- 4
What overlap does not fix
A rule spread over a long section, or a fact far from the rule it changes, needs more than a few repeated lines. Split on headings, or keep whole sections together.
There is no fixed right value. LangChain says that "there is no universal best value" for chunk size. Its guide gives a common starting point of 10% to 20% of the chunk size, as a place to begin testing.
How would you choose the overlap for a fee-policy bot?
Start with about 50 questions that real customers ask, each with the right answer and the policy section it needs. A bank's fee bot is judged on the wrong fee, so the test has to include the exceptions.
- 1
Try a few settings
Keep the chunk size near the length of one policy section. Then try overlaps of about 10% and 20% of that size, and zero overlap as the control.
- 2
Score the misses
For each question, check whether the chunk holding the answer was returned. Overlap only helps where the misses are cuts through a rule.
- 3
Keep the cheapest setting that passes
A bigger overlap that adds almost nothing to the score is extra storage and prompt cost with no gain.
- 4
Recheck when documents change
New fee tables or a new product bring new cut points, so run the same questions again.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: the end of one chunk repeated at the start of the next.
- Why: a cut can split a rule, and overlap keeps it whole in one chunk.
- How it's sized: chunk size minus overlap is the step between chunks.
- The costs: more text stored, repeated results, a fuller prompt.
- What it does not fix: a bad split elsewhere, or context far apart.
- How you'd choose it: test on questions with known answers.
Common traps
Trap"More overlap is always better."
BetterOverlap repeats text, so it costs storage and prompt space. Raise it only when the test shows misses at the cuts.
Trap"Overlap makes the chunks mean the same thing."
BetterIt only copies the words at the edge. Each chunk is still embedded as its own piece of text.
Trap"Overlap fixes any bad split."
BetterIt helps when the overlap reaches back past the start of the idea. Context far apart needs other fixes, such as splitting on headings.
Can you spot the problem?
Spot the broken setting
A team reviews the chunker config for a claims-policy search. Which setting does this chunker refuse outright?
Quick check
A customer asks whether the Premier fee exception applies. The rule and its exception were cut apart, and neither chunk holds both. What helps most?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 26 November 2026
Building a search over your own documents?
I design and build AI products and agents, including the search behind them and the tests that show it finds the right passage. Book a short call and tell me what you need.