vllm.model_executor.models.config
¶
Classes:
-
ColQwen3_5Config–Apply the attention contract declared by a ColQwen3.5 checkpoint.
-
D3ForSequenceClassificationConfig–Apply the contract declared by a Decision 3.0
decision_config.json. -
DiffusionGemmaDiffusionOptions–DiffusionGemma
DiffusionConfig.model_options. Unset options are read -
DiffusionGemmaModelForBlockDiffusionConfig– -
Gemma4Config– -
HybridAttentionMambaModelConfig– -
KimiK3ForConditionalGenerationConfig–Route MXFP4-checkpointed Kimi-K3 MoE experts to the MXFP4 interface.
-
LlamaNemotronVLConfig–Config handler for LlamaNemotronVL embedding models.
-
MambaModelConfig– -
MiniMaxM3SparseForConditionalGenerationConfig– -
NemotronDiffusionOptions–Nemotron Labs Diffusion
DiffusionConfig.model_options. -
NemotronHForCausalLMConfig– -
NemotronLabsDiffusionForBlockDiffusionConfig– -
Qwen3_5ForConditionalGenerationConfig– -
Qwen4ExpForConditionalGenerationConfig–Apply the Qwen3.5 hybrid-cache contract to Qwen4Exp.
-
UnlimitedOCRForCausalLMConfig–
Functions:
-
register_model_config–Register the config hook of an architecture (e.g. from a plugin), as
ColQwen3_5Config
¶
Bases: Qwen3_5ForConditionalGenerationConfig
Apply the attention contract declared by a ColQwen3.5 checkpoint.
D3ForSequenceClassificationConfig
¶
Bases: Qwen3_5ForConditionalGenerationConfig
Apply the contract declared by a Decision 3.0 decision_config.json.
DiffusionGemmaDiffusionOptions
¶
Bases: DiffusionModelOptions
DiffusionGemma DiffusionConfig.model_options. Unset options are read
from the model's generation_config.json.
Attributes:
-
confidence_threshold(float | None) –Confidence above which a position is committed.
-
entropy_bound(float | None) –Entropy budget for the EntropyBound sampler.
-
stability_threshold(int | None) –Number of previous steps a prediction must match before it is
-
t_max(float | None) –Temperature at the first denoising step.
-
t_min(float | None) –Temperature at the last denoising step.
confidence_threshold = None
class-attribute
instance-attribute
¶
Confidence above which a position is committed.
entropy_bound = Field(default=None, gt=0)
class-attribute
instance-attribute
¶
Entropy budget for the EntropyBound sampler.
stability_threshold = Field(default=None, ge=0)
class-attribute
instance-attribute
¶
Number of previous steps a prediction must match before it is committed.
t_max = None
class-attribute
instance-attribute
¶
Temperature at the first denoising step.
t_min = None
class-attribute
instance-attribute
¶
Temperature at the last denoising step.
DiffusionGemmaModelForBlockDiffusionConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Set up the diffusion config and defaults for DiffusionGemma.
verify_and_update_config(vllm_config)
classmethod
¶
Set up the diffusion config and defaults for DiffusionGemma.
Auto-creates DiffusionConfig from the HF config when the user
didn't pass --diffusion-config. Diffusion sampling params are
read straight from generation_config.json at sampler-build time
(see DiffusionGemma's custom_sampler), not injected here.
Gemma4Config
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Configure attention for heterogeneous head dimensions.
verify_and_update_config(vllm_config)
staticmethod
¶
Configure attention for heterogeneous head dimensions.
Gemma4 uses different head dimensions for sliding window vs full attention layers. The default FA3 on Hopper cannot handle head_dim > 256.
On SM90 with FP8 KV cache, use FA3 for supported layers and let the generic FlashAttention selector upgrade larger head dimensions to FA4. The multimodal-prefix composite routes image masks to Triton and causal requests to this per-layer FA3/FA4 selection. For other configurations, force FA4 for all layers to avoid the mixed FA3+FA4 penalty. When FA4 is not available, fall back to Triton, or to FlashInfer for a plain Gemma4 with an NVFP4 KV cache, which Triton cannot read.
HybridAttentionMambaModelConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Perform early validation and setup for hybrid attention/mamba models.
verify_and_update_config(vllm_config)
classmethod
¶
Perform early validation and setup for hybrid attention/mamba models.
Block size alignment with mamba page sizes is handled later by Platform.update_block_size_for_backend(), which runs after model layers are constructed and the attention backend is known.
Parameters:
-
(vllm_config¶VllmConfig) –vLLM Config
KimiK3ForConditionalGenerationConfig
¶
Bases: VerifyAndUpdateConfig
Route MXFP4-checkpointed Kimi-K3 MoE experts to the MXFP4 interface.
Kimi-K3 ships its routed experts as compressed-tensors
mxfp4-pack-quantized (quant_method="compressed-tensors"), which
lands them on CompressedTensorsW4A4Mxfp4MoEMethod and its narrow kernel
selection. Rewriting quant_method to "mxfp4" selects Mxfp4Config
(hence Mxfp4MoEMethod) with its full backend set, while any non-MXFP4
checkpoint is left untouched. Covers both the main model and the MTP draft.
model_arch_config.quantization_config is a separate dict, snapshotted in
ModelConfig.__init__ before this hook runs, and it is what
_verify_quantization reads when resolving the quant method. Patch it
alongside the hf configs so the rewrite lands before resolution; otherwise
the main model still resolves to compressed-tensors.
Methods:
-
verify_and_update_config–Default the kv-cache dtype when the text backbone carries DSA:
verify_and_update_config(vllm_config)
classmethod
¶
Default the kv-cache dtype when the text backbone carries DSA: per-tensor fp8 for FLASHINFER_MLA_SPARSE, the default on SM10x, and "fp8_ds_mla" otherwise.
LlamaNemotronVLConfig
¶
Bases: VerifyAndUpdateConfig
Config handler for LlamaNemotronVL embedding models.
MambaModelConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Enable FULL_AND_PIECEWISE cuda graph mode by default (required
verify_and_update_config(vllm_config)
classmethod
¶
Enable FULL_AND_PIECEWISE cuda graph mode by default (required to get good performance for mamba layers in V1).
Parameters:
-
(vllm_config¶VllmConfig) –vLLM Config
MiniMaxM3SparseForConditionalGenerationConfig
¶
Bases: MiniMaxM3SparseConfig
Methods:
-
verify_and_update_model_config–Reject IndexCache overrides set on the outer VL config, where the
verify_and_update_model_config(model_config)
classmethod
¶
Reject IndexCache overrides set on the outer VL config, where the ROCm text model never reads them.
NemotronDiffusionOptions
¶
Bases: DiffusionModelOptions
Nemotron Labs Diffusion DiffusionConfig.model_options.
Attributes:
-
confidence_threshold(float | None) –Probability threshold for
selection_policy="confidence_threshold". -
selection_policy(Literal['low_confidence', 'leftmost', 'confidence_threshold'] | None) –Which masked positions to unmask each denoising step.
-
temperature(float | None) –Default sampling temperature; explicit request temperatures take
confidence_threshold = Field(default=None, gt=0, lt=1)
class-attribute
instance-attribute
¶
Probability threshold for selection_policy="confidence_threshold".
If not set, read from the model's generation_config.json
(diffusion_confidence_threshold), defaulting to 0.9.
selection_policy = None
class-attribute
instance-attribute
¶
Which masked positions to unmask each denoising step.
low_confidence: the most confident predictions first (LLaDA),
top-k per step with k from the even transfer schedule.
leftmost: strictly left-to-right.
confidence_threshold: unmask every position whose chosen-token
probability exceeds confidence_threshold (always at least the single
most confident one, so each step makes progress).
If not set, read from the model's generation_config.json
(diffusion_selection_policy), defaulting to confidence_threshold.
temperature = Field(default=None, ge=0)
class-attribute
instance-attribute
¶
Default sampling temperature; explicit request temperatures take precedence. 0 means greedy. If unset, the model's generation defaults apply.
NemotronHForCausalLMConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
update_mamba_ssm_cache_dtype–Update mamba_ssm_cache_dtype for NemotronH models when set to 'auto'
Attributes:
-
DEFAULT_MAMBA_SSM_CACHE_DTYPE(MambaDType) –Only
float32is known to have no accuracy issues by default.
DEFAULT_MAMBA_SSM_CACHE_DTYPE = 'float32'
class-attribute
instance-attribute
¶
Only float32 is known to have no accuracy issues by default.
update_mamba_ssm_cache_dtype(*, cache_config, hf_config)
classmethod
¶
Update mamba_ssm_cache_dtype for NemotronH models when set to 'auto'
(or not explicitly set), to the value specified in the HF config, or to
float32 if not specified.
NemotronLabsDiffusionForBlockDiffusionConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Set up the diffusion config and defaults for the Nemotron
verify_and_update_config(vllm_config)
classmethod
¶
Set up the diffusion config and defaults for the Nemotron Ministral masked block-diffusion LM.
Auto-creates DiffusionConfig from the HF config (canvas_length ==
block_size) when the user didn't pass --diffusion-config.
max_denoising_steps defaults to canvas_length at
sampler-build time when generation_config.json doesn't provide it.
Qwen3_5ForConditionalGenerationConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Update mamba_ssm_cache_dtype for Qwen3.5 models when set to 'auto'
verify_and_update_config(vllm_config)
staticmethod
¶
Update mamba_ssm_cache_dtype for Qwen3.5 models when set to 'auto' (or not explicitly set), to the value specified in the HF config's mamba_ssm_dtype field. Warn if the user explicitly overrides it to a different value.
Qwen4ExpForConditionalGenerationConfig
¶
Bases: Qwen3_5ForConditionalGenerationConfig
Apply the Qwen3.5 hybrid-cache contract to Qwen4Exp.
M-RoPE is kept under language_model_only so the KV layout matches a
multimodal prefill.
UnlimitedOCRForCausalLMConfig
¶
Bases: VerifyAndUpdateConfig
Methods:
-
verify_and_update_config–Configure Unlimited-OCR attention backends for R-SWA and vision.
verify_and_update_config(vllm_config)
staticmethod
¶
Configure Unlimited-OCR attention backends for R-SWA and vision.
Backend selection — controlled by the standard --attention-config
CLI argument (priority order):
-
--attention-config '{"backend": "FLASH_ATTN"}'→ FA4 + rswa_mask_mod. Exact token-level R-SWA.flash_attn_versionis forced to 4 if not already set (R-SWA mask_mod requires FA4; FA3 cannot express it). Raises if FA4 is not available on this device. -
--attention-config '{"backend": "FLEX_ATTENTION"}'→ FlexAttention R-SWA via Triton block mask. -
--attention-config '{"backend": "TRITON_ATTN"}'→ Triton unified attention with an R-SWA decode mask. -
--attention-config '{"backend": "auto"}'(or omitted) → Auto-detect: FA4 if available (H20/H100 SM90), else TritonAttention.
Regardless of backend, prefix caching is disabled for this model: R-SWA decode-phase KV is not a pure causal function of the prefix (so decode blocks are not reusable), and single-turn image-led OCR prompts rarely hit the prefix cache.
Example — force FlexAttention even on a machine with FA4::
vllm serve baidu/Unlimited-OCR \
--attention-config '{"backend": "FLEX_ATTENTION"}'
_indexer_sparse_logits_supported(vllm_config)
¶
Whether to enable candidate-only indexer scoring by default.
_parse_diffusion_model_options(vllm_config, options_cls)
¶
Validate --diffusion-config model_options against options_cls.
_set_deepseek_indexer_logits_dtype(vllm_config)
¶
Default DeepSeek indexer logits to BF16 where the MQA logits kernels also reduce in BF16 (SM100) and to FP32 elsewhere.
register_model_config(architecture, config_cls)
¶
Register the config hook of an architecture (e.g. from a plugin), as
MODELS_CONFIG_MAP does for in-tree models. Like
ModelRegistry.register_model, a later registration overwrites an earlier
one; replacing a different hook logs a warning.