SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2506.04790 · CVPR · 2025

LotusFilter: Fast Diverse Nearest Neighbor Search via a Learned Cutoff Table

Yusuke Matsui

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2506.04790.json · badge: /api/ran/2506.04790.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
matsui528/lotf community
Papers with Code archive
3 ran · 1 no recorded run
FunctionStatusWhere it lives
batch_range_search Ran
ran; our contract draft was wrong, not the code
matsui528/lotf/src/lotf/core.py
code served (permissive licence) · get_code("02850216018fe759")
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. 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

class MockFaissIndex:
    """Mock Faiss index that implements range_search."""
    def __init__(self, data):
        self.data = data
        self.d = data.shape[1]
    
    def range_search(self, x, thresh):
        """Simple range search implementation for testing."""
        lims = [0]
        dists = []
        ids = []
        
        for query in x:
            # Compute squared L2 distances
            distances = np.sum((self.data - query) ** 2, axis=1)
            # Find neighbors within threshold
            mask = distances <= thresh
            neighbor_ids = np.where(mask)[0]
            neighbor_dists = distances[mask]
            
            dists.extend(neighbor_dists)
            ids.extend(neighbor_ids)
            lims.append(len(dists))
        
        return (
            np.array(lims, dtype=np.int64),
            np.array(dists, dtype=np.float32),
            np.array(ids, dtype=np.int64)
        )

# Create small test data
np.random.seed(42)
X_train = np.random.randn(8, 4).astype(np.float32)
X_query = np.random.randn(6, 4).astype(np.float32)

# Create mock Faiss index
index = MockFaissIndex(X_train)

ARGS = {
    "index": index,
    "X": X_query,
    "thresh": 2.0,
    "bs": 2
}
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 — a tuple 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
build_neighbor_lists Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
matsui528/lotf/src/lotf/core.py
code served (permissive licence) · get_code("3a09eaed6d37475c")
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. 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
import faiss

# Create a small dataset
np.random.seed(0)
N, D = 5, 4
X = np.random.randn(N, D).astype(np.float32)

# Create a Faiss index for range search
index = faiss.IndexFlatL2(D)
index.add(X)

# Define arguments for build_neighbor_lists
ARGS = {
    'X': X,
    'index': index,
    'epsilon': 2.0,
    'with_dist': True,
    'batch_size': 2,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
faiss, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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
flatten_with_offsets Ran
ran; our contract draft was wrong, not the code
matsui528/lotf/src/lotf/core.py
code served (permissive licence) · get_code("af54b8be915373f5")
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. 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 valid arguments for flatten_with_offsets
# The function takes a list of lists (or np arrays) and flattens them

# Create a list of lists with different lengths
list_of_list = [
    [1, 2, 3],
    [4, 5, 6, 7],
    [8, 9]
]

# Map the parameter to its value
ARGS = {
    "list_of_list": list_of_list
}
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 — a tuple 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
CutoffTable Not yet run
unverified (harvested, no recorded run)
matsui528/lotf/src/lotf/core.py
code served (permissive licence) · get_code("eb1f77774104bb33")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 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 4 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

Approximate nearest neighbor search (ANNS) is an essential building block for applications like RAG but can sometimes yield results that are overly similar to each other. In certain scenarios, search results should be similar to the query and yet diverse. We propose LotusFilter, a postprocessing module to diversify ANNS results. We precompute a cutoff table summarizing vectors that are close to each other. During the filtering, LotusFilter greedily looks up the table to delete redundant vectors from the candidates. We demonstrated that the LotusFilter operates fast (0.02 [ms/query]) in settings resembling real-world RAG applications, utilizing features such as OpenAI embeddings. Our code is publicly available at https://github.com/ matsui528/lotf.

For agents

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

get_harvested_code_for_paper("2506.04790")
get_code_for_paper("2506.04790")
have("2506.04790")

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

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

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

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

Connect an agent — have() is free.