IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Python function

build_greedy_acceptance_sampler_graph

build_greedy_acceptance_sampler_graph()

max.pipelines.sampling.build_greedy_acceptance_sampler_graph(device)

source

Builds a graph that implements strict greedy acceptance for MTP.

Draft tokens are accepted only when they match the argmax of the target logits at each position. Always produces a recovered token for every draft position and a bonus token from the final (+1) target position.

Parameters:

device (DeviceRef) – Device for the graph.

Returns:

A graph that takes draft tokens, target logits, and target logit offsets and outputs the first rejected index, target tokens for all draft positions, and a bonus token.

Return type:

Graph