From 5aa9552304f51b940ca27675fd7548f2d56f6dcb Mon Sep 17 00:00:00 2001 From: Marcin Pozniak Date: Wed, 25 Jun 2025 02:00:26 -0700 Subject: [PATCH] Remove SVS and SVS_TIERED add SVS-VAMANA algorithm --- engine/clients/redis/search.py | 10 +++------- engine/clients/redis/upload.py | 4 ++-- experiments/configurations/create-svs.py | 10 +++++----- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/engine/clients/redis/search.py b/engine/clients/redis/search.py index 374f42226..3f22fe948 100644 --- a/engine/clients/redis/search.py +++ b/engine/clients/redis/search.py @@ -37,10 +37,8 @@ def init_client(cls, host, distance, connection_params: dict, search_params: dic # 'EF_RUNTIME' is irrelevant for 'ADHOC_BF' policy if cls.hybrid_policy != "ADHOC_BF": cls.knn_conditions = "EF_RUNTIME $EF" - elif cls.algorithm == "SVS": - cls.knn_conditions = "WS_SEARCH $WS_SEARCH" - elif cls.algorithm == "SVS_TIERED": - cls.knn_conditions = "WS_SEARCH $WS_SEARCH" + elif cls.algorithm == "SVS-VAMANA": + cls.knn_conditions = "WS_SEARCH $SEARCH_WINDOW_SIZE" cls.data_type = "FLOAT32" if "search_params" in cls.search_params: cls.data_type = ( @@ -99,9 +97,7 @@ def search_one(cls, vector, meta_conditions, top) -> List[Tuple[int, float]]: if cls.hybrid_policy != "ADHOC_BF": params_dict["EF"] = cls.search_params["search_params"]["ef"] if cls.algorithm == "SVS": - params_dict["WS_SEARCH"] = cls.search_params["search_params"]["WS_SEARCH"] - if cls.algorithm == "SVS_TIERED": - params_dict["WS_SEARCH"] = cls.search_params["search_params"]["WS_SEARCH"] + params_dict["SEARCH_WINDOW_SIZE"] = cls.search_params["search_params"]["SEARCH_WINDOW_SIZE"] results = cls._ft.search(q, query_params=params_dict) return [(int(result.id), float(result.vector_score)) for result in results.docs] diff --git a/engine/clients/redis/upload.py b/engine/clients/redis/upload.py index beb4bb9db..2022290c1 100644 --- a/engine/clients/redis/upload.py +++ b/engine/clients/redis/upload.py @@ -95,7 +95,7 @@ def upload_batch( @classmethod def post_upload(cls, _distance): - if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS" and cls.algorithm != "SVS_TIERED": + if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS-VAMANA": print(f"TODO: FIXME!! Avoiding calling ft.info for {cls.algorithm}...") return {} index_info = cls.client.ft().info() @@ -136,7 +136,7 @@ def get_memory_usage(cls): used_memory.append(used_memory_shard) index_info = {} device_info = {} - if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS" and cls.algorithm != "SVS_TIERED": + if cls.algorithm != "HNSW" and cls.algorithm != "FLAT" and cls.algorithm != "SVS-VAMANA": print(f"TODO: FIXME!! Avoiding calling ft.info for {cls.algorithm}...") else: index_info = cls.client_decode.ft().info() diff --git a/experiments/configurations/create-svs.py b/experiments/configurations/create-svs.py index e84d02003..105bc97b6 100644 --- a/experiments/configurations/create-svs.py +++ b/experiments/configurations/create-svs.py @@ -5,12 +5,12 @@ ws_search = [32, 40, 48, 64] #ws_search = [48] graph_degree = [32] -#quantization = ["0", "4x4", "4x8", "8", "4"] -quantization = ["8"] +#quantization = ["NO_COMPRESSION", "LVQ4x4", "LVQ4x8", "LVQ4", "LVQ8", "LeanVec4x8", "LeanVec8x8"] +quantization = ["LVQ4x8"] topKs = [10] data_types = ["FLOAT32"] -for algo in ["svs_tiered"]: +for algo in ["svs-vamana"]: for data_type in data_types: for ws_construct in ws_constructs: for graph_d in graph_degree: @@ -24,7 +24,7 @@ "collection_params": { "algorithm": algo, "data_type": data_type, - f"{algo}_config": {"NUM_THREADS": thread, "GRAPH_DEGREE": graph_d, "WS_CONSTRUCTION": ws_construct, "QUANTIZATION": quant}, + f"{algo}_config": {"NUM_THREADS": thread, "GRAPH_MAX_DEGREE": graph_d, "CONSTRUCTION_WINDOW_SIZE": ws_construct, "COMPRESSION": quant}, }, "search_params": [], "upload_params": { @@ -40,7 +40,7 @@ "algorithm": algo, "parallel": client, "top": top, - "search_params": {"WS_SEARCH": ws_s, "data_type": data_type}, + "search_params": {"SEARCH_WINDOW_SIZE": ws_s, "data_type": data_type}, } config["search_params"].append(test_config) configs.append(config)