MENU

GET IN TOUCH

Back

chunkaudit: Auditing RAG Chunking

Year

2026

Tech & Technique

Python, NumPy, BM25, pytest, GitHub Actions

Description

An open-source Python tool that audits RAG chunking strategies. For each strategy it reports how often the text that answers a question is split across two chunks, and whether retrieval still returns a chunk that contains the whole answer.

Key facts:
  • Four chunkers (fixed, sentence, paragraph, recursive) that keep character spans, a BM25 retriever on an inverted index, and support for custom chunkers and retrievers.
  • Reports answer split rate, Recall@k, MRR and context size. Offline and deterministic: no API keys, and NumPy is the only dependency.
  • On SQuAD v1.1 (48 long documents, 10,570 questions), fixed 200-word chunks with no overlap split the answering sentence in 14.1% of questions. A 50-word overlap cut that to 1.1% and raised Recall@5 from 78.7% to 90.2%.
  • A --show-splits option lists the answers a strategy cut, with the cut position marked.

The method, the full results and the caveats are in the write-up.

My Role

Author and maintainer
  • Designed the span-based audit and the metrics.
  • Tests, type checks and CI on Python 3.10 to 3.13.
Nine strategies on SQuAD v1.1
Real output of the audit on 10,570 questions. Fixed 100-word chunks split 29.0% of answers; sentence-aware and paragraph-aware strategies split none.
The bundled demo
Output of "chunkaudit demo" on the sample dataset of 5 articles and 20 questions that ships with the package.

VISHAL-KRISHNA

vishalkrishnakkr@gmail.com