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)
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:
-
- kv_cache_inputs (KVCacheInputs[Buffer, Buffer] | None)
- lora_buffers (tuple[Buffer, ...])
- vision_embeddings (list[Buffer])
- vision_scatter_indices (list[Buffer])
- hidden_states (Buffer | list[Buffer] | None)
- spec (SpecDecodeInputTypeSpec | None)
- draft_tokens (Buffer | None)
- draft_probs_full (Buffer | None)
- draft_probs_replicas (list[Buffer] | None)
- seed (Buffer | None)
- temperature (Buffer | None)
- top_k (Buffer | None)
- max_k (Buffer | None)
- top_p (Buffer | None)
- min_top_p (Buffer | None)
- in_thinking_phase (Buffer | None)
- draft_slot_ids (Buffer | None)
- draft_block_offsets (Buffer | None)
- draft_scores (Buffer | None)
- draft_score_coeffs (Buffer | None)
- pinned_bitmask (Buffer | None)
- wait_payload (Buffer | None)
- device_bitmask_scratch (Buffer | None)
- structured_output (bool)
device_bitmask_scratch
draft_block_offsets
The draft block’s ragged row offsets: [0, K, 2K, ...] to draft, all
zeros to skip.
draft_probs_full
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_full under draft_probs_layout="replica": each
replica’s rows on its own device, packed in its place.
draft_score_coeffs
The host-fitted calibrator coefficients over the draft positions,
declared beside draft_scores.
draft_scores
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
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
in_thinking_phase
max_k
min_top_p
pinned_bitmask
seed
spec
spec: SpecDecodeInputTypeSpec | None = None
The signature the graph was built from, which
_spec_decode_buffers() packs by.
structured_output
structured_output: bool = False
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.