Skip to content

Commit 8a4bfc6

Browse files
committed
feat(milvus): add SCANN index support
- Add SCANN index type for Milvus - Build params: nlist (default: 1024), with_raw_data (default: false) - Search params: reorder_k (default: 100) - Add UI configuration for SCANN index Signed-off-by: JackLCL <chenglong.li@zilliz.com>
1 parent 3e6c993 commit 8a4bfc6

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

vectordb_bench/backend/clients/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class IndexType(str, Enum):
4141
GPU_IVF_PQ = "GPU_IVF_PQ"
4242
GPU_CAGRA = "GPU_CAGRA"
4343
SCANN = "scann"
44+
SCANN_MILVUS = "SCANN_MILVUS"
4445
Hologres_HGraph = "HGraph"
4546
Hologres_Graph = "Graph"
4647
NONE = "NONE"

vectordb_bench/backend/clients/milvus/config.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,29 @@ def search_param(self) -> dict:
414414
}
415415

416416

417+
class SCANNConfig(MilvusIndexConfig, DBCaseConfig):
418+
nlist: int = 1024
419+
with_raw_data: bool = False
420+
reorder_k: int | None = 100
421+
index: IndexType = IndexType.SCANN_MILVUS
422+
423+
def index_param(self) -> dict:
424+
return {
425+
"metric_type": self.parse_metric(),
426+
"index_type": "SCANN",
427+
"params": {
428+
"nlist": self.nlist,
429+
"with_raw_data": self.with_raw_data,
430+
},
431+
}
432+
433+
def search_param(self) -> dict:
434+
return {
435+
"metric_type": self.parse_metric(),
436+
"params": {"reorder_k": self.reorder_k},
437+
}
438+
439+
417440
_milvus_case_config = {
418441
IndexType.AUTOINDEX: AutoIndexConfig,
419442
IndexType.HNSW: HNSWConfig,
@@ -430,4 +453,5 @@ def search_param(self) -> dict:
430453
IndexType.GPU_IVF_PQ: GPUIVFPQConfig,
431454
IndexType.GPU_CAGRA: GPUCAGRAConfig,
432455
IndexType.GPU_BRUTE_FORCE: GPUBruteForceConfig,
456+
IndexType.SCANN_MILVUS: SCANNConfig,
433457
}

vectordb_bench/frontend/config/dbCaseConfigs.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ class CaseConfigInput(BaseModel):
411411
IndexType.IVFPQ.value,
412412
IndexType.IVFSQ8.value,
413413
IndexType.IVF_RABITQ.value,
414+
IndexType.SCANN_MILVUS.value,
414415
IndexType.DISKANN.value,
415416
IndexType.Flat.value,
416417
IndexType.AUTOINDEX.value,
@@ -1014,12 +1015,33 @@ class CaseConfigInput(BaseModel):
10141015
IndexType.IVFPQ.value,
10151016
IndexType.IVFSQ8.value,
10161017
IndexType.IVF_RABITQ.value,
1018+
IndexType.SCANN_MILVUS.value,
10171019
IndexType.GPU_IVF_FLAT.value,
10181020
IndexType.GPU_IVF_PQ.value,
10191021
IndexType.GPU_BRUTE_FORCE.value,
10201022
],
10211023
)
10221024

1025+
CaseConfigParamInput_with_raw_data = CaseConfigInput(
1026+
label=CaseConfigParamType.with_raw_data,
1027+
inputType=InputType.Option,
1028+
inputHelp="Whether to include raw data in the index. Setting to True enables reordering with original vectors.",
1029+
inputConfig={"options": [False, True]},
1030+
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None) == IndexType.SCANN_MILVUS.value,
1031+
)
1032+
1033+
CaseConfigParamInput_reorder_k = CaseConfigInput(
1034+
label=CaseConfigParamType.reorder_k,
1035+
inputType=InputType.Number,
1036+
inputHelp="Number of candidate vectors to reorder. Must be greater than or equal to k.",
1037+
inputConfig={
1038+
"min": 1,
1039+
"max": 65536,
1040+
"value": 100,
1041+
},
1042+
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None) == IndexType.SCANN_MILVUS.value,
1043+
)
1044+
10231045
CaseConfigParamInput_Nprobe = CaseConfigInput(
10241046
label=CaseConfigParamType.Nprobe,
10251047
inputType=InputType.Number,
@@ -1908,6 +1930,7 @@ class CaseConfigInput(BaseModel):
19081930
CaseConfigParamInput_M,
19091931
CaseConfigParamInput_EFConstruction_Milvus,
19101932
CaseConfigParamInput_Nlist,
1933+
CaseConfigParamInput_with_raw_data,
19111934
CaseConfigParamInput_M_PQ,
19121935
CaseConfigParamInput_Nbits_PQ,
19131936
CaseConfigParamInput_intermediate_graph_degree,
@@ -1927,6 +1950,8 @@ class CaseConfigInput(BaseModel):
19271950
CaseConfigParamInput_EF_Milvus,
19281951
CaseConfigParamInput_SearchList,
19291952
CaseConfigParamInput_Nlist,
1953+
CaseConfigParamInput_with_raw_data,
1954+
CaseConfigParamInput_reorder_k,
19301955
CaseConfigParamInput_Nprobe,
19311956
CaseConfigParamInput_M_PQ,
19321957
CaseConfigParamInput_Nbits_PQ,

vectordb_bench/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class CaseConfigParamType(Enum):
8181
refine_k = "refine_k"
8282
rbq_bits_query = "rbq_bits_query"
8383
sq_type = "sq_type"
84+
with_raw_data = "with_raw_data"
85+
reorder_k = "reorder_k"
8486
level = "level"
8587
maintenance_work_mem = "maintenance_work_mem"
8688
max_parallel_workers = "max_parallel_workers"

0 commit comments

Comments
 (0)