pub struct Sampler { /* private fields */ }Expand description
Stateful sampler: owns the RNG + the recent-token history (for penalties).
Implementations§
Source§impl Sampler
impl Sampler
pub fn new(cfg: SamplerConfig) -> Self
pub fn is_greedy(&self) -> bool
Sourcepub fn is_spec_sampling(&self) -> bool
pub fn is_spec_sampling(&self) -> bool
Sampled spec in its FASTEST regime: pure temperature, no truncation filters, no
penalties. Filters and penalties are also distribution-exact under the rejection
verify (spec.rs applies both symmetrically to draft q and target p), so they remain
spec-ELIGIBLE — see spec_eligible in memra-server’s worker, the authoritative
predicate. What they cost is the in-graph draft chain: the captured sampled draft
samples from the RAW softmax and can hold neither per-row filter stats nor a varying
penalty history, so spec.rs engages graph_s only in this pure-temp regime
(pure_temp) and otherwise falls back to the eager draft chain. This predicate names
that regime; it is NOT an eligibility test.
pub fn top_k(&self) -> usize
pub fn penalty_last_n(&self) -> usize
pub fn penalty_repeat(&self) -> f32
pub fn penalty_freq(&self) -> f32
pub fn penalty_present(&self) -> f32
pub fn top_p(&self) -> f32
pub fn min_p(&self) -> f32
pub fn temperature(&self) -> f32
pub fn seed(&self) -> u64
Sourcepub fn identity(&self) -> SamplerIdentity
pub fn identity(&self) -> SamplerIdentity
This sampler’s canonical SamplerIdentity — the whole-session resume predicate’s input.