Adding the XTC sampler (#486)

Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
This commit is contained in:
Kawrakow
2025-06-03 11:32:03 +03:00
committed by GitHub
parent 4f8b05a0d7
commit ccb265c016
7 changed files with 76 additions and 2 deletions

View File

@@ -1208,6 +1208,14 @@ extern "C" {
llama_token_data_array * candidates,
float temp);
/// @details XTC sampler as described in https://github.com/oobabooga/text-generation-webui/pull/6335
LLAMA_API void llama_sample_xtc(
struct llama_context * ctx,
llama_token_data_array * candidates_p,
float probability,
float threshold,
size_t min_keep);
/// @details Mirostat 1.0 algorithm described in the paper https://arxiv.org/abs/2007.14966. Uses tokens instead of words.
/// @param candidates A vector of `llama_token_data` containing the candidate tokens, their probabilities (p), and log-odds (logit) for the current position in the generated text.
/// @param tau The target cross-entropy (or surprise) value you want to achieve for the generated text. A higher value corresponds to more surprising or less predictable text, while a lower value corresponds to less surprising or more predictable text.