SamplingCategory

Struct SamplingCategory 

Source
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: f32

2026-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: f32

2026-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: f32

2026-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

Source§

fn clone(&self) -> SamplingCategory

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SamplingCategory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SamplingCategory

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.