IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python module

max.nn.sampling

Sampling custom ops.

Acceptance sampling​

AcceptanceSamplerDispatches between greedy, synthetic, and stochastic acceptance.

Sampler factories​

compute_synthetic_acceptance_base_rateSolves for the per-position base acceptance rate that matches a target mean.
greedy_acceptance_samplerTarget-only rejection sampler for speculative decoding.
stochastic_acceptance_samplerVerifies speculative draft tokens against the target model.
synthetic_acceptance_samplerSynthetic sampler for speculative decoding benchmarking.