AB

alessandrobenigni/bm25-turbo-rust-python-wasm-cli

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

51 stars 2 forks 质量 55 趋势 13AGPL-3.0

最快的 BM25 计分引擎:比 BM25S 快 2300 倍。880万文档下 28K QPS。5 个 BM25 变体(Robertson、Lucene、ATIRE、BM25L、BM25+)。内存映射持久化、宝马修剪、流式索引。

概览

BM25 涡轮⚡锈 ·蟒蛇 ·WASM ·CLI 最快的 BM25 计分引擎。就这么简单。 涉及880万份文件。.预计算稀疏 BM25,支持 BMW 剪枝、内存映射持久性和零复制索引加载。为 RAG 流水线、搜索应用和机器学习工作流程构建。 大多数 BM25 库在查询时计算分数——每次请求扫描倒置索引。BM25 Turbo 采取相反方法:进入压缩稀疏列(CSC)矩阵。查询在服务时间变成稀疏向量查找,无需数学计算。 这使得 BM25 Turbo 成为合适的选择:- 你(RAG、重新排序、批次评估)- 你需要(机器学习流水线、实验)- 你想要(3行索引,1行查询)- 你正在构建一个搜索服务器,不需要完整的搜索服务器 基于MS MARCO(8,841,823份文档,509,962次查询)——标准信息检索基准测试。支持宝马修剪。单线程。 在10万文档以下的语料库中,亚毫秒级。

概述(AI 翻译)

BM25涡轮 ⚡ Rust ·Python ·WASM ·CLI 最快的BM25计分引擎。就这样。


**每秒28,217次查询,880万份文档。8.6毫秒P50延迟。预计算稀疏BM25,支持BMW剪枝、内存映射持久性和零拷贝索引加载。专为RAG流水线、搜索应用和机器学习工作流构建。

为什么是BM25涡轮?

大多数 BM25 库在查询时计算分数——每次请求扫描倒置索引。BM25 Turbo 采取相反方法:在索引时预先计算每个 BM25 分数,形成压缩稀疏列(CSC)矩阵。查询变成稀疏向量查找,服务时间无数学计算。

这使得BM25 Turbo成为以下条件的合适选择:

  • 你多次查询同一个索引(RAG、重新排序、批处理评估)
  • 你需要确定性、可复现的评分(机器学习流水线、实验)
  • 你需要最简单的API(3行索引,1行查询)
  • 你是在构建一个搜索功能,不需要完整的搜索服务器

表演

基于MS MARCO(8,841,823份文档,509,962次查询)——标准信息检索基准测试。支持宝马修剪。单线程。

查询吞吐量

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

BM25 Turbo ⚡ Rust · Python · WASM · CLI The fastest BM25 scoring engine. Period.


28,217 queries/second on 8.8 million documents. 8.6ms P50 latency. Precomputed sparse BM25 with BMW pruning, memory-mapped persistence, and zero-copy index loading. Built for RAG pipelines, search applications, and ML workflows.

use bm25_turbo::{BM25Builder, Method};

let index = BM25Builder::new()
    .method(Method::Lucene)       // Robertson, Lucene, ATIRE, BM25L, BM25+
    .k1(1.5).b(0.75)
    .build_from_corpus(&[
        "Rust is a systems programming language",
        "BM25 is a ranking function used in information retrieval",
        "Machine learning models benefit from fast retrieval",
    ])?;

let results = index.search("information retrieval", 10)?;
for (id, score) in results.doc_ids.iter().zip(results.scores.iter()) {
    println!("doc {} → {:.4}", id, score);
}

Why BM25 Turbo?

Most BM25 libraries compute scores at query time — scanning inverted indexes on every request. BM25 Turbo takes the opposite approach: precompute every BM25 score at index time into a compressed sparse column (CSC) matrix. Queries become sparse vector lookups with no math at serving time.

This makes BM25 Turbo the right choice when:

  • You query the same index many times (RAG, reranking, batch evaluation)
  • You need deterministic, reproducible scores (ML pipelines, experiments)
  • You want the simplest possible API (3 lines to index, 1 line to query)
  • You’re building a search feature and don’t need a full search server

Performance

Benchmarked on MS MARCO (8,841,823 documents, 509,962 queries) — the standard information retrieval benchmark. BMW pruning enabled. Single-threaded.

Query Throughput

Query Latency

Scaling Across Corpus Sizes

Corpus Documents P50 Latency QPS nDCG@10
SciFact 5,183 67 μs 682,127 0.665
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →