r/MachineLearning • ML Engineer • Oct 05 '26

Project A chunking lib in Rust that is ~20x faster [P]

Hey,

I wanted a faster chunking library for my system without affecting the overall accuracy. Did not find many options. So I've build https://github.com/d1pankarmedhi/chunkr

It has most of the chunking strategies like Character, Recursive, Markdown header, Late chunking, Hierarchical chunking, etc. It also supports native PDF loader, and other additional file types.

Some stats (MBA M4 16GB):

Test Case (matched parameters)ChunkrLangChainLlamaIndexChonkiesemchunktext-splitter
Recursive (1 MB, 1000/200)2,264 MB/s769 MB/s10 MB/s225 MB/s42 MB/s175 MB/s
Recursive (5 MB, 1000/200)2,039 MB/s696 MB/s—201 MB/s40 MB/s46 MB/s
Fixed Char (1 MB, 1000/200)750 MB/s1.7 MB/s—22 MB/s——
Markdown (500 KB, 1000/150)819 MB/s67 MB/s19 MB/s——40 MB/s
Python Code (200 KB, 1500/200)3,232 MB/s622 MB/s———5.7 MB/s
Sentence (500 KB)622 MB/s—10 MB/s20 MB/s——
BPE Tokens (200 KB, cl100k_base, 512/50)38 MB/s43 MB/s2.0 MB/s151 MB/s—7.2 MB/s
100 docs x 50 KB (parallel batch)3,224 MB/s679 MB/s—213 MB/s——

Extractor / PipelineLatencyThroughputSpeedup vs PyPDF
Chunkr PDFLoader (Full Text)747.9 ms2,762 pgs/s15.9x Faster
Chunkr PDFLoader (Page Documents)721.0 ms2,865 pgs/s16.5x Faster
PyMuPDF (fitz)2,616.8 ms789.5 pgs/s4.5x Faster
pypdf (pure Python)11,900.5 ms173.6 pgs/s1.0x (baseline)
Chunkr End-to-End (PDF + Recursive)798.1 ms2,589 pgs/s14.9x Faster
PyMuPDF + LangChain RecursiveTextSplitter2,659.3 ms776.9 pgs/s4.5x Faster
pypdf + LangChain RecursiveTextSplitter12,054.5 ms171.4 pgs/s1.0x (baseline)

Accuracy is measured on Chroma's token-level chunking benchmark (5 corpora, 472 questions with gold answer spans): k = 5, 1000 chars / 200 overlap

ImplementationRecallPrecisionIoUprec_ΩAvg chunk chars
Chunkr RecursiveChunker (defaults)0.7920.0570.0570.255854
LangChain RecursiveCharacterTextSplitter0.7620.0600.0600.251745
text-splitter TextSplitter0.7620.0600.0600.262790
Chonkie RecursiveChunker0.7520.0620.0610.292701
semchunk0.7360.0700.0690.260644
LlamaIndex SentenceSplitter0.6540.0130.0130.0544136

Do check it out and share your feedback. Thanks!

16 Upvotes

7 comments sorted by

1

u/Ok_Cartographer5609 ML Engineer Oct 07 '26

The retrieval quality and accuracy table has been updated. Please check out repo for more details.

1

u/Grumlyly Oct 05 '26

Nice results. Where to publish this kind of results ?

1

u/Ok_Cartographer5609 ML Engineer Oct 06 '26

Didn't get what you mean by "publish"? Could you elaborate?

1

u/Grumlyly Oct 07 '26

I'm curious to know in what conferences or journals it's possible to read work like your.

2

u/Ok_Cartographer5609 ML Engineer Oct 07 '26

Keep track of every journal or publisher is not possible. You can probably try https://www.alphaxiv.org/
Although it is mostly focused on Tech.