Skip to content

Commit c0745bc

Browse files
Merge pull request #25 from redis-performance/svs_release
Remove SVS and SVS_TIERED add SVS-VAMANA algorithm
2 parents 5544ec0 + 5aa9552 commit c0745bc

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

engine/clients/redis/search.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ def init_client(cls, host, distance, connection_params: dict, search_params: dic
3737
# 'EF_RUNTIME' is irrelevant for 'ADHOC_BF' policy
3838
if cls.hybrid_policy != "ADHOC_BF":
3939
cls.knn_conditions = "EF_RUNTIME $EF"
40-
elif cls.algorithm == "SVS":
41-
cls.knn_conditions = "WS_SEARCH $WS_SEARCH"
42-
elif cls.algorithm == "SVS_TIERED":
43-
cls.knn_conditions = "WS_SEARCH $WS_SEARCH"
40+
elif cls.algorithm == "SVS-VAMANA":
41+
cls.knn_conditions = "WS_SEARCH $SEARCH_WINDOW_SIZE"
4442
cls.data_type = "FLOAT32"
4543
if "search_params" in cls.search_params:
4644
cls.data_type = (
@@ -99,9 +97,7 @@ def search_one(cls, vector, meta_conditions, top) -> List[Tuple[int, float]]:
9997
if cls.hybrid_policy != "ADHOC_BF":
10098
params_dict["EF"] = cls.search_params["search_params"]["ef"]
10199
if cls.algorithm == "SVS":
102-
params_dict["WS_SEARCH"] = cls.search_params["search_params"]["WS_SEARCH"]
103-
if cls.algorithm == "SVS_TIERED":
104-
params_dict["WS_SEARCH"] = cls.search_params["search_params"]["WS_SEARCH"]
100+
params_dict["SEARCH_WINDOW_SIZE"] = cls.search_params["search_params"]["SEARCH_WINDOW_SIZE"]
105101
results = cls._ft.search(q, query_params=params_dict)
106102

107103
return [(int(result.id), float(result.vector_score)) for result in results.docs]

engine/clients/redis/upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def upload_batch(
9595

9696
@classmethod
9797
def post_upload(cls, _distance):
98-
if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS" and cls.algorithm != "SVS_TIERED":
98+
if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS-VAMANA":
9999
print(f"TODO: FIXME!! Avoiding calling ft.info for {cls.algorithm}...")
100100
return {}
101101
index_info = cls.client.ft().info()
@@ -136,7 +136,7 @@ def get_memory_usage(cls):
136136
used_memory.append(used_memory_shard)
137137
index_info = {}
138138
device_info = {}
139-
if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS" and cls.algorithm != "SVS_TIERED":
139+
if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS-VAMANA":
140140
print(f"TODO: FIXME!! Avoiding calling ft.info for {cls.algorithm}...")
141141
else:
142142
index_info = cls.client_decode.ft().info()

experiments/configurations/create-svs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
ws_search = [32, 40, 48, 64]
66
#ws_search = [48]
77
graph_degree = [32]
8-
#quantization = ["0", "4x4", "4x8", "8", "4"]
9-
quantization = ["8"]
8+
#quantization = ["NO_COMPRESSION", "LVQ4x4", "LVQ4x8", "LVQ4", "LVQ8", "LeanVec4x8", "LeanVec8x8"]
9+
quantization = ["LVQ4x8"]
1010
topKs = [10]
1111
data_types = ["FLOAT32"]
1212

13-
for algo in ["svs_tiered"]:
13+
for algo in ["svs-vamana"]:
1414
for data_type in data_types:
1515
for ws_construct in ws_constructs:
1616
for graph_d in graph_degree:
@@ -24,7 +24,7 @@
2424
"collection_params": {
2525
"algorithm": algo,
2626
"data_type": data_type,
27-
f"{algo}_config": {"NUM_THREADS": thread, "GRAPH_DEGREE": graph_d, "WS_CONSTRUCTION": ws_construct, "QUANTIZATION": quant},
27+
f"{algo}_config": {"NUM_THREADS": thread, "GRAPH_MAX_DEGREE": graph_d, "CONSTRUCTION_WINDOW_SIZE": ws_construct, "COMPRESSION": quant},
2828
},
2929
"search_params": [],
3030
"upload_params": {
@@ -40,7 +40,7 @@
4040
"algorithm": algo,
4141
"parallel": client,
4242
"top": top,
43-
"search_params": {"WS_SEARCH": ws_s, "data_type": data_type},
43+
"search_params": {"SEARCH_WINDOW_SIZE": ws_s, "data_type": data_type},
4444
}
4545
config["search_params"].append(test_config)
4646
configs.append(config)

0 commit comments

Comments
 (0)