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,19 @@ 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+ inputConfig = {
690+ "min" : 1 ,
691+ "max" : 16 ,
692+ "value" : 2 ,
693+ },
694+ isDisplayed = lambda config : config .get (CaseConfigParamType .IndexType , None ) in [IndexType .HNSW_PRQ .value ],
609695)
610696
611697CaseConfigParamInput_intermediate_graph_degree = CaseConfigInput (
@@ -1186,6 +1272,10 @@ class CaseConfigInput(BaseModel):
11861272 CaseConfigParamInput_graph_degree ,
11871273 CaseConfigParamInput_build_algo ,
11881274 CaseConfigParamInput_cache_dataset_on_device ,
1275+ CaseConfigParamInput_SQType ,
1276+ CaseConfigParamInput_Refine ,
1277+ CaseConfigParamInput_RefineType ,
1278+ CaseConfigParamInput_NRQ ,
11891279]
11901280MilvusPerformanceConfig = [
11911281 CaseConfigParamInput_IndexType ,
@@ -1197,6 +1287,8 @@ class CaseConfigInput(BaseModel):
11971287 CaseConfigParamInput_Nprobe ,
11981288 CaseConfigParamInput_M_PQ ,
11991289 CaseConfigParamInput_Nbits_PQ ,
1290+ CaseConfigParamInput_RBQBitsQuery ,
1291+ CaseConfigParamInput_NRQ ,
12001292 CaseConfigParamInput_intermediate_graph_degree ,
12011293 CaseConfigParamInput_graph_degree ,
12021294 CaseConfigParamInput_itopk_size ,
@@ -1207,6 +1299,10 @@ class CaseConfigInput(BaseModel):
12071299 CaseConfigParamInput_build_algo ,
12081300 CaseConfigParamInput_cache_dataset_on_device ,
12091301 CaseConfigParamInput_refine_ratio ,
1302+ CaseConfigParamInput_SQType ,
1303+ CaseConfigParamInput_Refine ,
1304+ CaseConfigParamInput_RefineType ,
1305+ CaseConfigParamInput_RefineK ,
12101306]
12111307
12121308WeaviateLoadConfig = [
0 commit comments