chunk-bench
Benchmark RAG chunking strategies on your own documents. Compare fixed, sliding, paragraph, and recursive chunking with real retrieval metrics.
Why chunk-bench?
Chunking strategy is one of the highest-impact decisions in a RAG pipeline — 2026 benchmarks show up to a 9% recall gap between best and worst strategy on the same corpus. But most teams pick a strategy once and never measure whether it's actually working for their documents.
chunk-bench lets you run all four strategies against your own text and queries in one call, and get back recall, precision, and MRR scores — no embeddings required, no external services.
Install
pip install chunk-bench
Quick start
from chunk_bench import ChunkBench
bench = ChunkBench()
report = bench.run(
text=your_document_text,
queries=["What is retrieval augmented generation?",
"How does chunking affect retrieval quality?",
"What is the difference between fixed and semantic chunking?"],
)
print(report.summary_table())
Output:
Strategy Chunks Avg Tokens Recall Precision MRR F1
────────────────────────────────────────────────────────────────────────
recursive 18 94 0.857 0.733 0.833 0.790
paragraph 12 142 0.810 0.700 0.810 0.752
fixed 24 71 0.762 0.667 0.762 0.711
sliding 31 55 0.714 0.633 0.714 0.671
────────────────────────────────────────────────────────────────────────
Best recall: recursive (0.857)
Best F1: recursive (0.790)
Best MRR: recursive (0.833)
Providing your own relevance terms
report = bench.run(
text=your_document,
queries=["What is GDPR?", "What are data subject rights?"],
relevant_terms=[
["GDPR", "General Data Protection", "regulation"],
["subject", "rights", "access", "erasure", "portability"],
],
top_k=5,
)
Use specific strategies
report = bench.run(
text=text,
queries=queries,
strategies=["fixed", "recursive"], # skip sliding and paragraph
chunk_size=512,
overlap=50,
)
Chunk any text directly
from chunk_bench import chunk
chunks = chunk(text, strategy="recursive", chunk_size=512, overlap=50)
for c in chunks:
print(f"[{c.index}] ~{c.token_count} tokens: {c.text[:60]}")
CLI
chunk-bench document.txt --queries "What is X?" "How does Y work?" --strategies fixed recursive --json
Strategies
| Strategy | Description | Best for |
|---|---|---|
fixed |
Split at regular character intervals with overlap | Simple, uniform documents |
sliding |
Overlapping windows stepping forward | When context preservation matters most |
paragraph |
Split on double newlines, merge small paragraphs | Structured documents with clear sections |
recursive |
Try paragraph → sentence → word boundaries | Most document types — good default |
Metadata
Release files for chunk-bench 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chunk_bench-1.0.0.tar.gz | 12.5 kB | With provenance | Details for chunk_bench-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chunk_bench-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for chunk_bench-1.0.0-py3-none-any.whl |
Total release size: 22.7 kB
Release files / chunk_bench-1.0.0.tar.gz
| Download URL | chunk_bench-1.0.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d9985f371cb798567976591a7628063d9aeaac2d610d186d1dd05e46599b9a6
|
|
BLAKE2b-256 checksum How to use checksums |
a84220d219ffc27aa5a702f12b7a3a8f4635e534a3fbef47d9472b5f6269b957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logRelease files / chunk_bench-1.0.0-py3-none-any.whl
| Download URL | chunk_bench-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e397505adddd82472c818c5acd4cb7da110265a6b023075e196ee8db9c62455
|
|
BLAKE2b-256 checksum How to use checksums |
97941c67b83f37416a573e87a1d41049aa975a532aa50965874bc6e4684c6eca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logSecurity for chunk-bench 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for chunk_bench-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.