# xhluca/bm25s

Fast BM25 search in Python, powered by Numpy and Numba

Repository: https://github.com/xhluca/bm25s
Canonical: https://ross.abutalabs.com/products/bm25s
Homepage: https://bm25s.github.io
Language: Python
License: MIT
License Family: permissive
Topics: bm25, bm25-l, bm25-plus, lexical-search, retrieval, robertson, search, okapi-bm25, rag, information-retrieval
Last push: 2026-08-25T03:14:31+00:00

## Health v2 (maintenance only)
Score: 92/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 99, longevity 62
- inputs: {"age_days": 875, "days_push": 8, "days_rel": 8, "gap_med": 14.0, "n_releases_24m": 27}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1774, forks 101 (observed 2026-08-28T04:05:34.236906+00:00)

## What it is
BM25S is a pure Python library implementing BM25 lexical ranking using Numpy/Scipy sparse matrices with an optional Numba backend, achieving speeds comparable to or exceeding Elasticsearch without Java or servers. It supports BM25 variants (Okapi, BM25L, BM25+), tokenization, stemming, and Hugging Face Hub index sharing.

## Use cases
- rank documents by relevance to a query in Python
- add fast lexical search to a RAG pipeline without Elasticsearch
- replace rank-bm25 with a much faster BM25 implementation
- build keyword retrieval over a corpus with minimal dependencies
- score and retrieve top-k documents for hybrid search
- share and load prebuilt BM25 indices via Hugging Face Hub

## When to choose
- you need fast BM25 scoring entirely in Python with no Java or web server
- you want a lightweight, low-memory lexical retriever for RAG or hybrid search
- you need BM25 variants like BM25L or BM25+ out of the box

## When to avoid
- you need a full search engine with distributed indexing, faceting, or analytics
- you require advanced analyzers or multilingual tokenization matching Elasticsearch quality
- your corpus is too large to fit in memory as sparse matrices

## Facets
- artifact type: library
- maturity: active
- function: search-engine, nlp, rag
- domain: machine-learning
- platform: python, cross-platform
- tags: bm25, lexical-search, information-retrieval, sparse-matrices, numpy, numba, text-ranking, search, natural-language-processing, retrieval-augmented-generation

## Member repositories
- xhluca/bm25s (main) score 92

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:34.236906+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:25:24.488617+00:00, confidence not recorded.
  - readme: https://github.com/xhluca/bm25s (fetched 2026-08-28T04:05:34.236906+00:00, sha 0dd8ddb0f31f)
  - homepage: https://bm25s.github.io (fetched 2026-08-29T11:03:58.411028+00:00, sha 89cee17e9cc9)
  - registry_pypi: https://pypi.org/pypi/bm25s/json (fetched 2026-08-29T11:03:58.420009+00:00, sha c0f7bdada977)
- Data as of 2026-08-30T08:39:29.467469+00:00.
