Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Fast BM25 search in Python, powered by Numpy and Numba
| Date | Stars |
|---|---|
| 2026-07-24 | 1746 |
| 2026-07-25 | 1746 |
| 2026-07-28 | 1746 |
| 2026-07-30 | 1746 |
| 2026-08-06 | 1746 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
35.0
growth rate 0.00%/day
<div align="center">
<h1>BM25S⚡</h1>
<i>BM25S (or BM25-Sparse) is an ultrafast implementation of BM25 in pure Python, powered by Numpy</i>
<table>
<tr>
<td>
<a href="https://github.com/xhluca/bm25s">💻 GitHub</a>
</td>
<td>
<a href="https://bm25s.github.io">🏠 Homepage</a>
</td>
<td>
<a href="https://arxiv.org/abs/2407.03618">📝 Technical Report</a>
</td>
<td>
<a href="https://huggingface.co/blog/xhluca/bm25s">🤗 Blog Post</a>
</td>
<td>
<a href="#installation">🛠️ Installation</a>
</td>
</tr>
</table>
<a href="https://pepy.tech/projects/bm25s"><img src="https://static.pepy.tech/badge/bm25s" alt="PyPI Downloads"></a>
<a href="https://pypi.org/project/bm25s/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/bm25s"></a>
<a href="https://github.com/xhluca/bm25s/blob/main/LICENSE"><img alt="GitHub License" src="https://img.shields.io/github/license/xhluca/bm25s?link=https%3A%2F%2Fgithub.com%2Fxhluca%2Fbm25s%2Fblob%2Fmain%2FLICENSE"></a>
<a href="https://github.com/xhluca/bm25s/pulls?q=is%3Apr+is%3Aclosed"><img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues-pr-closed/xhluca/bm25s"></a>
<a href="https://github.com/xhluca/bm25s/discussions"><img alt="GitHub Discussions" src="https://img.shields.io/github/discussions/xhluca/bm25s?link=https%3A%2F%2Fgithub.com%2Fxhluca%2Fbm25s%2Fdiscussions"></a>
</div>
Welcome to `bm25s`, a library that implements BM25 in Python, allowing you to rank documents based on a query. BM25 is a widely used ranking function used for text retrieval tasks, and is a core component of search services like Elasticsearch.
It is designed to be:
* **Fast**: `bm25s` is implemented in pure Python and leverage sparse matrices to store eagerly computed scores for all document tokens. This allows extremely fast scoring at query time, improving performance over popular libraries by orders of magnitude (see benchmarks below).
* **Simple**: `bm25s` is designed to be easy to use and understand. You can install it with pip and start using it in minutes. There is no dependencies on Java or Pytorch - all you need is Numpy, and optional lightweight dependencies for stemming and speedup via `numba` compilation.
Below, we compare `bm25s` with Elasticsearch in terms of speedup over `rank-bm25`, the most popular Python implementation of BM25. We measure the throughput in queries per second (QPS) on a few popular datasets from [BEIR](https://github.com/beir-cellar/beir) in a single-threaded setting.

> [!IMPORTANT]
> New in version 0.2.0: We are rolling out support for a numba backend, which gives around [2x speedup for larger datasets](https://github.com/xhluca/bm25-benchmarks?tab=readme-ov-file#queries-per-second)! Learn more about it and share your thoughts in [the version 0.2.0 release thread](https://github.com/xhluca/bm25s/discussions/58).
<details open>
<summary>Show/Hide citation</summary><br>
```
@misc{bm25s,
title={BM25S: Orders of magnitude faster lexical search via eager sparse scoring},
author={Xing Han Lù},
year={2024},
eprint={2407.03618},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2407.03618},
}
```
</details>
## Installation
You can install `bm25s` with pip:
```bash
pip install bm25s
```
You can install the recommended (but optional) dependencies:
```bash
# HIGHLY RECOMMENDED: To install all core dependencies (json loading, progress bar, stemming, JIT compilation)
pip install "bm25s[core]"
# If you just want to use stemming for better results, you can install a stemmer
pip install PyStemmer
# Install all extra dependencies
pip install "bm25s[full]"
```
## Quickstart
Here is a simple example of how to use `bm25s`:
```python
import Excerpt of 27,824 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:3b381ab9127bff1f, topic:rag