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
SequentialDriver
SequentialDriver
class max.pipelines.speculative.driver.SequentialDriver(verify, proposer, *, target_model, draft_model, input_spec, speculative_config=None, enable_structured_output=False, use_greedy_acceptance=False, num_draft_steps=None, vocab_size=None, ep_input_types=(), trailing_input_types=(), hisparse_input_types=(), fold_index_glue=False)
Bases: SpecDecodeGraphSignature, Module, Generic[_TargetHiddenT]
Drives the sequential speculative-decoding loop.
Each iteration runs merge, verify, mask, accept, shift, propose, and pack.
-
Parameters:
-
- verify (Callable[[SequentialBatch], Verified[_TargetHiddenT]])
- proposer (SequentialProposer[_TargetHiddenT] | SequentialProposer[Any, Tensor, Tensor, Tensor])
- target_model (Module | ModuleV3[..., Any])
- draft_model (Module | ModuleV3[..., Any])
- input_spec (SpecDecodeInputTypeSpec)
- speculative_config (SpeculativeConfig | None)
- enable_structured_output (bool)
- use_greedy_acceptance (bool)
- num_draft_steps (int | None)
- vocab_size (int | None)
- ep_input_types (Sequence[TensorType | BufferType])
- trailing_input_types (Sequence[TensorType | BufferType])
- hisparse_input_types (Sequence[TensorType | BufferType])
- fold_index_glue (bool)
ep_input_types()
ep_input_types()
The target’s expert-parallel inputs; empty when EP is off.
-
Return type:
hisparse_input_types()
hisparse_input_types()
The target’s HiSparse tables ahead of the speculative tail.
-
Return type:
input_spec
property input_spec: SpecDecodeInputTypeSpec
The spec both directions are derived from.
trailing_input_types()
trailing_input_types()
This model’s own group past the canonical tail; empty for most.
decode_inputs() returns it as
SpecDecodeGraphInputs.trailing.
-
Return type: