33from pydantic import BaseModel
44from vectordb_bench .backend .cases import CaseLabel , CaseType
55from vectordb_bench .backend .clients import DB
6- from vectordb_bench .backend .clients .api import IndexType , MetricType
6+ from vectordb_bench .backend .clients .api import IndexType , MetricType , SQType
77from vectordb_bench .frontend .components .custom .getCustomConfig import get_custom_configs
88
99from vectordb_bench .models import CaseConfig , CaseConfigParamType
@@ -164,10 +164,13 @@ class CaseConfigInput(BaseModel):
164164 inputConfig = {
165165 "options" : [
166166 IndexType .HNSW .value ,
167+ IndexType .HNSW_SQ .value ,
168+ IndexType .HNSW_PQ .value ,
169+ IndexType .HNSW_PRQ .value ,
167170 IndexType .IVFFlat .value ,
168171 IndexType .IVFSQ8 .value ,
172+ IndexType .IVF_RABITQ .value ,
169173 IndexType .DISKANN .value ,
170- IndexType .STREAMING_DISKANN .value ,
171174 IndexType .Flat .value ,
172175 IndexType .AUTOINDEX .value ,
173176 IndexType .GPU_IVF_FLAT .value ,
@@ -346,9 +349,16 @@ class CaseConfigInput(BaseModel):
346349 "max" : 64 ,
347350 "value" : 30 ,
348351 },
349- isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) == IndexType .HNSW .value ,
352+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
353+ in [
354+ IndexType .HNSW .value ,
355+ IndexType .HNSW_SQ .value ,
356+ IndexType .HNSW_PQ .value ,
357+ IndexType .HNSW_PRQ .value ,
358+ ],
350359)
351360
361+
352362CaseConfigParamInput_m = CaseConfigInput (
353363 label = CaseConfigParamType .m ,
354364 inputType = InputType .Number ,
@@ -369,7 +379,62 @@ class CaseConfigInput(BaseModel):
369379 "max" : 512 ,
370380 "value" : 360 ,
371381 },
372- isDisplayed = lambda config : config [CaseConfigParamType .IndexType ] == IndexType .HNSW .value ,
382+ isDisplayed = lambda config : config [CaseConfigParamType .IndexType ]
383+ in [
384+ IndexType .HNSW .value ,
385+ IndexType .HNSW_SQ .value ,
386+ IndexType .HNSW_PQ .value ,
387+ IndexType .HNSW_PRQ .value ,
388+ ],
389+ )
390+
391+ CaseConfigParamInput_SQType = CaseConfigInput (
392+ label = CaseConfigParamType .sq_type ,
393+ inputType = InputType .Option ,
394+ inputHelp = "Scalar quantizer type." ,
395+ inputConfig = {
396+ "options" : [SQType .SQ6 .value , SQType .SQ8 .value , SQType .BF16 .value , SQType .FP16 .value , SQType .FP32 .value ]
397+ },
398+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .HNSW_SQ .value ],
399+ )
400+
401+ CaseConfigParamInput_Refine = CaseConfigInput (
402+ label = CaseConfigParamType .refine ,
403+ inputType = InputType .Option ,
404+ inputHelp = "Whether refined data is reserved during index building." ,
405+ inputConfig = {"options" : [True , False ]},
406+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
407+ in [IndexType .HNSW_SQ .value , IndexType .HNSW_PQ .value , IndexType .HNSW_PRQ .value , IndexType .IVF_RABITQ .value ],
408+ )
409+
410+ CaseConfigParamInput_RefineType = CaseConfigInput (
411+ label = CaseConfigParamType .refine_type ,
412+ inputType = InputType .Option ,
413+ inputHelp = "The data type of the refine index." ,
414+ inputConfig = {
415+ "options" : [SQType .FP32 .value , SQType .FP16 .value , SQType .BF16 .value , SQType .SQ8 .value , SQType .SQ6 .value ]
416+ },
417+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
418+ in [IndexType .HNSW_SQ .value , IndexType .HNSW_PQ .value , IndexType .HNSW_PRQ .value , IndexType .IVF_RABITQ .value ]
419+ and config .get (CaseConfigParamType .refine , True ),
420+ )
421+
422+ CaseConfigParamInput_RefineK = CaseConfigInput (
423+ label = CaseConfigParamType .refine_k ,
424+ inputType = InputType .Float ,
425+ inputHelp = "The magnification factor of refine compared to k." ,
426+ inputConfig = {"min" : 1.0 , "max" : 10000.0 , "value" : 1.0 },
427+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
428+ in [IndexType .HNSW_SQ .value , IndexType .HNSW_PQ .value , IndexType .HNSW_PRQ .value , IndexType .IVF_RABITQ .value ]
429+ and config .get (CaseConfigParamType .refine , True ),
430+ )
431+
432+ CaseConfigParamInput_RBQBitsQuery = CaseConfigInput (
433+ label = CaseConfigParamType .rbq_bits_query ,
434+ inputType = InputType .Number ,
435+ inputHelp = "The magnification factor of refine compared to k." ,
436+ inputConfig = {"min" : 0 , "max" : 8 , "value" : 0 },
437+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .IVF_RABITQ .value ],
373438)
374439
375440CaseConfigParamInput_EFConstruction_Weaviate = CaseConfigInput (
@@ -519,7 +584,13 @@ class CaseConfigInput(BaseModel):
519584 "max" : MAX_STREAMLIT_INT ,
520585 "value" : 100 ,
521586 },
522- isDisplayed = lambda config : config [CaseConfigParamType .IndexType ] == IndexType .HNSW .value ,
587+ isDisplayed = lambda config : config [CaseConfigParamType .IndexType ]
588+ in [
589+ IndexType .HNSW .value ,
590+ IndexType .HNSW_SQ .value ,
591+ IndexType .HNSW_PQ .value ,
592+ IndexType .HNSW_PRQ .value ,
593+ ],
523594)
524595
525596CaseConfigParamInput_EF_Weaviate = CaseConfigInput (
@@ -561,6 +632,7 @@ class CaseConfigInput(BaseModel):
561632 in [
562633 IndexType .IVFFlat .value ,
563634 IndexType .IVFSQ8 .value ,
635+ IndexType .IVF_RABITQ .value ,
564636 IndexType .GPU_IVF_FLAT .value ,
565637 IndexType .GPU_IVF_PQ .value ,
566638 IndexType .GPU_BRUTE_FORCE .value ,
@@ -579,6 +651,7 @@ class CaseConfigInput(BaseModel):
579651 in [
580652 IndexType .IVFFlat .value ,
581653 IndexType .IVFSQ8 .value ,
654+ IndexType .IVF_RABITQ .value ,
582655 IndexType .GPU_IVF_FLAT .value ,
583656 IndexType .GPU_IVF_PQ .value ,
584657 IndexType .GPU_BRUTE_FORCE .value ,
@@ -593,7 +666,8 @@ class CaseConfigInput(BaseModel):
593666 "max" : 65536 ,
594667 "value" : 0 ,
595668 },
596- isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .GPU_IVF_PQ .value ],
669+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
670+ in [IndexType .GPU_IVF_PQ .value , IndexType .HNSW_PQ .value , IndexType .HNSW_PRQ .value ],
597671)
598672
599673
@@ -605,7 +679,20 @@ class CaseConfigInput(BaseModel):
605679 "max" : 65536 ,
606680 "value" : 8 ,
607681 },
608- isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .GPU_IVF_PQ .value ],
682+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None )
683+ in [IndexType .GPU_IVF_PQ .value , IndexType .HNSW_PQ .value , IndexType .HNSW_PRQ .value ],
684+ )
685+
686+ CaseConfigParamInput_NRQ = CaseConfigInput (
687+ label = CaseConfigParamType .nrq ,
688+ inputType = InputType .Number ,
689+ inputHelp = "The number of residual subquantizers." ,
690+ inputConfig = {
691+ "min" : 1 ,
692+ "max" : 16 ,
693+ "value" : 2 ,
694+ },
695+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .HNSW_PRQ .value ],
609696)
610697
611698CaseConfigParamInput_intermediate_graph_degree = CaseConfigInput (
@@ -1186,6 +1273,10 @@ class CaseConfigInput(BaseModel):
11861273 CaseConfigParamInput_graph_degree ,
11871274 CaseConfigParamInput_build_algo ,
11881275 CaseConfigParamInput_cache_dataset_on_device ,
1276+ CaseConfigParamInput_SQType ,
1277+ CaseConfigParamInput_Refine ,
1278+ CaseConfigParamInput_RefineType ,
1279+ CaseConfigParamInput_NRQ ,
11891280]
11901281MilvusPerformanceConfig = [
11911282 CaseConfigParamInput_IndexType ,
@@ -1197,6 +1288,8 @@ class CaseConfigInput(BaseModel):
11971288 CaseConfigParamInput_Nprobe ,
11981289 CaseConfigParamInput_M_PQ ,
11991290 CaseConfigParamInput_Nbits_PQ ,
1291+ CaseConfigParamInput_RBQBitsQuery ,
1292+ CaseConfigParamInput_NRQ ,
12001293 CaseConfigParamInput_intermediate_graph_degree ,
12011294 CaseConfigParamInput_graph_degree ,
12021295 CaseConfigParamInput_itopk_size ,
@@ -1207,6 +1300,10 @@ class CaseConfigInput(BaseModel):
12071300 CaseConfigParamInput_build_algo ,
12081301 CaseConfigParamInput_cache_dataset_on_device ,
12091302 CaseConfigParamInput_refine_ratio ,
1303+ CaseConfigParamInput_SQType ,
1304+ CaseConfigParamInput_Refine ,
1305+ CaseConfigParamInput_RefineType ,
1306+ CaseConfigParamInput_RefineK ,
12101307]
12111308
12121309WeaviateLoadConfig = [
0 commit comments