pub struct SamplingCategory {
pub temperature: f32,
pub top_p: f32,
pub top_k: u32,
pub presence_penalty: f32,
pub frequency_penalty: f32,
pub repetition_penalty: f32,
pub dry_multiplier: f32,
pub dry_base: f32,
pub dry_allowed_length: u32,
pub lz_penalty: f32,
pub min_p: Option<f32>,
pub top_n_sigma: Option<f32>,
}Expand description
2026-09-25: One MODEL.toml [sampling.<category>] table, parsed by
build_parse.rs (parse_sampling_presets). An absent table, or an absent
key, takes the value SamplingCat::default() gives in build.rs.
Fields§
§temperature: f32§top_p: f32§top_k: u32§presence_penalty: f32§frequency_penalty: f32§repetition_penalty: f322026-09-25: Repetition penalty. metrale_sampling::apply_penalties_and_bias
divides a positive logit by it, and multiplies a non-positive one, once
for every occurrence of the token in SamplingParams::repetition_penalty_window.
1.0 (the parse default) skips it.
dry_multiplier: f322026-09-25: DRY penalty (metrale_sampling::apply_dry_penalty, whose
doc says which token each match penalises): a match of len tokens,
with len > dry_allowed_length, subtracts
dry_multiplier * dry_base^(len - dry_allowed_length) from one logit.
0.0, the parse default, disables it.
dry_base: f32§dry_allowed_length: u32§lz_penalty: f322026-09-25: LZ penalty (metrale_sampling::apply_lz_penalty): a token
that would complete a 3-, 4- or 5-gram already present in the last 256
tokens loses lz_penalty * (n - 2) per earlier occurrence of that
n-gram. 0.0, the parse default, disables it.
min_p: Option<f32>2026-09-25: Model-declared min-p, or None when MODEL.toml is silent.
Option, because absence and 0.0 mean different things: None
leaves --default-min-p in charge, Some(0.0) asks for no min-p.
At startup the default is generation_config.json’s min_p, then
this value, then --default-min-p (resolve_sampling_defaults). On a
chat request a request value wins; with use_sampling_presets_for_core
set, this value comes next, ahead of that startup default.
top_n_sigma: Option<f32>2026-09-25: Model-declared top-n-sigma, or None when MODEL.toml is
silent. Read only on the chat path with use_sampling_presets_for_core
set, where a request value wins and None leaves
--default-top-n-sigma in charge; Some(0.0) disables the filter.
Trait Implementations§
Source§impl Clone for SamplingCategory
impl Clone for SamplingCategory
Source§fn clone(&self) -> SamplingCategory
fn clone(&self) -> SamplingCategory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more