RAG Chunk Boundaries: Test Size, Overlap and Missing Context
Test RAG chunk boundaries with cross-paragraph questions, source spans and a runnable Python fixture. Separate text coverage from retrieval and answer quality.
Choose RAG chunk boundaries by tracing the evidence each question needs through extraction, splitting, retrieval and final context assembly. Compare controlled candidates and verify that rules, exceptions and table labels survive together; a larger chunk or more overlap alone does not establish better answers.
Define the evidence a complete answer needs
A passage can match a question while omitting the sentence that changes its answer. A policy might describe a standard retention period in one paragraph and a special-case exception in the next. Retrieving only the first paragraph gives the generator fluent but incomplete evidence. Before changing chunk size, identify which pieces must remain available together and which questions actually depend on that relationship.
Build a small question set from documents you are allowed to use. Include a simple fact contained in one sentence, a rule plus exception, a definition followed by a condition, a table value requiring its header, and a question whose answer is absent. For every answerable case, mark the required source spans and write a reference answer. The absent-answer case should test whether the system acknowledges missing evidence rather than rewarding an invented explanation.
Use exact document versions and stable identifiers. Store the extracted text used for ingestion, not just a PDF filename that can later point to different content. Character offsets, page references and section labels can help trace a failure, but each needs an explicit coordinate system. An offset into normalized extracted text is not automatically an offset into the original PDF bytes.
Keep authorization and version selection separate from chunk quality. A perfectly formed passage from the wrong release or an inaccessible document is still unsuitable evidence. Apply your actual access policy before exposing retrieved context. A boundary experiment should never silently broaden the corpus merely to improve its apparent success rate.
| Question type | Required evidence | Failure to inspect |
|---|---|---|
| Rule plus exception | Both the general statement and qualifying exception | Confident answer based only on the general rule |
| Table lookup | Cell, relevant row and column labels | Number detached from its meaning |
| Cross-paragraph definition | Term definition and later condition | Correct term with incorrect scope |
| Unanswerable question | No supporting passage in this corpus | Unsupported answer instead of an explicit gap |
Source: NVIDIA RAG — text-only ingestion and split options ↗
Separate text coverage, retrieval and answer support
Test the pipeline in stages. First inspect whether the generated chunks preserve the marked evidence at all. Then check whether search and reranking return that evidence within the selected context budget. Finally inspect whether the generated answer uses it correctly. If extraction has dropped the exception sentence, improving the embedding model cannot restore that missing text.
Single-chunk coverage is a useful diagnostic, not a universal requirement. Some systems retrieve adjacent chunks or expand a selected child chunk to its parent section. They can assemble complete evidence even when no individual chunk contains every required span. Record that expansion policy and evaluate the final assembled context. Conversely, coverage somewhere in the index says nothing about whether that passage reaches the model.
For each failed question, record the earliest failing stage. Did the evidence exist in the source, survive extraction, survive splitting, appear in retrieval, survive reranking and fit inside the final prompt? Inspect the actual text at each stage instead of relying on a chunk count or a similarity score alone. This gives you a specific change to test.
NVIDIA’s evaluation documentation distinguishes answer accuracy, context relevancy and response groundedness, and also describes retrieval recall evaluation. Use metrics appropriate to the stage you are changing. Keep the question set and relevance labels stable when comparing candidates; otherwise an apparent improvement may come from easier questions rather than better boundaries.
Change one boundary decision at a time
Begin with the current extraction and splitting configuration as the baseline. Make a candidate that changes only chunk size or overlap, then ingest it into a separate test collection. Keep document versions, embedding and ranking models, query wording, filters and generation settings the same. If you intentionally compare complete configurations with several changes, describe the result as a configuration comparison rather than attributing it to overlap alone.
Chunk size needs a unit. A character window, a token window, a sentence-aware splitter and a page-level extractor can produce very different passages for the same numeric value. Inspect your installed splitter and tokenizer contract before copying settings from an example. Record how headings, separators, tables and page breaks are handled; those transformations can matter as much as the nominal size.
Increasing overlap repeats text across neighboring chunks. That can preserve a boundary-spanning statement, but it also creates more indexed and potentially retrieved copies of similar evidence. Compare the number of chunks and duplicated material, then check whether several top results are simply overlapping copies of the same source. Keep a fixed final context budget as well as recording the retrieval cutoff.
NVIDIA’s common-settings reference exposes chunk-size and overlap controls and describes their context and processing tradeoffs. Its text-only ingestion example also shows split_options with chunk_size and chunk_overlap. Those are configuration entry points, not proof that one pair is best for your documents. Check the documentation and effective settings for your deployed release; this guide does not prescribe a universal pair or equate those units with the character fixture below.
Source: NVIDIA RAG — common settings and chunking tradeoffs ↗
Run a small boundary fixture before using a model
The following standalone Python script deliberately uses character windows. It creates made-up text containing a general statement and an exception, with padding that places them across a boundary. With size 40 and overlap zero, no chunk contains both complete spans. Keeping size 40 and changing only overlap to 16 creates a chunk that does. The padding is a controlled test arrangement, not a representative document or a recommended production setting.
The helper tests whether all required spans fit inside one chunk using half-open offsets: start is included and end is excluded. It does not search embeddings, select the best chunk or judge a generated answer. The same text can be covered by several chunks collectively even when this stricter single-chunk check fails. That distinction is intentional and keeps the result interpretable.
The complete fixture passed 926 checks locally with Python 3.12.14. It checks source-slice fidelity, ordered nonempty windows, full source coverage and maximum window length across four strings and a grid of sizes and overlaps. It also checks invalid settings, an empty evidence request, an out-of-range span and nonmutation of the candidate. The strings include empty input, combining characters, Arabic and an emoji.
Python string indexing here counts Unicode code points, not model tokens, UTF-8 bytes or user-perceived grapheme clusters. A window can therefore split a visible character sequence. The test verifies that it preserves the chosen coordinate system; it is not a grapheme-aware splitter, a tokenizer conformance test or a production document parser. It runs without a GPU, network request, vector database or model.
from copy import deepcopy
def windows(text, size, overlap):
if type(size) is not int or type(overlap) is not int:
raise ValueError('integer character counts required')
if size <= 0 or not 0 <= overlap < size:
raise ValueError('require size > 0 and 0 <= overlap < size')
result = []
start = 0
while start < len(text):
end = min(start + size, len(text))
result.append({'start': start, 'end': end, 'text': text[start:end]})
if end == len(text):
break
start = end - overlap
return result
def contains_evidence(chunks, spans):
# All required spans must fit in ONE chunk; this is not retrieval.
return bool(spans) and any(
all(c['start'] <= a < b <= c['end'] for a, b in spans)
for c in chunks)
def validate(text, chunks):
covered = set()
previous = -1
for c in chunks:
a, b = c['start'], c['end']
assert previous < a < b <= len(text)
assert c['text'] == text[a:b]
covered.update(range(a, b))
previous = a
assert covered == set(range(len(text)))
# Made-up policy text, padded to place its rule across a window boundary.
text = 'A'*24 + 'Standard: 30 days.\n\nException: 7 days.' + 'Z'*24
rule = (text.index('Standard:'), text.index('Standard:') + len('Standard: 30 days.'))
exception = (text.index('Exception:'), text.index('Exception:') + len('Exception: 7 days.'))
spans = [rule, exception]
baseline = windows(text, 40, 0)
candidate = windows(text, 40, 16)
assert not contains_evidence(baseline, spans)
assert contains_evidence(candidate, spans)
assert contains_evidence([{'start': 0, 'end': rule[1]}], [rule])
assert not contains_evidence([{'start': 0, 'end': rule[1]}], spans)
checks = 4
for value in ('', 'x', text, 'cafe\u0301\nالعربية\n😀'):
for size in (1, 2, 7, 40, 64):
for overlap in range(size):
chunks = windows(value, size, overlap)
validate(value, chunks)
assert all(len(c['text']) <= size for c in chunks)
checks += 2
for size, overlap in ((0, 0), (-1, 0), (4, -1), (4, 4), (4, 5), (2.5, 0), (True, 0)):
try:
windows(text, size, overlap)
except ValueError:
checks += 1
else:
raise AssertionError('invalid configuration accepted')
saved = deepcopy(candidate)
contains_evidence(candidate, spans)
assert candidate == saved
checks += 1
assert not contains_evidence(candidate, [(0, len(text) + 1)])
assert not contains_evidence(candidate, [])
checks += 2
print('baseline single-chunk evidence:', contains_evidence(baseline, spans))
print('candidate single-chunk evidence:', contains_evidence(candidate, spans))
print(f'{checks} checks passed; character offsets, not tokens or retrieval scores')Inspect real documents where the fixture is deliberately simple
After the fixture, inspect extracted samples from your actual file types. A PDF with two columns may interleave unrelated paragraphs. A table may lose its header or repeat it unpredictably. A heading may arrive as a separate element from the paragraph it qualifies. Save examples of these failures and repair extraction or structure handling before expanding every chunk to compensate.
Look for evidence that already exceeds the candidate budget. A long procedure may need several ordered steps, prerequisites and a warning. Increasing overlap by a few characters cannot guarantee all of that fits in one window. Consider preserving an appropriate section or assembling linked chunks, then test whether the final context includes the necessary relationships without collecting unrelated sections.
Inspect truncation after retrieval too. A candidate may preserve complete evidence in storage but lose its final sentence when a context builder clips text to a token budget. Capture the exact context passed to the model for the test question. Repeating only the search call can miss a defect in that later assembly stage.
Duplicate text needs careful accounting. An overlapping passage appearing three times is not three independent sources supporting a claim. Retain source identity and offsets when inspecting candidates, and distinguish repeated coverage from genuinely complementary evidence. Review answer citations against the assembled passages, including the exception or qualifier that made the question difficult.
Choose a candidate using failures and cost together
Create a compact comparison record for each candidate: corpus version, splitter and unit, settings, chunk count, retrieval cutoff, final context budget and per-question outcome. Measure ingestion work, retrieval latency and prompt size in the actual deployment if these influence the decision. Do not infer those costs from the synthetic Python script, which performs no embeddings or generation.
Adopt a candidate when it resolves important boundary failures without introducing unacceptable regressions on simple, table-based and unanswerable questions. Reserve some questions for a final check so repeated tuning does not merely fit the development examples. When results are mixed, inspect individual failures; a single average can conceal a lost exception in a high-value workflow.
Rebuild or replace the relevant test index when chunk settings change; querying a stale collection does not evaluate the new splitter. Keep the original collection and configuration available for rollback through your established deployment process. Verify the document count, version and effective settings before comparing outputs, and avoid combining old and new chunks accidentally.
The local fixture establishes one narrow fact: changing a boundary can change whether complete evidence exists in a single passage. A deployable improvement requires the next checks as well: authorized evidence must be retrieved, assembled within budget and used accurately in the final answer. Start with a failure you can trace, change one decision, and keep the evidence that explains the result.
Your next steps
- Mark the complete evidence required by each test question.
- Separate chunk coverage from retrieval ranking and answer correctness.
- Record splitter units, corpus versions and the final context budget.
- Use the local character fixture as a boundary check, then evaluate the actual deployment.
Sources & official resources
Linked resources checked on 2026-10-30. Technical behavior and provider guidance can change; check the documentation for the version you use.
NCP-ARI rack and interconnect guides
- Server Rack Grounding and Bonding: The NCP-ARI Readiness Check
- 400G DR4 vs FR4: Which Fiber and Optic Fit the Link?
- MPO Fiber Inspection and Cleaning: Inspect, Clean, Reinspect
- MPO Polarity Types A, B and C: Trace the Whole Link
- Fiber Optic Link Loss Budget: Calculate Margin in dB
- OLTS vs OTDR: Which Fiber Test Answers Your Question?
- Overhead Fiber Cable Tray Capacity: An NCP-ARI Worked Example
- Fiber Optic Cable Bend Radius: Check Slack and Strain Relief
- AI Rack Cable Routing: Separate Power, Copper and Fiber
- AI Rack Liquid Cooling: CDU vs Manifold vs Cold Plate
- Rack PDU A/B Redundancy: Calculate Failover Headroom
- Hot Aisle vs Cold Aisle: NCP-ARI Rack Airflow Practice
- MPO Fiber Link Down: A No-Light Troubleshooting Checklist
- AI Rack Fiber Acceptance Test Record: What to Capture
- NCP-ARI Practice Questions: Link Flaps, Link Status, and BER
- NCP-ARI Rack Site Survey Checklist and Worked Example
- How to Read an AI Rack Cable Map for NCP-ARI
- NCP-ARI Preparation: Study AI Rack and Interconnect Decisions
- RAG Citation Audit: Verify Sources, Versions and Claim Support
About this guide and its recommendations
Published by Prep With Proof with AI-assisted drafting. Study routines and examples are editorial suggestions, not official exam instructions or claims of a learner's personal results. Cited provider facts are linked; ownership of recommended Prep With Proof products is disclosed. No competitor endorsement or guaranteed certification outcome is implied.
Suggest a correction →