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.
Source§impl SamplerConfig
impl SamplerConfig
Sourcepub fn from_provenance(provenance: Option<&Value>) -> Self
pub fn from_provenance(provenance: Option<&Value>) -> Self
The engine defaults with the file’s own sampling recommendation on
top: header.provenance.sampling (written by cortiq convert --sampling, e.g. a rewriting model trained and evaluated at
temperature 1.0 / top-p 0.95 / no top-k / no min-p / no repetition
penalty). Keys the file does not set keep the engine default;
explicit flags and request fields still override both.
Sourcepub fn file_has_defaults(provenance: Option<&Value>) -> bool
pub fn file_has_defaults(provenance: Option<&Value>) -> bool
True when the file carries a sampling recommendation.