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 function
synthetic_acceptance_sampler
synthetic_acceptance_sampler()
max.nn.sampling.synthetic_acceptance_sampler(draft_tokens, target_logits, base_acceptance_rate, num_draft_steps, seed)
Synthetic sampler for speculative decoding benchmarking.
Accepts each draft position independently with probability
base_acceptance_rate. Once a position is rejected all subsequent
positions are also rejected. Recovered tokens and bonus tokens are
taken from the target argmax — generated text is not a faithful
speculative decode; intended for throughput benchmarking only.
-
Parameters:
-
- draft_tokens (TensorValue) – Draft token ids
[batch, num_steps]. - target_logits (TensorValue) – Verified target logits.
- base_acceptance_rate (float) – Per-position acceptance probability.
- num_draft_steps (int) – Number of speculative draft steps.
- seed (TensorValue) – Per-execute seed tensor. A rank-1 per-row seed uses its row-0 value: synthetic acceptance is batch-level benchmarking noise.
- draft_tokens (TensorValue) – Draft token ids
-
Return type:
Returns (first_rejected_idx, recovered_tokens, bonus_tokens)