From bae13e59069729b6fe43f72299b066dc7e3338e8 Mon Sep 17 00:00:00 2001 From: Divye Gala Date: Wed, 1 Nov 2023 16:04:52 -0400 Subject: [PATCH] Add constraints to `hnswlib` in `raft-bench-ann` (#1949) This PR adds a constraint for `hnswlib` search params such that `ef >= k` Authors: - Divye Gala (https://github.com/divyegala) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: https://github.com/rapidsai/raft/pull/1949 --- .../src/raft-ann-bench/constraints/__init__.py | 5 +++++ .../src/raft-ann-bench/run/conf/algos/hnswlib.yaml | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/constraints/__init__.py b/python/raft-ann-bench/src/raft-ann-bench/constraints/__init__.py index b61d185356..d827c3d1e1 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/constraints/__init__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/constraints/__init__.py @@ -38,3 +38,8 @@ def raft_ivf_pq_search_constraints(params, build_params, k, batch_size): def raft_cagra_search_constraints(params, build_params, k, batch_size): if "itopk" in params: return params["itopk"] >= k + + +def hnswlib_search_constraints(params, build_params, k, batch_size): + if "ef" in params: + return params["ef"] >= k diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/conf/algos/hnswlib.yaml b/python/raft-ann-bench/src/raft-ann-bench/run/conf/algos/hnswlib.yaml index 021ca96bcd..9268c4cb08 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/conf/algos/hnswlib.yaml +++ b/python/raft-ann-bench/src/raft-ann-bench/run/conf/algos/hnswlib.yaml @@ -1,8 +1,10 @@ name: hnswlib +constraints: + search: raft-ann-bench.constraints.hnswlib_search_constraints groups: base: build: M: [12, 16, 24, 36] efConstruction: [64, 128, 256, 512] search: - ef: [10, 20, 40, 60, 80, 120, 200, 400, 600, 800] \ No newline at end of file + ef: [10, 20, 40, 60, 80, 120, 200, 400, 600, 800]