Chunking about 5,000 pages of reference documentation: what changed when the token counter stopped guessing
Corrected 2026-10-08, 2026-10-10 and 2026-10-14. The corpus is about 5,000 pages, manual plus datasheet, not one manual. The fixed-window context effect is +0.033, not zero. An 80 % chance of qualifying needs 71 and 81 questions, not 35 and 40. The method interval ends at +0.133, not +0.117. The text layer the chunks were cut from has no freeze record. The question counts and the estimate-era interval are calculated from measured data, not measured. Corrections, at the end, lists the changes.
We built a factorial benchmark for PDF chunking and retrieval and ran 24 configurations on about 5,000 pages of microcontroller reference documentation. We scored them on 30 questions frozen before any result was seen. Partway through, the benchmark turned out to be measuring its own defect: the token counter was never pinned, so a metric denominated in tokens was counting an estimate, and the arm named "fixed 512-token windows" was cutting by word count.
Fixing that changed the results. A metric we had written off turned out to carry information. An effect we had called the run's only near-signal halved. The three fixed-window RRF configurations reversed their order. This post reports the corrected numbers and what the correction moved, because the second is the more useful half.
The headline, unchanged by any of it: none of the 23 comparisons is statistically distinguishable at 30 questions.
1. What was measured
The corpus is a microcontroller reference manual of about 4,800 pages plus a datasheet of about 120 pages, about 5,000 pages in all. The manual is register-dense. Every page has a real embedded text layer, and zero pages needed an OCR fallback. The documents are third-party copyright, so nothing from them appears here: no excerpt, no question text, no retrieved span. Metrics and method only.
| Factor | Levels | Status |
|---|---|---|
| Extraction | txt — embedded text layer | fixed (1) |
| Boundary | fix 512-token windows · par paragraph groups | varied (2) |
| Context | none · sec · chap | varied (3) |
| Embedder | 0.6 B dense · 568 M dense | varied (2) |
| Retrieval | bm25 · dense · rrf | varied (3) |
The primary metric is recall@B1024: was the gold answer span retrieved within a 1,024-token budget, counting the actual tokens of the chunks returned rather than a fixed k. A budget metric is the honest one when chunk sizes differ between arms — ranking by k silently rewards whichever arm ships bigger chunks. That choice is what made the token counter load-bearing, and therefore what made its being wrong matter.
The scorer takes chunks in rank order until the running total reaches 1,024. The last chunk can overrun the budget by up to one chunk: three 400-token chunks deliver 1,200 tokens. The overrun favours larger chunks.
A gold span counts as retrieved when one returned chunk covers at least half of it. Four of the 30 questions have two gold spans, so a question scores 0, 0.5 or 1. Recall is the mean over questions.
| Setting | Value |
|---|---|
fix boundary | 512-token windows with a 64-token overlap, cut on the pinned tokenizer |
par boundary | paragraphs split per page at blank lines, at headings, bullets and table lead words, after short lines and at indent changes. Runs of three or more one-line paragraphs with no blank line between them merge into one. Up to two paragraphs per chunk. The fix rule re-splits any chunk over 512 tokens. |
| Pages | no chunk crosses a page, in either rule |
sec context | the last numbered heading on the chunk's page at or before the chunk's start; the chapter title when there is none |
chap context | the chapter title from each document's outline |
| Context prefix | joined to the chunk text, counted in the chunk's tokens, never truncated |
| Token counter | Qwen3.5 tokenizer, vocabulary 248,070, pinned by SHA-256 |
| Dense search | exact cosine over the whole index, no approximate search |
2. The counter was an estimate, and the window was not a window
Two defects, found only by re-deriving results from what was on disk.
No tokenizer was ever pinned. The chunking spec carried a
TODO placeholder, the loader returns nothing for a placeholder
path, and the fallback is words / 0.75. Every token count in the
campaign was that estimate. Measured against the real tokenizer on 400-chunk
samples, the estimate ran at 0.677× of true on the
fix arm and 0.775× on par. The
error was not constant — it was arm-dependent, so it did not rescale
the comparison, it tilted it, granting one arm about 15 % more real text per unit of budget than the
other.
The fixed-window cutter never used a tokenizer at all. It cut by word count scaled by 0.75 and only reported counts from the pinned counter. So the manifest recorded a ceremony tokenizer that had played no part in the cut. With the real tokenizer applied to the same chunks:
| Chunk set | n | mean | max | over 512 |
|---|---|---|---|---|
| as built, counted by estimate | 5,571 | 313 | 512 | 0 % |
| as built, counted honestly | 5,571 | 433 | 1222 | 27.7 % |
| after the fix, cut on real tokens | 6,664 | 371 | 512 | 0 % |
A quarter of the chunks in the control arm were over the window the arm is named for, one of them by 2.4×. A third defect of the same shape sat in the paragraph rule: its oversize backstop — the split whose entire job is to enforce that window — also cut by words, leaving 138 chunks over 512 with a maximum of 1,195. All three passed a suite of 600+ tests, because every test asserted the reported count against the same estimator that produced it. An earlier adversarial review of the same harness found defects that the green suite also missed; What a green suite cannot see reports it.
When one source produces both a result and its check, an error in that source reaches both. Our post on independent verification evidence under ISO 26262 covers that failure for AI-written code and tests.
3. Results, on real tokens
24 series, 30 questions each, single run, seed 42. Baseline for deltas is
fix/none/BM25.
| Boundary | Context | Embedder | Method | R@B1024 | R@B4096 | R@10 | nDCG@10 |
|---|---|---|---|---|---|---|---|
par | none | 568 M | dense | 0.283 | 0.350 | 0.283 | 0.243 |
par | chap | 568 M | dense | 0.283 | 0.333 | 0.300 | 0.276 |
par | sec | 568 M | dense | 0.233 | 0.333 | 0.233 | 0.204 |
fix | chap | 568 M | dense | 0.217 | 0.333 | 0.333 | 0.276 |
fix | sec | 568 M | dense | 0.217 | 0.333 | 0.333 | 0.268 |
fix | sec | 0.6 B | rrf | 0.183 | 0.417 | 0.417 | 0.264 |
fix | chap | 0.6 B | rrf | 0.183 | 0.383 | 0.383 | 0.222 |
fix | none | 568 M | dense | 0.183 | 0.317 | 0.250 | 0.223 |
par | chap | 0.6 B | rrf | 0.183 | 0.250 | 0.150 | 0.188 |
fix | sec | 0.6 B | dense | 0.150 | 0.367 | 0.300 | 0.191 |
par | sec | 0.6 B | rrf | 0.150 | 0.250 | 0.150 | 0.186 |
par | none | 0.6 B | rrf | 0.150 | 0.250 | 0.150 | 0.179 |
par | none | — | bm25 | 0.150 | 0.250 | 0.150 | 0.161 |
par | sec | — | bm25 | 0.150 | 0.217 | 0.183 | 0.147 |
par | chap | — | bm25 | 0.150 | 0.217 | 0.150 | 0.153 |
par | sec | 0.6 B | dense | 0.150 | 0.183 | 0.100 | 0.067 |
par | chap | 0.6 B | dense | 0.133 | 0.183 | 0.100 | 0.129 |
par | none | 0.6 B | dense | 0.133 | 0.150 | 0.100 | 0.097 |
fix | none | 0.6 B | rrf | 0.117 | 0.383 | 0.317 | 0.240 |
fix | chap | 0.6 B | dense | 0.117 | 0.283 | 0.183 | 0.197 |
fix | none | 0.6 B | dense | 0.117 | 0.267 | 0.200 | 0.177 |
fix | none | — | bm25 | 0.100 | 0.283 | 0.283 | 0.170 |
fix | sec | — | bm25 | 0.100 | 0.250 | 0.250 | 0.163 |
fix | chap | — | bm25 | 0.100 | 0.250 | 0.250 | 0.163 |
fix/none/BM25 baseline on recall@B1024, averaged over
the series at each level, baseline excluded: 568 M +0.136 (6 series), dense
+0.085 (12), par +0.079 (12), chap +0.071 (8),
sec +0.067 (8), none +0.062 (7), fix
+0.053 (11). The three context levels are the point of the chart: they sit
within 0.009 of each other.The levels hold different series. 568 M holds only dense series, while
0.6 B also holds the five BM25 and six RRF series. The chart leaves out 0.6 B
at +0.042 (17 series), rrf at +0.061 (6) and bm25 at
+0.030 (5). These are descriptive averages, not one-factor effects.
4. What the correction moved
We scored all twelve fix series under both counters, on the
same questions and the same retrieval code. Eight fell, two held and two rose.
The two that rose are the 0.6 B RRF arms with a section or chapter prefix,
+0.033 each. The budget now charges real tokens, so it admits less text. The
cutter changed at the same time, so the rerun does not isolate the counter's
effect:
| Series | estimate | real tokens | change |
|---|---|---|---|
fix.chap · 568 M · dense | 0.267 | 0.217 | −0.050 |
fix.sec · 568 M · dense | 0.267 | 0.217 | −0.050 |
fix.none · 568 M · dense | 0.200 | 0.183 | −0.017 |
fix.none · bm25 | 0.167 | 0.100 | −0.067 |
fix.sec · bm25 | 0.167 | 0.100 | −0.067 |
fix.chap · bm25 | 0.167 | 0.100 | −0.067 |
fix.chap · 0.6 B · dense | 0.150 | 0.117 | −0.033 |
fix.sec · 0.6 B · dense | 0.150 | 0.150 | 0.000 |
fix.none · 0.6 B · dense | 0.117 | 0.117 | 0.000 |
fix.none · 0.6 B · rrf | 0.183 | 0.117 | −0.067 |
fix.chap · 0.6 B · rrf | 0.150 | 0.183 | +0.033 |
fix.sec · 0.6 B · rrf | 0.150 | 0.183 | +0.033 |
Three findings from the first pass did not survive.
The context effect halved on the same arm and measured zero on
paragraphs. Under the estimate, attaching a chapter heading beat
attaching nothing by +0.067 paired on fixed windows (568 M, dense), interval
[+0.000, +0.167]. It was the
only one of the first pass's four headline contrasts whose interval held no
negative value. We called it the closest thing to a signal. On real tokens
that same contrast is +0.033. On paragraph chunks, which the
first pass never measured, it is +0.000, interval
[−0.083, +0.067].
The three context level averages sit within 0.009 of each other. A prefix costs tokens; when those tokens were under-counted, the context arms were being handed text they had not paid for.
A metric that "measured nothing" turned out to measure something.
The first pass reported recall@B4096 as identical to
recall@10 in all 360 series-question cells, and concluded the wide
budget was a rename of the rank metric. That was an artifact: word-window
cutting made every chunk a similar size, so a fixed budget and a fixed rank
selected the same sets. With honest cutting and two boundary rules whose chunks
differ by 4×, the two metrics now disagree in 43 of 720 cells.
The collapse was a property of the bug, not of the corpus.
Lexical search stopped leading on fixed windows. The first
pass found BM25 (0.167) above the 0.6 B dense arm (0.117) and made something
of it. On real tokens and on the same slice, fixed windows with no context,
BM25 sits at 0.100 against 0.117 dense: +0.017 for dense. On paragraph chunks
the order differs. With no context or with chapter context, dense trails BM25
by 0.017, and the paired interval in section 7 is
[−0.150, +0.133]. On fixed windows the dense arm does not qualify
against the baseline, and the paragraph interval contains zero.
5. Small chunks win a tight budget; big chunks can win a fixed rank
The one robust-looking pattern in the corrected data is a trade, and it is only visible because the two metrics stopped agreeing. Paragraph chunks average 96 tokens; fixed windows average 371.
At a 1,024-token budget
par leads — 0.283 against 0.217 for the 568 M dense model with
chapter context. At a fixed rank of 10 the order reverses: fix
takes 0.333 against par's 0.300, because ten large chunks deliver
3.7k tokens of text where ten small ones deliver under 1k. With no context
there is no reversal: par also leads at rank 10, 0.283 against
0.250.
So "which chunker is better" is not answerable without saying what is
scarce. If the constraint is the context window, small chunks spend it more
precisely. If the constraint is the number of retrieved items — a reranker's
input, say, or a UI list — larger chunks carry more of the answer per slot.
The paired par-over-fix contrast at B1024 is +0.067,
interval [+0.000, +0.150]: suggestive, not decided.
6. The embedders, and what an index costs
Two dense models ran on the same consumer 16 GB GPU. The first, Qwen3-Embedding-0.6B, is a 0.6 B, 1024-dim model with last-token pooling, served through llama.cpp at Q8_0 with a 2,048-token context. The second, snowflake-arctic-embed-l-v2.0, is a 568 M, 1024-dim model with CLS pooling, un-normalised, served through vLLM at float32 with an 8,192-token context.
The 568 M model has the largest level average in the run, +0.136. Paired on fixed windows with chapter context, it leads by +0.100. It is also cheaper to index: 284 s against 461 s of embedding time for the same 24,540 paragraph chunks with no context.
Two caveats keep that from being a model verdict: the engines differ, so part of the speed gap is serving stack; and the 0.6 B deployment's 2,048-token context is a configuration choice rather than a model limit. What this run shows is that this deployment indexed faster and scored higher than that deployment on this sample. The accuracy gap does not clear the qualification rule.
| Series | Boundary (s) | Embedding (s, client wall time) | Vectors | R@B1024 |
|---|---|---|---|---|
par.none · 568 M · dense | 8.1 | 284 | 24,540 | 0.283 |
fix.chap · 568 M · dense | 3.7 | 194 | 6,664 | 0.217 |
par.none · bm25 | 8.1 | 0 | 0 | 0.150 |
par.none · 0.6 B · dense | 8.1 | 461 | 24,540 | 0.133 |
fix.none · bm25 | 7.7 | 0 | 0 | 0.100 |
BM25 still earns its place on the frontier, at zero embedding cost. On paragraph chunks with no context it scores 0.150 against 0.133 for the 0.6 B dense model. On fixed windows with no context it trails that model, 0.100 against 0.117. Section 4 sets out what the intervals show.
7. Nothing qualifies, and here is what it would take
Every series was compared with the baseline by paired bootstrap, 2,000 resamples, seed 42, on the same 30 questions. Qualification requires the 95 % interval of the paired difference to exclude zero.
0 of 23 series qualify. The best result in the run, +0.183 over baseline, has an interval whose lower bound is exactly +0.000 — the closest anything has come, and still not a pass. From the measured per-question variance, the questions each contrast would need:
| Contrast | Slice | Paired Δ | SD | 95 % CI at n = 30 | Break-even n (≈50 % power) |
|---|---|---|---|---|---|
| 568 M over 0.6 B (embedder) | fix · chap · dense | +0.100 (6/60) | 0.300 | [+0.000, +0.200] | 35 |
par over fix (boundary) | chap · 568 M · dense | +0.067 (4/60) | 0.213 | [+0.000, +0.150] | 40 |
chap over none (context) | par | +0.000 | 0.224 | [−0.083, +0.067] | no detected effect |
| dense over bm25 (method) | par · 0.6 B | −0.017 | 0.376 | [−0.150, +0.133] | no detected effect |
At the measured effect and spread, 35 and 40 questions only bring the interval's lower bound to zero on average. That gives about a 50 % chance of qualifying. For an 80 % chance the same arithmetic, n = ⌈((1.96 + 0.84) · SD / Δ)²⌉, gives 71 and 81: more than twice the current set.
That is the useful result. The benchmark did not fail; it needs more than twice its questions for an 80 % chance of answering its own two best questions. For the other two, the sample shows no detected effect at n = 30. Their intervals still allow effects up to +0.067 (context) and +0.133 (method), so the sample establishes neither a gain nor equivalence.
8. What this report does not cover
- No generation, no model tiers. This is a retrieval measurement. The larger models earmarked for semantic chunking and query transformation have processed nothing, and no claim here touches them.
- Passages, not field values. Span coverage shows that a returned chunk covers at least half of a gold span. It does not check that a register's offset, width or reset value in that chunk is correct, and no claim here depends on that. Our post on agentic AI in ISO 26262 development proposes a field-by-field check of that kind; we have not run it.
- One extraction level. Structure-aware extraction and OCR are absent, so this cannot say whether a better extractor beats a better chunker.
- Single run, single seed. Retrieval is deterministic here, so the variance measured is across questions, not across runs.
- One corpus, one domain. Register-dense hardware documentation has unusual retrieval properties. None of this should be carried to prose without re-measuring.
- Model identities are still unpinned. The tokenizer is now pinned by hash; the transform-tier model repos, revisions and weights are not. That ceremony has not happened, and this report makes no claim requiring it.
The correction is the part worth keeping. A benchmark whose headline metric is denominated in tokens will happily report five significant figures on a counter that was never connected, and a full test suite will agree with it, because the tests assert the reported number against the same estimator that produced it. The only thing that caught it was recomputing a result from the artefacts on disk and finding the pipeline disagreed with itself.
Corrections
The first version went live on 2026-10-07 under the dateline of 2026-08-18. Each item gives the old value first.
- Corpus. The first version named one reference manual of about 4,800 pages. The corpus is that manual plus a datasheet of about 120 pages, about 5,000 pages in all.
- Context effect. The first version said it went to zero.
On the same fixed-window arm (568 M, dense) it fell from +0.067 to +0.033.
The +0.000 result, interval
[−0.083, +0.067], belongs to paragraph chunks. - Context interval. The first version said the estimate-era context contrast was the only contrast in the run whose interval held no negative value. It was the only one of the first pass's four headline contrasts. Other contrasts in the run had such intervals too.
- Rescored series. The first version showed eight series and said every one fell or held. We rescored twelve: eight fell, two held and two rose. The three fixed-window RRF configurations reverse their order, not two. The first version credited the change to the counter alone. The cutter changed too, so the rerun does not isolate the counter.
- Wide-budget metric. The opening of the first version said one metric stopped existing. The wide-budget metric, recall@B4096, now carries information: it differs from recall@10 in 43 of 720 cells.
- Level averages. The first version called the section 3 figures marginal effects. It said "Every one of these intervals contains zero" and that the three context levels "are indistinguishable from each other". The figures are averages of the paired difference over each level's series. They are not one-factor effects, and we publish no interval for them. Section 6 now calls +0.136 the largest level average, not the largest effect in the run.
- Embedder contrast. The first version gave +0.100 paired "on matched boundary and context". It holds on fixed windows with chapter context, not on every matched pair.
- Dense over BM25. The first version gave −0.017 for fixed windows with no context. There dense leads by +0.017. The −0.017 belongs to paragraph chunks with the 0.6 B embedder.
- Budget comparison. Section 5 set the no-context budget
values (0.283 against 0.183) beside the chapter-context rank values (0.333
against 0.300) as one context. With chapter context throughout, the budget
comparison is 0.283 against 0.217. With no context the rank order does not
reverse:
parleads, 0.283 against 0.250. The heading now says big chunks can win a fixed rank. - Index cost. Section 6 said 194 s against 357 s for 6,664 chunks, and 295 s against 473 s for 24,540 chunks. The cost table gives 284 s and 461 s for the 24,540 chunks and has no row for 357 s. Settling the difference needs the corrected run's cost records, which we have not yet read. Until then section 6 quotes the table, and we withdraw 295 s, 473 s and 357 s. The 194 s stays in the table.
- Index cost, settled 2026-10-10. The cost records show the withdrawn 295 s, 473 s and 357 s, and the 194 s, as chapter-context embedding times. With chapter context, embedding took 294.6 s and 472.9 s on paragraph chunks and 193.8 s and 356.8 s on fixed windows. The 568 M model comes first in each pair. For paragraph chunks with no context, section 6 and the cost table quote 284 s and 461 s, rounded from 283.6 s and 461.4 s. The closing note now says our evidence ledger lists the corrected run's records.
- Cost unit. The cost table labelled embedding time as GPU seconds, and section 6 said BM25 costs zero GPU-seconds. The column is client wall time. BM25 has zero embedding cost.
- Questions needed. The first version said the benchmark needed 35 and 40 questions and was roughly 30 % short. Those counts give about a 50 % chance of qualifying. An 80 % chance needs 71 and 81 questions.
- Withdrawn from section 7. "cannot answer the other two at any size because there is no effect there to find", and the table entry "no effect to size". Their intervals still allow effects up to +0.067 and +0.117.
- Method interval, corrected 2026-10-14. Sections 4 and 7
and the item above gave the dense-over-BM25 interval as
[−0.150, +0.117]. The harness's paired bootstrap, rerun on the per-question records on 2026-10-10, gives[−0.150, +0.133]. The same rerun reproduces the embedder and boundary intervals of section 7 exactly. No record shows where +0.117 came from. The interval still contains zero. - Withdrawn from section 6. "beat that pinned deployment on both axes" and "It is no longer beating the small dense model; it is tying with it for free". On paragraph chunks with no context, BM25 leads that model, 0.150 against 0.133.
- Withdrawn from the closing note. "every number here was read back from them".
- Baseline label. The first version gave the baseline
as
fix/none/0.6 B/BM25. It isfix/none/BM25. - Additions. This version adds the scoring rules and
the configuration table. It adds the level averages for 0.6 B,
rrfandbm25, and the estimate-era context interval. It adds the note on field values and links to related posts. - Text-layer freeze, added 2026-10-14. The harness has a freeze step that records the text layer's digest before chunking. It never ran on this layer, so no freeze record exists. All six chunk sets record the same text-layer digest as the header-and-footer strip record, so all 24 series come from one layer. Run on that layer on 2026-10-10, the freeze step's checks report no failure. The question set has its own freeze record.