SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.03618 · 2024

BM25S: Orders of magnitude faster lexical search via eager sparse scoring

arXiv · PDF · Open in the Atlas

Code that ran

15 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 2 violated it and 5 have no contract verdict; 8 failures of our instrument; 7 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2407.03618.json · badge: /api/ran/2407.03618.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xhluca/bm25s canonical (classifier label)
classifier basis: census
10 ran · 7 no recorded run
xhluca/bm25-benchmarks community (classifier label)
classifier basis not recorded on the link
5 ran · 0 no recorded run
FunctionStatusWhere it lives
can_save_locally Ran
ran, violated the contract we drafted
xhluca/bm25s/bm25s/hf.py
code served (permissive licence) · get_code("e7083f6103f913bb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Test case 1: Non-empty directory with overwrite_local=True
test_dir_1 = os.path.join(temp_dir, "test_dir_1")
os.makedirs(test_dir_1, exist_ok=True)
with open(os.path.join(test_dir_1, "dummy_file.txt"), "w") as f:
    f.write("dummy content")

# Test case 2: Empty directory
test_dir_2 = os.path.join(temp_dir, "test_dir_2")
os.makedirs(test_dir_2, exist_ok=True)

# Test case 3: Non-existent directory
test_dir_3 = os.path.join(temp_dir, "test_dir_3_nonexistent")

ARGS = {
    "local_save_dir": test_dir_1,
    "overwrite_local": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
change_extension Ran
ran; our contract draft was wrong, not the code
xhluca/bm25s/bm25s/utils/corpus.py
code served (permissive licence) · get_code("05fff06955fafff6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import pathlib

torch.manual_seed(0)

# Analyze the function:
# - path: needs to be convertible to str, and have a '.' to partition
# - new_extension: a string to append after the partition

ARGS = {
    "path": "model.pth",
    "new_extension": ".safetensors"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
clean_results_keys Ran
ran; our contract draft was wrong, not the code
xhluca/bm25s/bm25s/utils/beir.py
code served (permissive licence) · get_code("d4e1a0e6133bc36b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Construct valid arguments for clean_results_keys
# The function takes beir_results dict and extracts keys by splitting on '@' and taking the last part

beir_results = {
    "metric@1": 0.85,
    "recall@10": 0.92,
    "precision@5": 0.78,
    "ndcg@100": 0.88,
    "mrr@10": 0.91
}

ARGS = {
    "beir_results": beir_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_top_k_from_scores Ran
ran on a synthesized input
xhluca/bm25-benchmarks/benchmark/on_bm25_pt.py
code served (permissive licence) · get_code("f16a6001458fe054")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample scores as a numpy array
scores = np.array([0.1, 0.9, 0.3, 0.7, 0.5, 0.8, 0.2, 0.6, 0.4, 0.95])

# Create a sample corpus (list of items)
corpus = ["item_0", "item_1", "item_2", "item_3", "item_4", 
          "item_5", "item_6", "item_7", "item_8", "item_9"]

# Define arguments
ARGS = {
    "scores": scores,
    "corpus": corpus,
    "k": 3,
    "sorting": True,
    "with_scores": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_top_k_from_scores Ran
ran on a synthesized input
xhluca/bm25-benchmarks/benchmark/on_rank_bm25.py
code served (permissive licence) · get_code("cda747e09a9100fd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create sample scores array
scores = np.array([0.1, 0.9, 0.3, 0.7, 0.2, 0.8, 0.4, 0.6, 0.5, 0.95])

# Create a sample corpus (list of strings or items)
corpus = ["item_0", "item_1", "item_2", "item_3", "item_4", 
          "item_5", "item_6", "item_7", "item_8", "item_9"]

# Define arguments for the function
ARGS = {
    "scores": scores,
    "corpus": corpus,
    "k": 5,
    "sorting": True,
    "with_scores": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_tokenized_to_string_list Ran
ran; our contract draft was wrong, not the code
xhluca/bm25s/bm25s/tokenization.py
code served (permissive licence) · get_code("ab7f90eda021ae13")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import List, Dict, NamedTuple

class Tokenized(NamedTuple):
    """
    NamedTuple with two fields: ids and vocab. The ids field is a list of list of token IDs
    for each document. The vocab field is a dictionary mapping tokens to their index in the
    vocabulary.
    """
    ids: List[List[int]]
    vocab: Dict[str, int]

    def __repr__(self):
        """
        Returns:
            a string representation of the class.
            for example, for a small corpus, it would be something like:
            ----
            Tokenized(
              "ids": [
                0: [0, 1, 2, 3]
              ],
              "vocab": [
                '': 4
                'cat': 0
                'feline': 1
                'likes': 2
                'purr': 3
              ],
            )
            ----

            and, for example, for a large corpus, it would be something like:
            ----
            Tokenized(
              "ids": [
                0: [0, 1, 2, 3]
                1: [4, 5, 6, 7, 8, 9]
                2: [10, 11, 12, 13, 14]
                3: [15, 16, 17, 18, 19]
                4: [0, 1, 2, 3, 0, 20, 21, 22, 23, 24, ...]
                5: [0, 1, 2, 3]
                6: [4, 5, 6, 7, 8, 9]
                7: [10, 11, 12, 13, 14]
                8: [15, 16, 17, 18, 19]
                9: [0, 1, 2, 3, 0, 20, 21, 22, 23, 24, ...]
                ... (total 500000 docs)
              ],
              "vocab": [
                '': 29
                'animal': 12
                'beautiful': 11
                'best': 6
                'bird': 10
                'can': 13
                'carefully': 27
                'casually': 28
                'cat': 0
                'creature': 16
                ... (total 30 tokens)
              ],
            )
            ----
        """
        lines_print_max_num = 10
        single_doc_print_max_len = 10
        lines = ['Tokenized(', '  "ids": [']
        for doc_idx, document in enumerate(self.ids[:lines_print_max_num]):
            preview = document[:single_doc_print_max_len]
            if len(document) > single_doc_print_max_len:
                preview += ['...']
            lines.append(f"    {doc_idx}: [{', '.join([str(x) for x in preview])}]")
        if len(self.ids) > lines_print_max_num:
            lines.append(f'    ... (total {len(self.ids)} docs)')
        lines.append(f'  ],\n  "vocab": [')
        vocab_keys = sorted(list(self.vocab.keys()))
        for vocab_idx, key_ in enumerate(vocab_keys[:lines_print_max_num]):
            val_ = self.vocab[key_]
            lines.append(f'    {key_!r}: {val_}')
        if len(list(vocab_keys)) > 10:
            lines.append(f'    ... (total {len(vocab_keys)} tokens)')
        lines.append('  ],\n)')
        return '\n'.join(lines)

# Create a small but complete Tokenized object
vocab = {
    'cat': 0,
    'feline': 1,
    'likes': 2,
    'purr': 3,
    '': 4
}

ids = [
    [0, 1, 2, 3],
    [0, 2, 1]
]

tokenized = Tokenized(ids=ids, vocab=vocab)

ARGS = {
    'tokenized': tokenized
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dumps_with_builtin Ran
ran; our contract draft was wrong, not the code
xhluca/bm25s/bm25s/utils/json_functions.py
code served (permissive licence) · get_code("59ca7ac3fdaff9b0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json

def dumps_with_builtin(d: dict, **kwargs) -> str:
    return json.dumps(d, **kwargs)

# Construct valid arguments
d_example = {
    "name": "test",
    "value": 42,
    "nested": {
        "key": "data",
        "number": 3.14
    },
    "list": [1, 2, 3]
}

ARGS = {
    "d": d_example,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate Ran
ran on a synthesized input
xhluca/bm25-benchmarks/benchmark/on_bm25s.py
code served (permissive licence) · get_code("cae3ad88ac9412a8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math

# Construct minimal qrels dict
# Structure: {query_id: {doc_id: relevance_score, ...}, ...}
qrels = {
    'q1': {
        'doc1': 2,  # relevant with score 2
        'doc2': 1,  # relevant with score 1
        'doc3': 0,  # not relevant
    },
    'q2': {
        'doc4': 1,  # relevant with score 1
        'doc5': 0,  # not relevant
    },
}

# Construct minimal results dict
# Structure: {query_id: {doc_id: score, ...}, ...}
results = {
    'q1': {
        'doc1': 0.9,  # high score
        'doc3': 0.7,  # medium score
        'doc2': 0.5,  # low score
    },
    'q2': {
        'doc4': 0.8,
        'doc5': 0.6,
    },
}

# k_values for evaluation
k_values = [1, 2, 5]

# ignore_identical_ids parameter
ignore_identical_ids = True

ARGS = {
    'qrels': qrels,
    'results': results,
    'k_values': k_values,
    'ignore_identical_ids': ignore_identical_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
format_beir_result_keys Ran
ran on a synthesized input
xhluca/bm25-benchmarks/benchmark/on_pisa.py
code served (permissive licence) · get_code("ac6986c427c852da")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# The function format_beir_result_keys takes a dict with keys that contain '@' characters
# and returns a new dict where keys are split by '@' and only the last part is kept

beir_results = {
    "metric@5": 0.85,
    "ndcg@10": 0.92,
    "recall@100": 0.78,
    "precision@5": 0.88
}

ARGS = {
    "beir_results": beir_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
heap_pop Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xhluca/bm25s/bm25s/numba/selection.py
code served (permissive licence) · get_code("0a07896a7f42f858")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create numpy arrays for a small heap structure
# values: array of numeric values
# indices: array of corresponding indices
# length: number of elements currently in the heap

values = np.array([1.5, 3.2, 2.1, 4.0, 5.5], dtype=np.float64)
indices = np.array([0, 1, 2, 3, 4], dtype=np.int64)
length = 5

ARGS = {
    "values": values,
    "indices": indices,
    "length": length
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_dir_empty Ran
ran, violated the contract we drafted
xhluca/bm25s/bm25s/hf.py
code served (permissive licence) · get_code("cd3dee563db75da9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory for testing
test_dir_empty = tempfile.mkdtemp()
test_dir_nonempty = tempfile.mkdtemp()

# Create a file in the non-empty directory
with open(os.path.join(test_dir_nonempty, "test_file.txt"), "w") as f:
    f.write("test")

# Test with a directory that doesn't exist
test_dir_nonexistent = os.path.join(tempfile.gettempdir(), "nonexistent_dir_12345")
if os.path.exists(test_dir_nonexistent):
    shutil.rmtree(test_dir_nonexistent)

ARGS = {
    "local_save_dir": test_dir_empty
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_qrels_dict Ran
ran on a synthesized input
xhluca/bm25-benchmarks/benchmark/on_bm25s.py
code served (permissive licence) · get_code("4cc099c26fff4c42")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from pathlib import Path

# Create a temporary directory structure with a valid qrels file
temp_dir = tempfile.mkdtemp()
dataset_name = 'test_dataset'
dataset_path = Path(temp_dir) / dataset_name / 'qrels'
dataset_path.mkdir(parents=True, exist_ok=True)

# Create a valid qrels TSV file
qrels_file = dataset_path / 'test.tsv'
with open(qrels_file, 'w') as f:
    f.write('qid\tcid\tscore\n')
    f.write('q1\tc1\t1\n')
    f.write('q1\tc2\t0\n')
    f.write('q2\tc3\t1\n')

ARGS = {
    'dataset': dataset_name,
    'split': 'test',
    'save_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
postprocess_results_for_eval Ran
ran; our contract draft was wrong, not the code
xhluca/bm25s/bm25s/utils/beir.py
code served (permissive licence) · get_code("bd26864807521fc2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct small sample data that mimics BM25S output format
# results: list of lists, where each inner list contains document IDs (strings)
results = [
    ['doc_1', 'doc_2', 'doc_3'],
    ['doc_4', 'doc_5']
]

# scores: list of arrays/lists, where each contains relevance scores
scores = [
    np.array([0.95, 0.87, 0.72]),
    np.array([0.88, 0.61])
]

# query_ids: list of query identifiers
query_ids = ['query_0', 'query_1']

ARGS = {
    'results': results,
    'scores': scores,
    'query_ids': query_ids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
topk Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xhluca/bm25s/bm25s/selection.py
code served (permissive licence) · get_code("679762797d78948e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set up small query scores array (1D array as per function docstring)
query_scores = np.array([0.9, 0.1, 0.8, 0.2, 0.7, 0.3])

# Set k to be smaller than the array length
k = 3

# Set backend to 'numpy' to avoid JAX dependency issues
backend = 'numpy'

# Set sorted to True to test the sorting logic
sorted_flag = True

ARGS = {
    'query_scores': query_scores,
    'k': k,
    'backend': backend,
    'sorted': sorted_flag
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
topk Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xhluca/bm25s/bm25s/numba/selection.py
code served (permissive licence) · get_code("95129e49e1d55862")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a 1D array of random scores for the query
np.random.seed(0)
query_scores = np.array([0.9, 0.3, 0.7, 0.1, 0.8, 0.5, 0.2, 0.6], dtype=np.float32)

# Define k as the number of top results to retrieve
k = 3

# Define backend
backend = 'numba'

# Define sorted parameter
sorted_flag = True

ARGS = {
    'query_scores': query_scores,
    'k': k,
    'backend': backend,
    'sorted': sorted_flag
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
batch_tokenize Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/hf.py
code served (permissive licence) · get_code("4690c1cf386dfd10")
How it ran

no invocation recorded.

download_dataset Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/utils/beir.py
code served (permissive licence) · get_code("a195383bf3405f8c")
How it ran

no invocation recorded.

dumps_with_orjson Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/utils/json_functions.py
code served (permissive licence) · get_code("16c525229af810b0")
How it ran

no invocation recorded.

find_newline_positions Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/utils/corpus.py
code served (permissive licence) · get_code("572c5677af80154d")
How it ran

no invocation recorded.

get_max_memory_usage Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/utils/benchmark.py
code served (permissive licence) · get_code("c7e33bb0befabc76")
How it ran

no invocation recorded.

load_mmindex Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/utils/corpus.py
code served (permissive licence) · get_code("05a414c3417e7237")
How it ran

no invocation recorded.

tokenize Not yet run
unverified (harvested, no recorded run)
xhluca/bm25s/bm25s/tokenization.py
code served (permissive licence) · get_code("7c70347879b998bf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 22 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We introduce BM25S, an efficient Python-based implementation of BM25 that only depends on Numpy and Scipy. BM25S achieves up to a 500x speedup compared to the most popular Python-based framework by eagerly computing BM25 scores during indexing and storing them into sparse matrices. It also achieves considerable speedups compared to highly optimized Java-based implementations, which are used by popular commercial products. Finally, BM25S reproduces the exact implementation of five BM25 variants based on Kamphuis et al. (2020) by extending eager scoring to non-sparse variants using a novel score shifting method. The code can be found at https://github.com/xhluca/bm25s

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2407.03618")
get_code_for_paper("2407.03618")
have("2407.03618")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2407.03618.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2407.03618.svg)](https://syntology.ai/paper/2407.03618)

Connect an agent — have() is free.