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

build_depth_lookup

build_depth_lookup()​

max.pipelines.speculative.depth_schedule.build_depth_lookup(schedule, *, max_batch_size, max_depth)

source

Expands a schedule into a dense batch_size -> depth lookup.

Index 0 is unused so a runtime batch size indexes the list directly. Gaps between configured ranges carry the previous range’s depth forward, as does the tail past the final range, so the lookup is total over 1..max_batch_size.

Parameters:

  • schedule (Sequence[tuple[int, int, int]]) – A schedule already through normalize_depth_schedule().
  • max_batch_size (int) – Largest decode batch size the lookup must cover.
  • max_depth (int) – Ceiling applied to every entry. A schedule cannot ask to verify more drafts than the step actually carries, which is the configured num_speculative_tokens.

Returns:

A list of length max_batch_size + 1 whose element i is the number of drafts to verify at batch size i.

Raises:

ValueError – If max_batch_size or max_depth is not positive.

Return type:

list[int]