pub struct SamplerConfig {
pub temperature: f32,
pub top_p: f32,
pub top_k: u32,
pub repetition_penalty: f32,
pub min_p: f32,
pub presence_penalty: f32,
pub seed: Option<u64>,
pub suppress_tokens: Vec<u32>,
pub penalty_window: usize,
}Expand description
Sampling configuration.
Fields§
§temperature: f32§top_p: f32§top_k: u32§repetition_penalty: f32§min_p: f32§presence_penalty: f32Flat additive penalty on every token that has appeared at least once (OpenAI-style presence penalty). Qwen3.8’s instruct sampling asks for 1.5 here — the multiplicative repetition_penalty is a different curve and cannot stand in for it.
seed: Option<u64>Fixed seed for reproducible generation (None = entropy).
suppress_tokens: Vec<u32>Token IDs to suppress (force logit to -inf).
penalty_window: usizeHow many of the most recent ids the repetition / presence
penalties look at. 0 = the whole sequence (the historical
behaviour). A natively bounded model (Embryo-O1 anchor) never
scans unbounded history: the pipeline substitutes
BOUNDED_PENALTY_WINDOW there when this is 0.
Implementations§
Source§impl SamplerConfig
impl SamplerConfig
Sourcepub fn penalty_past<'a>(
&self,
past: &'a [u32],
bounded_native: bool,
) -> &'a [u32]
pub fn penalty_past<'a>( &self, past: &'a [u32], bounded_native: bool, ) -> &'a [u32]
The slice of past the penalties may scan: the last
penalty_window ids, or all of them when the window is 0 and the
model is not bounded-native.