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 class

UnifiedSpecDecodeInputs

UnifiedSpecDecodeInputs​

class max.pipelines.lib.UnifiedSpecDecodeInputs(*, kv_cache_inputs=None, lora_buffers=(), vision_embeddings=<factory>, vision_scatter_indices=<factory>, hidden_states=None, spec=None, draft_tokens=None, draft_probs_full=None, draft_probs_replicas=None, seed=None, temperature=None, top_k=None, max_k=None, top_p=None, min_top_p=None, in_thinking_phase=None, draft_slot_ids=None, draft_block_offsets=None, draft_scores=None, draft_score_coeffs=None, pinned_bitmask=None, wait_payload=None, device_bitmask_scratch=None, structured_output=False)

source

Bases: ModelInputs

Shared spec-decode fields, packed in the order the graph takes them.

_spec_decode_buffers() packs a step as the leaves of spec_decode_input_tree(), the tree whose leaves are the graph’s signature. A model that packs the inputs ahead of the tail itself appends _spec_decode_tail_buffers().

Parameters:

device_bitmask_scratch​

device_bitmask_scratch: Buffer | None = None

source

draft_block_offsets​

draft_block_offsets: Buffer | None = None

source

The draft block’s ragged row offsets: [0, K, 2K, ...] to draft, all zeros to skip.

draft_probs_full​

draft_probs_full: Buffer | None = None

source

The distribution each draft_tokens entry was sampled from, [batch_size, num_speculative_tokens, vocab_size]. The pipeline sets it exactly when the compiled graph declares it (draft_proposal="sampled"), so the tail packs it whenever it is present.

draft_probs_replicas​

draft_probs_replicas: list[Buffer] | None = None

source

draft_probs_full under draft_probs_layout="replica": each replica’s rows on its own device, packed in its place.

draft_score_coeffs​

draft_score_coeffs: Buffer | None = None

source

The host-fitted calibrator coefficients over the draft positions, declared beside draft_scores.

draft_scores​

draft_scores: Buffer | None = None

source

The previous step’s per-draft scores, which a per-row verify graph declares. MAX Serve feeds none, so _spec_decode_buffers() refuses that graph.

draft_slot_ids​

draft_slot_ids: Buffer | None = None

source

Which drafter rows this step computes, as the buffer’s extent: arange(batch_size * rows_per_seq) to draft, empty to skip. Set by the pipeline from the verify-width schedule, alongside draft_tokens.

draft_tokens​

draft_tokens: Buffer | None = None

source

in_thinking_phase​

in_thinking_phase: Buffer | None = None

source

max_k​

max_k: Buffer | None = None

source

min_top_p​

min_top_p: Buffer | None = None

source

pinned_bitmask​

pinned_bitmask: Buffer | None = None

source

seed​

seed: Buffer | None = None

source

spec​

spec: SpecDecodeInputTypeSpec | None = None

source

The signature the graph was built from, which _spec_decode_buffers() packs by.

structured_output​

structured_output: bool = False

source

Whether this graph was compiled with constrained-decoding bitmask inputs, for _spec_decode_tail_buffers(). Mirrors pipeline_config.needs_bitmask_constraints, which sets the signature’s enable_structured_output. Set by each capable module’s prepare_initial_token_inputs.

temperature​

temperature: Buffer | None = None

source

top_k​

top_k: Buffer | None = None

source

top_p​

top_p: Buffer | None = None

source

wait_payload​

wait_payload: Buffer | None = None

source