From bc338380379a0522fcce721779ae843a5ae33e15 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 27 Jan 2026 10:19:36 +0200 Subject: [PATCH] common : rename speculative.draftless_type -> speculative.type --- common/arg.cpp | 12 ++++++------ common/common.h | 4 +--- common/speculative.cpp | 12 +++++++----- tools/server/server-task.cpp | 7 ++++--- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/common/arg.cpp b/common/arg.cpp index a5515642f8..dd16a67503 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -3400,18 +3400,18 @@ common_params_context common_params_parser_init(common_params & params, llama_ex add_opt(common_arg( {"--spec-draftless"}, "[none|ngram-cache|ngram-simple|ngram-map-k|ngram-map-k4v]", string_format("type of speculative decoding to use when no draft model is provided (default: %s)\n", - common_speculative_type_to_str(params.speculative.draftless_type).c_str()), + common_speculative_type_to_str(params.speculative.type).c_str()), [](common_params & params, const std::string & value) { if (value == "none") { - params.speculative.draftless_type = COMMON_SPECULATIVE_TYPE_NONE; + params.speculative.type = COMMON_SPECULATIVE_TYPE_NONE; } else if (value == "ngram-cache") { - params.speculative.draftless_type = COMMON_SPECULATIVE_TYPE_NGRAM_CACHE; + params.speculative.type = COMMON_SPECULATIVE_TYPE_NGRAM_CACHE; } else if (value == "ngram-simple") { - params.speculative.draftless_type = COMMON_SPECULATIVE_TYPE_NGRAM_SIMPLE; + params.speculative.type = COMMON_SPECULATIVE_TYPE_NGRAM_SIMPLE; } else if (value == "ngram-map-k") { - params.speculative.draftless_type = COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K; + params.speculative.type = COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K; } else if (value == "ngram-map-k4v") { - params.speculative.draftless_type = COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K4V; + params.speculative.type = COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K4V; } else { throw std::invalid_argument("unknown speculative decoding type without draft model"); } diff --git a/common/common.h b/common/common.h index 9d3f880b84..95bde8e43c 100644 --- a/common/common.h +++ b/common/common.h @@ -273,9 +273,7 @@ struct common_params_speculative { struct common_params_model model; - // draftless: - - common_speculative_type draftless_type = COMMON_SPECULATIVE_TYPE_NONE; // type of speculative decoding without a draft model + common_speculative_type type = COMMON_SPECULATIVE_TYPE_NONE; // type of speculative decoding uint16_t ngram_size_n = 12; // ngram size for lookup uint16_t ngram_size_m = 48; // mgram size for speculative tokens diff --git a/common/speculative.cpp b/common/speculative.cpp index c4cf38537f..6a7421f090 100644 --- a/common/speculative.cpp +++ b/common/speculative.cpp @@ -355,12 +355,14 @@ struct common_speculative * common_speculative_init( // Compute the implementations to use based on the config and their order of preference std::vector configs = {}; // list of speculative configs to try { - bool has_draft =!params.model.path.empty(); + bool has_draft = !params.model.path.empty(); bool has_draft_eagle3 = false; // TODO PR-18039: if params.speculative.eagle3 - bool has_ngram_cache = (params.draftless_type == COMMON_SPECULATIVE_TYPE_NGRAM_CACHE); - bool has_ngram_simple = (params.draftless_type == COMMON_SPECULATIVE_TYPE_NGRAM_SIMPLE); - bool has_ngram_map_k = (params.draftless_type == COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K); - bool has_ngram_map_k4v = (params.draftless_type == COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K4V); + + bool has_ngram_cache = (params.type == COMMON_SPECULATIVE_TYPE_NGRAM_CACHE); + bool has_ngram_simple = (params.type == COMMON_SPECULATIVE_TYPE_NGRAM_SIMPLE); + bool has_ngram_map_k = (params.type == COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K); + bool has_ngram_map_k4v = (params.type == COMMON_SPECULATIVE_TYPE_NGRAM_MAP_K4V); + // In a more complex implementation we could use the same implementation but with different parameters. // This was initially used in PR-18471 but removed to simplify the code. if (has_ngram_simple) { diff --git a/tools/server/server-task.cpp b/tools/server/server-task.cpp index 197f9d1018..2d25db63b7 100644 --- a/tools/server/server-task.cpp +++ b/tools/server/server-task.cpp @@ -77,7 +77,7 @@ json task_params::to_json(bool only_metrics) const { {"speculative.n_max", speculative.n_max}, {"speculative.n_min", speculative.n_min}, {"speculative.p_min", speculative.p_min}, - {"speculative.draftless_t", common_speculative_type_to_str(speculative.draftless_type)}, + {"speculative.type", common_speculative_type_to_str(speculative.type)}, {"speculative.ngram_size_n", speculative.ngram_size_n}, {"speculative.ngram_size_m", speculative.ngram_size_m}, {"speculative.ngram_c_rate", speculative.ngram_check_rate}, @@ -141,7 +141,7 @@ json task_params::to_json(bool only_metrics) const { {"speculative.n_max", speculative.n_max}, {"speculative.n_min", speculative.n_min}, {"speculative.p_min", speculative.p_min}, - {"speculative.draftless_t", common_speculative_type_to_str(speculative.draftless_type)}, + {"speculative.type", common_speculative_type_to_str(speculative.type)}, {"speculative.ngram_size_n", speculative.ngram_size_n}, {"speculative.ngram_size_m", speculative.ngram_size_m}, {"speculative.ngram_c_rate", speculative.ngram_check_rate}, @@ -253,7 +253,8 @@ task_params server_task::params_from_json_cmpl( params.speculative.n_min = std::max(params.speculative.n_min, 0); params.speculative.n_max = std::max(params.speculative.n_max, 0); - params.speculative.draftless_type = common_speculative_type_from_name(json_value(data, "speculative.draftless_t", common_speculative_type_to_str(defaults.speculative.draftless_type))); + params.speculative.type = common_speculative_type_from_name(json_value(data, "speculative.type", common_speculative_type_to_str(defaults.speculative.type))); + params.speculative.ngram_size_n = json_value(data, "speculative.ngram_size_n", defaults.speculative.ngram_size_n); params.speculative.ngram_size_m = json_value(data, "speculative.ngram_size_m", defaults.speculative.ngram_size_m); params.speculative.ngram_check_rate = json_value(data, "speculative.ngram_c_rate", defaults.speculative.ngram_check_rate);