Summary
In the search feature of a service developed at my own company, the input limit of the embedding model turned out not to justify the choice of chunk unit. The search targets long specialized documents divided into levels. I call one entry at the level that search returns as a result an upper unit, and I call each block of body text that an upper unit is divided into a smallest component. At first, the AI agent explained the unit by the headroom under the input limit and by the chunk limit set for a different corpus. After I pointed this out, the AI agent looked again at the distribution of body text lengths and at published research, and chose to embed the smallest components.
The 90th percentile of the body text length of the smallest components was 360 characters, about 243 tokens, roughly 3% of the input limit of 8,192 tokens. Of the upper units, 64.5% have only one smallest component, so for these upper units, the text passed to the embedding model is the same whether the upper unit or each smallest component is embedded.
We (the AI agent and I) did not score the two options against our own ground truth set, so whether the newly chosen unit is better has not been confirmed. This conclusion covers only documents with a clear structure. It does not deal with text that has no structure, or with data in which queries and documents are about the same length.
What you can take away
Developers who decide the chunk unit can get the following four things from this article.
- You can count the smallest components in each upper unit, and estimate the range in which the two options pass different text and the amount of input.
- You can check which metric each reported value in published research on splitting methods and preambles was measured with.
- You can re-estimate the memory of an HNSW index, and consider changing settings before moving to a larger instance type.
- You can use a procedure for building a ground truth set without a person labeling answers, and four steps for deciding the unit.
This article rests on the design documents and code of a service developed at my own company, the AI agent’s work records, and published research. It does not include measurements that compare the two options on our own data.
The rest of this article is paid
You can read the rest by buying this article on its own, or with a subscription that covers every paid article.
The paid part is about 15,100 characters, roughly a 30-minute read.
Read just this article
From 300 JPY
Buy this article on its own. The exact price is shown at checkout. Purchased articles stay readable whenever you sign in with the email used at purchase.
Read every paid article
Standard is 490 JPY / month
Four new paid articles ship every month. For yearly billing and the full comparison, see the plans.
Add dialogue and columns
Premium is 980 JPY / month
Premium adds the subscriber-only columns and dialogue with matsumotory-kun on top of every paid article. See the plans for details.
Prices include tax. Purchases and subscriptions start after you sign in. Subscribers and readers who already bought this article can sign in and read the full article; for the plans, see the plans page.
Sales are available in supported regions only; the Terms list where we sell. All charges are in Japanese yen.