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 module
max.pipelines.architectures.inkling
InklingConfigβ
class max.pipelines.architectures.inkling.InklingConfig(*, devices, dtype, kv_params, max_seq_len, text_config, quant_config=None, use_subgraphs=True)
Bases: ArchConfigWithKVCache
Top-level Inkling config wrapping the text backbone.
-
Parameters:
-
- devices (list[DeviceRef])
- dtype (DType)
- kv_params (MultiKVCacheParams)
- max_seq_len (int)
- text_config (InklingTextConfig)
- quant_config (QuantConfig | None)
- use_subgraphs (bool)
DEFAULT_ENCODINGβ
DEFAULT_ENCODING: ClassVar[max.pipelines.lib.config.SupportedEncoding] = 'bfloat16'
SUPPORTED_ENCODINGSβ
SUPPORTED_ENCODINGS: ClassVar[set[max.pipelines.lib.config.SupportedEncoding]] = {'bfloat16', 'float4_e2m1fnx2'}
calculate_max_seq_len()β
static calculate_max_seq_len(pipeline_config, huggingface_config, model_config=None)
-
Parameters:
-
- pipeline_config (PipelineConfig)
- huggingface_config (AutoConfig)
- model_config (MAXModelConfig | None)
-
Return type:
construct_kv_params()β
static construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype)
One cache per attention flavor; they differ in KV head count.
-
Parameters:
-
- huggingface_config (AutoConfig)
- pipeline_config (PipelineConfig)
- devices (list[DeviceRef])
- kv_cache_config (KVCacheConfig)
- cache_dtype (DType)
-
Return type:
devicesβ
dtypeβ
dtype: DType
finalize()β
finalize(huggingface_config, state_dict)
Sets quant_config from which routed tensors ship block
scales; the released NVFP4 checkpoint leaves one MoE layer bfloat16.
-
Parameters:
-
- huggingface_config (AutoConfig)
- state_dict (Mapping[str, WeightData])
-
Return type:
-
None
get_kv_params()β
get_kv_params()
KV cache parameters to use when running the model.
-
Return type:
get_max_seq_len()β
get_max_seq_len()
Returns the default maximum sequence length for the model.
Subclasses should determine whether this value can be overridden by
setting the --max-length (pipeline_config.model.max_length) flag.
-
Return type:
initialize()β
classmethod initialize(pipeline_config, model_config=None)
Initialize the config from a PipelineConfig.
-
Parameters:
-
- pipeline_config (PipelineConfig) β The pipeline configuration.
- model_config (MAXModelConfig | None) β The model configuration to read from. When
None(the default),pipeline_config.modelis used. Pass an explicit config (e.g.pipeline_config.draft_model) to initialize the arch config for a different model.
-
Return type:
kv_paramsβ
kv_params: MultiKVCacheParams
max_seq_lenβ
max_seq_len: int
quant_configβ
quant_config: QuantConfig | None = None
Set by finalize() when the routed experts are packed FP4.
text_configβ
text_config: InklingTextConfig
use_subgraphsβ
use_subgraphs: bool = True
InklingInputsβ
class max.pipelines.architectures.inkling.InklingInputs(tokens, input_row_offsets, positions, return_n_logits, signal_buffers, slot_idx, conv_pools, *, kv_cache_inputs=None, lora_buffers=(), vision_embeddings=<factory>, vision_scatter_indices=<factory>, hidden_states=None)
Bases: ModelInputs
Ragged token inputs plus the convolution-state pool addressing.
-
Parameters:
-
- tokens (Buffer)
- input_row_offsets (Buffer)
- positions (Buffer)
- return_n_logits (Buffer)
- signal_buffers (list[Buffer])
- slot_idx (list[Buffer])
- conv_pools (list[Buffer])
- kv_cache_inputs (KVCacheInputsInterface[Buffer, Buffer] | None)
- lora_buffers (tuple[Buffer, ...])
- vision_embeddings (list[Buffer])
- vision_scatter_indices (list[Buffer])
- hidden_states (Buffer | list[Buffer] | None)
buffersβ
Returns positional Buffer inputs for model ABI calls.
conv_poolsβ
Per device, one pool per convolution site per layer, mutated in place.
input_row_offsetsβ
input_row_offsets: Buffer
positionsβ
positions: Buffer
return_n_logitsβ
return_n_logits: Buffer
signal_buffersβ
slot_idxβ
tokensβ
tokens: Buffer
InklingModelβ
class max.pipelines.architectures.inkling.InklingModel(pipeline_config, session, devices, kv_cache_config, weights, adapter=None, return_logits=ReturnLogits.LAST_TOKEN, return_hidden_states=ReturnHiddenStates.NONE, max_batch_size=1)
Bases: LogProbabilitiesMixin, GraphPipelineModelWithKVCache[TextContext], SupportsSSMStateWarmup
Pipeline model for Inklingβs text decoder.
-
Parameters:
-
- pipeline_config (PipelineConfig)
- session (InferenceSession)
- devices (list[Device])
- kv_cache_config (KVCacheConfig)
- weights (Weights)
- adapter (WeightsAdapter | None)
- return_logits (ReturnLogits)
- return_hidden_states (ReturnHiddenStates)
- max_batch_size (int)
batch_processor_clsβ
batch_processor_cls
alias of InklingBatchProcessor
emits_folded_sampled_tokensβ
property emits_folded_sampled_tokens: bool
Whether the forward graph appends a folded greedy-token output.
Architectures that fold the sampler (argmax) into the forward graph
emit the sampled-token buffer as a trailing graph output and override
this to return True. Callers must peel that trailing output into
ModelOutputs.sampled_tokens only when this is True;
otherwise the fold_sampler_into_graph runtime flag is a no-op for
the architecture.
execute()β
execute(model_inputs)
Executes the graph with the given inputs.
-
Parameters:
-
model_inputs (ModelInputs) β The model inputs to execute, containing tensors and any other required data for model execution.
-
Returns:
-
ModelOutputs containing the pipelineβs output tensors.
-
Return type:
This is an abstract method that must be implemented by concrete PipelineModels to define their specific execution logic.
modelβ
model: Model
model_config_clsβ
model_config_cls
alias of InklingConfig
release()β
release(request_id)
Drops the requestβs convolution state, freeing its slot.
-
Parameters:
-
request_id (RequestID)
-
Return type:
-
None
release_warmup_state()β
release_warmup_state(request_ids)
Frees the slots a graph-capture warmup probe claimed.
Without this the second probe finds no free slot and serving never
starts; claim zeros a slot when a real request takes it.