Repository: ggerganov/llama.cpp
File: common/arg.cpp (C++)

Code before:
            params.sparams.top_k = value;
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--top-p"}, "N",
        string_format("top-p sampling (default: %.1f, 1.0 = disabled)", (double)params.sparams.top_p),
        [](common_params & params, const std::string & value) {
            params.sparams.top_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--min-p"}, "N",
        string_format("min-p sampling (default: %.1f, 0.0 = disabled)", (double)params.sparams.min_p),
        [](common_params & params, const std::string & value) {
            params.sparams.min_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--tfs"}, "N",
        string_format("tail free sampling, parameter z (default: %.1f, 1.0 = disabled)", (double)params.sparams.tfs_z),
        [](common_params & params, const std::string & value) {
            params.sparams.tfs_z = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"-xtc-p", "--xtc-probability"}, "N",
        string_format("xtc probability (default: %.1f, 0.0 = disabled)", (double)params.sparams.xtc_probability),
        [](common_params & params, const std::string & value) {
            params.sparams.xtc_probability = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"-xtc-t", "--xtc-threshold"}, "N",
        string_format("xtc threshold (default: %.1f, 1.0 = disabled)", (double)params.sparams.xtc_threshold),
        [](common_params & params, const std::string & value) {
            params.sparams.xtc_threshold = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--typical"}, "N",
        string_format("locally typical sampling, parameter p (default: %.1f, 1.0 = disabled)", (double)params.sparams.typ_p),
        [](common_params & params, const std::string & value) {
            params.sparams.typ_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--repeat-last-n"}, "N",
        string_format("last n tokens to consider for penalize (default: %d, 0 = disabled, -1 = ctx_size)", params.sparams.penalty_last_n),
        [](common_params & params, int value) {
            params.sparams.penalty_last_n = value;
            params.sparams.n_prev = std::max(params.sparams.n_prev, params.sparams.penalty_last_n);

Review comment (suggestion):
According to longstanding UNIX command line convention, single-hyphen arguments should be single letters, so they can be combined into an unambiguous multi-argument string following a single hyphen. I don't know if the command line parser used by llama.cpp would even work with an argument like `-xtc-p`, but it is certainly not how most CLIs operate, and would break many parsing libraries.


Code after:
            params.sparams.top_k = value;
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--top-p"}, "N",
        string_format("top-p sampling (default: %.1f, 1.0 = disabled)", (double)params.sparams.top_p),
        [](common_params & params, const std::string & value) {
            params.sparams.top_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--min-p"}, "N",
        string_format("min-p sampling (default: %.1f, 0.0 = disabled)", (double)params.sparams.min_p),
        [](common_params & params, const std::string & value) {
            params.sparams.min_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--tfs"}, "N",
        string_format("tail free sampling, parameter z (default: %.1f, 1.0 = disabled)", (double)params.sparams.tfs_z),
        [](common_params & params, const std::string & value) {
            params.sparams.tfs_z = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--xtc-probability"}, "N",
        string_format("xtc probability (default: %.1f, 0.0 = disabled)", (double)params.sparams.xtc_probability),
        [](common_params & params, const std::string & value) {
            params.sparams.xtc_probability = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--xtc-threshold"}, "N",
        string_format("xtc threshold (default: %.1f, 1.0 = disabled)", (double)params.sparams.xtc_threshold),
        [](common_params & params, const std::string & value) {
            params.sparams.xtc_threshold = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--typical"}, "N",
        string_format("locally typical sampling, parameter p (default: %.1f, 1.0 = disabled)", (double)params.sparams.typ_p),
        [](common_params & params, const std::string & value) {
            params.sparams.typ_p = std::stof(value);
        }
    ).set_sparam());
    add_opt(common_arg(
        {"--repeat-last-n"}, "N",
        string_format("last n tokens to consider for penalize (default: %d, 0 = disabled, -1 = ctx_size)", params.sparams.penalty_last_n),
        [](common_params & params, int value) {
            params.sparams.penalty_last_n = value;
            params.sparams.n_prev = std::max(params.sparams.n_prev, params.sparams.penalty_last_n);