Replies: 2 comments
|
Your setup looks right to me, and the 513s aren't a config problem. I reproduced it with 1.7.0 and
So the over-limit count is measuring a real effect, and there's a second one next to it: those chunks lose the bytes of the split character. If you want that in the comparison, a check that |
|
Thanks, Dylan!
This is very helpful. I understand now that TokenChunker records the size
of each token-ID window, then decodes each window independently. If a
boundary splits a UTF-8 character, the replacement character can make the
returned text recount to 513 tokens, while the original character is not
preserved. Your reproduction clarified both the count and the text-loss
issue. I’ll add a short, version-specific explanation to the benchmark
notes. Thanks for investigating this and sharing the details. Also, thank
you for your quick response!
Sincerely,
Ömer Cihangiroğlu
Dylan Pulver ***@***.***>, 18 Kas 2026 Çar, 18:48 tarihinde
şunu yazdı:
… Your setup looks right to me, and the 513s aren't a config problem.
TokenChunker encodes the text once, slices the ids into fixed 512-token
windows and decodes each window on its own (token.py
<https://github.com/feyninc/chonkie/blob/v1.7.0/src/chonkie/chunker/token.py#L113-L139>).
When a window edge lands inside a multi-byte character, that window decodes
the partial bytes as U+FFFD, and re-encoding the chunk text costs one
extra token. Chonkie's own token_count still says 512, because it counts
the window, not the text.
I reproduced it with 1.7.0 and tiktoken.get_encoding("cl100k_base")
passed as tokenizer=, the same way your adapter builds it, on 1,161,530
tokens of multilingual markdown plus Rust:
- TokenChunker: 3 of 2,269 chunks recount at 513. Each one starts or
ends with U+FFFD, and 30 chunks contain one although the source has
none.
- RecursiveChunker: 0 over 512, and the chunks join back to the exact
input.
So the over-limit count is measuring a real effect, and there's a second
one next to it: those chunks lose the bytes of the split character. If you
want that in the comparison, a check that "".join(chunk.text for chunk in
chunks) == text shows it directly.
—
Reply to this email directly, view it on GitHub
<#689?email_source=notifications&email_token=AOLUXZWNXVOOUACZWA5XWIT5ZXOIJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJXGE2DIMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-19714416>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOLUXZWD7YVPWP6ZPA4HFKT5ZXOIJAVCNFSNUABIKJSXA33TNF2G64TZHM4TKNRZGA4DINBVHNCGS43DOVZXG2LPNY5TCMJTGQYDIMJUUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AOLUXZRX2FGIQ2VWBX5NTZD5ZXOIJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJXGE2DIMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/AOLUXZWYLO7ZVRFTSXATI3T5ZXOIJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJXGE2DIMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Uh oh!
There was an error while loading. Please reload this page.
Hi Chonkie maintainers,
I recently published a reproducible comparison of several text chunkers and would appreciate a sanity check of my Chonkie setup.
I benchmarked Chonkie 1.7.0’s TokenChunker and RecursiveChunker alongside other libraries across 12 workloads. The benchmark used cl100k_base, a 512-token budget, and no overlap, with each library’s documented token-bounded API and default settings where applicable. In this run, TokenChunker produced 18 over-limit chunks, with a maximum of 513 tokens; RecursiveChunker produced none. This is not an equal-feature comparison: text-chipper is Markdown-aware and recounts each delivered chunk.
The benchmark harness and raw results are here:
Could you let me know if I used the recommended APIs and configuration for a fair comparison, or if there’s a setting or method I should include? I’m preparing a separate retrieval-quality evaluation next; any suggestions for a useful dataset or metric would be welcome.
All reactions