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 function

compute_synthetic_acceptance_base_rate

compute_synthetic_acceptance_base_rate()​

max.nn.sampling.compute_synthetic_acceptance_base_rate(p_avg, n, tol=1e-09)

source

Solves for the per-position base acceptance rate that matches a target mean.

Under independent per-position Bernoulli acceptance with cascading rejection, the mean joint acceptance across n positions is sum_{i=1..n} base ** i / n. This function binary-searches for the base that produces a mean of p_avg.

Parameters:

  • p_avg (float) – Desired mean acceptance rate in [0, 1].
  • n (int) – Number of speculative draft steps.
  • tol (float) – Binary search tolerance.

Returns:

The per-position base acceptance rate.

Return type:

float