- Category
- AI Tools
- Rank
- No. 1573Tools index
Previous survey · No. 1466 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- instructkr
- GitHub
- 149 stars
- Latest release
- v0.4.0
- Date
About
Fast, self-contained BM25 + Bayesian calibration implementation with a minimal Python API — drop into your RAG pipeline for better keyword retrieval.
What it does
bb25 builds a local text corpus, indexes term frequencies, computes BM25 relevance, and converts those signals into probabilities. It can combine lexical evidence with cosine-based vector similarity using probabilistic operations or log-odds fusion. A bundled corpus, queries, experiments, and calibration diagnostics support numerical exploration.
Why it's ranked here
The project has unusual depth for an experimental retrieval package. It covers scoring, probability conversion, hybrid fusion, calibration metrics, debugging traces, and parameter learning behind Python bindings. Its documented SQuAD experiment beats the stated classic BM25 hybrid baseline, but the repository explicitly positions bb25 as experimental validation rather than the production-ready reference implementation.
What's good
The Rust core exposes both lexical and vector scoring through Python. Fusion includes probabilistic AND, OR, complement, weighted log-odds, and gated variants. Calibration support includes Brier score, expected calibration error, reliability data, Platt calibration, and isotonic calibration. Detailed traces expose intermediate priors, logits, probabilities, and fusion values for diagnosis.
Tradeoffs
The built-in tokenizer only lowercases ASCII letters and numbers, so language handling and linguistic normalization are limited. A custom corpus must be indexed before scorers are created, then the Python binding freezes it against modification. The project directs users needing automatic parameter estimation, online learning, ranking-order preservation, or drop-in conversion for an existing search system to the original implementation.
How to use it well
Use bb25 when testing Bayesian treatment of BM25 scores, studying hybrid lexical and dense retrieval, or reproducing the package's numerical experiments. Build and index a stable corpus, calibrate against relevance labels, inspect reliability metrics, and compare fusion choices on your own evaluation set. Do not treat it as a complete search service, embedding generator, or production score-conversion layer.
Technical notes+
Cargo.toml defines the bayesian_bm25 Rust library as both rlib and cdylib, plus the run_experiments binary from src/main.rs. pyproject.toml builds the bb25 Python module with maturin and PyO3 for Python 3.8 or newer. src/corpus.rs stores documents, token frequencies, document frequencies, and average length in memory. src/pybindings.rs requires Corpus.build_index() before constructing BM25Scorer and freezes the shared corpus afterward. src/fusion.rs implements probability operations, gated log-odds conjunction, and normalized sparse-dense blending. src/metrics.rs supplies ECE, Brier score, and reliability bins. src/debug.rs traces BM25, vector, complement, and fusion intermediates.
Observed
- License
- UNLICENSED, classified as Other/Proprietary License
- Primary implementation
- Rust core with Python bindings through PyO3
- Installation
- Published Python package installable with pip
- Build system
- maturin builds the Python extension; Cargo builds the Rust library and experiment binary
- Interfaces
- Python library API and Rust library API, plus a Rust experiment runner binary
- Python support
- Python 3.8 or newer
- Platform declaration
- Package metadata classifies it as operating-system independent
Read from README.md, Makefile, Cargo.toml, pyproject.toml, src/lib.rs, src/main.rs, src/debug.rs, src/corpus.rs, src/fusion.rs, src/metrics.rs, src/defaults.rs, src/tokenizer.rs, src/math_utils.rs, src/pybindings.rs, src/bm25_scorer.rs.
What it can do
Perform BM25 keyword retrieval
Text documents and search query → Ranked list of relevant documents
Apply Bayesian calibration to search scores
Raw BM25 scores → Calibrated relevance scores
Integrate keyword retrieval into RAG pipeline
Document corpus and retrieval queries → Retrieved context for language model prompting
Index documents for fast keyword search
Collection of text documents → Searchable document index
Execute self-contained retrieval operations
Documents and search parameters → Retrieval results without external dependencies
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
