@@ -282,6 +282,11 @@ void parse_build_param(const nlohmann::json& conf, cuvs::neighbors::cagra::index
282282 params.graph_build_params )) {
283283 params.graph_build_params = cuvs::neighbors::graph_build_params::ace_params{};
284284 }
285+ } else if (conf.at (" graph_build_algo" ) == " ITERATIVE_SEARCH" ) {
286+ if (!std::holds_alternative<cuvs::neighbors::graph_build_params::iterative_search_params>(
287+ params.graph_build_params )) {
288+ params.graph_build_params = cuvs::neighbors::graph_build_params::iterative_search_params{};
289+ }
285290 }
286291 }
287292
@@ -291,16 +296,18 @@ void parse_build_param(const nlohmann::json& conf, cuvs::neighbors::cagra::index
291296 nlohmann::json nn_descent_conf = collect_conf_with_prefix (conf, " nn_descent_" );
292297 nlohmann::json ace_conf = collect_conf_with_prefix (conf, " ace_" );
293298
299+ // When graph_build_algo is not specified, leave graph_build_params as monostate so the
300+ // CAGRA build uses AUTO selection (NN_DESCENT or IVF_PQ based on dataset/heuristics).
301+ // Only infer from algo-specific config keys when present.
294302 if (std::holds_alternative<std::monostate>(params.graph_build_params )) {
295303 if (!ivf_pq_build_conf.empty () || !ivf_pq_search_conf.empty ()) {
296304 params.graph_build_params = cuvs::neighbors::graph_build_params::ivf_pq_params{};
297305 } else if (!nn_descent_conf.empty ()) {
298306 params.graph_build_params = cuvs::neighbors::graph_build_params::nn_descent_params{};
299307 } else if (!ace_conf.empty ()) {
300308 params.graph_build_params = cuvs::neighbors::graph_build_params::ace_params{};
301- } else {
302- params.graph_build_params = cuvs::neighbors::graph_build_params::iterative_search_params{};
303309 }
310+ // else: leave as monostate → AUTO in cagra_build.cuh
304311 }
305312
306313 // Apply build-algo-specific parameters
0 commit comments