Skip to content

vllm.config

Modules:

Classes:

Functions:

AttentionConfig

Configuration for attention mechanisms in vLLM.

Methods:

Attributes:

backend = None class-attribute instance-attribute

Attention backend to use. Use "auto" or None for automatic selection. TORCH_SDPA is reserved for multi-modal encoder attention.

backend_per_kind = field(default_factory=dict) class-attribute instance-attribute

Per-KV-cache-group attention backend overrides, keyed by KVCacheSpecKind (e.g. {"mla_attention": "FLASHINFER_MLA", "sliding_window_mla": "TRITON_MLA"}). This lets a model that splits its layers across multiple KV-cache groups (e.g. interleaved full and sliding-window attention) use a different backend per group.

An entry overrides backend for layers of the matching kind; kinds not listed fall back to backend (or automatic selection). A selected backend that is invalid for that kind raises at startup.

disable_flashinfer_q_quantization = False class-attribute instance-attribute

If set, when using fp8 kv, do not quantize Q to fp8.

flash_attn_max_num_splits_for_cuda_graph = 32 class-attribute instance-attribute

Flash Attention max number splits for cuda graph decode.

flash_attn_version = None class-attribute instance-attribute

Force vllm to use a specific flash-attention version (2, 3, or 4). Only valid when using the flash-attention backend.

flex_attn_block_m = None class-attribute instance-attribute

Triton kernel BLOCK_M tile size for flex attention. Must be a power of 2 >= 16. If None and VLLM_BATCH_INVARIANT=1, defaults to 16.

flex_attn_block_n = None class-attribute instance-attribute

Triton kernel BLOCK_N tile size for flex attention. Must be a power of 2 >= 16. If None and VLLM_BATCH_INVARIANT=1, defaults to 16.

flex_attn_kv_block_size = None class-attribute instance-attribute

Logical KV block size for the flex attention block mask. Must be a multiple of 16 and divisible by flex_attn_block_n. If None, uses the KV cache block size for paged KV attention and 128 for encoder-only attention.

flex_attn_q_block_size = None class-attribute instance-attribute

Logical Q block size for the flex attention block mask. Must be a power of 2 and divisible by flex_attn_block_m. If None, uses 16 for paged KV attention and 128 for encoder-only attention.

hisparse_config = None class-attribute instance-attribute

HiSparse host-resident KV configuration. Setting this enables experimental Model Runner V2-only HiSparse DSA and QSA decode hot-buffering. It is inferred with defaults when HiSparseConnector is configured (directly or via MultiConnector); set it explicitly only to tune its fields.

indexer_decode_cp = False class-attribute instance-attribute

Split the sparse-attention indexer's decode scoring across the tensor-parallel ranks by context instead of by index head: each rank scores a 1/TP slice of the index-K pages for every head and the ranks exchange their local top-k, so each reads 1/TP of the index-K cache per sparse layer. The index-K cache stays replicated, so this is unrelated to --decode-context-parallel-size, which shards the KV cache itself; the two cannot be combined. Implemented for the MiniMax M3 NVFP4 indexer, which needs indexer_kv_dtype="nvfp4" and TP 4 (one index head per rank); it is ignored with a warning where it does not apply. It pays off from about 4 concurrent decodes at 128K context and grows with batch and context.

indexer_kv_dtype = 'auto' class-attribute instance-attribute

Data type for the sparse-attention indexer K cache. "auto" picks the model's default (bf16 for MiniMax M3, fp8 for the DeepSeek sparse indexer, mxfp4 for DeepSeek-V4 on ROCm CDNA4 with aiter). Quantized formats (fp8, mxfp4, nvfp4) require indexer kernel support in the backend; MiniMax M3 supports nvfp4 on SM100/SM103/SM107 with at most 8 decode queries per request.

indexer_logits_dtype = 'auto' class-attribute instance-attribute

Output dtype of DeepGEMM's dense MQA-logits kernels in the DeepSeek sparse-attention indexer, also used by Kimi K3. "auto" (default) picks the model's default: "bfloat16" for DeepSeek-V3.2 and DeepSeek-V4 on SM100, "float32" otherwise (Kimi K3 included). "float32" reduces the head-weighted scores in FP32 and feeds them to the top-k as is. "bfloat16" halves the logits memory; on SM100 it also reduces in BF16 with BF16 head weights and lets the top-k kernels that take BF16 rank the logits directly (DeepSelect; in decode also the cooperative and persistent kernels), while the others read an FP32 copy. The sparse MQA-logits path (indexer_sparse_logits) emits BF16 on SM100 and FP32 on SM90 and ROCm, independently of this setting.

indexer_sparse_logits = None class-attribute instance-attribute

Score only candidate blocks in the DeepSeek V4.1 two-level indexer. None (default) enables it on SM90 and supported SM100 configurations; True forces it; False uses dense scoring. Requires no context parallelism. SM90 uses CuTe DSL with FP8 cache and dense fallback for short prefills. Unsupported cache, model geometry or microbatching raises at initialization, including with the default None. SM100 requires DeepGEMM >= 2.8 and DeepSelect (FP8/MXFP4 cache). ROCm gfx950 uses aiter with MXFP4 cache and remains opt-in.

minimax_m3_indexer_cp = False class-attribute instance-attribute

MiniMax M3 on ROCm with tensor_parallel_size > 1: score the sparse indexer context-parallel at decode. Each rank reads 1/TP of the index cache, scores every index head on it, and per-head top-k candidates are exchanged and merged, so the selected blocks match the default path. indexer_kv_dtype picks the kernels that do it: a bf16 index cache ("auto" or "bf16") runs the Triton CP indexer, an fp8 e4m3 one the AITER MSA CP indexer on gfx950. This shards indexer work and not the KV cache, so it is not decode_context_parallel_size and requires that to be 1.

minimax_m3_msa_decode_backend = 'cutlass' class-attribute instance-attribute

Sparse decode kernel used by the MiniMax M3 MSA backend. "cutlass" falls back to Triton where the CUTLASS kernel does not support the platform, KV cache dtype, or head layout.

mla_prefill_backend = None class-attribute instance-attribute

MLA prefill backend to use. If None, will be selected automatically. Valid options: FLASH_ATTN (FA3/FA4), FLASHINFER, TRTLLM_RAGGED; on ROCm, ROCM_AITER_FA and ROCM_AITER_FLYDSL_FP8. ROCM_AITER_FLYDSL_FP8 is opt-in (gfx950, bf16 models): it quantizes Q/K/V to FP8 per tensor at runtime and falls back to ROCM_AITER_FA for inputs the FlyDSL kernel cannot take.

sparse_mla_force_mqa = False class-attribute instance-attribute

Force sparse MLA to use forward_mqa for all requests, including prefill. When False (default), pure prefill batches use forward_mha when implemented. Set to True to always use the MQA path.

sparse_mla_prefill_workspace_factor = Field(default=None, ge=2) class-attribute instance-attribute

Sparse MLA prefill workspace size, in multiples of max_model_len. FlashMLA sparse gathers a prefill step's context KV into this workspace and runs attention in more chunks when the step holds more. The sparse indexer's prefill K buffer is sized to fit in the same memory. Lower values return memory to the KV cache at long max_model_len; the minimum of 2 leaves room for a full-length request's context-parallel shard. If None, 5 when max_model_len is at most 256K tokens, else 2.

sparse_mla_shard_q = True class-attribute instance-attribute

Under tensor parallelism, shard sparse-MLA (DSA) prefill by token instead of by head: each TP rank runs the indexer and the sparse attention for its slice of the tokens with all heads, and all-to-all exchanges move the query and the attention output between the layouts. Applies to steps with at least sparse_mla_shard_q_min_tokens prefill tokens on the FlashInfer sparse MLA backend, or on FlashMLA sparse with an FP8 DeepSeek KV cache, without PCP or HiSparse. Under DCP (on FlashInfer and SM100, with the DCP group equal to the TP group), each rank attends a gathered copy of its tokens' context instead of the DCP-local cache. A mixed step's decode tokens stay sharded by head (on the DCP path under DCP). On ROCm, models that opt in (currently HY4) shard on ROCM_AITER_MLA_SPARSE with an fp8_ds_mla KV cache or VLLM_ROCM_USE_AITER_TRITON_SPARSE_MLA=1, and only with fewer than 16 local heads (e.g. HY4 at TP8). DeepSeek-V4.1 on ROCm shards only its indexer prefill this way and all-gathers the top-k back, with its attention sharded by head.

sparse_mla_shard_q_min_tokens = Field(default=1024, ge=1) class-attribute instance-attribute

Minimum number of tokens after a step's decodes (requests of at most 1 + num_speculative_tokens tokens) for sparse_mla_shard_q to apply. Below it the all-to-all exchanges can cost more than they save.

tokenspeed_mla_min_split_kv = Field(default=1, ge=1, le=256) class-attribute instance-attribute

Minimum KV splits for TokenSpeed MLA decode. The default of 1 preserves automatic scheduling. Larger values request a split floor and may increase workspace memory. Only applies to the TokenSpeed MLA backend.

tq_max_kv_splits_for_cuda_graph = 32 class-attribute instance-attribute

TurboQuant max NUM_KV_SPLITS for cuda graph decode. Fixes the split count so grid dimensions are constant across captures, and buffers can be pre-allocated to avoid inflating the memory estimate.

trtllm_ragged_backend = 'trtllm-gen' class-attribute instance-attribute

Kernel backend for cached-context TRTLLM_RAGGED MLA prefill. CuTe DSL requires FP8 queries for head dimension 192 and does not support head dimension 256. New-token prefill always uses TRTLLM.

use_non_causal = False class-attribute instance-attribute

Whether to use non-causal (bidirectional) attention.

use_prefill_query_quantization = False class-attribute instance-attribute

If set, quantize query for attention in prefill.

use_trtllm_attention = None class-attribute instance-attribute

If set to True/False, use or don't use the TRTLLM attention backend in flashinfer. If None, auto-detect the attention backend in flashinfer.

compile_factors()

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

resolve_indexer_kv_dtype(default)

Resolve indexer_kv_dtype, substituting default for "auto".

resolve_indexer_logits_dtype(default)

Resolve indexer_logits_dtype, substituting default for "auto".

validate_backend_before(value) classmethod

Enable parsing of the backend enum type from string.

The special value "auto" is treated as None, which triggers automatic backend selection.

validate_backend_per_kind_before(value) classmethod

Parse the backend_per_kind map from strings.

Keys must be valid KVCacheSpecKind values; values are parsed like backend (enum name, case-insensitive).

validate_mla_prefill_backend_before(value) classmethod

Enable parsing of the mla_prefill_backend enum type from string.

AuxOutputConfig

Configuration for auxiliary-output delivery.

Methods:

  • compile_factors –

    WARNING: Whenever a new field is added to this config, add it to

Attributes:

enable_return_routed_experts = False class-attribute instance-attribute

Capture and return routed-experts auxiliary outputs.

enabled property

Whether any execution auxiliary output is enabled.

max_bytes = Field(default=None, gt=0) class-attribute instance-attribute

Initial capacity, or None to derive it from the KV cache capacity. Grows when every object is referenced.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

CUDAGraphMode

Bases: Enum

Constants for the cudagraph mode in CompilationConfig. Meanwhile, the subset enum NONE, PIECEWISE and FULL are also treated as concrete runtime mode for cudagraph runtime dispatching.

CacheConfig

Configuration for the KV cache.

Methods:

  • compile_factors –

    WARNING: Whenever a new field is added to this config, add it to

Attributes:

_block_size_resolved = field(default=False, init=False) class-attribute instance-attribute

Guard against pydantic re-running _apply_block_size_default.

_extensible_kv_cache_resolved = field(default=False, init=False) class-attribute instance-attribute

Set once enable_extensible_kv_cache has been settled for the model.

block_size = Field(default=None, gt=0) class-attribute instance-attribute

Size of a contiguous cache block in number of tokens. Accepts None (meaning "use default"). After construction, always int.

cache_dtype = 'auto' class-attribute instance-attribute

Data type for kv cache storage. If "auto", will use model data type. An explicit float16 or bfloat16 must match the model data type. Custom dtypes can registered by platform backends via register_kv_cache_dtype are accepted (see vllm.config.cache). CUDA 11.8+ supports fp8 (=fp8_e4m3) and fp8_e5m2. ROCm (AMD GPU) supports fp8 (=fp8_e4m3). Intel Gaudi (HPU) supports fp8 (using fp8_inc). Some models (namely DeepSeekV3.2) default to fp8, set to bfloat16 to use bfloat16 instead, this is an invalid option for models that do not default to fp8. "nvfp4_4over6" uses the NVFP4 layout and selects between max/6 and max/4 scales per 16 values by minimizing squared reconstruction error.

cache_hit_alignment_tokens = field(default=None, init=False) class-attribute instance-attribute

Token granularity at which prefix-cache hits land: hash_block_size with partial hash hits, otherwise the scheduler block size.

device_memory_utilization property writable

Device-neutral alias for gpu_memory_utilization.

effective_attention_block_size = field(default=None, init=False) class-attribute instance-attribute

Full-attention block size in tokens, including DCP, or None if unavailable.

enable_extensible_kv_cache = Field(default=None) class-attribute instance-attribute

Reserve the KV cache address range with device virtual memory and commit physical pages after warmup, so the cache is sized from the memory actually free after CUDA graph capture rather than from a profiling estimate. If unspecified, enabled on CUDA and ROCm unless kv_cache_memory_bytes is set, or NIXL on device memory has no IMEX channel; falls back to estimate-based sizing where the driver lacks VMM support. Explicitly requesting it where unsupported is an error. On unpartitioned discrete ROCm GPUs, the sizing adds back free memory that HIP hides by counting each allocation as at least 2 MiB, so gpu_memory_utilization bounds exact device memory use there. When a KV connector registers the KV cache for RDMA or exports it to another process, each segment is backed by a single physical allocation; connectors declare this by overriding KVConnectorBase_V1.kv_cache_access.

enable_mamba_shared_prefix_checkpoint = False class-attribute instance-attribute

Also register a Mamba checkpoint at the shared-prefix junction -- where a sibling request was observed to resume -- instead of only at the prompt tail. Off by default; only takes effect with prefix caching enabled and a prefix match unit smaller than the Mamba block size.

enable_prefix_caching = True class-attribute instance-attribute

Whether to enable prefix caching.

gpu_memory_utilization = Field(default=None, gt=0, le=1) class-attribute instance-attribute

The fraction of GPU memory to be used for the model executor, which can range from 0 to 1. For example, a value of 0.5 would imply 50% GPU memory utilization. This is a per-instance limit, and only applies to the current vLLM instance. It does not matter if you have another vLLM instance running on the same GPU. For example, if you have two vLLM instances running on the same GPU, you can set the GPU memory utilization to 0.5 for each instance. On non-GPU installs, this value controls the corresponding device memory utilization.

If unspecified, 1.0 with the extensible KV cache (sized from measured memory) and 0.92 otherwise; see resolved_gpu_memory_utilization.

With the extensible KV cache (the default on CUDA and ROCm), leave this unset unless something needs memory that vLLM does not measure: other processes sharing the GPU (including ones that allocate after vLLM has started), unified-memory devices whose memory the CPU also uses, weight transfer buffers for weight updates, or KV connectors that allocate their own device buffers. A lower value takes memory away from the KV cache.

hash_block_size = field(default=None, init=False) class-attribute instance-attribute

Tokens per prefix-cache block hash.

is_attention_free = False class-attribute instance-attribute

Whether the model is attention-free. This is primarily set in ModelConfig and that value should be manually duplicated here.

kv_cache_dtype_skip_layers = field(default_factory=list) class-attribute instance-attribute

Layer patterns to skip KV cache quantization. Accepts layer indices (e.g., '0', '2', '4') or attention type names (e.g., 'sliding_window').

kv_cache_layout = field(default=None, init=False) class-attribute instance-attribute

Resolved physical KV cache layout name (a KVCacheLayout member).

None means the layout has not been resolved yet. The engine core resolves it once (resolve_kv_cache_layout) before memory profiling, and every worker process adopts the resolved name — via the set_kv_cache_layout RPC, or KVCacheConfig.kv_cache_layout for workers spawned after resolution — before the KV cache is allocated. Once set the value is final and read with get_resolved_kv_cache_layout, which raises on None. Tests and standalone tools may pre-set a value, which resolution then honors as-is.

kv_cache_max_concurrency = field(default=None, init=False) class-attribute instance-attribute

Per-DP-engine maximum concurrency at max_model_len tokens.

kv_cache_memory_bytes = None class-attribute instance-attribute

Size of KV Cache per GPU in bytes. By default, this is set to None and vllm can automatically infer the kv cache size based on gpu_memory_utilization. However, users may want to manually specify the kv cache memory size. kv_cache_memory_bytes allows more fine-grain control of how much memory gets used when compared with using gpu_memory_utilization. Note that kv_cache_memory_bytes (when not-None) ignores gpu_memory_utilization

kv_cache_size_tokens = field(default=None, init=False) class-attribute instance-attribute

Per-DP-engine KV cache capacity in tokens (group-aware). Uses group-aware capacity since num_gpu_blocks * block_size can be wrong for hybrid models where requests occupy multiple KV cache groups.

kv_offloading_backend = 'native' class-attribute instance-attribute

The backend to use for KV cache offloading. Supported backends include 'native' (vLLM native CPU offloading), 'lmcache'. KV offloading is only activated when kv_offloading_size is set.

kv_offloading_size = None class-attribute instance-attribute

Size of the KV cache offloading buffer in GiB. When TP > 1, this is the total buffer size summed across all TP ranks. By default, this is set to None, which means no KV offloading is enabled. When set, vLLM will enable KV cache offloading to CPU using the kv_offloading_backend.

kv_sharing_fast_prefill = False class-attribute instance-attribute

In some KV sharing setups, e.g. YOCO (https://arxiv.org/abs/2405.05254), some layers can skip tokens corresponding to prefill. This flag enables attention metadata for eligible layers to be overridden with metadata necessary for implementing this optimization in some models (e.g. Gemma3n). In Model Runner V2, batches containing LoRA requests use regular prefill; batches without LoRA requests can still use fast prefill.

mamba_block_size = Field(default=None, gt=0) class-attribute instance-attribute

Size of a contiguous cache block in number of tokens for mamba cache. Can be set only when prefix caching is enabled.

mamba_cache_dtype = 'auto' class-attribute instance-attribute

The data type to use for the Mamba cache (both the conv as well as the ssm state). If set to 'auto', the data type will be inferred from the model config.

mamba_page_size_padded = None class-attribute instance-attribute

Optional override for mamba page size; used by hybrid mamba/attention models to ensure exact alignment with attention page size.

mamba_ssm_cache_dtype = 'auto' class-attribute instance-attribute

The data type to use for the Mamba cache (ssm state only, conv state will still be controlled by mamba_cache_dtype). If set to 'auto', the data type for the ssm state will be determined by mamba_cache_dtype.

num_cpu_blocks = field(default=None, init=False) class-attribute instance-attribute

The number of blocks to allocate for CPU memory.

num_gpu_blocks = field(default=None, init=False) class-attribute instance-attribute

The number of blocks to allocate for GPU memory.

num_gpu_blocks_override = None class-attribute instance-attribute

Number of GPU blocks to use. This overrides the profiled num_gpu_blocks if specified. Does nothing if None. Used for testing preemption.

prefix_cache_retention_interval = Field(default=0, ge=0) class-attribute instance-attribute

Token interval between retained sliding-window and Mamba prefix-cache checkpoints. 0 retains only semantic checkpoints, including the latest replay boundary and shared-prefix junctions. Positive values additionally retain periodic checkpoints at the specified interval, which must be a multiple of the scheduler block size. None retains checkpoints densely. Applies only to sliding-window and Mamba cache groups.

prefix_caching_hash_algo = 'sha256' class-attribute instance-attribute

Set the hash algorithm for prefix caching:

  • "sha256" uses Pickle for object serialization before hashing. This is the current default, as SHA256 is the most secure choice to avoid potential hash collisions.
  • "sha256_cbor" provides a reproducible, cross-language compatible hash. It serializes objects using canonical CBOR and hashes them with SHA-256.
  • "xxhash" uses Pickle serialization with xxHash (128-bit) for faster, non-cryptographic hashing. Requires the optional xxhash package. IMPORTANT: Use of a hashing algorithm that is not considered cryptographically secure theoretically increases the risk of hash collisions, which can cause undefined behavior or even leak private information in multi-tenant environments. Even if collisions are still very unlikely, it is important to consider your security risk tolerance against the performance benefits before turning this on.
  • "xxhash_cbor" combines canonical CBOR serialization with xxHash for reproducible hashing. Requires the optional xxhash package.

prefix_match_unit = Field(default=None, gt=0) class-attribute instance-attribute

The finest token boundary (in tokens) a prefix-cache hit can land on.

Prefix-cache keys are computed every prefix_match_unit tokens. It can be set finer than the physical KV cache block sizes (e.g. 32 vs a 1024-token hybrid-model block) as long as every KV cache group's block_size is divisible by it, enabling cache hits at boundaries inside a physical block. It controls matching granularity only, not how often states are stored.

An explicit value fails at startup if prefix-cache hits would fall back to the scheduler block size (for example, when a sliding-window group requires block-aligned lookups).

This equals to the hash_block_size used throughout the KV cache code.

replayssm_buffer_len = Field(default=16, gt=0) class-attribute instance-attribute

ReplaySSM logical history length B. Mamba2 Triton standard decode and Gated DeltaNet (Qwen3.5, Qwen4Exp) use B physical rows, at most 32 for Gated DeltaNet; FlashInfer and Triton speculative decoding use B+T, where T is the target verification length. Kimi-K3 speculative decode does not use B. Default 16.

resolved_gpu_memory_utilization property

gpu_memory_utilization, or its default given the sizing mode.

skip_page_size_padded = None class-attribute instance-attribute

Optional override for the page size of layers skipped from KV cache quantization (--kv-cache-dtype-skip-layers); set during block-size alignment so unquantized skip layers pad up to the quantized primary's page.

sliding_window = None class-attribute instance-attribute

Sliding window size for the KV cache. This is primarily set in ModelConfig and that value should be manually duplicated here.

swa_bounded_replay = True class-attribute instance-attribute

Keep the sliding-window KV of models that support it (DeepSeek-V4.1) out of prefix caching and rebuild it after a prefix hit by recomputing the hit's last window. The layers past the last KV-source layer then also run eager prefill steps on each request's trailing window only. Requires model runner V2.

use_kda_recoverssm = field(default=False, init=False) class-attribute instance-attribute

Whether Kimi-K3 KDA uses RecoverSSM speculative decode.

use_replayssm = False class-attribute instance-attribute

Use the ReplaySSM decode kernels for Mamba2 and Gated DeltaNet (Qwen3.5, Qwen4Exp): cache recent SSM inputs and skip the per-step full-state store, writing the checkpoint back only on flush. Triton and FlashInfer support Mamba prefix caching on and off. Mamba2 speculative decoding supports both backends; Gated DeltaNet supports Triton standard decode only. Pipeline parallelism is not supported. Flushes are most efficient when mamba_block_size is a multiple of replayssm_buffer_len, but this is not required.

user_specified_block_size = field(default=False, init=False) class-attribute instance-attribute

Whether block_size was explicitly provided. Derived automatically.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

CompilationConfig

Configuration for compilation.

You must pass CompilationConfig to VLLMConfig constructor. VLLMConfig's post_init does further initialization. If used outside of the VLLMConfig, some fields will be left in an improper state.

It contains PassConfig, which controls the custom fusion/transformation passes. The rest has three parts:

Why we have different sizes for cudagraph and inductor: - cudagraph: a cudagraph captured for a specific size can only be used for the same size. We need to capture all the sizes we want to use. - inductor: a graph compiled by inductor for a general shape can be used for different sizes. Inductor can also compile for specific sizes, where it can have more information to optimize the graph with fully static shapes. However, we find the general shape compilation is sufficient for most cases. It might be beneficial to compile for certain small batchsizes, where inductor is good at optimizing.

Methods:

Attributes:

backend = '' class-attribute instance-attribute

The backend for compilation. It needs to be a string:

  • "" (empty string): use the default backend ("inductor" on CUDA-alike platforms).
  • "eager"/"openxla"/...: use the specified backend registered in PyTorch.
  • "full.module.name": a qualified name which can be used to import the

backend function. We use string to avoid serialization issues when using compilation in a distributed setting. When the compilation mode is 1 or 2, the backend is used for the compilation directly (it sees the whole graph). When the compilation mode is 3, the backend supports both whole graph and piecewise compilation, available backends include eager, inductor, and custom backends, the latter of which can be defined via get_compile_backend. Furthermore, compilation is only piecewise if splitting ops is set accordingly and use_inductor_graph_partition is off. Note that the default options for splitting ops are sufficient for piecewise compilation.

cache_dir = '' class-attribute instance-attribute

The directory to store the compiled graph, to accelerate Inductor compilation. By default, it will use model-related information to generate a cache directory.

compilation_time = field(default=0.0, init=False) class-attribute instance-attribute

time taken for compilation

compile_cache_save_format = field(default_factory=lambda: envs.VLLM_COMPILE_CACHE_SAVE_FORMAT) class-attribute instance-attribute

Format for saving torch compile cache:

  • "binary": saves as binary file (multiprocess safe)

  • "unpacked": saves as directory structure for inspection/debugging (NOT multiprocess safe)

Defaults to VLLM_COMPILE_CACHE_SAVE_FORMAT if not specified.

compile_mm_encoder = False class-attribute instance-attribute

Whether or not to compile the multimodal encoder. Currently, this only works for Qwen2_5_vl and mLLaMa4 models on selected platforms. It may also work for models loaded with the Transformers modeling backend if the encoder is compilable. Disabled by default until more models are supported/tested to work.

compile_ranges_endpoints = None class-attribute instance-attribute

Endpoints for Inductor compile ranges. The compile ranges are [1, endpoints[0]], [endpoints[0] + 1, endpoints[1]], ..., [endpoints[-1] + 1, max_num_batched_tokens]. Compile sizes are also used single element ranges, the range is represented as [compile_sizes[i], compile_sizes[i]].

If a range overlaps with the compile size, graph for compile size will be prioritized, i.e. if we have a range [1, 8] and a compile size 4, graph for compile size 4 will be compiled and used instead of the graph for range [1, 8].

compile_sizes = None class-attribute instance-attribute

Sizes to compile for inductor. In addition to integers, it also supports "cudagraph_capture_sizes" to specify the sizes for cudagraph capture.

cudagraph_capture_sizes = None class-attribute instance-attribute

Sizes to capture cudagraph. - None (default): capture sizes are inferred from vllm config. - list[int]: capture sizes are specified as given.

Deprecated with model runner V2, which takes prefill_cudagraph_capture_token_sizes and decode_cudagraph_capture_request_sizes instead. Set there, these token counts are the prefill sizes and, rounded up to whole requests of the target model's query length, the decode sizes. After config resolution it holds the token count of every captured graph.

cudagraph_copy_inputs = False class-attribute instance-attribute

Deprecated: has no effect and will be removed in v0.37.0. The model runner already passes persistent input buffers to CUDA graphs.

cudagraph_decoder_replay = True class-attribute instance-attribute

Run the decoder replay layers of YOCO models (e.g. DeepSeek-V4.1) in CUDA graphs of their own, and trim them in PIECEWISE graph steps. Requires breakable PIECEWISE graphs; off under LoRA, prompt embeddings and non-first PP ranks.

cudagraph_mm_encoder = False class-attribute instance-attribute

Enable CUDA graph capture for multimodal encoder (ViT). When enabled, captures full encoder forward as CUDA graph for each token budget level.

cudagraph_mode = None class-attribute instance-attribute

The mode of the cudagraph:

  • NONE, no cudagraph capture.
  • PIECEWISE.
  • FULL.
  • FULL_DECODE_ONLY.
  • FULL_AND_PIECEWISE. (v1 default)

PIECEWISE mode build piecewise cudagraph only, keeping the cudagraph incompatible ops (i.e. some attention ops) outside the cudagraph for general flexibility.

FULL mode: Capture full cudagraph for all batches. Can be good for small models or workloads with small prompts; not supported by many backends. Generally for performance FULL_AND_PIECEWISE is better.

FULL_DECODE_ONLY mode: Capture full cudagraph for decode batches only. Mixed prefill-decode batches are run without cudagraphs. Can be good for decode instances in a P/D setup where prefill is not as important so we can save some memory.

FULL_AND_PIECEWISE mode: Capture full cudagraph for decode batches and piecewise cudagraph for prefill and mixed prefill-decode batches. This is the most performant mode for most models and is the default.

Currently, the cudagraph mode is only used for the v1 engine. Note that the cudagraph logic is generally orthogonal to the compilation logic. While piecewise cudagraphs require piecewise compilation (mode=VLLM_COMPILE and non-empty splitting_ops), full cudagraphs are supported with and without compilation.

Warning: This flag is new and subject to change in addition more modes may be added.

cudagraph_num_of_warmups = 0 class-attribute instance-attribute

Number of warmup runs for cudagraph. It means the first several runs will be treated as warmup runs. Only after that, the execution will be recorded, and the recorded cudagraph will be used for subsequent runs.

cudagraph_specialize_lora = True class-attribute instance-attribute

Whether to create separate cuda graphs for cases with and without active LoRA adapters. When set to False, the LoRA-enabled cuda graph will be used for all cases, incurring the overhead of running LoRA ops even when no adapters are active. Setting this to True will remove this overhead at the cost of increased startup time and slightly higher memory usage. When enable_lora is False, this option has no effect.

custom_ops = field(default_factory=list) class-attribute instance-attribute

Fine-grained control over which custom ops to enable/disable. Use 'all' to enable all, 'none' to disable all. Also specify a list of custom op names to enable (prefixed with a '+'), or disable (prefixed with a '-'). Examples:

  • ['all', '-op1'] to enable all except op1
  • ['none', '+op1', '+op2'] to enable only op1 and op2

By default, all custom ops are enabled when running without Inductor and disabled when running with Inductor: mode>CompilationMode.NONE and backend="inductor". Inductor generates (fused) Triton kernels for disabled custom ops.

debug_dump_path = None class-attribute instance-attribute

The path to dump the debug information.

decode_cudagraph_capture_request_sizes = None class-attribute instance-attribute

Request counts of the FULL CUDA graphs for uniform decode batches, whose requests all have the same query length q: 1 + num_speculative_tokens for the target model, K or K + 1 for DSpark, DFlash and multi-module MTP drafters. A runner captures n requests as n * q tokens, for each n up to the most requests its batches have and the recorded max_cudagraph_capture_size // q. One-token draft decodes (EAGLE, EAGLE3, MTP) take the request-count grid up to max_num_seqs instead. [] captures none. None (default): the request-count grid up to max_decode_cudagraph_capture_requests.

With adaptive verification, the target model's decode batches mix query lengths, so they take token-keyed FULL graphs instead: the token-count grid up to max_decode_cudagraph_capture_requests * (1 + num_speculative_tokens) tokens, within max_decode_cudagraph_capture_tokens. These request counts then set the draft decode graphs alone.

decoder_replay_cudagraph_capture_sizes = field(default_factory=list) class-attribute instance-attribute

Decoder replay CUDA graph sizes for YOCO models (e.g. DeepSeek-V4.1), at most max_num_batched_tokens. If empty: the powers of two below sliding_window, then multiples of sliding_window up to min(max_cudagraph_capture_size, max_num_seqs * sliding_window), coarser past 16 * sliding_window. Larger replay batches run eagerly.

decoder_replay_trim_threshold = Field(default=768, ge=0) class-attribute instance-attribute

For YOCO models (e.g. DeepSeek-V4.1), PIECEWISE graphs with at least this many padded tokens trim the decoder replay batch; must exceed the replay window (128), below which nothing trims. Independent of the replay graph capture sizes; eager steps still trim.

disabled_custom_ops = field(default_factory=Counter, init=False) class-attribute instance-attribute

custom ops that are disabled

dynamic_shapes_config = field(default_factory=DynamicShapesConfig) class-attribute instance-attribute

Configuration for dynamic shapes options

enabled_custom_ops = field(default_factory=Counter, init=False) class-attribute instance-attribute

custom ops that are enabled

encoder_compilation_time = field(default=0.0, init=False) class-attribute instance-attribute

time taken for multimodal encoder compilation

encoder_cudagraph_max_frames_per_batch = None class-attribute instance-attribute

Maximum total video frames per batch for encoder CUDA graph capture. Controls the cu_seqlens buffer size (one entry per attention sequence, i.e. one per video frame). If None (default), auto-inferred as encoder_cudagraph_max_vision_items_per_batch * max_frames_per_video (model-specific value according to processing_info). Positive value overrides auto-inference and applies to all budget levels. If we limit the video count per prompt to 0, it will also be set to 0 (i.e., fall back to image-only mode).

encoder_cudagraph_max_token_budget = 5120 class-attribute instance-attribute

Largest auto-generated encoder CUDA graph token budget; must be positive or None. A batch with more tokens runs eagerly. The default balances graph memory against replay coverage; performance depends on the model, batch shape, and hardware. None captures up to the model's largest budget. Ignored when encoder_cudagraph_token_budgets is set.

encoder_cudagraph_max_vision_items_per_batch = 0 class-attribute instance-attribute

Maximum number of images/videos per batch for encoder CUDA graph capture. Determines the fixed batch size used during graph capture. If 0 (default), auto-inferred as max_budget // min_budget from the model's budget range. User-provided positive value overrides auto-inference. A batch with more items runs eagerly in one forward.

encoder_cudagraph_token_budgets = field(default_factory=list) class-attribute instance-attribute

Token budget levels for encoder CUDA graph capture. Each budget defines a fixed token capacity. At runtime, a batch replays the smallest budget that holds it, or runs eagerly if none does. If empty (default), generated over the model's budget range: quarter-octave steps up to 1024 tokens, steps of 128 up to 2560, then 1/8-octave steps, up to encoder_cudagraph_max_token_budget. User-provided values override auto-inference. Example: [2048, 4096, 8192, 13824]

fast_moe_cold_start = None class-attribute instance-attribute

Optimization for fast MOE cold start.

This is a bit of a hack that assumes that: 1. the only decoder forward pass being run is the current model 2. the decoder forward pass runs all of the MOEs in the order in which they are initialized

When the above two conditions hold, this option greatly decreases cold start time for MOE models.

The options are: - True: optimization is always on - False: optimization is always off - None: optimization is on usually but off for speculative decoding

If conditions 1&2 don't hold then this option will lead to silent incorrectness. The only condition in which this doesn't hold is speculative decoding, where there is a draft model that may have MOEs in them.

NB: We're working on a longer-term solution that doesn't need these assumptions.

inductor_compile_config = field(default_factory=dict) class-attribute instance-attribute

Additional configurations for inductor. - None: use default configurations.

inductor_passes = field(default_factory=dict) class-attribute instance-attribute

Additional passes for inductor. It is a dictionary from pass name to pass function qualified name. We use function name because the config uses JSON format. If we pass the config from Python, functions can also be passed directly via Python object constructor, e.g. CompilationConfig(inductor_passes={"a": func}).

ir_enable_torch_wrap = None class-attribute instance-attribute

If True, enable vllm_ir torch custom op wrapping during the forward pass. When False, torch custom op wrapping is disabled, allowing Dynamo to trace the selected implementation directly or avoiding torch custom op overhead in eager mode. Defaults to True when using Inductor with vllm-compile (backend=="inductor" and mode == VLLM_COMPILE), False otherwise.

local_cache_dir = field(default=None, init=False) class-attribute instance-attribute

local cache dir for each rank

max_cudagraph_capture_size = None class-attribute instance-attribute

The maximum cudagraph capture size.

If cudagraph_capture_sizes is specified, this will be set to the largest size in that list (or checked for consistency if specified). If cudagraph_capture_sizes is not specified, the list of sizes is generated automatically following the pattern:

[1, 2, 4] + list(range(8, 256, 8)) + list(
range(256, max_cudagraph_capture_size + 1, 16))

If not specified, max_cudagraph_capture_size is capped at 512 by default, or 1024 on data center Blackwell GPUs. This avoids OOM in tight memory scenarios with small max_num_seqs, and limits capture of large graphs that increase startup time and memory usage. Uniform decode sizes are appended only within this default ceiling.

Deprecated with model runner V2, which takes max_prefill_cudagraph_capture_tokens (tokens) and max_decode_cudagraph_capture_requests (requests) instead. After config resolution it holds the token count of the widest captured graph.

max_decode_cudagraph_capture_requests = Field(default=None, ge=0) class-attribute instance-attribute

Largest request count of a decode CUDA graph; with adaptive verification it also bounds the verify graphs' tokens (see decode_cudagraph_capture_request_sizes). None (default): max_num_seqs on SM100 GPUs, otherwise the most requests that the platform's default max_cudagraph_capture_size holds at the target model's query lengths. Graphs no wider than the widest prefill graph mostly reuse its memory in the shared graph pool. Wider graphs, and FULL graphs of models with large per-token buffers (e.g. DeepSeek's indexer at a long max_model_len), take memory from the KV cache.

max_decode_cudagraph_capture_tokens = Field(default=None, ge=1) class-attribute instance-attribute

Token budget of a uniform decode CUDA graph: each runner captures n requests at query length q only while n * q fits, and wider decode batches take the prefill graphs. It also bounds adaptive verification's token-keyed graphs. None (default): 8192 on SM100 GPUs, otherwise no budget. Wider decode graphs take memory from the KV cache.

max_prefill_cudagraph_capture_tokens = Field(default=None, ge=0) class-attribute instance-attribute

Largest token count of a prefill CUDA graph. None (default): 8192 on SM100 GPUs, otherwise the platform's default max_cudagraph_capture_size; at most max_num_batched_tokens. More and wider graphs take memory from the KV cache and lengthen startup.

mode = None class-attribute instance-attribute

The compilation approach used for torch.compile-based compilation of the model.

  • None: If None, we will select the default compilation mode. For V1 engine this is 3.
  • 0: NONE: No torch.compile compilation is applied, model runs in fully eager pytorch mode. The model runs as-is.
  • 1: STOCK_TORCH_COMPILE: The standard torch.compile compilation pipeline.
  • 2: DYNAMO_TRACE_ONCE: Single Dynamo trace through the model, avoiding recompilation by removing guards. Requires no dynamic-shape-dependent control-flow.
  • 3: VLLM_COMPILE: Custom vLLM Inductor-based backend with caching, piecewise compilation, shape specialization, and custom passes.

pass_config = field(default_factory=PassConfig) class-attribute instance-attribute

Custom inductor passes, see PassConfig for more details

prefill_cudagraph_capture_token_sizes = None class-attribute instance-attribute

Token counts of the CUDA graphs for prefill batches: every batch that is not a uniform decode batch, i.e. one with a prefill or with requests of different query lengths, and every batch when cudagraph_mode is FULL or PIECEWISE. Decode batches under adaptive verification are the exception; see decode_cudagraph_capture_request_sizes. [] captures none, and sizes above max_num_batched_tokens are dropped. None (default): the token-count grid up to max_prefill_cudagraph_capture_tokens.

splitting_ops = None class-attribute instance-attribute

A list of ops to exclude from cudagraphs, used in piecewise compilation.

The behavior depends on use_inductor_graph_partition:

  • When use_inductor_graph_partition=False (default): These ops are used for Dynamo FX-level graph splitting. The graph is split at these ops before Inductor compilation, creating separate subgraphs for cudagraph capture.

  • When use_inductor_graph_partition=True: These ops are used to register Inductor partition rules. The graph partitioning happens at Inductor codegen time after all passes and fusions are finished, allowing compilation and custom passes to operate on the full graph while still excluding these ops from cudagraphs.

If None, defaults to attention ops for piecewise cudagraphs. If empty list [], no ops are excluded (suitable for full cudagraphs).

static_all_moe_layers = field(default_factory=list, init=False) class-attribute instance-attribute

The names of all the MOE layers in the model

static_forward_context = field(default_factory=dict, init=False) class-attribute instance-attribute

Per-model forward context Map from layer name to layer objects that need to be accessed outside model code, e.g., Attention, FusedMOE when dp_size>1.

traced_files = field(default_factory=set, init=False) class-attribute instance-attribute

files that are traced for compilation

use_breakable_cudagraph = None class-attribute instance-attribute

Whether to use breakable CUDA graphs (runtime stream-capture breaks instead of torch.compile FX graph splitting).

Resolved by VllmConfig.post_init: an explicit VLLM_USE_BREAKABLE_CUDAGRAPH env var takes precedence, otherwise it is auto-enabled for breakable-by-default architectures (and for tuned batch-invariant setups). None means unresolved; readers fall back to envs.VLLM_USE_BREAKABLE_CUDAGRAPH so standalone CompilationConfig users keep working. Stored per-config (and pickled to workers) rather than written back to os.environ.

use_inductor_graph_partition = None class-attribute instance-attribute

Use inductor graph partition to split the graph at cudagraph_unsafe ops. This partition happens at inductor codegen time after all passes and fusions are finished. It generates a single call function which wraps cudagraph-safe ops into partition functions and leave cudagraph-unsafe ops outside the partition functions. For a graph with N cudagraph-unsafe ops (e.g., Attention), there would be N+1 partitions. To mark an op as cudagraph unsafe, we can add tags=(torch._C.Tag.cudagraph_unsafe) when register the custom op.

This config supports both full cudagraph and piecewise cudagraph without compiling twice. For piecewise cudagraph, it applies vLLM CUDAGraph wrapper to each partition. For N+1 partitions, there would be N+1 CUDAGraph wrapper instances.

For full CUDAGraph, we always apply a single CUDAGraph wrapper outside the inductor call function in the model runner. The top-level full cudagraph capture ignores all partitioning.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialisation is delayed.

compile_factors()

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

custom_op_log_check()

This method logs the enabled/disabled custom ops and checks that the passed custom_ops field only contains relevant ops. It is called at the end of set_current_vllm_config, after the custom ops have been instantiated.

enable_custom_op_by_default(op)

Enable op unless custom_ops already enables or disables it.

Idempotent, because VllmConfig.__post_init__ runs again on every replace() and shares this config with the original.

get_compile_ranges()

Get the compile ranges for the compilation config.

init_backend(vllm_config, prefix='', is_encoder=False, use_aot_compile=True)

Initialize the backend for the compilation config from a vllm config.

Parameters:

  • vllm_config

    (VllmConfig) –

    The vllm config to initialize the backend from.

  • prefix

    (str, default: '' ) –

    Cache directory prefix for this compiled module.

  • is_encoder

    (bool, default: False ) –

    Whether this module is used in an encoder (as opposed to a text backbone).

  • use_aot_compile

    (bool, default: True ) –

    Whether the module permits AOT and direct artifacts.

Returns:

  • str | Callable –

    The backend for the compilation config.

post_init_cudagraph_sizes()

To complete the initialization after cudagraph related configs are set. This includes: - initialize compile_sizes

resolve_cudagraph_mode_and_sizes(min_cg_support, min_cg_attn_backend, uniform_decode_query_len=1, kv_cache_config=None, max_num_reqs=None, is_profiling=False, piecewise_capture_available=True)

Resolve the CUDA Graphs mode the attention backends can support.

Downgrades the configured mode to the best supported one and stores it, or raises a ValueError if the requested CUDA Graphs cannot be supported.

uses_rope_kernel()

Whether RoPE should lower to a kernel instead of Inductor codegen.

True when the RoPE custom op is enabled or a RoPE fusion pass is on, so RoPE left unfused keeps the kernel. Safe before custom_ops resolution.

validate_cudagraph_mode_before(value) classmethod

Enable parsing of the cudagraph_mode enum type from string.

validate_mode_before(value) classmethod

Enable parsing the mode field from string mode names. Accepts both integers (0-3) and string names, like NONE, STOCK_TORCH_COMPILE, DYNAMO_TRACE_ONCE, VLLM_COMPILE.

validate_pass_config_before(value) classmethod

Enable parsing of the pass_config field from a dictionary.

CompilationMode

Bases: IntEnum

The compilation approach used for torch.compile-based compilation of the model.

Attributes:

  • DYNAMO_TRACE_ONCE –

    Single Dynamo trace through the model, avoiding recompilation.

  • NONE –

    No torch.compile compilation is applied, model runs in fully eager pytorch mode.

  • STOCK_TORCH_COMPILE –

    The standard torch.compile compilation pipeline.

  • VLLM_COMPILE –

    Custom vLLM Inductor-based backend with caching, piecewise compilation,

DYNAMO_TRACE_ONCE = 2 class-attribute instance-attribute

Single Dynamo trace through the model, avoiding recompilation.

NONE = 0 class-attribute instance-attribute

No torch.compile compilation is applied, model runs in fully eager pytorch mode. The model runs as-is.

STOCK_TORCH_COMPILE = 1 class-attribute instance-attribute

The standard torch.compile compilation pipeline.

VLLM_COMPILE = 3 class-attribute instance-attribute

Custom vLLM Inductor-based backend with caching, piecewise compilation, shape specialization, and custom passes.

DeviceConfig

Configuration for the device to use for vLLM execution.

Methods:

Attributes:

  • device (SkipValidation[Device | device | None]) –

    Device type for vLLM execution.

  • device_type (str) –

    Device type from the current platform. This is set in

device = 'auto' class-attribute instance-attribute

Device type for vLLM execution. This parameter is deprecated and will be removed in a future release. It will now be set automatically based on the current platform.

device_type = field(init=False) class-attribute instance-attribute

Device type from the current platform. This is set in __post_init__.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

DiffusionConfig

Configuration for discrete diffusion language models (dLLMs).

dLLMs generate tokens via iterative denoising over a fixed-length canvas rather than left-to-right autoregressive decoding. They reuse the speculative-decoding data path (draft token ids, scheduled spec decode tokens) with overloaded semantics for block-based generation.

Attributes:

canvas_length = Field(default=None, gt=0) class-attribute instance-attribute

Length of the denoising canvas (block). Also determines the number of speculative tokens scheduled per step.

max_denoising_steps = None class-attribute instance-attribute

Maximum number of denoising iterations per canvas block. If not set, read from the model's generation_config.json.

model_options = Field(default_factory=dict) class-attribute instance-attribute

Model-specific options. The accepted keys depend on the model and are validated once the model is known, e.g. NemotronDiffusionOptions or DiffusionGemmaDiffusionOptions in vllm.model_executor.models.config.

ECEventsConfig

Bases: PublisherConfig

Configuration for encoder cache (EC) event publishing.

Attributes:

enable_ec_cache_events = False class-attribute instance-attribute

If True, enable encoder cache events for tracking which multimodal inputs are cached and where. Events can be published externally by zmq using the event publisher config.

endpoint = 'tcp://*:6558' class-attribute instance-attribute

The zmq endpoint for EC events.

Ports are offset by the data parallel rank like KV events. The block starts 1000 ports above the 5557/5558 KV events block, so the two stay disjoint for up to 1000 DP ranks on one host, replay included.

ECTransferConfig

Configuration for distributed EC cache transfer.

Methods:

Attributes:

ec_buffer_device = 'cuda' class-attribute instance-attribute

The device used by ec connector to buffer the EC cache. Currently only support 'cuda'.

ec_buffer_size = 1000000000.0 class-attribute instance-attribute

The buffer size for TorchDistributedConnector. Measured in number of bytes. Recommended value: 1e9 (about 1GB).

ec_connector = None class-attribute instance-attribute

The EC connector for vLLM to transmit EC caches between vLLM instances.

Built-in options include ECExampleConnector (shared filesystem via safetensors) and ECMooncakeConnector (Mooncake TransferEngine RDMA; requires mooncake-transfer-engine and matching producer/consumer ec_connector_extra_config; see mooncake_ec_connector module docstring). Set cross_encoder_cache in Mooncake extra config to reuse shared Encoder outputs from Store before encoding, retaining P2P delivery.

ec_connector_extra_config = field(default_factory=dict) class-attribute instance-attribute

any extra config that the connector may need.

ec_connector_module_path = None class-attribute instance-attribute

The Python module path to dynamically load the EC connector from. Only supported in V1.

ec_ip = '127.0.0.1' class-attribute instance-attribute

The EC connector ip, used to build distributed connection.

ec_port = 14579 class-attribute instance-attribute

The EC connector port, used to build distributed connection.

ec_role = None class-attribute instance-attribute

Whether this vLLM instance produces, consumes EC cache, or both. Choices are 'ec_producer', 'ec_consumer', 'ec_both'.

engine_id = None class-attribute instance-attribute

The engine id for EC transfers.

is_encode_only property

Whether this instance encodes but does not run the language model.

It allocates no KV cache either -- GPUModelRunner.get_kv_cache_layer_configs returns {} for it -- so it is the one role that can spend accelerator time and memory on frontend work.

mm_encoder_output_widths = field(default_factory=dict, init=False) class-attribute instance-attribute

Per-token width of the encoder output for each modality, measured by EC producers at startup. It can exceed the LM embedding width (e.g. DeepStack).

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

EPLBConfig

Configuration for Expert Parallel Load Balancing (EP).

Attributes:

communicator = None class-attribute instance-attribute

Backend for EPLB expert weight communication: - "torch_nccl": Use torch.distributed on the device process group - "torch_gloo": Use torch.distributed gloo with CPU staging - "torch_xccl": Use torch.distributed XCCL device P2P on XPU - "nixl": Use NIXL with staged send/recv buffers - "pynccl": Use PyNccl send/recv - "symm_mem": Push expert rows over CUDA symmetric memory; needs all EP ranks in one NVLink domain (MNNVL across nodes) - None: Auto-select backend ("torch_xccl" on XPU, prefers "nixl" on CUDA, falls back to "torch_gloo")

draft_num_redundant_experts = Field(default=None, ge=0) class-attribute instance-attribute

Redundant expert count for an EPLB-backed MoE draft. If unset, the target count is inherited when target and draft routed expert counts match and the target count is valid for the draft; otherwise, the draft's minimum valid count is computed. Explicit values are validated and rejected if they do not satisfy EP divisibility for every draft routed expert count.

enable_migration_batching = False class-attribute instance-attribute

Schedule expert migrations in batches where each rank communicates with at most one peer. This reduces per-rank network contention at the cost of additional sequential communication steps. This option only applies to async EPLB and is disabled by default.

log_balancedness = False class-attribute instance-attribute

Log the balancedness each step of expert parallelism. This is turned off by default since it will cause communication overhead.

log_balancedness_interval = Field(default=1, gt=0) class-attribute instance-attribute

Interval for logging the balancedness.

migration_batching_enabled property

Whether contention-aware batching is active for this configuration.

num_redundant_experts = Field(default=None, ge=0) class-attribute instance-attribute

Number of redundant experts to use for expert parallelism. If None (default), the minimum valid value will be computed automatically based on the number of logical experts and the expert parallel size. The value will be rounded up to the nearest multiple of the expert parallel size.

policy = None class-attribute instance-attribute

Built-in or platform-defined policy name. None selects the platform default ("default" on built-in platforms). Validated by the platform.

step_interval = Field(default=3000, gt=0) class-attribute instance-attribute

Interval for rearranging experts in expert parallelism.

Note that if this is greater than the EPLB window size, only the metrics of the last lb_window_size steps will be used for rearranging experts. With async EPLB, the interval starts when the previous rearrangement has committed all layers.

use_async = True class-attribute instance-attribute

Whether to use non-blocking EPLB. Async policy computation runs in a persistent CPU subprocess per worker. The policy and its CPU inputs must be serializable. Synchronous and profiling calls stay in the worker.

window_size = Field(default=1000, gt=0) class-attribute instance-attribute

Window size for expert load recording.

EncoderCacheManagerConfig

Attributes:

encoder_cache_manager_cls = None class-attribute instance-attribute

Fully qualified class name of the custom encoder cache manager.

manager_config = field(default_factory=dict) class-attribute instance-attribute

Opaque configuration interpreted by the custom cache manager.

EngramConfig

Configuration for Engram embedding storage and sharding.

Methods:

Attributes:

  • cpu_offload (bool) –

    Store embedding weights in host memory. NVLink peer groups use local

  • disk_offload (bool) –

    Keep Qwen4Exp PLE tables in the checkpoint files and read each step's

  • dp_shared_memory (bool | None) –

    Share CPU-offloaded embedding weights between co-located

  • embedding_across_dp (bool) –

    Shard embeddings across TP and all DP ranks when enabled.

  • peer_group_fetch (Literal['sync', 'async']) –

    Where a peer group's fetch kernels run. sync: on the compute stream,

  • peer_group_rdma_inflight (int) –

    With rdma, the most prefill-sized gathers (64 WRs each) a GPU's NIC

  • peer_group_size (int) –

    Split each table's rows over this many GPUs of several engines (the sum

  • peer_group_store (str | None) –

    File through which a peer group's engines meet once at startup. Required

  • peer_group_thp_dir (str | None) –

    With rdma and cpu_offload: a directory on a tmpfs mounted with

  • peer_group_transport (Literal['nvlink', 'rdma']) –

    How a peer group reads rows: nvlink loads them from peer device or host memory

  • use_thp (bool) –

    Back private CPU-offloaded tables with transparent huge pages (best

cpu_offload = True class-attribute instance-attribute

Store embedding weights in host memory. NVLink peer groups use local Grace host memory when enabled and HBM when disabled.

disk_offload = False class-attribute instance-attribute

Keep Qwen4Exp PLE tables in the checkpoint files and read each step's rows on the host instead of allocating the table. Takes precedence over cpu_offload.

dp_shared_memory = None class-attribute instance-attribute

Share CPU-offloaded embedding weights between co-located DP replicas. Each node stores one copy of every TP shard, reducing host memory without per-step Engram DP collectives. Uses host-NUMA cuMem shared by FABRIC handle where supported (on ROCm, HIP VMM host memory with VLLM_ROCM_ENGRAM_HIP_VMM=1), else /dev/shm (which then needs capacity and a shared IPC namespace). Defaults to enabled when the model and other settings allow it; Flash uses private replicas. Falls back to per-replica tables when DP replicas are not co-located on one node or the host cannot hold them.

embedding_across_dp = False class-attribute instance-attribute

Shard embeddings across TP and all DP ranks when enabled. Otherwise, each DP rank has a separate TP-sharded embedding replica.

peer_group_fetch = 'sync' class-attribute instance-attribute

Where a peer group's fetch kernels run. sync: on the compute stream, started before the decoder layers, each Engram layer waiting for its own rows; over RDMA the rows move without SMs in between. async: on a side stream beside the layers, so their SM work (all of NVLink's gather) overlaps compute. Full CUDA graphs capture both; piecewise ones break at the start and at each Engram layer's wait.

peer_group_rdma_inflight = Field(default=8, ge=0) class-attribute instance-attribute

With rdma, the most prefill-sized gathers (64 WRs each) a GPU's NIC has in flight for its peers; 0 means no limit. Decode-sized fetches bypass it, so one engine's prefill delays another engine's decode by at most this backlog. The default (~2 MB) keeps prefill fetches at full rate.

peer_group_size = 0 class-attribute instance-attribute

Split each table's rows over this many GPUs of several engines (the sum of their GPU counts); lookups read rows from the owning GPU. Every engine passes the same value, peer_group_store and peer_group_transport. Requires a model with Engram pool support (DeepSeek V4.1 or Qwen4Exp), CUDA, TP=1 and PP=1.

peer_group_store = None class-attribute instance-attribute

File through which a peer group's engines meet once at startup. Required with peer_group_size: the same path for every engine, reachable by all of them and fresh per launch (e.g. under a per-job directory).

peer_group_thp_dir = None class-attribute instance-attribute

With rdma and cpu_offload: a directory on a tmpfs mounted with huge=always, where host shards are placed on transparent huge pages. NICs gather rows at random, so a large shard on base pages misses the NIC's address-translation cache on nearly every row, which can make large fetches several times slower.

peer_group_transport = 'nvlink' class-attribute instance-attribute

How a peer group reads rows: nvlink loads them from peer device or host memory through CUDA FABRIC handles and an IMEX channel. With rdma, the owners' NICs gather them from HBM, or from host memory with cpu_offload.

use_thp = False class-attribute instance-attribute

Back private CPU-offloaded tables with transparent huge pages (best effort, falls back to ordinary pinned pages). Prefaulting the tables at startup takes longer. Requires cpu_offload without dp_shared_memory. Always on for private tables on ROCm.

compile_factors()

Hash settings that affect embedding execution and graph structure.

get_parallel_size(parallel_config)

Derive the embedding group size from the parallel configuration.

resolve_dp_shared_memory(parallel_config, model_config=None)

Share host tables by default wherever the model supports them.

verify_model_config(model_config)

Reject Engram configuration for models without n-gram embeddings.

verify_parallel_config(parallel_config)

Reject unsupported embedding parallel topologies.

FaultToleranceConfig

Configuration for fault tolerance.

Methods:

Attributes:

engine_recovery_timeout_sec = 120 class-attribute instance-attribute

Timeout (in seconds) to wait for error handling instructions before raising an exception. If the EngineCore encounters an error, it waits up to this many seconds for vLLM to receive instructions on how to handle the error and then recover from the fault. If vLLM does not recover during this time, the original error is raised.

request_failure_policy = 'fail' class-attribute instance-attribute

Policy for handling unfinished requests when the engine encounters a fault. 'recompute': preempt requests back to the waiting queue to recompute their KV cache and continue generation after recovery, without abort notifications. 'fail': abort unfinished requests immediately (default). Passing params={"abort": true} to the retry instruction discards queued requests even when the policy is 'recompute'.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

HiSparseConfig

Configuration for HiSparse DSA and QSA KV offloading.

Attributes:

device_buffer_size = Field(default=None, gt=0) class-attribute instance-attribute

Total per-request GPU hot-buffer rows, including the newest-token slot.

Defaults to one top-k per decode query plus one top-k of LRU slack. The physical allocation is rounded up to the GPU cache block size selected from the active backends.

eager_host_mirror = True class-attribute instance-attribute

Mirror decode-written KV rows to the host pool during the forward so page spills complete without moving data. When disabled, decode rows stay resident-only and evicted pages are copied to host at spill time. Prefill rows are always mirrored during the forward.

KVEventsConfig

Bases: PublisherConfig, _KVEventsToggle

Configuration for KV event publishing.

KVTransferConfig

Configuration for distributed KV cache transfer.

Methods:

Attributes:

enable_permute_local_kv = False class-attribute instance-attribute

Experiment feature flag to enable HND to NHD KV Transfer

engine_id = None class-attribute instance-attribute

The engine id for KV transfers.

kv_buffer_device = field(default_factory=kv_buffer_device_default_factory) class-attribute instance-attribute

The device used by kv connector to buffer the KV cache. Choices are 'cuda', 'cpu' and 'xpu'.

kv_connector = None class-attribute instance-attribute

The KV connector for vLLM to transmit KV caches between vLLM instances.

kv_connector_extra_config = field(default_factory=dict) class-attribute instance-attribute

any extra config that the connector may need.

kv_connector_module_path = None class-attribute instance-attribute

The Python module path to dynamically load the KV connector from. Only supported in V1.

kv_load_failure_policy = 'fail' class-attribute instance-attribute

Policy for handling KV cache load failures. 'recompute': reschedule the request to recompute failed blocks 'fail': immediately fail the request with an error finish reason (default)

kv_port = 14579 class-attribute instance-attribute

The KV connector port, used to build distributed connection.

kv_role = None class-attribute instance-attribute

Whether this vLLM instance produces, consumes KV cache, or both. Choices are 'kv_producer', 'kv_consumer', and 'kv_both'. With MultiConnector, the roles of its connectors decide this instead.

_connector_roles()

The kv_role of each connector. MultiConnector does not pass its own kv_role to its connectors, so only theirs count.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

has_connector(connector_name)

Whether connector_name is configured, directly or in MultiConnector.

kv_cache_access()

How the configured connectors reach the device KV cache, directly or in MultiConnector. Imports the connector class to ask it, through KVConnectorBase_V1.kv_cache_access.

registers_kv_cache_memory()

Whether a connector registers the device KV cache with UCX or RDMA, or another process imports it, directly or in MultiConnector: each segment must then be backed by one physical allocation.

uses_custom_mem_pool()

Whether a connector allocates the KV cache from its own memory pool (custom_mem_pool), directly or in MultiConnector.

KernelConfig

Configuration for kernel selection and warmup behavior.

Methods:

Attributes:

b12x_moe_uncompressed_scales = False class-attribute instance-attribute

Decode csf-compressed NVFP4 MoE block scales at load. By default the B12X MoE backend keeps them compressed on the GPU and expands the routed experts' scales on each call, which saves memory (2.57 GiB on Qwen3.8-Flash-Next-FP4-Local) at some latency at higher batch sizes.

enable_cutedsl_warmup = True class-attribute instance-attribute

Deprecated: run legacy CuTeDSL warmup providers.

enable_flashinfer_autotune = None class-attribute instance-attribute

Benchmark FlashInfer kernel implementations during warmup and use the fastest. Enabled by default except at -O0; disable for faster startup.

enable_flashinfer_mm_encoder_autotune = False class-attribute instance-attribute

Include multimodal encoders and projectors in FlashInfer autotuning. Disabled by default because profiling can increase startup time. Requires enable_flashinfer_autotune and Model Runner V2. Skipped when skip_mm_profiling is set.

enable_jit_warmup = True class-attribute instance-attribute

If True, run JIT compile warmup during kernel warmup.

enable_rocm_aiter_gemm_warmup = False class-attribute instance-attribute

If True, run a dummy forward at every AITER tuned-GEMM token bucket up to max_num_batched_tokens during kernel warmup on ROCm, so AITER builds those kernels at startup instead of stalling the first requests that hit each bucket. Costs one dummy forward per bucket (164 at 8192 tokens).

enable_rocm_segmented_attn_autotune = False class-attribute instance-attribute

If True, autotune ROCm segmented attention during kernel warmup on RDNA GPUs.

flashinfer_sparse_mla_kernel = 'auto' class-attribute instance-attribute

Kernel of the SM100 FLASHINFER_MLA_SPARSE backend for D576 sparse MLA. Available options:

  • "auto": prims_ts for nvfp4_ds_mla, and for a per-tensor fp8 cache under DCP (decode_context_parallel_size > 1) when it can run; else trtllm-gen
  • "trtllm": trtllm-gen; nvfp4_ds_mla caches cannot use this backend
  • "prims_ts": FlashInfer's task-scheduled sparse MLA decode, also for a per-tensor fp8 cache

ir_op_priority = Field(default_factory=IrOpPriorityConfig) class-attribute instance-attribute

vLLM IR op priority for dispatching/lowering during the forward pass. Platform defaults appended automatically during VllmConfig.post_init.

Deprecated: vLLM IR is being removed, and this option will be removed in v0.34.0. Kernels will be selected by the platform, as for other custom ops.

linear_backend = 'auto' class-attribute instance-attribute

Backend for linear layer GEMM kernels. Available options:

Layer types without an implementation from the requested backend use automatic selection.

  • "auto": Automatically select the best backend based on model and hardware
  • "cutlass": Use CUTLASS-based kernels
  • "flashinfer_cutlass": Use FlashInfer with CUTLASS kernels
  • "flashinfer_cutedsl": Use FlashInfer with CuTe-DSL kernels (BF16, NVFP4, MXFP8, W4A16_NVFP4)
  • "flashinfer_trtllm": Use FlashInfer with TensorRT-LLM kernels
  • "flashinfer_cudnn": Use FlashInfer with cuDNN kernels
  • "flashinfer_b12x": Use FlashInfer b12x CuteDSL NVFP4 GEMM (SM120+)
  • "b12x": Use native B12X FP8 and FP4 linear kernels on SM12x
  • "marlin": Use Marlin kernels
  • "triton": Use Triton-based kernels
  • "deep_gemm": Use DeepGEMM kernels
  • "torch": Use PyTorch native scaled_mm kernels
  • "aiter": Use AMD AITer kernels (ROCm only)
  • "machete": Use Machete kernels (mixed-precision)
  • "fbgemm": Use FBGEMM kernels
  • "conch": Use Conch mixed-precision kernels
  • "exllama": Use Exllama mixed-precision kernels
  • "emulation": Use slow dequant-to-BF16 emulation (for testing only)
  • "xpu": Use XPU kernels
  • "xpu_woq": Use XPU kernels for weight-only quantization (e.g. W8A16)

linear_backend_per_quant = Field(default=None, min_length=1) class-attribute instance-attribute

Backend overrides keyed by linear quantization scheme. Overrides take precedence over linear_backend; for example, {"nvfp4_w4a16": "humming"}.

moe_backend = 'auto' class-attribute instance-attribute

Backend for MoE expert computation kernels. Out-of-tree platforms can add names to the in-tree options:

  • "auto": Automatically select the best backend based on model and hardware
  • "triton": Use Triton-based fused MoE kernels
  • "batched_triton": Use batched Triton experts (moe_mmk) on the batched activation format ([E_local, max_num_tokens, K])
  • "deep_gemm": Use DeepGEMM kernels (FP8 block-quantized only)
  • "deep_gemm_mega_moe": Use DeepGEMM mega MoE kernels with MXFP4, MXFP8, NVFP4 or BF16 experts on SM100, or MXFP4 or 128x128 block-FP8 on SM90
  • "cutlass": Use vLLM CUTLASS kernels
  • "flashinfer_trtllm": Use FlashInfer with TRTLLM-GEN kernels
  • "flashinfer_cutlass": Use FlashInfer with CUTLASS kernels
  • "flashinfer_cutedsl": Use FlashInfer with CuteDSL kernels (NVFP4, and MXFP8 with --all2all-backend deepep_low_latency or nixl_ep, on Blackwell; unquantized bf16/fp16 on Hopper)
  • "flashinfer_moe_ep_cutedsl": Use FlashInfer's CuTeDSL MoE-EP mega-kernel with NVFP4 or MXFP4 weights on Blackwell (SM100/SM103, where MXFP4 checkpoints are requantized to NVFP4 at load, or SM107, where MXFP4 runs with MXFP8 activations), or with block-FP8 (128x128) or MXFP4 weights on Hopper; requires expert parallelism and NVSHMEM
  • "flashinfer_b12x": Use FlashInfer CuteDSL fused MoE for SM12x (RTX Pro 6000 / DGX Spark)
  • "b12x": Use b12x FP4 MoE kernels on SM12x
  • "flashinfer_moe_ep_mega_deep_gemm": Use the FlashInfer moe_ep expert-parallel mega-MoE with the DeepGEMM megakernel, which consumes an MXFP4 checkpoint verbatim (Blackwell, requires expert parallel; DeepSeek-V4 only)
  • "marlin": Use Marlin kernels (weight-only quantization)
  • "humming": Use Humming Mixed Precision kernels
  • "triton_unfused": Use Triton unfused MoE kernels
  • "aiter": Use AMD AITer kernels (ROCm only)
  • "aiter_mega_moe": Use the AITER MegaMoE fused dispatch/GEMM/combine kernel (ROCm gfx950, requires DP+EP with a MoRI all2all backend; DeepSeek-V4 and V4.1 only)
  • "aiter_triton_mxfp4_bf16": Use the AITER Triton MXFP4 W4A16 (moe_gemm_a16w4) MoE kernel (ROCm gfx942/gfx950/gfx1250)
  • "aiter_triton_mxfp4_mxfp4": Use the AITER Triton/Gluon MXFP4 W4A4 (moe_gemm_a4w4) MoE kernel (ROCm gfx1250)
  • "aiter_triton_mxfp8_mxfp8": Use the AITER Triton MXFP8 W8A8 (moe_gemm_a8w8) MoE kernel (ROCm gfx942)
  • "flydsl": Use AMD FlyDSL kernels (ROCm only)
  • "rdna3": Use the fused RDNA3 W4A16 HIP kernel (ROCm gfx1100 only)
  • "rdna3_int4_int8": Int4 MoE decode with int8 activations per 32 values on RDNA3/RDNA3.5 (ROCm gfx11) for up to 64 tokens, Triton WNA16 otherwise; auto-selected for quantization_config.moe.activation int8_per_group_32
  • "hpc": Use HPC kernels (FP8 and Hopper only)
  • "emulation": use BF16/FP16 GEMM, dequantizing weights and running QDQ on activations.

monokernel = False class-attribute instance-attribute

If True, run decode steps on the model's specialized decode (RFC #60904), e.g. a persistent kernel covering most or all of a decoder layer. Equivalent to --additional-config '{"decode_backend": "latency_specialized"}'. Which models, hardware and parallel layouts support it is model-specific; an unsupported deployment is refused at startup.

rdna_hybrid_w4a16_prefill_dequant = 'disable' class-attribute instance-attribute

Cache a dense dequantized copy of each weight for the RDNA hybrid W4A16 linear kernel's prefill GEMM. Applies only on gfx11/gfx12 RDNA GPUs, where that kernel is selected; a no-op for every other kernel. Prefill GEMMs then run on the dense copy instead of dequantizing int4 every step, cutting TTFT by 20-25% on gfx1151 for Qwen3 and Gemma-4. Decode stays on int4, so TPOT is unchanged. The copy is ~4x the size of the int4 weight and comes out of the gpu_memory_utilization budget, leaving less room for KV cache, so it suits unified-memory parts where TTFT matters more than KV capacity. Available options:

  • "disable": Keep prefill on the int4 path (default)
  • "enable": Cache every layer's copy; startup fails if they do not fit in the budget

sparse_indexer_topk_backend = 'auto' class-attribute instance-attribute

Backend for the DSA sparse indexer top-k kernel. Available options:

  • "auto": Decode uses the pre-existing chain (cooperative -> persistent -> per_row) on CUDA and per_row on ROCm; prefill ranks BF16 logits with DeepSelect on SM100a/SM103a (except under VLLM_BATCH_INVARIANT) and uses top_k_per_row_prefill elsewhere. The other backends are opt-in
  • "deep_select": Use DeepSelect kernels (SM100a/SM103a only)
  • "cooperative": Use vLLM's cooperative_topk kernel
  • "persistent": Use vLLM's persistent_topk kernel (CUDA and ROCm)
  • "per_row": Use vLLM's top_k_per_row_decode kernel
  • "flashinfer": Use FlashInfer's top_k_ragged_transform kernel
  • "flashinfer_gvr2": Use FlashInfer's self-sampling GVR V2 top-k (top_k_varlen(backend="gvr_2")). SM100 family, fp32 logits, topk in {512, 1024, 2048}. Also routes prefill chunks of >= 1024 row-relative rows to gvr_2. Its latency depends on the logit distribution (rows with strong position skew or many ties at the k-th value are slower)
  • "torch": Use a plain torch.topk implementation (debug reference)
  • "aiter": Use AITER's top_k_per_row_decode kernel (ROCm gfx950 only, requires VLLM_ROCM_USE_AITER)

Explicit values raise RuntimeError when their constraints are not met.

On SM100 decode without DCP, cooperative and persistent (including auto selecting them) read BF16 logits directly and widen scores inside the kernel, avoiding a full FP32 logits copy.

step5_attention_backend = 'native' class-attribute instance-attribute

Step5 attention backend. PrimTS supports SM100, SM103 and SM107 and handles all FP8 attention and BF16 prefill. BF16 decode uses PrimTS for MTP=3/Q=4 batches with at least 32 requests, using the padded batch size for full CUDA graphs.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialization is delayed.

compile_factors()

Produces a hash unique to the pass configuration. Any new fields that affect compilation should be added to the hash. Any future fields that don't affect compilation should be excluded.

set_platform_defaults(vllm_config)

Set platform-specific defaults for the kernel config.

LoRAConfig

Configuration for LoRA.

Methods:

Attributes:

default_mm_loras = None class-attribute instance-attribute

Dictionary mapping specific modalities to LoRA model paths; this field is only applicable to multimodal models and should be leveraged when a model always expects a LoRA to be active when a given modality is present. Note that currently, if a request provides multiple additional modalities, each of which have their own LoRA, we do NOT apply default_mm_loras because we currently only support one lora adapter per prompt. When run in offline mode, the lora IDs for n modalities will be automatically assigned to 1-n with the names of the modalities in alphabetic order.

enable_embedding_modules = False class-attribute instance-attribute

Enable LoRA on input embeddings and lm_head alongside the default LoRA modules. Both are skipped by default. Ignored when lora_target_modules is specified.

enable_mixed_moe_lora_format = False class-attribute instance-attribute

If True, force the engine to use the universal 2D MoE LoRA wrapper (FusedMoEWithLoRA) regardless of the model's is_3d_moe_weight flag, so that 2D-format and 3D-format MoE LoRA adapters can be served in the same deployment. Only meaningful for MoE models; ignored otherwise. Default False keeps the existing model-driven behavior.

enable_moe_shared_loras = False class-attribute instance-attribute

If True, load MoE expert adapters in the "shared-outer" layout, where the gate/up (w1/w3) lora_A and the down (w2) lora_B are shared across all experts (stored once with expert-dim 1) instead of per-expert. The shared factors are broadcast to the expert count at kernel time. 3D-weight MoE models use FusedMoEWithLoRA for this layout. Only meaningful for MoE models whose adapters use this layout; ignored otherwise.

enable_tower_connector_lora = False class-attribute instance-attribute

If True, LoRA support for the tower (vision encoder) and connector of multimodal models will be enabled. This is an experimental feature and currently only supports some MM models such as the Qwen VL series. The default is False.

fully_sharded_loras = False class-attribute instance-attribute

By default, only half of the LoRA computation is sharded with tensor parallelism. Enabling this will use the fully sharded layers. At high sequence length, max rank or tensor parallel size, this is likely faster.

lora_dtype = 'auto' class-attribute instance-attribute

Data type for LoRA. If auto, will default to base model dtype.

max_cpu_loras = None class-attribute instance-attribute

Maximum number of LoRAs to store in CPU memory. Must be >= than max_loras.

max_expert_lora_rank = Field(default=None, ge=1) class-attribute instance-attribute

Max LoRA slot rank for routed MoE experts. Defaults to max_lora_rank. Must be at most max_lora_rank. Dense and attention layers use max_lora_rank.

max_lora_cls_labels = Field(default=None, ge=1) class-attribute instance-attribute

Maximum output size for LoRA classification heads. Defaults to the base classification head size.

max_lora_rank = 16 class-attribute instance-attribute

Max LoRA rank.

max_loras = Field(default=1, ge=1) class-attribute instance-attribute

Max number of LoRAs in a single batch.

specialize_active_lora = False class-attribute instance-attribute

Whether to construct lora kernel grid by the number of active LoRA adapters. When set to True, separate cuda graphs will be captured for different counts of active LoRAs (powers of 2 up to max_loras), which can improve performance for variable LoRA usage patterns at the cost of increased startup time and memory usage. Only takes effect when cudagraph_specialize_lora is True.

split_k_reduction = 'atomic' class-attribute instance-attribute

Triton LoRA linear shrink split-K reduction. atomic (default): accumulate partial results using atomic adds in one kernel. kernel sums FP32 partials in a separate fixed-order kernel. Does not enable model-wide batch invariance or affect fused MoE LoRA. A matching VLLM_TUNED_CONFIG_FOLDER shrink config takes precedence, followed by VLLM_BATCH_INVARIANT=1 (which selects kernel), then this option. See https://github.com/vllm-project/vllm/issues/70061.

target_modules = None class-attribute instance-attribute

Restrict LoRA to specific module suffixes (e.g., ["o_proj", "qkv_proj"]). An explicit list takes precedence over enable_lora_embedding_modules.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

verify_with_kernel_config(kernel_config)

Reject MegaMoE backends, which do not support LoRA.

LoadConfig

Configuration for loading the model weights.

Methods:

Attributes:

device = None class-attribute instance-attribute

Device to which model weights will be loaded, default to device_config.device

download_dir = None class-attribute instance-attribute

Directory to download and load the weights, default to the default cache directory of Hugging Face.

ignore_patterns = Field(default_factory=lambda: ['original/**/*']) class-attribute instance-attribute

The list of patterns to ignore when loading the model. Default to "original/*/" to avoid repeated loading of llama's checkpoints.

load_format = 'auto' class-attribute instance-attribute

The format of the model weights to load.

  • "auto" will try to load the weights in the safetensors format and fall back to the pytorch bin format if safetensors format is not available.
  • "pt" will load the weights in the pytorch bin format.
  • "safetensors" will load the weights in the safetensors format.
  • "instanttensor" will load the Safetensors weights on CUDA devices using InstantTensor, which enables distributed loading with pipelined prefetching and fast direct I/O.
  • "ipc_cache" will map post-quantized weights from a local weight cache daemon via CUDA IPC for fast engine restarts. Launch the daemon with vllm preload first.
  • "peer_cache" will build the model on meta and pull post-processed weights from a source replica's weight cache daemon. Set internally by vllm preload --weight-cache-seed; not for engine use.
  • "npcache" will load the weights in pytorch format and store a numpy cache to speed up the loading.
  • "dummy" will initialize the weights with random values, which is mainly for profiling.
  • "tensorizer" will use CoreWeave's tensorizer library for fast weight loading. See the Tensorize vLLM Model script in the Examples section for more information.
  • "runai_streamer" will load the Safetensors weights using Run:ai Model Streamer.
  • "runai_streamer_sharded" will load weights from pre-sharded checkpoint files using Run:ai Model Streamer.
  • "sharded_state" will load weights from pre-sharded checkpoint files, supporting efficient loading of tensor-parallel models.
  • "mistral" will load weights from consolidated safetensors files used by Mistral models.
  • "modelexpress" will load weights using ModelExpress.
  • Other custom values can be supported via plugins.

model_loader_extra_config = Field(default_factory=dict) class-attribute instance-attribute

Extra config for model loader. This will be passed to the model loader corresponding to the chosen load_format.

pt_load_map_location = 'cpu' class-attribute instance-attribute

The map location for loading pytorch checkpoint, to support loading checkpoints can only be loaded on certain devices like "cuda", this is equivalent to {"": "cuda"}. Another supported format is mapping from different devices like from GPU 1 to GPU 0: {"cuda:1": "cuda:0"}. Note that when passed from command line, the strings in dictionary need to be double quoted for json parsing. For more details, see the original doc for map_location parameter in torch.load parameter.

safetensors_load_strategy = None class-attribute instance-attribute

Specifies the loading strategy for safetensors weights.

  • None (default): Uses memory-mapped (lazy) loading. When an NFS filesystem is detected and the total checkpoint size fits within 90% of available RAM, prefetching is enabled automatically.
  • "lazy": Weights are memory-mapped from the file. This enables on-demand loading and is highly efficient for models on local storage. Unlike the default (None), auto-prefetch on NFS is not performed.
  • "eager": The entire file is read into CPU memory upfront before loading. This is recommended for models on network filesystems (e.g., Lustre, NFS) as it avoids inefficient random reads, significantly speeding up model initialization. However, it uses more CPU RAM.
  • "prefetch": Checkpoint files are read into the OS page cache before workers load them, speeding up the model loading phase. Useful on network or high-latency storage.
  • "torchao": Weights are loaded in upfront and then reconstructed into torchao tensor subclasses. This is used when the checkpoint was quantized using torchao and saved using safetensors. Needs torchao >= 0.14.0.

safetensors_prefetch_block_size = Field(default=DEFAULT_SAFETENSORS_PREFETCH_BLOCK_SIZE, ge=1) class-attribute instance-attribute

Read size in bytes for each safetensors checkpoint file prefetch.

safetensors_prefetch_num_threads = Field(default=DEFAULT_SAFETENSORS_PREFETCH_NUM_THREADS, ge=1) class-attribute instance-attribute

Number of worker threads used to prefetch safetensors checkpoint files into the OS page cache when safetensors prefetching is enabled.

shuffle_safetensors_files = False class-attribute instance-attribute

Whether to shuffle the safetensors checkpoint files during loading. When enabled, files are randomly shuffled based on the distributed rank, which can help with load balancing and improve weight loading speed in startup scenarios. This reduces I/O contention by ensuring different ranks load different files in a randomized order. Set to True to enable shuffling. Default is False.

use_tqdm_on_load = True class-attribute instance-attribute

Whether to enable tqdm for showing progress bar when loading model weights.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

LoggingConfig

vLLM logging. Default dictConfig adds a formatted stream handler.

Supply a JSON object with --logging-config or individual fields with dotted arguments such as --logging-config.log_level DEBUG and --logging-config.formatter json. --log-level overrides log_level. Set configure_logging to false to skip applying a dictConfig.

Attributes:

  • configure_logging (bool) –

    Whether to apply a Python logging configuration.

  • formatter (LogFormatter) –

    Formatter used by the built-in logging configuration.

  • log_level (LogLevel) –

    Log level used when no custom logging configuration is provided.

  • pylogging_config_file (str | None) –

    Path to a Python logging JSON file using

configure_logging = Field(default_factory=lambda: envs.VLLM_CONFIGURE_LOGGING) class-attribute instance-attribute

Whether to apply a Python logging configuration.

With no pylogging_config_file, the default config adds a formatted stream handler to the vllm logger. A custom Python logging configuration file also requires this to be enabled.

formatter = 'text' class-attribute instance-attribute

Formatter used by the built-in logging configuration.

log_level = Field(default_factory=lambda: cast(LogLevel, envs.VLLM_LOGGING_LEVEL)) class-attribute instance-attribute

Log level used when no custom logging configuration is provided.

pylogging_config_file = Field(default_factory=lambda: envs.VLLM_LOGGING_CONFIG_PATH) class-attribute instance-attribute

Path to a Python logging JSON file using dictConfig schema.

A custom dictConfig is authoritative over log_level and formatter for logger, handler, and formatter settings.

MambaConfig

Configuration for Mamba SSM backends.

Methods:

Attributes:

backend = MambaBackendEnum.TRITON class-attribute instance-attribute

Mamba SSU backend to use.

enable_stochastic_rounding = False class-attribute instance-attribute

Enable stochastic rounding when writing SSM state to fp16 cache. Uses random bits to unbias the rounding error, which can improve numerical stability for long sequences. The Triton backend requires compute capability 10.0 on CUDA or gfx950 on ROCm.

prefill_backend = MambaBackendEnum.TRITON class-attribute instance-attribute

Kernel backend for the SSD scan of Mamba2 prefills. "flashinfer" runs FlashInfer's fused SSD scan (SM100/SM103 only); prefills that store Mamba checkpoints always use "triton".

ssu_algorithm = None class-attribute instance-attribute

Selective state update algorithm to use with the FlashInfer backend. None defaults to FlashInfer's "auto" algorithm. Forced algorithms must be supported by FlashInfer for the active GPU, state dtype, and decoding mode.

stochastic_rounding_philox_rounds = 0 class-attribute instance-attribute

Number of Philox PRNG rounds for stochastic rounding random number generation. 0 uses the Triton default. Higher values improve randomness quality at the cost of compute.

validate_backend_before(value) classmethod

Enable parsing of the backend enum fields from strings.

ModelConfig

Configuration for the model.

Methods:

Attributes:

allow_deprecated_quantization = False class-attribute instance-attribute

Whether to allow deprecated quantization methods.

allowed_local_media_path = '' class-attribute instance-attribute

Allowing API requests to read local images or videos from directories specified by the server file system. This is a security risk. Should only be enabled in trusted environments.

allowed_media_domains = None class-attribute instance-attribute

If set, only media URLs that belong to this domain can be used for multi-modal inputs.

architecture property

The architecture vllm actually used.

attn_type property

Determine the attention type based on model configuration.

checkpoint_prepare_on_startup = False class-attribute instance-attribute

Prepare each engine for a process checkpoint once it starts, as /checkpoint/prepare does. It serves only after /checkpoint/restore. Requires sleep mode.

code_revision = None class-attribute instance-attribute

The specific revision to use for the model code on the Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.

config_format = 'auto' class-attribute instance-attribute

The format of the model config to load:

  • "auto" will try to load the config in hf format if available after trying to load in mistral format.
  • "hf" will load the config in hf format.
  • "mistral" will load the config in mistral format.

convert = 'auto' class-attribute instance-attribute

Convert the model using adapters defined in vllm.model_executor.models.adapters. The most common use case is to adapt a text generation model to be used for pooling tasks.

disable_sliding_window = False class-attribute instance-attribute

Whether to disable sliding window. If True, we will disable the sliding window functionality of the model, capping to sliding window size. If the model does not support sliding window, this argument is ignored.

dtype = 'auto' class-attribute instance-attribute

Data type for model weights and activations:

  • "auto" will use FP16 precision for FP32 and FP16 models, and BF16 precision for BF16 models.
  • "half" for FP16. Recommended for AWQ quantization.
  • "float16" is the same as "half".
  • "bfloat16" for a balance between precision and range.
  • "float" is shorthand for FP32 precision.
  • "float32" for FP32 precision.

enable_cumem_allocator = False class-attribute instance-attribute

Enable the custom cumem allocator to leverage advanced GPU memory allocation features such as multi-node NVLink support.

Sleep mode automatically enables this allocator. Only cuda and hip platforms are supported.

enable_nccl_comm_suspend = False class-attribute instance-attribute

Enable releasing NCCL communicator memory during sleep mode (ncclCommSuspend/ncclCommResume). Experimental; when disabled (the default) sleep still releases weights/KV-cache memory as before.

enable_prompt_embeds = False class-attribute instance-attribute

If True, enables passing text embeddings as inputs via the prompt_embeds key.

WARNING: The vLLM engine may crash if incorrect shape of embeddings is passed. Only enable this flag for trusted users!

enable_sleep_mode = False class-attribute instance-attribute

Enable sleep mode for the engine (only cuda and hip platforms are supported).

enable_trace_replay = False class-attribute instance-attribute

Whether to allow requests to set SamplingParams.trace_decode_token_ids, which forces decoding to follow a predetermined token sequence while still computing real logprobs. Reserved for debugging and RL workflows: enabling it reserves a per-request trace buffer, so it is off by default.

enforce_eager = False class-attribute instance-attribute

Whether to always use eager-mode PyTorch. If True, we will disable CUDA graph and always execute the model in eager mode. If False, we will use CUDA graph and eager execution in hybrid for maximal performance and flexibility.

NOTE: This disables both torch.compile and CUDA graphs, and is equivalent to setting -cc.mode=none -cc.cudagraph_mode=none.

generation_config = 'auto' class-attribute instance-attribute

The folder path to the generation config. Defaults to "auto", the generation config will be loaded from model path. If set to "vllm", no generation config is loaded, vLLM defaults will be used. If set to a folder path, the generation config will be loaded from the specified folder path. If max_new_tokens is specified in generation config, then it sets a server-wide limit on the number of output tokens for all requests.

head_dtype property

The "head" refers to the last Linear layer(s) of an LLM, such as the lm_head in a generation model, or the score or classifier in a classification model.

  • Pooling models default to an fp32 head; use --hf-overrides '{"head_dtype": "model"}' to disable it.
  • Generation models default to the model dtype; set --hf-overrides '{"head_dtype": "float32"}' to run the lm_head in fp32, which is required for RL training-inference consistency (the trainer computes logits in fp32).

hf_config = field(init=False) class-attribute instance-attribute

The Hugging Face config of the model.

hf_config_path = None class-attribute instance-attribute

Name or path of the Hugging Face config to use. If unspecified, model name or path will be used.

hf_overrides = field(default_factory=dict) class-attribute instance-attribute

If a dictionary, contains arguments to be forwarded to the Hugging Face config. If a callable, it is called to update the HuggingFace config.

hf_text_config = field(init=False) class-attribute instance-attribute

The Hugging Face config of the text model (same as hf_config for text models).

hf_token = Field(default=None, repr=False, exclude=True) class-attribute instance-attribute

The token to use as HTTP bearer authorization for remote files . If True, will use the token generated when running hf auth login (stored in ~/.cache/huggingface/token).

io_processor_plugin = None class-attribute instance-attribute

IOProcessor plugin name to load at model startup

is_diffusion cached property

Detect discrete diffusion (dLLM) models from HF config.

is_encoder_decoder cached property

Extract the HF encoder/decoder model flag.

is_submodel_config = field(default=False, init=False) class-attribute instance-attribute

Whether this is a view derived from an already-validated VllmConfig: a submodule view from VllmConfig.with_hf_config (e.g. a multimodal model's text stack, whose architecture list may be empty) or a draft model's view that reuses the target's configs. Deployment-level validation must not run against it.

logits_processors = None class-attribute instance-attribute

One or more logits processors' fully-qualified class names or class definitions

logprobs_mode = 'raw_logprobs' class-attribute instance-attribute

Indicates the content returned in the logprobs and prompt_logprobs. Supported mode: 1) raw_logprobs, 2) processed_logprobs, 3) raw_logits, 4) processed_logits. Raw means the values before applying any logit processors, like bad words. Processed means the values after applying all processors, including temperature and top_k/top_p. Note: for prompt_logprobs, processed_ and raw_ yield identical results because prompt tokens do not go through sampling processors.

masked_token_ids = None class-attribute instance-attribute

Token ids that are never sampled (their logits are set to -inf before sampling), e.g. the lm_head rows past the tokenizer or placeholder tokens. Prompt logprobs are unaffected.

max_logprobs = Field(default=20, ge=-1) class-attribute instance-attribute

Maximum number of log probabilities to return when logprobs is specified in SamplingParams. The default value comes the default for the OpenAI Chat Completions API. -1 means no cap, i.e. all (output_length * vocab_size) logprobs are allowed to be returned and it may cause OOM.

max_model_len = Field(default=None, ge=-1) class-attribute instance-attribute

Model context length (prompt and output). If unspecified, will be automatically derived from the model config.

When passing via --max-model-len, supports k/m/g/K/M/G in human-readable format. Examples:

  • 1k -> 1000
  • 1K -> 1024
  • 25.6k -> 25,600
  • -1 or 'auto' -> Automatically choose the maximum model length that fits in GPU memory. This will use the model's maximum context length if it fits, otherwise it will find the largest length that can be accommodated.

may_use_target_embed property

For a speculative decoding draft model, whether it may reuse the target's input embedding under pipeline parallelism.

model = 'Qwen/Qwen3-0.6B' class-attribute instance-attribute

Name or path of the Hugging Face model to use. It is also used as the content for model_name tag in metrics output when served_model_name is not specified.

model_class_overrides = field(default_factory=dict) class-attribute instance-attribute

Override the model class used for one or more architectures, mapping the architecture name to a "module:class" target (the same format accepted by ModelRegistry.register_model). This registers the target class at runtime, e.g. {"GlmMoeDsaForCausalLM": "vllm.models.deepseek_v32.nvidia.model:DeepseekV32ForCausalLM"}. This argument is for development and debugging purposes only.

model_impl = 'auto' class-attribute instance-attribute

Which implementation of the model to use:

  • "auto" will try to use the vLLM implementation, if it exists, and fall back to the Transformers implementation if no vLLM implementation is available.
  • "vllm" will use the vLLM model implementation.
  • "transformers" will use the Transformers model implementation.
  • "terratorch" will use the TerraTorch model implementation.

model_weights = '' class-attribute instance-attribute

Original model weights path. Used when the model is pulled from object storage (e.g., RunAI) to preserve the original URI while model points to the local directory.

multimodal_config = None class-attribute instance-attribute

Configuration for multimodal model. If None, this will be inferred from the architecture of self.model.

override_generation_config = field(default_factory=dict) class-attribute instance-attribute

Overrides or sets generation config. e.g. {"temperature": 0.5}. If used with --generation-config auto, the override parameters will be merged with the default config from the model. If used with --generation-config vllm, only the override parameters are used.

pooler_config = None class-attribute instance-attribute

Pooler config which controls the behaviour of output pooling in pooling models.

quantization = None class-attribute instance-attribute

Method used to quantize the weights. If None, we first check the quantization_config attribute in the model config file. If that is None, we assume the model weights are not quantized and use dtype to determine the data type of the weights.

quantization_config = None class-attribute instance-attribute

User-facing quantization configuration. Carries per-layer-kind specs (linear, moe) and ignore patterns; see QuantizationConfigArgs. Auto-populated from the matching online shorthand when quantization is one of the values in ONLINE_QUANT_SHORTHAND_NAMES.

renderer_num_workers = None class-attribute instance-attribute

Number of worker threads in the renderer thread pool. The pool is consumed by the async renderer path (e.g. the OpenAI-compatible API server started by vllm serve) to parallelize tokenization, chat template rendering, and multimodal preprocessing across concurrent requests.

If unset, defaults to 4 for the async renderer path, or to 1 for pooling runners (their preprocessing runs on the renderer workers, which is not compatible with the multimodal processor cache when multi-threaded). A single worker serializes tokenization of long prompts in each API server process and can cap the request rate well below what the engine can sustain.

The offline LLM entrypoint uses the synchronous renderer path and processes prompts (including multimodal preprocessing) serially, so this setting has no effect there (the offline default is 1).

return_sampling_mask = False class-attribute instance-attribute

Whether to return the post-processing token support for each sample.

revision = None class-attribute instance-attribute

The specific model version to use. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.

runner = 'auto' class-attribute instance-attribute

The type of model runner to use. Each vLLM instance only supports one model runner, even if the same model can be used for multiple types.

score_type property

Scoring API handles score/rerank for:

  • "classify" task (score_type: cross-encoder models)
  • "embed" task (score_type: bi-encoder models)
  • "token_embed" task (score_type: late interaction models)

seed = Field(default=0, ge=0, le=2 ** 32 - 1) class-attribute instance-attribute

Random seed for reproducibility.

The seed must be in the range [0, 2**32 - 1].

We must set the global seed because otherwise, different tensor parallel workers would sample different tokens, leading to inconsistent results.

served_model_name = None class-attribute instance-attribute

The model name(s) used in the API. If multiple names are provided, the server will respond to any of the provided names. The model name in the model field of a response will be the first name in this list. If not specified, the model name will be the same as the --model argument. Noted that this name(s) will also be used in model_name tag content of prometheus metrics, if multiple names provided, metrics tag will take the first one.

skip_tokenizer_init = False class-attribute instance-attribute

Skip initialization of tokenizer and detokenizer. Expects valid prompt_token_ids and None for prompt from the input. The generated output will contain token ids.

sleep_mode_backend = 'cumem' class-attribute instance-attribute

Mechanism used to free and restore GPU state for sleep mode. "cumem" (default) uses the built-in CuMemAllocator and is behavior-compatible with prior releases. Additional backends (CUDA checkpoint, CRIU, durable snapshot) may be registered in-tree or by plugins (RFC #34303).

sleep_mode_offload_cudagraph = False class-attribute instance-attribute

Back up CUDA graph memory to CPU during sleep, restored in place on wake. Takes effect with enable_sleep_mode, the cumem backend and CUDA graphs.

sleep_preserve_parameter_names = field(default_factory=list) class-attribute instance-attribute

Parameter-name globs to preserve across level-2 sleep. Use target globs for frozen Engram table weights and scales omitted by the trainer (e.g. *.engram.embed_tokens.weight*). Use draft.<name> for draft-private parameters, or draft.* for all. The sender must omit these parameters; loaders must preserve their storage.

spec_target_max_model_len = None class-attribute instance-attribute

Specify the maximum length for spec decoding draft models.

speculator_config_class property

For a speculative decoding draft model, the config class of the speculator it's for, if it declares one (see SpeculativeDraftModel).

tokenizer = None class-attribute instance-attribute

Name or path of the Hugging Face tokenizer to use. If unspecified, model name or path will be used.

tokenizer_mode = 'auto' class-attribute instance-attribute

Tokenizer mode:

  • "auto" will use the tokenizer from mistral_common for Mistral models if available, otherwise it will use the "hf" tokenizer.
  • "hf" will use the fast tokenizer if available.
  • "alpamayo2_super" uses the "hf" tokenizer with Alpamayo 2 Super's trajectory and special tokens added; selected automatically for nvidia/Alpamayo2-Super.
  • "hy_v4" uses the HF tokenizer with HYV4 VL chat rendering.
  • "mistral" will always use the tokenizer from mistral_common.
  • "deepseek_v32" will always use the tokenizer from deepseek_v32.
  • "deepseek_v4" will always use the tokenizer from deepseek_v4.
  • "deepseek_v41" will use the DeepSeek V4.1 prompt encoder.
  • "kimi_k3" requires a tokenizer with native Kimi K3 XTML chat encoding. It rejects the generic Hugging Face Jinja fallback.
  • "glm5_next" uses the "hf" tokenizer and renderer on the Python frontend; the Rust frontend renders GLM-5.3 and GLM-5.3-Flash prompts natively, and selects this under "auto" for the glm5_next model type (GLM-5.3-Flash). GLM-5.3-Flash multimodal inputs require the Rust frontend; Python supports text-only inference with image and video limits set to zero.
  • "cohere" uses the standard HF tokenizer but renders the chat template via the cohere_melody library (cmd3 / cmd4 templates) instead of Jinja, and surfaces grounded-citation metadata on responses.
  • Other custom values can be supported via plugins.

To swap the Rust BPE backend that powers HF fast tokenizers for the fastokens implementation, set VLLM_USE_FASTOKENS=1 instead — that override applies to any mode that loads an HF fast tokenizer (hf, deepseek_v32, deepseek_v4, …).

tokenizer_revision = None class-attribute instance-attribute

The specific revision to use for the tokenizer on the Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.

trust_remote_code = False class-attribute instance-attribute

Trust remote code (e.g., from HuggingFace) when downloading the model and tokenizer.

use_fp64_gumbel = False class-attribute instance-attribute

Whether to use FP64 (instead of FP32) random noise for Gumbel-max and equivalent exponential-race sampling. FP64 preserves lower-tail sampling events that fp32 uniform/exponential draws can truncate, at the cost of significantly lower throughput on most GPUs.

word_embeddings_untied_by_checkpoint = field(default=False, init=False) class-attribute instance-attribute

Whether tie_word_embeddings was overridden to False because the checkpoint contains an lm_head of its own. The two may still turn out to be identical, in which case they are re-tied once the weights have been loaded.

_apply_dict_overrides(config, overrides) classmethod

Apply dict overrides, handling both nested configs and dict values.

_get_transformers_backend_cls()

Determine which Transformers modeling backend class will be used if model_impl is set to transformers or auto.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialisation is delayed.

_supports_multimodal_for_mm_prefix()

Whether multimodal inputs can still appear for this deployment.

This runs more than once per config: once early in __post_init__ (before multimodal_config exists), again after it is created, and then for every get_model_arch_config regeneration -- notably with_hf_config, which deep-copies this ModelConfig and swaps hf_config for a text-only submodule (e.g. Gemma4ForCausalLM).

The result is cached for correctness, not just to save work: on the with_hf_config copy the submodule architecture has no registered multimodal processor, so re-querying the registry would raise and be treated as text-only, wrongly clearing is_mm_prefix_lm even when a vision modality is still enabled (e.g. image=0 but video allowed). The deep-copied cache preserves the top-level decision instead.

_supports_multimodal_inputs()

Checks if the model supports multimodal inputs. Returns True if the model is multimodal with any non-zero supported modalities, otherwise returns False, effectively running in text-only mode.

_update_nested(target, updates) classmethod

Recursively updates a config or dict with nested updates.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

get_diff_sampling_param()

This method returns a dictionary containing the non-default sampling parameters with override_generation_config applied.

The default sampling parameters are:

  • vLLM's neutral defaults if self.generation_config="vllm"
  • the model's defaults if self.generation_config="auto"
  • as defined in generation_config.json if self.generation_config="path/to/generation_config/dir"

Returns:

  • dict[str, Any] –

    A dictionary containing the non-default sampling parameters.

get_mamba_chunk_size()

Returns the mamba chunk size if it exists.

get_multimodal_config()

Get the multimodal configuration of the model.

Raises:

get_num_attention_heads(parallel_config, arch_config=None)

Returns the number of attention heads per GPU.

Pass arch_config (from model_arch_config[layer_idx]) to size a single layer of a heterogeneous model rather than the model as a whole.

get_num_kv_heads(parallel_config, arch_config=None)

Returns the number of KV heads per GPU.

Pass arch_config (from model_arch_config[layer_idx]) to size a single layer of a heterogeneous model rather than the model as a whole.

get_sliding_window()

Get the sliding window size from the HF text config if present.

get_total_num_kv_heads()

Returns the total number of KV heads.

maybe_pull_model_tokenizer_for_runai(model, tokenizer)

Pull model/tokenizer from Object Storage to temporary directory when needed.

Parameters:

  • model

    (str) –

    Model name or path

  • tokenizer

    (str) –

    Tokenizer name or path

maybe_untie_word_embeddings()

Stop trusting tie_word_embeddings when the checkpoint disagrees.

A config may claim the word embeddings are tied while the checkpoint ships an lm_head of its own. Tying regardless would silently discard that tensor, so build the lm_head as if untied and let it load. The two are compared once loaded, and re-tied if they turn out to match, by maybe_retie_word_embeddings.

Transformers makes the same decision in PreTrainedModel.tie_weights, where it can compare the two tensors directly.

try_get_generation_config()

This method attempts to retrieve the non-default values of the generation config for this model.

The generation config can contain information about special tokens, as well as sampling parameters. Which is why this method exists separately to get_diff_sampling_param.

Returns:

  • dict[str, Any] –

    A dictionary containing the non-default generation config.

using_transformers_backend()

Check if the model is using the Transformers modeling backend class.

validate_model_config_after()

Called after post_init.

verify_eplb_config(parallel_config, *, num_experts=None, config_name='eplb_config.num_redundant_experts', disable_config_name=None)

Validate that this model's experts can be evenly distributed by EPLB.

MultiModalConfig

Controls the behavior of multimodal models.

Methods:

Attributes:

allow_missing_mm_embeddings = False class-attribute instance-attribute

Whether a pre-computed-embedding input may omit the *_embeds tensor.

In an encode/prefill/decode (EPD) deployment the encoder instance publishes embeddings through the EC connector. An EC consumer loads those embeddings from the connector, while a KV consumer receives the resulting prompt KV cache. Their requests only need the grid/size metadata that sizes the placeholder range.

Derived, not user-settable: VllmConfig.__post_init__ sets this to True on EC consumers, and on KV consumers unless language_model_only is set without enable_mm_embeds. Everywhere else it stays False so that a request which forgets its embeddings still fails fast in the frontend, with a clear error, rather than deep inside the model.

enable_mm_embeds = False class-attribute instance-attribute

If True, enables passing multimodal embeddings: for LLM class, this refers to tensor inputs under multi_modal_data; for the OpenAI-compatible server, this refers to chat messages with content "type": "*_embeds".

When enabled with --limit-mm-per-prompt set to 0 for a modality, precomputed embeddings skip count validation for that modality, saving memory by not loading encoder modules while still enabling embeddings as an input. Limits greater than 0 still apply to embeddings.

WARNING: The vLLM engine may crash if incorrect shape of embeddings is passed. Only enable this flag for trusted users!

interleave_mm_strings = False class-attribute instance-attribute

Enable fully interleaved support for multimodal prompts, while using --chat-template-content-format=string.

language_model_only = False class-attribute instance-attribute

If True, disables all multimodal inputs by setting all modality limits to 0. Equivalent to setting --limit-mm-per-prompt to 0 for every modality.

limit_per_prompt = Field(default_factory=MultiModalDummyOptions) class-attribute instance-attribute

The maximum number of input items and options allowed per prompt for each modality.

Defaults to 999 for each modality unless the model processor provides a lower default.

Legacy format (count only):

Configurable format (with options): {"video": {"count": 1, "num_frames": 32, "width": 512, "height": 512}, "image": {"count": 5, "width": 512, "height": 512}}

Mixed format (combining both): {"image": 16, "video": {"count": 1, "num_frames": 32, "width": 512, "height": 512}}

Set "allow_embeds": false to reject pre-computed embeddings of a modality even when enable_mm_embeds is on: {"image": 0, "video": {"count": 0, "allow_embeds": false}}

media_io_kwargs = Field(default_factory=dict) class-attribute instance-attribute

Additional args passed to process media inputs, keyed by modalities. For example, to set num_frames for video, set --media-io-kwargs '{"video": {"num_frames": 40} }'

mm_device_do_normalize = True class-attribute instance-attribute

Move the do_normalize computation in the mm preprocessing to before the ViT, and let the device do it, so that CPU computation can be saved.

mm_encoder_attn_backend = None class-attribute instance-attribute

Optional override for the multi-modal encoder attention backend when using vision transformers. Accepts any value from vllm.v1.attention.backends.registry.AttentionBackendEnum (e.g. FLASH_ATTN).

mm_encoder_attn_dtype = None class-attribute instance-attribute

Optional dtype override for ViT encoder attention. Set to "fp8" to enable FP8 quantization via the FlashInfer cuDNN backend. When set to "fp8" without a scale file, dynamic scaling is used automatically. See docs/features/quantization/fp8_vit_attn.md for details.

mm_encoder_fp8_scale_path = None class-attribute instance-attribute

Path to a JSON file containing per-layer FP8 Q/K/V scales for ViT encoder attention. When provided (with mm_encoder_attn_dtype="fp8"), static scaling is used. When omitted, dynamic scaling is used.

mm_encoder_fp8_scale_save_margin = Field(default=1.5, gt=0.0) class-attribute instance-attribute

Safety margin multiplied onto scales when auto-saving. A value > 1 leaves headroom so that inputs with larger activations than the calibration set do not overflow FP8 range. Default 1.5.

mm_encoder_fp8_scale_save_path = None class-attribute instance-attribute

When set with dynamic FP8 scaling (mm_encoder_attn_dtype="fp8" and no mm_encoder_fp8_scale_path), saves the calibrated scales to this file after the amax history buffer is full. The saved file can then be used as mm_encoder_fp8_scale_path in subsequent runs.

mm_encoder_only = False class-attribute instance-attribute

When enabled, skips the language component of the model.

This is usually only valid in disaggregated Encoder process.

mm_encoder_tp_mode = 'weights' class-attribute instance-attribute

Indicates how to optimize multi-modal encoder inference using tensor parallelism (TP).

  • "weights": Within the same vLLM engine, split the weights of each layer across TP ranks. (default TP behavior)
  • "data": Within the same vLLM engine, split the batched input data across TP ranks to process the data in parallel, while hosting the full weights on each TP rank. This batch-level DP is not to be confused with API request-level DP (which is controlled by --data-parallel-size). This is only supported on a per-model basis and falls back to "weights" if the encoder does not support DP.

mm_hasher_algorithm = 'blake3' class-attribute instance-attribute

Hash algorithm to use for multi-modal input caching. Use "sha256" or "sha512" for FIPS-compliant deployments.

mm_ipc_gpu_memory_gb = Field(default=0, ge=0) class-attribute instance-attribute

Amount of GPU memory (in GiB) sequestered on the engine's device for GPU-side multimodal work in the API-server (frontend) process, such as hardware video decoding.

This budget is carved out of the engine's KV-cache memory so the headroom physically exists, and frontend GPU decode paths acquire from a blocking byte-counting semaphore of this size before allocating on the device.

Set to 0 (default) to disable frontend GPU multimodal memory gating.

mm_processor_cache_gb = Field(default=4, ge=0) class-attribute instance-attribute

The size (in GiB) of the multi-modal processor cache, which is used to avoid re-processing past multi-modal inputs.

This cache is duplicated for each API process and engine core process, resulting in a total memory usage of mm_processor_cache_gb * (api_server_count + data_parallel_size).

A single processed item larger than this budget is served uncached (with a warning) instead of failing. Raise this value to cache such items.

Set to 0 to disable this cache completely (not recommended).

mm_processor_cache_type = 'lru' class-attribute instance-attribute

Type of cache to use for the multi-modal preprocessor/mapper. If shm, use shared memory FIFO cache. If lru, use mirrored LRU cache.

mm_processor_kwargs = None class-attribute instance-attribute

Arguments to be forwarded to the model's processor for multi-modal data, e.g., image processor. Overrides for the multi-modal processor obtained from transformers.AutoProcessor.from_pretrained.

The available overrides depend on the model that is being run.

For example, for Phi-3-Vision: {"num_crops": 4}.

mm_shm_cache_buffer_name = Field(default_factory=_get_default_shm_name) class-attribute instance-attribute

Name of the shared memory buffer used by the multi-modal processor cache. Only effective when mm_processor_cache_type is "shm".

mm_shm_cache_max_object_size_mb = Field(default=128, ge=0) class-attribute instance-attribute

Size limit (in MiB) for each object stored in the multi-modal processor shared memory cache. Only effective when mm_processor_cache_type is "shm".

mm_tensor_ipc = 'direct_rpc' class-attribute instance-attribute

IPC (inter-process communication) method for multimodal tensors. - "direct_rpc": Use msgspec serialization via RPC - "torch_shm": Use torch.multiprocessing shared memory for zero-copy IPC Defaults to "direct_rpc".

skip_mm_profiling = False class-attribute instance-attribute

When enabled, skips multimodal memory profiling and only profiles with language backbone model during engine initialization.

This reduces engine startup time but shifts the responsibility to users for estimating the peak memory usage of the activation of multimodal encoder and embedding cache.

video_pruning_method = 'evs' class-attribute instance-attribute

Video token pruning algorithm applied when video_pruning_rate > 0: - "evs": Efficient Video Sampling. - "vidcom2": Video Compression Commander.

video_pruning_rate = Field(default=None, ge=0.0, lt=1.0) class-attribute instance-attribute

Fraction of video tokens to prune from each video. Value sits in range [0;1); pruning is enabled when it is greater than 0. The pruning algorithm is selected by video_pruning_method.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

fold_mm_processor_device(mm_processor_kwargs, mm_processor_device) staticmethod

Fold the mm_processor_device convenience flag into the kwargs.

The flag keeps no state of its own: mm_processor_kwargs["device"] is the only representation of where the processor runs, so an explicit device there always wins and "auto" stays unresolved for VllmConfig, which is where the EC role needed to resolve it lives.

Parameters:

  • mm_processor_kwargs

    (dict[str, Any] | None) –

    The kwargs as given, or None.

  • mm_processor_device

    (MMProcessorDevice | None) –

    The flag's value, or None when unset.

Returns:

  • dict[str, Any] | None –

    The kwargs to build the config with, unchanged unless the flag adds

  • dict[str, Any] | None –

    a device.

get_limit_per_prompt(modality)

Get the maximum number of input items allowed per prompt for the given modality (backward compatible).

get_mm_processor_device_type()

The torch device type mm_processor_kwargs["device"] names.

mm_processor_kwargs is untyped, so device may be any form torch accepts -- "cuda", "cuda:1", torch.device(...), or a bare index. Normalising through torch rather than parsing the string keeps the non-string forms from slipping past a caller's comparison.

Returns:

  • str | None –

    The device type, or None when no device is requested.

Raises:

  • ValueError –

    If device is not something torch.device accepts. validate_mm_processor_device is what surfaces this during startup, so the value is only parsed once.

get_video_pruning_spec()

Return (method, rate) when video pruning is enabled, else None. rate is the fraction of video tokens to prune.

is_mm_embeds_enabled(modality)

Whether pre-computed embeddings are accepted for the given modality.

merge_mm_processor_kwargs(inference_kwargs)

Get the keyword arguments to pass to the multi-modal processor according to the extra arguments passed during inference.

Nested mappings are merged recursively, with inference-time values taking precedence over configured values.

use_gpu_video_backend()

Return whether the configured video loader or codec uses the GPU.

validate_mm_processor_device(ec_config)

Check mm_processor_kwargs["device"] for this deployment.

The only place the requested device is validated, so it runs even on a CPU-only platform: the value is parsed before any early return.

Parameters:

  • ec_config

    (ECTransferConfig | None) –

    The deployment's EC config, or None when it is not an encode/prefill/decode deployment. Passed in because it is not reachable from here, and because a field assigned after construction would not re-trigger this config's validators.

Raises:

  • ValueError –

    If the requested device is not a torch device, or if it is the accelerator on an instance that also runs the language model.

ObservabilityConfig

Configuration for observability - metrics and tracing.

Methods:

Attributes:

collect_detailed_traces = None class-attribute instance-attribute

It makes sense to set this only if --otlp-traces-endpoint is set. If set, it will collect detailed traces for the specified modules. This involves use of possibly costly and or blocking operations and hence might have a performance impact.

Note that collecting detailed timing information for each request can be expensive.

collect_model_execute_time cached property

Whether to collect model execute time for the request.

collect_model_forward_time cached property

Whether to collect model forward time for the request.

cudagraph_metrics = False class-attribute instance-attribute

Enable CUDA graph metrics (number of padded/unpadded tokens, runtime cudagraph dispatch modes, and their observed frequencies at every logging interval).

custom_histogram_buckets = None class-attribute instance-attribute

Custom Prometheus histogram bucket boundaries, as a JSON mapping from bucket-family key to a list of strictly increasing, positive, finite upper bounds. When a family key is present, its list replaces the default buckets for every histogram in that family; families not listed keep their defaults. Known families: request_latency, time_to_first_token, inter_token_latency, iteration_tokens, request_params_n, request_num_preemptions, request_tokens, kv_cache_residency. Example: --custom-histogram-buckets '{"request_latency": [0.01, 0.05, 0.1, 0.5]}'. Note that every extra bucket adds one time series per metric and label set.

enable_layerwise_nvtx_tracing = False class-attribute instance-attribute

Deprecated: per-layer tracing was only implemented by the removed Model Runner V1. This now only adds NVTX range markers around calls to the compiled model, and will be removed in a future release. It doesn't work with CUDA graphs enabled.

enable_logging_iteration_details = False class-attribute instance-attribute

Enable detailed logging of iteration details. If set, vllm EngineCore will log iteration details This includes number of context/generation requests and tokens and, where the output worker measures it with CUDA events, the elapsed GPU time for the iteration.

Stat loggers also receive two workload summaries, which are not printed in the log; read them in a custom stat logger. Each iteration record has scheduled_workload, a summary of the KV context lengths of the requests that iteration scheduled, and SchedulerStats has queued_workload, a summary of the requests that are still waiting.

With --api-server-count above 1, the engine sends the stats of each step to only one of the API servers, so the stat loggers of any one server receive only part of the iterations.

enable_mfu_metrics = False class-attribute instance-attribute

Enable Model FLOPs Utilization (MFU) metrics.

enable_mm_processor_stats = False class-attribute instance-attribute

Enable collection of timing statistics for multimodal processor operations. This is for internal use only (e.g., benchmarks) and is not exposed as a CLI argument.

jit_monitor_mode = 'warn' class-attribute instance-attribute

How to handle post-warmup JIT compilation events.

jit_monitor_verbose = False class-attribute instance-attribute

Log every monitored JIT compile with runtime details. This can emit many logs and add overhead, so it is intended for debugging.

kv_cache_metrics = False class-attribute instance-attribute

Enable KV cache residency metrics (lifetime, idle time, reuse gaps). Uses sampling to minimize overhead. Requires log stats to be enabled (i.e., --disable-log-stats not set).

kv_cache_metrics_sample = Field(default=0.01, gt=0, le=1) class-attribute instance-attribute

Sampling rate for KV cache metrics (0.0, 1.0]. Default 0.01 = 1% of blocks.

otlp_traces_endpoint = None class-attribute instance-attribute

Target URL to which OpenTelemetry traces will be sent.

per_request_spec_decode_metrics = 'none' class-attribute instance-attribute

Include per-request speculative-decoding acceptance metrics in the response under metrics.speculative_decoding. none disables; summary adds mean acceptance length, draft acceptance rate, and the step-by-draft-length histogram; detailed additionally records the ordered per-step accepted/proposed arrays (one entry per verify step). Only reported for single-sequence requests (n == 1), mirroring the timing metrics. No effect unless speculative decoding is enabled. Independent of --disable-log-stats. This is the per-request response-body counterpart of the aggregate vllm:spec_decode_* Prometheus metrics. The response field is experimental and its shape may change in a future release.

show_hidden_metrics cached property

Check if the hidden metrics should be shown.

show_hidden_metrics_for_version = None class-attribute instance-attribute

Enable deprecated Prometheus metrics that have been hidden since the specified version. For example, if a previously deprecated metric has been hidden since the v0.7.0 release, you use --show-hidden-metrics-for-version=0.7 as a temporary escape hatch while you migrate to new metrics. The metric is likely to be removed completely in an upcoming release.

_reject_bool_histogram_bounds(value) classmethod

Reject booleans before pydantic silently coerces them to floats.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

OffloadConfig

Configuration for model weight offloading to reduce GPU memory usage.

Methods:

Attributes:

offload_backend = 'auto' class-attribute instance-attribute

The backend for weight offloading. Options: - "auto": Selects based on which sub-config has non-default values (prefetch if offload_group_size > 0, uva if cpu_offload_gb > 0). - "uva": UVA (Unified Virtual Addressing) zero-copy offloading. - "prefetch": Async prefetch with group-based layer offloading.

prefetch = Field(default_factory=PrefetchOffloadConfig) class-attribute instance-attribute

Parameters for prefetch offloading backend.

uva = Field(default_factory=UVAOffloadConfig) class-attribute instance-attribute

Parameters for UVA offloading backend.

compile_factors()

Provide a hash that uniquely identifies all the offload configs.

All fields are included because PrefetchOffloader patches module forwards and inserts custom ops (wait_prefetch, start_prefetch) into the computation graph. Changing any offload setting can alter which layers are hooked and how prefetch indices are computed, so the compilation cache must distinguish them.

validate_offload_config()

Validate offload configuration constraints.

ParallelConfig

Configuration for the distributed execution.

Methods:

Attributes:

_all2all_backend_auto_one_sided = Field(default=False, repr=False) class-attribute instance-attribute

Whether "auto" picked "flashinfer_nvlink_one_sided"; VllmConfig falls back to "allgather_reducescatter" for models it does not support.

_allow_auto_resolve_cp_interleave_size = True class-attribute instance-attribute

Whether NIXL or MoRIIO may select the interleave size automatically.

_api_process_count = Field(default=1, gt=0) class-attribute instance-attribute

The number of API processes initialized.

Note

This is an internal config that is only valid for and should only be set by API server scale-out.

_api_process_rank = Field(default=0, ge=-1) class-attribute instance-attribute

The rank of this API process, or -1 for engine core processes under API server scale-out.

Note

This is an internal config that is only valid for and should only be set by API server scale-out.

_coord_store_port = 0 class-attribute instance-attribute

Port of the coordination TCPStore. Can be set by the API server; workers connect as clients to exchange self-picked group ports at runtime.

_data_parallel_master_port_list = Field(default_factory=list) class-attribute instance-attribute

List of open port auto-queried for data parallel messaging. Set to be private as it's not intended to be configured by users.

_numa_bind_auto = Field(default=False, repr=False) class-attribute instance-attribute

Internal launch decision: use soft memory preference in spawned children.

all2all_backend = 'auto' class-attribute instance-attribute

All2All backend for MoE expert parallel communication. Available options:

  • "auto": "flashinfer_nvlink_one_sided" for expert parallelism without elastic EP, with any data-parallel size on GB200/GB300/VR200 or on a single HGX B200/B300 node launched by vLLM (any parallel layout), for BF16/FP16, ModelOpt NVFP4 or 128x128 block FP8 models without LoRA or a MoE-EP backend; "allgather_reducescatter" otherwise

  • "allgather_reducescatter": All2all based on allgather and reducescatter

  • "alltoall_batched": All2all based on all_to_all_single, routing each token only to the ranks owning its experts, in batched activation format
  • "deepep_high_throughput": Use deepep high-throughput kernels
  • "deepep_low_latency": Use deepep low-latency kernels
  • "mori_high_throughput": MoRI EP with InterNodeV1 for multi-node (deprecated; use "mori")
  • "mori_low_latency": MoRI EP with InterNodeV1LL for multi-node (deprecated; use "mori")
  • "moonep": MoonEP balanced EP with dynamic redundant experts (NVLink)
  • "mori": MoRI EP; uses EPv2 where supported (see VLLM_MORI_EP_V2) and EPv1 otherwise, picking the EPv1 inter-node kernel from the token budget (see VLLM_MORI_DISPATCH_INTER_KERNEL_SWITCH_THRESHOLD)
  • "nixl_ep": Use nixl-ep kernels
  • "mooncake_ep": Use Mooncake EP low-latency kernels with elastic buffers
  • "flashinfer_nvlink_one_sided": Use flashinfer high-throughput a2a kernels
  • "flashinfer_nvlink_two_sided": Use flashinfer two-sided kernels for mnnvl
  • "passthrough": No all2all at all: the MoE backend dispatches and combines itself (e.g. the FlashInfer MoE-EP megakernels). Bound automatically for such MoE backends; not selectable from the CLI.

assigned_physical_gpu_ids = None class-attribute instance-attribute

Mapping from vLLM-local logical GPU IDs to physical GPU IDs.

For example, [2, 3] means logical GPU 0 maps to physical GPU 2, and logical GPU 1 maps to physical GPU 3. Physical IDs are used only at platform/topology boundaries such as NVML, NIC affinity, P2P checks, and final CUDA device selection when needed. When None, logical IDs map to visible device IDs in order.

cp_kv_cache_interleave_size = 1 class-attribute instance-attribute

Interleave size of kv_cache storage while using DCP. Store interleave_size tokens on dcp_rank i, then store next interleave_size tokens on dcp_rank i+1. Interleave_size=1: token-level alignment, where token i is stored on dcp_rank i % dcp_world_size. Interleave_size=block_size: block-level alignment, where tokens are first populated to the preceding ranks. Tokens are then stored in (rank i+1, block j) only after (rank i, block j) is fully occupied. Block_size should be greater than or equal to cp_kv_cache_interleave_size. Block_size should be divisible by cp_kv_cache_interleave_size.

When --cp-kv-cache-interleave-size is omitted (None), the interleave size is resolved automatically based on NIXL or MoRIIO transfer requirements. Explicit settings take priority.

cpu_distributed_timeout_seconds = None class-attribute instance-attribute

Timeout (in seconds) for cpu communication groups. If None, PyTorch's default timeout is used (1800s for gloo).

data_parallel_backend = 'mp' class-attribute instance-attribute

Backend to use for data parallel, either "mp" or "ray".

data_parallel_coordinator_startup_timeout_seconds = Field(default=120, gt=0, le=2147483) class-attribute instance-attribute

Seconds the frontend waits for the DP coordinator to report its ZMQ socket addresses at startup. The wait must fit in a signed 32-bit millisecond count.

data_parallel_external_lb = False class-attribute instance-attribute

Whether to use "external" DP LB mode. Applies only to online serving and when data_parallel_size > 0. This is useful for a "one-pod-per-rank" wide-EP setup in Kubernetes. Supported only for MoE deployments; non-MoE models should use independent vLLM instances without --data-parallel-* arguments. Set implicitly when --data-parallel-rank is provided explicitly to vllm serve.

data_parallel_hybrid_lb = False class-attribute instance-attribute

Whether to use "hybrid" DP LB mode. Applies only to online serving and when data_parallel_size > 0. Enables running an AsyncLLM and API server on a "per-node" basis where vLLM load balances between local data parallel ranks, but an external LB balances between vLLM nodes/replicas. Set explicitly in conjunction with --data-parallel-start-rank.

data_parallel_index = Field(init=False) class-attribute instance-attribute

Equal to the data parallel rank but not used for torch process groups and not overridden for dense models.

data_parallel_master_ip = '127.0.0.1' class-attribute instance-attribute

IP of the data parallel master.

data_parallel_master_port = 29500 class-attribute instance-attribute

Port of the data parallel master.

data_parallel_rank = Field(default=0, ge=0) class-attribute instance-attribute

Rank of the data parallel group. The runtime check at __post_init__ further bounds this by data_parallel_size.

data_parallel_rank_local = None class-attribute instance-attribute

Local rank of the data parallel group, set only in SPMD mode.

data_parallel_rpc_port = Field(default=29550, ge=1, le=65535) class-attribute instance-attribute

Fixed port for data parallel messaging, shared by all nodes.

data_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute

Number of data parallel groups. MoE layers will be sharded according to the product of the tensor, prefill-context, and data parallel sizes.

data_parallel_size_local = Field(default=1, ge=0) class-attribute instance-attribute

Number of local data parallel groups. A value of 0 is a sentinel used by the engine-args layer to signal that data parallelism was specified externally (see ParallelConfig.__post_init__).

dbo_decode_token_threshold = Field(default=32, ge=0) class-attribute instance-attribute

The threshold for dual batch overlap for batches only containing decodes. If the number of tokens in the request is greater than this threshold, microbatching will be used. Otherwise, the request will be processed in a single batch.

dbo_prefill_token_threshold = Field(default=512, ge=0) class-attribute instance-attribute

The threshold for dual batch overlap for batches that contain one or more prefills. If the number of tokens in the request is greater than this threshold, microbatching will be used. Otherwise, the request will be processed in a single batch.

dbo_schedule = None class-attribute instance-attribute

What one microbatch overlaps with the other's compute: dispatch-combine-overlap its expert all-to-all, all-reduce-overlap its TP all-reduces. all-reduce-overlap needs tensor parallelism on one DP rank without expert parallelism and is the default there; everywhere else the default is dispatch-combine-overlap.

dcp_comm_backend = None class-attribute instance-attribute

Communication backend for Decode Context Parallel (DCP). - "ag_rs": AllGather + ReduceScatter (existing behavior) - "a2a": All-to-All exchange of partial outputs + LSE, then combine with Triton kernel. Reduces NCCL calls from 3 to 2 per layer for MLA models.

None selects the model default, which is "ag_rs" unless the model overrides it via set_dcp_defaults.

dcp_kv_cache_interleave_size = 1 class-attribute instance-attribute

Interleave size of kv_cache storage while using DCP. dcp_kv_cache_interleave_size has been replaced by cp_kv_cache_interleave_size, and will be deprecated when PCP is fully supported.

dcp_q_replicate = None class-attribute instance-attribute

Replicate the MLA query projection within each DCP group so decode can skip the query all-gather.

With DCP the KV cache is sharded across the group, so the standard MLA decode path all-gathers the query every step. Replicating the (small) query projection at load time lets each rank materialize the full group-local head set and skip that collective, at the cost of computing the projection redundantly on every rank in the group.

decode_context_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute

Number of ranks that shard the decode KV cache. DCP does not expand the process world size. Without PCP, DCP reuses TP ranks. With PCP, DCP either spans the PCP axis or the full TP x PCP block.

disable_custom_all_reduce = False class-attribute instance-attribute

Disable the custom all-reduce kernel and fall back to NCCL.

disable_nccl_for_dp_synchronization = None class-attribute instance-attribute

Forces the dp synchronization logic in vllm/v1/worker/dp_utils.py to use Gloo instead of NCCL for its all reduce.

Defaults to True when async scheduling is enabled, False otherwise.

distributed_executor_backend = None class-attribute instance-attribute

Backend to use for distributed model workers, either "ray" or "mp" (multiprocessing). If the product of pipeline_parallel_size and tensor_parallel_size is less than or equal to the number of GPUs available, "mp" will be used to keep processing on a single host. Otherwise, an error will be raised. To use "mp" you must also set nnodes, and to use "ray" you must manually set distributed_executor_backend to "ray".

Note

TPU platform only supports Ray for distributed inference.

distributed_timeout_seconds = None class-attribute instance-attribute

Timeout in seconds for distributed operations (e.g., init_process_group). If set, this value is passed to torch.distributed.init_process_group as the timeout parameter. If None, PyTorch's default timeout is used (600s for NCCL). Increase this for multi-node setups where model downloads may be slow.

dp_sync_interval = Field(default=16, ge=1) class-attribute instance-attribute

Steps between DP finish-sync all-reduces; must match across DP ranks.

effective_cpu_distributed_timeout property

The timeout cpu groups operate with right now: the configured value, except under FT before steady state, where group timeouts are deferred because uneven rank startup would trip them.

elastic_ep_max_dp_size = Field(default=None, ge=1) class-attribute instance-attribute

Maximum data parallel size supported by elastic expert parallelism.

enable_batch_sharded_sampling = None class-attribute instance-attribute

Use sharded sampling across tensor parallel ranks. Each rank samples a slice of the batch instead of every rank sampling all of it. Currently defaults to False if not set. Enabling it explicitly raises when the config cannot support it (tensor_parallel_size must be > 1, max_num_seqs at least tensor_parallel_size, and max_logprobs non-negative). Models opt in by implementing compute_logits_local.

enable_dbo = False class-attribute instance-attribute

Enable dual batch overlap for the model executor.

enable_elastic_ep = False class-attribute instance-attribute

Enable elastic expert parallelism with stateless NCCL groups for DP/EP.

enable_ep_weight_filter = False class-attribute instance-attribute

Skip non-local expert weights during model loading when expert parallelism is active. Each rank only reads its own expert shard from disk, which can drastically reduce storage I/O for MoE models with per-expert weight tensors (e.g. DeepSeek, Mixtral, Kimi-K2.5). With EPLB, each rank also reads the experts its redundant slots replicate in the initial placement; elastic EP loads every expert. Has no effect on 3D fused-expert checkpoints (e.g. GPT-OSS) or non-MoE models.

enable_eplb = False class-attribute instance-attribute

Enable expert parallelism load balancing for MoE layers.

enable_expert_parallel = False class-attribute instance-attribute

Use expert parallelism instead of tensor parallelism for MoE layers.

enable_fault_tolerance = False class-attribute instance-attribute

Enable fault tolerance for detailed error recovery, such as scaling down faulty DPEngineCores.

enable_hc_sp = False class-attribute instance-attribute

Enable sequence parallelism for HyperConnection (HC) computation. Currently supported by Qwen4Exp on CUDA/ROCm with TP>1 and PP=1 (ignored when TP=1). Does not change MoE parallelism. MoE SP may enable HC SP independently of this flag.

enable_shm_tensor_arena = False class-attribute instance-attribute

Route large CPU tensors (e.g. multimodal pixel_values) in the engine→worker broadcast through a zero-copy shared-memory arena instead of sending a copy to every reader. Experimental: may be reconciled with vLLM's existing multimodal shm tensor caching in a future release. Opt-in; most beneficial for multimodal serving with large images and tensor parallelism. Active only when all queue readers are node-local; reserves slots in /dev/shm.

eplb_config = Field(default_factory=EPLBConfig) class-attribute instance-attribute

Expert parallelism configuration.

expert_placement_strategy = 'linear' class-attribute instance-attribute

The expert placement strategy for MoE layers:

  • "linear": Experts are placed in a contiguous manner. For example, with 4 experts and 2 ranks, rank 0 will have experts [0, 1] and rank 1 will have experts [2, 3].
  • "round_robin": Experts are placed in a round-robin manner. For example, with 4 experts and 2 ranks, rank 0 will have experts [0, 2] and rank 1 will have experts [1, 3]. This strategy can help improve load balancing for grouped expert models with no redundant experts.

fault_tolerance_config = Field(default_factory=FaultToleranceConfig) class-attribute instance-attribute

The configurations for fault tolerance.

is_moe_model = None class-attribute instance-attribute

Whether the deployed model is MoE (if known).

local_engines_only property

Client manages local+remote EngineCores in pure internal LB case. Client manages local EngineCores in hybrid and external LB case.

master_addr = '127.0.0.1' class-attribute instance-attribute

distributed master address for multi-node distributed inference when distributed_executor_backend is mp.

master_port = 29501 class-attribute instance-attribute

distributed master port for multi-node distributed inference when distributed_executor_backend is mp.

max_parallel_loading_workers = Field(default=None, ge=1) class-attribute instance-attribute

Maximum number of parallel loading workers when loading model sequentially in multiple batches. To avoid RAM OOM when using tensor parallel and large models.

mori_ep_v2 = None class-attribute instance-attribute

Whether the "mori" all2all backend runs MoRI EPv2. Resolved from VLLM_MORI_EP_V2 and the deployment by resolve_mori_all2all; not meant to be set by users.

nnodes = Field(default=1, ge=1) class-attribute instance-attribute

num of nodes for multi-node distributed inference when distributed_executor_backend is mp.

nnodes_within_dp property

Number of nodes one DP replica spans.

External LB pins data_parallel_size_local to 1, so the ratio rounds down to 0 once DP replicas outnumber nodes. A replica that does not span nodes still occupies exactly one.

node_rank = Field(default=0, ge=0) class-attribute instance-attribute

distributed node rank for multi-node distributed inference when distributed_executor_backend is mp.

numa_bind = None class-attribute instance-attribute

Enable NUMA binding for GPU worker subprocesses.

Workers are pinned to their GPU's NUMA-local CPUs; on PCT-capable Xeons they also auto-bind to the SKU's PCT priority cores.

If None (default), vLLM binds only when the environment supports it (multiple NUMA nodes, numactl installed, unrestricted CPU affinity, a default NUMA memory policy, and the spawn start method with an mp/uni executor and mp DP, including PCP). Ray, external launchers and device-ID remapping are excluded from automatic binding. Automatic mode prefers GPU-local memory but permits allocations on other nodes. Unsupported environments start unbound. With True, strict memory binding may override an existing policy, and a missing numactl or undetectable GPU-to-NUMA topology is a startup error; False disables binding.

numa_bind_cpus = None class-attribute instance-attribute

Optional CPU lists to bind each GPU worker to.

Setting this list implies explicit numa_bind=True and requests strict --membind, not CPU-only binding or automatic soft memory preference. It cannot be combined with numa_bind=False.

Specify one CPU list per visible GPU, for example ["0-3", "4-7", "8-11", "12-15"]. When set, vLLM uses numactl --physcpubind instead of --cpunodebind. This is useful for custom policies such as binding to PCT or other high-frequency cores. Each entry must use numactl --physcpubind CPU-list syntax, for example "0-3" or "0,2,4-7".

numa_bind_nodes = None class-attribute instance-attribute

NUMA node to bind each GPU worker to.

Setting this list implies explicit numa_bind=True and requests strict --membind, not automatic soft memory preference. It cannot be combined with numa_bind=False.

Specify one NUMA node per visible GPU, for example [0, 0, 1, 1] for a 4-GPU system with GPUs 0-1 on NUMA node 0 and GPUs 2-3 on NUMA node 1. If unset and numa_bind=True, vLLM auto-detects the GPU-to-NUMA topology. The values are passed to numactl --membind and --cpunodebind, so they must be valid numactl NUMA node indices.

pcp_shard_decode_requests property

Whether PCP can shard decode requests across its ranks.

PCP-only execution replicates the KV cache, so each decode request can have a single PCP owner. DCP shards the KV cache and therefore requires every decode request to run on every participating DCP rank.

pipeline_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute

Number of pipeline parallel groups.

placement_group = None class-attribute instance-attribute

ray distributed model workers placement group.

prefill_context_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute

Number of ranks that split prefill sequence computation. PCP expands the process world size but does not increase the KV-cache shard count.

rank = 0 class-attribute instance-attribute

Global rank in distributed setup.

ray_runtime_env = None class-attribute instance-attribute

Ray runtime environment to pass to distributed workers.

ray_workers_use_nsight = False class-attribute instance-attribute

Whether to profile Ray workers with nsight, see https://docs.ray.io/en/latest/ray-observability/user-guides/profiling.html#profiling-nsight-profiler.

tensor_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute

Number of tensor parallel groups.

ubatch_size = Field(default=0, ge=0) class-attribute instance-attribute

Number of ubatch size.

worker_cls = 'auto' class-attribute instance-attribute

The full name of the worker class to use. If "auto", the worker class will be determined based on the platform.

worker_extension_cls = '' class-attribute instance-attribute

The full name of the worker extension class to use. The worker extension class is dynamically inherited by the worker class. This is used to inject new attributes and methods to the worker class for use in collective_rpc calls. It may also define init_worker_extension(self), called after device and distributed initialization but before model loading, and destroy_worker_extension(self), called (best-effort) before the worker shuts down.

world_size = Field(init=False) class-attribute instance-attribute

world_size is TPxPP, it affects the number of workers we create.

world_size_across_dp property

Process world size across TP, PCP, PP, and DP.

_pick_stateless_dp_port()

Return (port, listen_socket) for DP group init.

With a coord store, rank 0 binds a socket and publishes the port; others read it. Without one, pops a pre-allocated port and returns listen_socket=None.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialisation is delayed.

compile_factors()

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

This hash is also used for DP worker configuration validation to prevent hangs from mismatched collective communication patterns.

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

compute_eplb_num_redundant_experts(num_logical_experts)

Compute and set num_redundant_experts if not explicitly specified.

This method should be called after ParallelConfig is initialized and when the number of logical experts is known (from ModelConfig).

Parameters:

  • num_logical_experts

    (int) –

    The number of logical experts from the model.

get_local_gpu_index(local_rank, dp_local_rank=None)

Map a worker's local rank to its host-local logical GPU index.

get_next_dp_init_port()

We might need to initialize process groups in multiple processes that is related to data parallelism, e.g. both in the worker and in the engine, which can live in different processes. To avoid port conflicts, we pop a new port from the prepared port list each time we need to initialize a new process group related to data parallelism.

reconfigure_for_independent_dp_rank()

Reconfigure for a single independent non-MoE DP rank.

set_dcp_defaults(comm_backend='ag_rs', q_replicate=False)

Fill in the DCP options the user left unset.

Models can set their preferred DCP settings by calling this from their verify_and_update_config hook.

sync_dp_state(dp_group, has_unfinished, pending_pause)

Combined all-reduce for DP state synchronization.

Uses a single SUM all-reduce on a 2-element tensor

[0] = 1 if this rank has unfinished work, else 0. SUM > 0 ≡ logical OR across ranks → any rank has work. [1] = 1 if this rank has a pending pause request, else 0. SUM == dp_size ≡ all ranks reached pause consensus.

has_unfinished_global is true if any rank has unfinished work, or if some ranks are waiting for a pause consensus.

Returns:

PassConfig

Configuration for custom Inductor passes.

This is separate from general CompilationConfig so that inductor passes don't all have access to full configuration - that would create a cycle as the PassManager is set as a property of config.

You must pass PassConfig to VLLMConfig constructor via the CompilationConfig constructor. VLLMConfig's post_init does further initialization. If used outside of the VLLMConfig, some fields may be left in an improper state.

Methods:

Attributes:

eliminate_noops = Field(default=True) class-attribute instance-attribute

Eliminate no-op ops.

enable_qk_norm_rope_fusion = None class-attribute instance-attribute

Enable fused Q/K RMSNorm + RoPE pass.

fi_allreduce_fusion_max_size_mb = None class-attribute instance-attribute

The threshold of the communicated tensor sizes under which vllm should use flashinfer fused allreduce. Specified as a float in MB. Unspecified will fallback to default values which are compute capability and world size dependent. See FI_ALLREDUCE_FUSION_MAX_SIZE_MB, keyed by device capability.

fuse_act_padding = None class-attribute instance-attribute

Fuse the custom RMSNorm + padding ops.

fuse_act_quant = None class-attribute instance-attribute

Fuse the custom SiluMul + quant ops.

fuse_allreduce_rms = None class-attribute instance-attribute

Enable flashinfer allreduce fusion.

fuse_attn_quant = None class-attribute instance-attribute

Fuse the custom Attention and MLAAttention + quant ops.

fuse_mla_dual_rms_norm = None class-attribute instance-attribute

Fuse paired q/kv RMS norms in MLA attention.

fuse_norm_quant = None class-attribute instance-attribute

Fuse the custom RMSNorm + quant ops.

fuse_qk_norm_rope_kvcache = Field(default=None) class-attribute instance-attribute

Fuse QK RMSNorm + RoPE/MRoPE + KV cache update into an AITER HIP kernel. Supersedes both enable_qk_norm_rope_fusion and fuse_rope_kvcache for layers that support it. Auto-enabled at O2+ on ROCm for models with QK-norm (e.g. Qwen3-MoE and Qwen3-VL-class architectures).

fuse_rope_kvcache = None class-attribute instance-attribute

Fuse the QK rope + KV cache ops.

fuse_rope_kvcache_cat_mla = None class-attribute instance-attribute

Enable fused MLA KV cache update with RoPE.

rope_kvcache_fusion_max_token_num = 256 class-attribute instance-attribute

The threshold for ROCm AITER RoPE+KVCache fusion e.g. for small batch decode. Larger batch sizes e.g. during prefill will use the unfused kernels. Also applies to the fused QK-Norm+RoPE/MRoPE+KVCache pass.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialisation is delayed.

compile_factors()

Produces a hash unique to the pass configuration. Any new fields that affect compilation should be added to the hash. Any future fields that don't affect compilation should be excluded.

flashinfer_max_size(world_size)

Returns the max communication size in bytes for flashinfer allreduce fusion for the given world size. Returns None if world size is not supported by configs as it's not supported by flashinfer.

log_enabled_passes()

Log the enabled custom fusion passes. This is called at the end of VLLMConfig post_init, after all defaults are finalized. TODO also log the compile ranges for which this is enabled.

PoolerConfig

Controls the behavior of output pooling in pooling models.

Methods:

Attributes:

  • dimensions (int | None) –

    Reduce the dimensions of embeddings if model

  • enable_chunked_processing (bool) –

    Whether to enable chunked processing for long inputs that exceed the model's

  • enable_flash_late_interaction (bool) –

    Whether the engine-side late-interaction scorer may use the fused

  • logit_mean (float | None) –

    If provided, subtract this value from classification logits before

  • logit_sigma (float | None) –

    If provided, divide the classification logits by this value after

  • max_embed_len (int | None) –

    Maximum input length allowed for embedding generation. When set, allows

  • pooling_type (SequencePoolingType | TokenPoolingType | None) –

    The pooling method used for pooling.

  • returned_token_ids (list[int] | None) –

    A list of indices for the vocabulary dimensions to be extracted,

  • seq_pooling_type (SequencePoolingType | None) –

    The pooling method used for sequence pooling.

  • step_tag_id (int | None) –

    If set, only the score corresponding to the step_tag_id in the

  • task (PoolingTask | None) –

    The task used for pooling.

  • tok_pooling_type (TokenPoolingType | None) –

    The pooling method used for tokenwise pooling.

  • use_activation (bool | None) –

    Whether to apply activation function to the pooler outputs.

dimensions = None class-attribute instance-attribute

Reduce the dimensions of embeddings if model support matryoshka representation. Defaults to None.

enable_chunked_processing = False class-attribute instance-attribute

Whether to enable chunked processing for long inputs that exceed the model's maximum position embeddings. When enabled, long inputs will be split into chunks, processed separately, and then aggregated using weighted averaging. This allows embedding models to handle arbitrarily long text without CUDA errors. Multimodal inputs are not supported. Defaults to False.

enable_flash_late_interaction = True class-attribute instance-attribute

Whether the engine-side late-interaction scorer may use the fused flash-maxsim Triton kernel. Disabled automatically when the API server is started with --disable-flash-late-interaction; the reference scorer is used instead.

logit_mean = None class-attribute instance-attribute

If provided, subtract this value from classification logits before activation. Used for affine score calibration (Platt scaling): activation((logit - logit_mean) / logit_sigma). Defaults to None.

logit_sigma = None class-attribute instance-attribute

If provided, divide the classification logits by this value after mean subtraction. Used for affine score calibration (Platt scaling): activation((logit - logit_mean) / logit_sigma). Defaults to None.

max_embed_len = None class-attribute instance-attribute

Maximum input length allowed for embedding generation. When set, allows inputs longer than max_embed_len to be accepted for embedding models. When an input exceeds max_embed_len, it will be handled according to the original max_model_len validation logic. Defaults to None (i.e. set to max_model_len).

pooling_type = None class-attribute instance-attribute

The pooling method used for pooling.

If set, seq_pooling_type or tok_pooling_type are automatically populated with this field. Alternatively, users can set seq_pooling_type and tok_pooling_type explicitly.

This field is mainly for user convenience. Internal code should always use seq_pooling_type or tok_pooling_type instead of pooling_type.

returned_token_ids = None class-attribute instance-attribute

A list of indices for the vocabulary dimensions to be extracted, such as the token IDs of good_token and bad_token in the math-shepherd-mistral-7b-prm model.

seq_pooling_type = None class-attribute instance-attribute

The pooling method used for sequence pooling.

step_tag_id = None class-attribute instance-attribute

If set, only the score corresponding to the step_tag_id in the generated sentence should be returned. Otherwise, the scores for all tokens are returned.

task = None class-attribute instance-attribute

The task used for pooling.

tok_pooling_type = None class-attribute instance-attribute

The pooling method used for tokenwise pooling.

use_activation = None class-attribute instance-attribute

Whether to apply activation function to the pooler outputs. None uses the pooler's default, which is True in most cases.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

PrefetchOffloadConfig

Configuration for prefetch-based CPU offloading.

Groups layers and uses async H2D prefetch to hide transfer latency.

Attributes:

offload_group_size = Field(default=0, ge=0) class-attribute instance-attribute

Group every N layers together. Offload last offload_num_in_group layers of each group. Default is 0 (disabled). Example: group_size=8, num_in_group=2 offloads layers 6,7,14,15,22,23,... Unlike cpu_offload_gb, this uses explicit async prefetching to hide transfer latency.

offload_num_in_group = Field(default=1, ge=1) class-attribute instance-attribute

Number of layers to offload per group. Must be <= offload_group_size. Default is 1.

offload_params = Field(default_factory=set) class-attribute instance-attribute

The set of parameter name segments to target for prefetch offloading. Unmatched parameters are not offloaded. If this set is empty, ALL parameters of each offloaded layer are offloaded. Uses segment matching: "w13_weight" matches "mlp.experts.w13_weight" but not "mlp.experts.w13_weight_scale".

offload_prefetch_step = Field(default=1, ge=0) class-attribute instance-attribute

Number of layers to prefetch ahead. Higher values hide more latency but use more GPU memory. Default is 1.

ProfilerConfig

Dataclass which contains profiler config for the engine.

Methods:

Attributes:

active_iterations = Field(default=5, ge=1) class-attribute instance-attribute

Number of active iterations for PyTorch profiler schedule. This is the number of iterations where profiling data is actually collected. Defaults to 5 active iterations.

capture_torch_profiler = False class-attribute instance-attribute

Deprecated and has no effect: only the removed Model Runner V1 profiled CUDA graph capture. It will be removed in a future release.

delay_iterations = Field(default=0, ge=0) class-attribute instance-attribute

Number of engine iterations to skip before starting profiling. Defaults to 0, meaning profiling starts immediately after receiving /start_profile.

detailed_trace_annotation = False class-attribute instance-attribute

If True, uses detailed annotations with roofline metrics (sk, sqsq, sqsk) in profiler trace events. If False, uses simple annotations with only context/generation request counts and token counts. Disabled by default.

ignore_frontend = False class-attribute instance-attribute

If True, disables the front-end profiling of AsyncLLM when using the 'torch' profiler. This is needed to reduce overhead when using delay/limit options, since the front-end profiling does not track iterations and will capture the entire range.

max_iterations = Field(default=0, ge=0) class-attribute instance-attribute

Maximum number of engine iterations to profile after starting profiling. Defaults to 0, meaning no limit.

profiler = None class-attribute instance-attribute

Which profiler to use. Defaults to None. Options are:

  • 'torch': Use PyTorch profiler.
  • 'cuda': Use CUDA profiler.
  • 'proton': Use Triton Proton profiler.

proton_backend = None class-attribute instance-attribute

Proton GPU backend. None lets Proton select CUPTI automatically.

proton_context = 'shadow' class-attribute instance-attribute

Proton context source. shadow records explicit scopes with low overhead; python records Python call stacks.

proton_data = 'tree' class-attribute instance-attribute

Proton output type. tree produces Hatchet data and trace produces a Chrome trace.

proton_graph_attribution = False class-attribute instance-attribute

Observe CUDA graph capture so replayed kernels can be attributed. Requires Triton >= 3.7 and proton_data='tree'.

proton_hook = None class-attribute instance-attribute

Optional Proton hook. Use triton to add Triton launch metadata.

proton_mode = None class-attribute instance-attribute

Optional backend-specific Proton mode string, such as pcsampling.

proton_output_format = None class-attribute instance-attribute

Optional format passed to Proton when finalizing a profile. None uses the default format for proton_data.

proton_profiler_dir = '' class-attribute instance-attribute

Directory to save Triton Proton profiles. Each worker writes a separate rank-qualified file.

should_profile_frontend property

Whether the frontend CPU profiler should be enabled.

torch_profiler_activities = Field(default=None, min_length=1) class-attribute instance-attribute

Activities recorded by workers using the torch profiler. When unset, each worker uses its platform default: CPU; CPU and CUDA; or CPU and XPU.

torch_profiler_dir = '' class-attribute instance-attribute

Directory to save torch profiler traces. Both AsyncLLM's CPU traces and worker's traces (CPU & GPU) will be saved under this directory. Note that it must be an absolute path.

torch_profiler_dump_cuda_time_total = True class-attribute instance-attribute

If True, dumps total CUDA time in torch profiler traces. Enabled by default.

torch_profiler_record_shapes = False class-attribute instance-attribute

If True, records tensor shapes in the torch profiler. Disabled by default.

torch_profiler_use_gzip = True class-attribute instance-attribute

If True, saves torch profiler traces in gzip format. Enabled by default

torch_profiler_with_flops = False class-attribute instance-attribute

If True, enables FLOPS counting in the torch profiler. Disabled by default.

torch_profiler_with_memory = False class-attribute instance-attribute

If True, enables memory profiling in the torch profiler. Disabled by default.

torch_profiler_with_stack = True class-attribute instance-attribute

If True, enables stack tracing in the torch profiler. Enabled by default as it is useful for debugging. Can be disabled via --profiler-config.torch_profiler_with_stack=false CLI flag.

wait_iterations = Field(default=0, ge=0) class-attribute instance-attribute

Number of wait iterations for PyTorch profiler schedule. During wait, the profiler is completely off with zero overhead. This allows skipping initial iterations before warmup begins. Defaults to 0 (no wait period).

warmup_iterations = Field(default=0, ge=0) class-attribute instance-attribute

Number of warmup iterations for PyTorch profiler schedule. During warmup, the profiler runs but data is discarded. This helps reduce noise from JIT compilation and other one-time costs in the profiled trace. Defaults to 0 (schedule-based profiling disabled, recording all iterations). Set to a positive value (e.g., 2) to enable schedule-based profiling.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

PublisherConfig

Transport settings shared by all cache event publishers.

Subclasses add the switch that gates the events they publish and override enable_events, which resolves publisher to "null" when they are off.

Attributes:

  • buffer_steps (int) –

    The number of steps to cache for replay endpoint. Will only save

  • enable_events (bool) –

    Whether the events gated by this config are enabled.

  • endpoint (str) –

    The zmq endpoint to use for publishing cache events.

  • hwm (int) –

    The zmq high water mark for the event publisher. After queueing N events,

  • max_queue_size (int) –

    The maximum number of events to queue while waiting for publishing.

  • publisher (Literal['null', 'zmq']) –

    The publisher to use for publishing cache events. Can be "null", "zmq".

  • replay_endpoint (str | None) –

    The zmq endpoint to use for replaying cache events.

  • topic (str) –

    The topic to use for the event publisher. Consumers can subscribe to

buffer_steps = 10000 class-attribute instance-attribute

The number of steps to cache for replay endpoint. Will only save events from the last N steps for the replay endpoint.

The replay socket's send high-water mark is 2 * (buffer_steps + 1).

enable_events property

Whether the events gated by this config are enabled.

endpoint = 'tcp://*:5557' class-attribute instance-attribute

The zmq endpoint to use for publishing cache events.

hwm = 100000 class-attribute instance-attribute

The zmq high water mark for the event publisher. After queueing N events, events will start dropping if the consumer is not keeping up.

max_queue_size = 100000 class-attribute instance-attribute

The maximum number of events to queue while waiting for publishing.

publisher = None class-attribute instance-attribute

The publisher to use for publishing cache events. Can be "null", "zmq".

replay_endpoint = None class-attribute instance-attribute

The zmq endpoint to use for replaying cache events.

topic = '' class-attribute instance-attribute

The topic to use for the event publisher. Consumers can subscribe to this topic to receive events.

ReasoningConfig

Configuration for reasoning models.

Set reasoning_start_str and reasoning_end_str to the strings used to enter and forcibly terminate reasoning. The end string may include a transition phrase before the parser's natural reasoning end marker. Token IDs are derived automatically by initialize_token_ids.

Methods:

Attributes:

_enabled = field(default=False, init=False, repr=False) class-attribute instance-attribute

Private field indicating whether reasoning token IDs have been initialized. Set to True by initialize_token_ids once token IDs are initialized.

_natural_reasoning_end_token_ids = field(default=None, init=False, repr=False) class-attribute instance-attribute

Token IDs that naturally terminate reasoning, as defined by the parser.

_reasoning_end_token_ids = field(default=None, init=False, repr=False) class-attribute instance-attribute

Private backing field for forced reasoning end token IDs.

_reasoning_start_token_ids = field(default=None, init=False, repr=False) class-attribute instance-attribute

Private backing field for reasoning_start_token_ids. Set by initialize_token_ids. Not intended to be configured directly.

enabled property

Returns True if reasoning is enabled (i.e. if token IDs have been initialized), False otherwise.

natural_reasoning_end_token_ids property

Token IDs that indicate the model naturally ended reasoning.

reasoning_end_str = '' class-attribute instance-attribute

String forced when the thinking budget is exhausted.

reasoning_end_token_ids property

Token IDs forced when the thinking budget is exhausted.

reasoning_parser = '' class-attribute instance-attribute

The name of the ReasoningParser to use for this model.

reasoning_start_str = '' class-attribute instance-attribute

String that indicates the start of reasoning.

reasoning_start_token_ids property

Token IDs derived from reasoning_start_str. Set automatically by initialize_token_ids. Not intended to be configured directly.

initialize_token_ids(model_config)

Initialize reasoning token IDs from strings using the tokenizer.

SchedulerConfig

Scheduler configuration.

Methods:

  • compile_factors –

    WARNING: Whenever a new field is added to this config, add it to

  • default_factory –

    Create a SchedulerConfig with default values for its InitVars.

Attributes:

async_scheduling = None class-attribute instance-attribute

If set to False, disable async scheduling. Async scheduling helps to avoid gaps in GPU utilization, leading to better latency and throughput.

async_scheduling_depth = Field(default=2, ge=2) class-attribute instance-attribute

Steps in flight with async scheduling: the step on the GPU plus async_scheduling_depth - 1 steps scheduled ahead of it (per pipeline stage beyond the first). The default 2 overlaps one step's host work (output processing, scheduling, input preparation) with the next step's GPU work. A deeper queue helps when the host round trip is longer than a GPU step, as in low-batch decode across nodes with speculative decoding. Ignored without async scheduling.

cache_aware_admission_threshold = Field(default=0.5, ge=0.0, le=1.0) class-attribute instance-attribute

KV cache usage below which cache_aware_admission_window is not applied.

Defaults to 0.5, so the window engages only once the cache is at least half used. Below that there is room for both prompts and reordering would change admission order without an eviction to avoid, which is a fairness cost for no benefit. It also means the per-request cache probe is skipped entirely while the cache is roomy. Set to 0.0 to reorder on every step.

cache_aware_admission_window = Field(default=0, ge=0) class-attribute instance-attribute

Look-ahead window for cache-aware admission. Within the first N waiting requests, those whose prefix is already in the KV cache are admitted ahead of requests that would have to compute theirs, so a cold request does not evict blocks a resident one still needs. 0 (the default) admits strictly in arrival order.

Reordering is confined to the window and to requests that are merely waiting, so a request that is blocked or already partially computed keeps its position and nothing is moved past it. Requires prefix caching and the "fcfs" policy; it is ignored otherwise. Costs one prefix-cache lookup per request in the window per step, so prefer the smallest window that spans the usual queue depth.

disable_chunked_mm_input = False class-attribute instance-attribute

If set to true and chunked prefill is enabled, we do not want to partially schedule a multimodal item. Only used in V1 This ensures that if a request has a mixed prompt (like text tokens TTTT followed by image tokens IIIIIIIIII) where only some image tokens can be scheduled (like TTTTIIIII, leaving IIIII), it will be scheduled as TTTT in one step and IIIIIIIIII in the next.

disable_hybrid_kv_cache_manager = None class-attribute instance-attribute

If set to True, KV cache manager will allocate the same size of KV cache for all attention layers even if there are multiple type of attention layers like full attention and sliding window attention. If set to None, the default value will be determined based on the environment and starting configuration.

enable_chunked_prefill = True class-attribute instance-attribute

If True, prefill requests can be chunked based on the remaining max_num_batched_tokens.

The default value here is mainly for convenience when testing. In real usage, this should be set in EngineArgs.create_engine_config.

encoder_cache_size = Field(default=None, ge=1) class-attribute instance-attribute

Multimodal encoder cache size in tokens, only used in V1, or None to derive it from max_num_batched_tokens.

This is a capacity: how many tokens of encoder output may stay resident, including across requests, so a later request reusing the same image can skip the encoder. It is unrelated to how much encoder work one step may do (max_num_encoder_input_tokens), and deriving it from a per-step batch budget caps cross-request reuse at max_num_batched_tokens / tokens_per_item items. Size it as in_flight_items * tokens_per_item when a workload sends several requests against the same image.

Raised to the largest single item if that would not fit. Costs GPU memory at the model's multimodal embedding width, which is taken from the KV cache.

Resolved in __post_init__; never None afterwards.

is_multimodal_model = False class-attribute instance-attribute

True if the model is multimodal.

long_prefill_token_threshold = Field(default=0, ge=0) class-attribute instance-attribute

For chunked prefill, a request is considered long if the prompt is longer than this number of tokens. 0 disables the cap (default). Ignored when chunked prefill is disabled.

The cap is not applied when the request is the only one in the batch, since there is no other request for it to starve.

long_prefill_token_threshold_adaptive = Field(default=False) class-attribute instance-attribute

Floor the effective long prefill token threshold at a fair share of the token budget: max_num_batched_tokens divided by the number of queued and running requests. Only applies when long_prefill_token_threshold is nonzero.

max_async_kv_loads_per_step = Field(default=None, ge=1) class-attribute instance-attribute

Maximum number of async KV connector loads (e.g. a P/D NIXL pull) that start in one scheduling step. Each start allocates KV blocks for the whole prompt on the main thread, and with data parallelism every rank waits for the slowest step. max_num_inflight_kv_loads bounds how many loads are held; this bounds how fast they start. None (default) means no limit.

Requests identified by the connector as async loads wait separately, so this limit does not block ordinary waiting requests. Starting loads while the running batch is full still requires max_num_inflight_kv_loads.

Experimental: this option may be changed or removed in a future release.

max_num_active_seqs = Field(default=None, ge=1) class-attribute instance-attribute

Maximum number of requests the scheduler admits into RUNNING.

max_num_seqs sizes the model runner (per-request buffers and CUDA graph capture) and is also the default admission limit. Setting this lowers only the number of requests that may occupy RUNNING, so decode batches stay smaller without shrinking runner or graph capacity. Must be <= max_num_seqs. None (default) keeps current behavior.

max_num_batched_tokens = Field(default=DEFAULT_MAX_NUM_BATCHED_TOKENS, ge=1) class-attribute instance-attribute

Maximum number of tokens that can be processed in a single iteration.

The default value here is mainly for convenience when testing. In real usage, this should be set in EngineArgs.create_engine_config.

max_num_encoder_input_tokens = Field(init=False) class-attribute instance-attribute

Multimodal encoder compute budget, only used in V1.

NOTE: This is not currently configurable. It will be overridden by max_num_batched_tokens in case max multimodal embedding size is larger.

max_num_inflight_kv_loads = Field(default=None, ge=1) class-attribute instance-attribute

Maximum number of requests holding KV blocks for an async KV connector load (e.g. a P/D NIXL pull) before they run: loads in progress, or finished and waiting for a running slot.

Setting it also lets requests the connector may load asynchronously (KVConnectorBase_V1.may_load_async, by default P/D remote-prefill requests) start their loads while the running batch is full, so they are ready when a slot frees. None (default) keeps current behavior: no cap, and loads start only when a running slot is free.

max_num_queued_reqs = Field(default=None, ge=0) class-attribute instance-attribute

Maximum number of requests that can be in-flight (waiting or running) at the same time, or None for no limit. When the limit is reached, new requests are rejected with HTTP 503 so the client can retry on another instance. This bounds vLLM's otherwise unbounded request queue and is primarily a coarse capacity valve.

Unlike max_num_seqs, which applies per data-parallel rank, this limit is enforced in the API server process and counts in-flight requests across all DP ranks it routes to. Size it as roughly data_parallel_size * max_num_seqs plus the desired queue depth if it should not bind before per-rank admission does.

max_num_queued_tokens = Field(default=None, ge=0) class-attribute instance-attribute

Maximum total prompt tokens of requests currently in the prefill phase, or None for no limit. When the limit is reached, new requests are rejected with HTTP 503.

This is a TTFT QoS mechanism: by setting it to target_TTFT * prefill_throughput you reject requests when the prefill backlog would exceed the latency target. In a disaggregated prefill-decode setup this maps directly to the prefill pool's capacity.

Like max_num_queued_reqs, this limit is enforced in the API server process and covers the prefill backlog across all DP ranks it routes to, so prefill_throughput in the formula above is the aggregate throughput of the deployment.

Note: the count is conservative. A partially prefilled request still contributes its full prompt_len until it transitions out of the prefill phase, because the scheduler's per-iteration num_computed_tokens progress is not propagated to the API server process during prefill (EngineCoreOutput is only emitted once the request starts producing tokens). Similarly, prefix-cache hits (num_cached_tokens) are only known to the OutputProcessor after prefill completes. This overestimates the real backlog, causing earlier rejection than strictly necessary — the safe direction for QoS. The impact is limited to long prompts under chunked prefill; short prompts that prefill in a single iteration are unaffected.

max_num_scheduled_tokens = Field(default=None, ge=1) class-attribute instance-attribute

Maximum number of tokens that the scheduler may issue in a single iteration.

This is usually equal to max_num_batched_tokens, but can be smaller in cases when the model might append tokens into the batch (such as speculative decoding). Defaults to max_num_batched_tokens.

max_num_seqs = Field(default=DEFAULT_MAX_NUM_SEQS, ge=1) class-attribute instance-attribute

Maximum number of sequences to be processed in a single iteration.

The default value here is mainly for convenience when testing. In real usage, this should be set in EngineArgs.create_engine_config.

policy = 'fcfs' class-attribute instance-attribute

The scheduling policy to use:

  • "fcfs" means first come first served, i.e. requests are handled in order of arrival.
  • "priority" means requests are handled based on given priority (lower value means earlier handling) and time of arrival deciding any ties).

pp_microbatch_min_tokens = Field(default=4096, ge=0) class-attribute instance-attribute

Pipeline parallelism only. Size prefill chunks at the uncached prefill backlog / pp_size, but not below this value, so they fill every stage. 0 disables.

prefill_schedule_interval = Field(default=1, ge=1) class-attribute instance-attribute

Only admit prefill once every N engine steps, leaving the steps in between to decode alone. 1 (the default) admits prefill on every step.

A deferred step carries no prefill at all, including chunks of an already-admitted prompt, so a long prompt can take up to N times as many steps to finish prefilling.

runner_type = 'generate' class-attribute instance-attribute

The runner type to launch for the model.

scheduler_cls = None class-attribute instance-attribute

The scheduler class to use. "vllm.v1.core.sched.scheduler.Scheduler" is the default scheduler. Can be a class directly or the path to a class of form "mod.custom_class".

scheduler_reserve_full_isl = True class-attribute instance-attribute

If True, the scheduler checks whether the full input sequence length fits in the KV cache before admitting a new request, rather than only checking the first chunk. Prevents over-admission and KV cache thrashing with chunked prefill.

stream_interval = Field(default=1, ge=1) class-attribute instance-attribute

The interval (or buffer size) for streaming in terms of token length. A smaller value (1) makes streaming smoother by sending each token immediately, while a larger value (e.g., 10) reduces host overhead and may increase throughput by batching multiple tokens before sending.

watermark = Field(default=0.0, ge=0.0, lt=1.0) class-attribute instance-attribute

Fraction of total KV cache blocks to keep free (the watermark) when admitting waiting or preempted requests into the running queue. This headroom helps avoid frequent KV cache eviction and the resulting repeated preemption of requests when GPU memory is scarce. Must be in the range [0.0, 1.0); 0.0 (the default) disables the watermark.

_skip_none_validation(value, handler) classmethod

Skip validation if the value is None when initialisation is delayed.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

default_factory(**kwargs) staticmethod

Create a SchedulerConfig with default values for its InitVars.

SpeculativeConfig

Configuration for speculative decoding.

Methods:

Attributes:

attention_backend = None class-attribute instance-attribute

Attention backend to use for the draft model. When None, the backend is automatically selected. Useful when the drafter requires a different attention backend (e.g. DFlash needs a backend that supports non-causal attention).

code_revision = None class-attribute instance-attribute

The specific revision to use for the draft model code on Hugging Face Hub. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.

custom_method = field(default=None, init=False) class-attribute instance-attribute

The configured custom speculative method, if any (see method).

draft_decode_context_parallel_size = Field(default=None, ge=1) class-attribute instance-attribute

The degree of decode context parallelism for the draft model. Can only be 1 or the same as the target model's decode context parallel size. Defaults to the target's, except for DFlash/DSpark drafts, which default to 1 unless they are full-attention MLA.

draft_enable_eplb = True class-attribute instance-attribute

Whether to enable EPLB for the draft model when it is enabled for the target model.

draft_lm_head_quantization = None class-attribute instance-attribute

Quantize the drafter's copy of a target lm_head it shares (EAGLE, MTP and DeepSeek-V4/V4.1 DSpark), or, with "fp8", the Muse Spark DSpark drafter's own lm_head and Markov head on ROCm. "fp8" uses per-row weight and per-token activation scales on the platform's FP8 linear kernel; "nvfp4" is weight-only on the platform's W4A16 kernel. The target verifies with its own head, so only the acceptance length can change.

draft_load_config = None class-attribute instance-attribute

Load config for the draft model. If not specified, will use the load config from the target model.

draft_model_config = None class-attribute instance-attribute

The configuration of the draft model initialized internal.

draft_parallel_config = None class-attribute instance-attribute

The parallel configuration for the draft model initialized internal.

draft_sample_method = 'greedy' class-attribute instance-attribute

How the draft model samples tokens. 'greedy' always picks the argmax token, and the draft probabilities are treated as one-hot during rejection sampling. 'probabilistic' samples stochastically from the draft distribution and uses the full draft logits for the probability ratio test during rejection sampling. This comes at the cost of additional GPU memory usage.

draft_tensor_parallel_size = Field(default=None, ge=1) class-attribute instance-attribute

The degree of the tensor parallelism for the draft model. Can only be 1 or the same as the target model's tensor parallel size.

dspark_draft_topk = Field(default=None, ge=1) class-attribute instance-attribute

For Qwen3 DSpark drafting, evaluate the Markov projection only for the top-k base-logit candidates. Requires draft tensor parallel size 1.

enable_adaptive_verification = False class-attribute instance-attribute

Whether to adaptively size the draft-verification budget from per-request confidence. Currently only supported for method="dspark".

enforce_eager = None class-attribute instance-attribute

Override the default enforce_eager from model_config

fly_entropy_threshold = Field(default=0.3, ge=0) class-attribute instance-attribute

Target top-k entropy lower bound for FLy loose acceptance.

fly_entropy_top_k = Field(default=3, ge=1) class-attribute instance-attribute

Number of largest target probabilities used by FLy's entropy gate.

fly_window_size = Field(default=None, ge=1) class-attribute instance-attribute

Number of subsequent native acceptance decisions checked by FLy. If unset, defaults to min(6, num_speculative_tokens - 1).

index_share_for_mtp_iteration = None class-attribute instance-attribute

Override whether MTP iterations reuse the first step's sparse indices. If None, use the value from the draft model's Hugging Face config.

kv_cache_dtype = None class-attribute instance-attribute

KV cache dtype for the draft model. When None, the draft inherits the target model's --kv-cache-dtype. Custom dtypes registered by platform backends are accepted.

max_model_len = Field(default=None, ge=1) class-attribute instance-attribute

The maximum model length of the draft model. Used when testing the ability to skip speculation for some sequences.

max_num_new_slots_for_drafting property

Return the maximum additional drafting slots per request.

The scheduler budget already includes one query slot per decoding request. Only the autoregressive draft-model input needs one more: it retains one unsliced token. DFlash and DSpark draft in a separate query pass rather than adding rows to the target batch.

method = None class-attribute instance-attribute

The name of the speculative method to use. If users provide and set the model param, the speculative method type will be detected automatically if possible, if model param is not provided, the method name must be provided.

If using ngram method, the related configuration prompt_lookup_max and prompt_lookup_min should be considered.

A configured method is never changed based on the draft checkpoint, but it is checked against it where the checkpoint can be recognized (e.g. mtp requires an MTP draft, and draft_model rejects one).

Besides the built-in methods, this can be a custom method registered with vllm.v1.worker.gpu.spec_decode.speculator_config.register_speculative_method (e.g. by a vLLM plugin). It is then moved to custom_method, and this is set to the built-in method that its config is based on (None if it isn't based on one).

model = None class-attribute instance-attribute

The name of the draft model, eagle head, or additional weights, if provided.

moe_backend = None class-attribute instance-attribute

MoE backend to use for the draft model. When None, the draft model inherits the target model's --moe-backend setting. Useful when the drafter and generator require different MoE kernels (e.g. quantized generator with unquantized drafter).

num_speculative_tokens = Field(default=None, gt=0) class-attribute instance-attribute

The number of speculative tokens, if provided. It will default to the number in the draft model config if present, otherwise, it is required.

num_speculative_tokens_per_batch_size = None class-attribute instance-attribute

Batch-size schedule used to dynamically choose speculative-token count.

Each entry is (range_start, range_end, num_speculative_tokens) with an inclusive batch-size range.

parallel_drafting = None class-attribute instance-attribute

Deprecated and has no effect. DFlash and DSpark always draft in parallel, and no other method supports it.

prefill_context_kv_only = False class-attribute instance-attribute

Set on a P/D prefill instance (Model Runner V2, DFlash-based speculators) to only store the drafter's context K/V, which the decode instance reads: no drafts, no lookahead KV slots, and, for draft models that support it, the draft weights only drafting reads are freed. Requests that decode there run without speculation. Keep the rest of the speculative config as on the decode instance; adaptive verification and dynamic speculative decoding are turned off.

prompt_lookup_max = Field(default=None, ge=1) class-attribute instance-attribute

Maximum size of ngram token window when using Ngram proposer. Defaults to prompt_lookup_min if set, otherwise 5.

prompt_lookup_min = Field(default=None, ge=1) class-attribute instance-attribute

Minimum size of ngram token window when using Ngram proposer. Defaults to prompt_lookup_max if set, otherwise 5.

quantization = None class-attribute instance-attribute

Quantization method that was used to quantize the draft model weights. If None, we assume the model weights are not quantized. Note that it only takes effect when using the draft model-based speculative method.

rejection_sample_method = 'standard' class-attribute instance-attribute

The rejection sampling method to use. 'standard' uses probabilistic rejection sampling (with or without cached draft logits, controlled by draft_sample_method). 'synthetic' accepts draft tokens with a decaying probability calibrated to synthetic_acceptance_rate. 'block' uses block verification (Sun et al.), which jointly verifies the draft tokens as a block instead of one at a time. 'fly' applies FLy's lossy, entropy-gated deferred window to the native per-token acceptance decisions.

resolved_draft_num_redundant_experts = field(default=None, init=False, repr=False) class-attribute instance-attribute

Resolved redundant expert count used for the draft's EPLB config.

revision = None class-attribute instance-attribute

The specific model version to use for the draft model. It can be a branch name, a tag name, or a commit id. If unspecified, will use the default version.

speculator_config property

The configured speculator's config. Derived on each access so that it follows changes to the fields it depends.

speculator_options = None class-attribute instance-attribute

Options for a custom speculator, interpreted by its SpeculatorConfig, which must list "speculator_options" in its supported_options.

subfolder = None class-attribute instance-attribute

The subfolder of the target model that holds the draft checkpoint, e.g. "eagle3" for a target that ships its EAGLE-3 draft in eagle3/. Only this subfolder is downloaded from the Hugging Face Hub. Cannot be combined with model. If neither is given, a draft method that needs a checkpoint looks for one in the target's subfolder named after the method.

suffix_decoding_corpus_tokens = 1 << 20 class-attribute instance-attribute

Token capacity of the GPU corpus of finished responses used for cross-request matching. Oldest responses are overwritten first. Set 0 (or suffix_decoding_max_cached_requests to 0) to match only within each request's own prompt and output.

suffix_decoding_max_cached_requests = 10000 class-attribute instance-attribute

Set to 0 to disable the cross-request corpus of finished responses (equivalent to suffix_decoding_corpus_tokens=0), so that each request matches only within its own prompt and output.

suffix_decoding_max_spec_factor = 1.0 class-attribute instance-attribute

Deprecated and has no effect: the GPU suffix speculator always drafts num_speculative_tokens tokens.

suffix_decoding_max_tree_depth = 24 class-attribute instance-attribute

The maximum suffix match length for suffix decoding.

suffix_decoding_min_token_prob = 0.1 class-attribute instance-attribute

Deprecated and has no effect: the GPU suffix speculator always drafts num_speculative_tokens tokens.

synthetic_acceptance_length = None class-attribute instance-attribute

Target mean acceptance length for synthetic rejection sampling, in [1, num_speculative_tokens + 1]. Resolved internally to synthetic_acceptance_rates. Only valid when rejection_sample_method is 'synthetic'. Mutually exclusive with synthetic_acceptance_rates.

synthetic_acceptance_rates = None class-attribute instance-attribute

Per-position unconditional acceptance rates for synthetic rejection sampling. Position i's entry is the marginal probability that the first i+1 draft tokens are all accepted; the list must have length num_speculative_tokens, each entry in [0, 1], and be monotonically non-increasing. Only valid when rejection_sample_method is 'synthetic'. Mutually exclusive with synthetic_acceptance_length.

target_model_config = None class-attribute instance-attribute

The configuration of the target model.

target_parallel_config = None class-attribute instance-attribute

The parallel configuration for the target model.

tensor_parallel_size = None class-attribute instance-attribute

Users should pass "draft_tensor_parallel_size". This parameter's purpose is to warn users when they mistakenly provide the wrong argument.

use_local_argmax_reduction = False class-attribute instance-attribute

Use vocab-parallel local argmax instead of all-gathering full logits for draft token generation. Reduces communication from O(vocab_size) to O(2 * tp_size) per token. Only applies to greedy draft selection in non-tree speculation.

uses_aux_hidden_states property

See SpeculatorConfig.uses_aux_hidden_states.

uses_separate_workspace_lane property

See SpeculatorConfig.uses_separate_workspace_lane.

uses_target_hidden_states property

See SpeculatorConfig.uses_target_hidden_states.

xpress_topc = Field(default=None, ge=0) class-attribute instance-attribute

For XPress drafting, score each Jacobi pass only on the drafter's top-C base-logit candidates. 0 disables the narrowing and scores the full vocabulary. Takes precedence over xpress_topc in the draft checkpoint's config, which is used when this is unset.

_acceptance_length_to_rates(length, n) staticmethod

Mean acceptance length to unconditional per-position rates, using the minimum-variance schedule.

_apply_dict_then_arch_override(target_hf_overrides, hf_config, transformers_mtp_overrides=None) staticmethod

Apply dict rope overrides, then the draft arch rewrite.

Dict patches run first so nested keys (text_config.rope_parameters) apply before arch mapping may promote text_config. Nested wrappers are skipped on flat draft configs, where setting them would create a bare text_config dict that get_text_config() picks up instead.

_apply_draft_eplb_override(parallel_config)

Return the parallel config with the draft EPLB settings applied.

_maybe_override_draft_max_model_len(speculative_max_model_len, draft_max_model_len, target_max_model_len) staticmethod

Determine the max sequence len for the draft model. This is usually the draft_max_model_len, but may be the target_max_model_len if it is less than the draft_max_model_len, or may be speculative_max_model_len if it is specified.

This is necessary so that sequences do not exceed the capacity of the draft model or the target model.

speculative_max_model_len is mainly used for testing that sequences can skip speculation.

_maybe_override_draft_max_position_embeddings(draft_hf_config, target_max_model_len) staticmethod

Raise the max_position_embeddings of a draft that shares the target's positional space (see DraftModelSpeculatorConfig's shares_target_positions) up to the target's.

The proposer feeds the draft positions up to the target's max_model_len, while max_position_embeddings sizes the draft's rotary cos_sin_cache. A smaller checkpoint value (e.g. 2048 for yuhuili/EAGLE3-LLaMA3.1-Instruct-8B, or a DFlash or DSpark draft published against a shorter context than the target is served with) makes that cache gather go out of bounds.

Only drafts whose RoPE types are all in _CACHE_ONLY_ROPE_TYPES are resized.

Parameters:

  • draft_hf_config

    (PreTrainedConfig) –

    The draft model's HF config, mutated in place.

  • target_max_model_len

    (int) –

    The target model's max_model_len.

_resolve_synthetic_acceptance_rates(n, rates, length) staticmethod

Return per-position unconditional acceptance rates from exactly one of rates or length (validates range, length, and monotonicity).

_select_draft_hf_overrides(overrides) staticmethod

Keep rope-relevant keys, including those nested under VL wrappers.

_verify_and_get_draft_dcp(target_parallel_config, draft_dcp) staticmethod

Default the draft's DCP to the target's; an explicit value must be 1 or the target's.

_verify_and_get_draft_tp(target_parallel_config, speculative_draft_tensor_parallel_size) staticmethod

Verifies and adjusts the tensor parallel size for a draft model specified using speculative_draft_tensor_parallel_size.

_verify_draft_eplb_config()

Validate EPLB against draft experts and the topology they use.

apply_draft_eplb_overrides(vllm_config)

Apply draft-only EPLB settings without changing the target config.

apply_draft_overrides(vllm_config)

Overlay this config's draft overrides onto a target VllmConfig.

Only non-None model overrides are applied. Draft EPLB settings are applied separately, including the draft-specific redundant-expert count from eplb_config.

compile_factors()

WARNING: Whenever a new field is added to this config, add it to ignored_factors if it does not affect the computation graph.

compose_draft_hf_overrides(target_hf_overrides, transformers_mtp_overrides=None) staticmethod

Build the hf_overrides for the draft ModelConfig.

Callable overrides on the target are config-to-config transforms (e.g. test harnesses shrinking num_hidden_layers) and must also reach the draft config — otherwise a draft belonging to a large target is instantiated at full size even when the target is shrunk.

Dict overrides are mostly target-specific key patches, but rope-relevant keys (rope_parameters / rope_theta, including nested text_config) must reach the draft or a YaRN-style target override leaves the draft on native rope (#58080). max_position_embeddings stays target-only so the draft max-model-len clamp keeps holding (#63909).

The composed override must stay picklable: the draft ModelConfig is sent to spawned engine-core processes, so a local closure would fail with Can't get local object during pickling. Bind the target via functools.partial over a module-referenceable static method instead.

create_draft_parallel_config(target_parallel_config, speculative_draft_tensor_parallel_size, draft_model_config=None) staticmethod

Create a parallel config for use by the draft worker.

Use the draft TP size and disable inherited EP for known dense drafts. Without a draft model config, preserve the previous EP inheritance.

get_subfolder_checkpoint(subfolder, required=True)

The local path of the draft checkpoint in subfolder of the target model. If there is none, raises if required, else returns None.

num_mtp_modules()

Number of MTP modules the drafter selects among by draft step.

update_arch_()

EagleConfig and ExtractHiddenStatesConfig update architectures, so update all architectures-related fields in self.draft_model_config

SpeechToTextConfig

Configuration for speech-to-text models.

Attributes:

audio_resample_method = None class-attribute instance-attribute

Optional resampler applied after decoding at the native sample rate. None preserves the audio decoder's default resampling behavior.

max_audio_clip_s = 30 class-attribute instance-attribute

Maximum duration in seconds for a single audio clip without chunking. Audio longer than this will be split into smaller chunks if allow_audio_chunking evaluates to True, otherwise it will be rejected. None means audio duration can be unlimited and won't be chunked.

min_energy_split_window_size = 1600 class-attribute instance-attribute

Window size in samples for finding low-energy (quiet) regions to split audio chunks. The algorithm looks for the quietest moment within this window to minimize cutting through speech. Default 1600 samples ≈ 100ms at 16kHz. If None, no chunking will be done.

overlap_chunk_second = 1 class-attribute instance-attribute

Overlap duration in seconds between consecutive audio chunks when splitting long audio. This helps maintain context across chunk boundaries and improves transcription quality at split points.

sample_rate = 16000 class-attribute instance-attribute

Sample rate (Hz) to resample input audio to. Most speech models expect 16kHz audio input. The input audio will be automatically resampled to this rate before processing.

SpeechToTextParams dataclass

All parameters consumed by get_generation_prompt().

TranscriptionRequest.build_stt_params() constructs this object, mapping API-level fields into typed attributes. Models only receive this object, so new parameters can be added here without changing the get_generation_prompt signature.

Attributes:

audio instance-attribute

Resampled audio waveform for a single chunk.

extra_args = None class-attribute instance-attribute

Request extensions supplied through vllm_xargs.

hotwords = None class-attribute instance-attribute

hotwords refers to a list of important words or phrases that the model should pay extra attention to during transcription.

language = None class-attribute instance-attribute

ISO 639-1 language code (validated / auto-detected).

model_config instance-attribute

Model configuration.

request_prompt = '' class-attribute instance-attribute

Optional text prompt to guide the model.

stt_config instance-attribute

Server-level speech-to-text configuration.

task_type = 'transcribe' class-attribute instance-attribute

"transcribe" or "translate".

to_language = None class-attribute instance-attribute

Target language for translation (model-dependent).

StructuredOutputsConfig

Dataclass which contains structured outputs config for the engine.

Methods:

Attributes:

backend = 'auto' class-attribute instance-attribute

Which engine will be used for structured outputs (e.g. JSON schema, regex, etc) by default. With "auto", we will make opinionated choices based on request contents and what the backend libraries currently support, so the behavior is subject to change in each release.

disable_additional_properties = False class-attribute instance-attribute

If True, the guidance backend will not use additionalProperties in the JSON schema. This is only supported for the guidance backend and is used to better align its behaviour with outlines and xgrammar.

disable_any_whitespace = False class-attribute instance-attribute

If True, json output will always be compact without any whitespace. If False, the model may generate whitespace between JSON fields, which is still valid JSON. This is only supported for xgrammar and guidance backends.

enable_in_reasoning = False class-attribute instance-attribute

Whether to use structured input for reasoning.

reasoning_parser = '' class-attribute instance-attribute

Select the reasoning parser depending on the model that you're using. This is used to parse the reasoning content into OpenAI API format.

reasoning_parser_plugin = '' class-attribute instance-attribute

Path to a dynamically reasoning parser plugin that can be dynamically loaded and registered.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

UVAOffloadConfig

Configuration for UVA (Unified Virtual Addressing) CPU offloading.

Uses zero-copy access from CPU-pinned memory. Simple but requires fast CPU-GPU interconnect.

Attributes:

cpu_offload_gb = Field(default=0, ge=0) class-attribute instance-attribute

The space in GiB to offload to CPU, per GPU. Default is 0, which means no offloading. Intuitively, this argument can be seen as a virtual way to increase the GPU memory size. For example, if you have one 24 GB GPU and set this to 10, virtually you can think of it as a 34 GB GPU. Then you can load a 13B model with BF16 weight, which requires at least 26GB GPU memory. Note that this requires fast CPU-GPU interconnect, as part of the model is loaded from CPU memory to GPU memory on the fly in each model forward pass. This uses UVA (Unified Virtual Addressing) for zero-copy access.

cpu_offload_params = Field(default_factory=set) class-attribute instance-attribute

The set of parameter name segments to target for CPU offloading. Unmatched parameters are not offloaded. If this set is empty, parameters are offloaded non-selectively until the memory limit defined by cpu_offload_gb is reached. Examples: - For parameter name "mlp.experts.w2_weight": - "experts" or "experts.w2_weight" will match. - "expert" or "w2" will NOT match (must be exact segments). This allows distinguishing parameters like "w2_weight" and "w2_weight_scale".

VllmConfig

Dataclass which contains all vllm-related configuration. This simplifies passing around the distinct configurations in the codebase.

Methods:

Attributes:

additional_config = Field(default_factory=dict) class-attribute instance-attribute

Additional config for specified platform. Different platforms may support different configs. Make sure the configs are valid for the platform you are using. Contents must be hashable.

attention_config = Field(default_factory=AttentionConfig) class-attribute instance-attribute

Attention configuration.

aux_output_config = Field(default_factory=AuxOutputConfig) class-attribute instance-attribute

Execution auxiliary output configuration.

cache_config = Field(default_factory=CacheConfig) class-attribute instance-attribute

Cache configuration.

compilation_config = Field(default_factory=CompilationConfig) class-attribute instance-attribute

torch.compile and cudagraph capture configuration for the model.

As a shorthand, one can append compilation arguments via -cc.parameter=argument such as -cc.mode=3 (same as -cc='{"mode":3}').

You can specify the full compilation config like so: {"mode": 3, "cudagraph_capture_sizes": [1, 2, 4, 8]}

device_config = Field(default_factory=DeviceConfig) class-attribute instance-attribute

Device configuration.

diffusion_config = None class-attribute instance-attribute

Diffusion LLM (dLLM) configuration.

ec_events_config = None class-attribute instance-attribute

The configurations for encoder cache event publishing.

ec_manager_config = Field(default_factory=EncoderCacheManagerConfig) class-attribute instance-attribute

The configurations for custom encoder cache manager.

ec_transfer_config = None class-attribute instance-attribute

The configurations for distributed EC cache transfer.

engram_config = None class-attribute instance-attribute

N-gram embedding storage and sharding settings.

gpu_iteration_timing property

Whether the output worker times logged iterations with CUDA events. Otherwise they are logged without an elapsed time.

instance_id = '' class-attribute instance-attribute

The ID of the vLLM instance.

kernel_config = Field(default_factory=KernelConfig) class-attribute instance-attribute

Kernel configuration.

kv_events_config = None class-attribute instance-attribute

The configurations for event publishing.

kv_transfer_config = None class-attribute instance-attribute

The configurations for distributed KV cache transfer.

load_config = Field(default_factory=LoadConfig) class-attribute instance-attribute

Load configuration.

logging_config = Field(default_factory=LoggingConfig) class-attribute instance-attribute

Logging configuration.

lora_config = None class-attribute instance-attribute

LoRA configuration.

mamba_config = Field(default_factory=MambaConfig) class-attribute instance-attribute

Mamba configuration.

model_config = None class-attribute instance-attribute

Model configuration.

needs_dp_coordinator property

Determine if the DPCoordinator process is needed.

The DPCoordinator is needed in two cases: 1. For MoE models with DP > 1: to handle wave coordination (even in external LB mode, since wave coordination runs in the coordinator) 2. For non-MoE models in internal/hybrid LB mode: to collect and publish queue stats for load balancing across DP ranks

Returns:

  • bool –

    True if DPCoordinator process is needed, False otherwise.

num_hash_lookahead_tokens = Field(default=0, init=False) class-attribute instance-attribute

Tokens after each block that its hash covers; 0 unless draft KV reads ahead.

num_lookahead_tokens property

KV slots to reserve past the tokens the target model is scheduled for.

The drafter writes KV for positions beyond the target model's query range, so every component that reserves blocks must add this margin: the scheduler through allocate_slots, and the worker warmup, which builds its own SchedulerOutputs. Consumers must read this property rather than re-deriving their own per-method lookahead, so the scheduler and warmup cannot drift apart.

num_prefill_lookahead_tokens property

Prefill tokens past the computed range that the drafter reads.

Mid-prefill the drafter consumes tokens the target model has not been scheduled for yet, so every component that has to keep them available must apply this margin: the scheduler, which never ends a chunk within it and shifts encoder scheduling by it, and the components that read num_reprefillable_tokens. Consumers must read this property rather than re-deriving their own per-method lookahead, so those components cannot drift apart.

num_reprefillable_tokens property

Trailing computed tokens whose drafter KV is not final yet: of the num_prefill_lookahead_tokens read past the prompt end, only the first is sampled, so the rest are rewritten later.

num_scheduled_spec_tokens property

See SpeculatorConfig.num_scheduled_spec_tokens.

observability_config = Field(default_factory=ObservabilityConfig) class-attribute instance-attribute

Observability configuration.

offload_config = Field(default_factory=OffloadConfig) class-attribute instance-attribute

Model weight offloading configuration.

optimization_level = OptimizationLevel.O2 class-attribute instance-attribute

The optimization level. These levels trade startup time cost for performance, with -O0 having the best startup time and -O3 having the best performance. -O2 is used by default. See OptimizationLevel for full description.

parallel_config = Field(default_factory=ParallelConfig) class-attribute instance-attribute

Parallel configuration.

performance_mode = 'balanced' class-attribute instance-attribute

Performance mode for runtime behavior, 'balanced' is the default. 'interactivity' favors low end-to-end per-request latency at small batch sizes (fine-grained CUDA graphs, latency-oriented kernels). 'throughput' favors aggregate tokens/sec at high concurrency (larger CUDA graphs, more aggressive batching, throughput-oriented kernels).

profiler_config = Field(default_factory=ProfilerConfig) class-attribute instance-attribute

Profiling configuration.

quant_config = None class-attribute instance-attribute

Quantization configuration.

reasoning_config = None class-attribute instance-attribute

The configurations for reasoning model.

scheduler_config = Field(default_factory=SchedulerConfig.default_factory) class-attribute instance-attribute

Scheduler configuration.

shutdown_timeout = Field(default=0, ge=0) class-attribute instance-attribute

Shutdown grace period for in-flight requests. Shutdown will be delayed for up to this amount of time to allow already-running requests to complete. Any remaining requests are aborted once the timeout is reached.

speculative_config = None class-attribute instance-attribute

Speculative decoding configuration.

structured_outputs_config = Field(default_factory=StructuredOutputsConfig) class-attribute instance-attribute

Structured outputs configuration.

uniform_decode_query_len property

Query length of every request in a uniform decode batch.

A decode step submits one query for the newly sampled token plus one for each draft token, so the widest uniform decode batch the scheduler can build is max_num_seqs * uniform_decode_query_len tokens. Anything that has to cover a decode batch reads this, so the sizing rule cannot drift between the places that apply it.

This deliberately does not derive from the KV slots a drafter reserves past the target's query range, which is a reservation contract rather than a query-length one. The two do not differ by a constant: DFlash reserves num_speculative_tokens + 1 slots yet still verifies 1 + num_speculative_tokens queries, while EAGLE reserves num_speculative_tokens and verifies the same 1 + n. Deriving one from the other would under-size EAGLE by a full request width, which is the failure this property exists to prevent.

use_cumem_cudagraph_pool property

Whether CUDA graphs go to the cuMem pool that sleep offloads.

use_replayssm_trackers property

Mamba2 ReplaySSM whose rings follow the runner-committed trackers.

watchdog_config = Field(default_factory=WatchdogConfig) class-attribute instance-attribute

Configuration for the stack-dump watchdog.

watermark_config = None class-attribute instance-attribute

Text watermarking configuration.

weight_transfer_config = None class-attribute instance-attribute

The configurations for weight transfer during RL training.

__post_init__()

Verify configs are valid & consistent with each other.

_apply_optimization_level_defaults(defaults)

Apply optimization level defaults using self as root.

Recursively applies values from defaults into nested config objects. Only fields present in defaults are overwritten.

If the user configuration does not specify a value for a default field and if the default field is still None after all user selections are applied, then default values will be applied to the field. User specified fields will not be overridden by the default.

Parameters:

  • defaults

    (dict[str, Any]) –

    Dictionary of default values to apply.

_disable_cudagraphs_for_stock_torch_compile()

Disable CUDA graphs, which the CUDA graph manager would otherwise capture around the stock-compiled model.

_get_dbo_unsupported_features()

Collect what the model runner cannot combine with DBO.

The runner microbatches a decoder forward pass (drafting runs whole, after it). Anything else that slices or replays the batch differently (adapters, pipeline stages, prefill context parallelism, encoders) is not handled yet.

_get_model_runner_unsupported_features()

Collect features the GPU model runner does not support.

_get_quantization_config(model_config, load_config) staticmethod

Get the quantization config.

_get_standalone_cpu_model_runner_unsupported_features()

Collect features not supported by the standalone CPU model runner.

_limit_max_model_len_to_draft()

Lower max_model_len to the draft model's when the model runner can't serve longer sequences.

_maybe_fall_back_from_auto_one_sided_all2all()

Keep the "auto" all2all default to models one-sided supports.

_one_sided_all2all_unsupported_reason()

Why the deployment cannot use flashinfer_nvlink_one_sided, if it can't.

_post_init_kv_transfer_config()

Update KVTransferConfig based on top-level configs in VllmConfig.

Right now, this function reads the offloading settings from CacheConfig and configures the KVTransferConfig accordingly.

_raise_dbo_thresholds_for_spec_decode()

The speculative counterpart of ParallelConfig's DBO threshold check.

A uniform decode batch below one request per microbatch cannot be split on a request boundary, and an idle DP rank's one-request dummy batch must stay below the thresholds too. Such batches gain nothing from microbatching, so raise the thresholds rather than reject the config.

_reject_mismatched_float_kv_cache()

Reject an explicit float16/bfloat16 KV dtype that differs from the model.

_resolve_and_verify_engram_config()

Resolve defaults and validate n-gram embedding settings.

_resolve_extensible_kv_cache()

Settle enable_extensible_kv_cache: on where supported if unset, an error if explicitly requested where unsupported.

Runs once per model: configs derived for sub-models (with_hf_config) may pick a different runner, and must not revisit the decision.

_resolve_mm_embedding_inputs()

Accept embedding inputs, tensor optional, on disaggregated consumers.

An EC consumer loads embeddings from its connector. A KV consumer receives the prompt KV produced from those embeddings, so it does not need the tensors either. On every other deployment a missing tensor is a client error and must keep failing fast in the frontend.

_resolve_mm_encoder_only()

Enable encoder-only mode for a dedicated EC producer.

_resolve_mm_processor_device()

Settle --mm-processor-device=auto now that the EC role is known.

"auto" means "the accelerator, but only where the processor has it to itself and its output can be handed over without a copy back to host": an encode-only instance whose tensor transport carries device tensors. Every other deployment keeps the processor on CPU.

An explicit device -- from --mm-processor-device or straight from mm_processor_kwargs -- is already folded in by MultiModalConfig, so it is left alone here and validated by _validate_mm_processor_device.

_resolve_mm_video_decode_device()

Default video decoding to torchcodec GPU backend for EPD encoder-only instance if the mm processor runs on CUDA.

The processor consumes the decoded frames on-device in that case, so keeping the frames on the GPU skips the host round-trip through the CPU media path. An explicit codec/backend choice in --media-io-kwargs is left alone, and the default is skipped where torchcodec (or its FFmpeg runtime) is unavailable.

_resolve_num_hash_lookahead_tokens()

Resolve the hash lookahead after the relevant configs are finalized.

_resolve_specialized_decode_switch()

kernel_config.monokernel and additional_config={"decode_backend": "latency_specialized"} are one switch: setting either sets both, whichever one a model reads.

_set_compile_ranges()

Set the compile ranges for the compilation config.

_set_config_default(config_obj, key, value)

Set config attribute to default if not already set by user.

Parameters:

  • config_obj

    (Any) –

    Configuration object to update.

  • key

    (str) –

    Attribute name.

  • value

    (Any) –

    Default value (static or callable).

_set_cudagraph_sizes()

VLLM defines the default candidate list of batch sizes for CUDA graph capture as:

```python default_max_graph_size = platform_defaults.legacy_max_tokens decode_query_len = self.uniform_decode_query_len max_graph_size = min( max_num_seqs * decode_query_len * 2, default_max_graph_size )

1, 2, 4, then multiples of 8 up to 256 and then multiples of 16

up to max_graph_size

cudagraph_capture_sizes = [1, 2, 4] + list(range(8, 256, 8)) + list( range(256, max_graph_size + 1, 16))

max_num_batched_tokens is also appended to the list if it fits within max_cudagraph_capture_size, so the max batch size is captured even when off-stride. Uniform decode sizes are appended when they fit within the platform's default capture ceiling, since they need not land on an 8- or 16-token stride.

In the end, vllm_config.compilation_config.cudagraph_capture_sizes will be the final sizes to capture cudagraph (in ascending order).

These sizes are used to capture and reuse CUDA graphs for performance-critical paths (e.g., decoding). Capturing enables significantly faster kernel dispatch by avoiding Python overhead. The list is then filtered based on max_num_batched_tokens (e.g., 8192 on most GPUs), which controls the total allowed number of tokens in a batch. Since each sequence may have a variable number of tokens, the maximum usable batch size will depend on actual sequence lengths.

Example: With max_num_batched_tokens = 8192, and typical sequences averaging ~32 tokens, most practical batch sizes fall below 256. However, the system will still allow capture sizes up to the platform default if shape and memory permit.

Note: If users explicitly specify cudagraph capture sizes in the compilation config, those will override this default logic. At runtime:

- If batch size <= one of the `cudagraph_capture_sizes`, the closest
padded CUDA graph will be used.
- If batch size > largest `cudagraph_capture_sizes`, cudagraph will
not be used.

_set_max_num_scheduled_tokens()

In most cases, the scheduler may schedule a batch with as many tokens as the worker is configured to handle.

_split_cudagraph_capture_sizes(legacy_sizes, target_query_lens)

Resolve the prefill (token) and decode (request) CUDA graph capture sizes, each from its own sizes, cap or default and never from the other's, and record every graph's token count in cudagraph_capture_sizes and max_cudagraph_capture_size.

Parameters:

  • legacy_sizes

    (bool) –

    The deprecated cudagraph_capture_sizes or max_cudagraph_capture_size was set before resolution.

  • target_query_lens

    (dict[int, int]) –

    The target model's decode query lengths, each mapped to the most requests its batches have.

_sync_draft_all2all_backend()

Make the draft follow the target's final all2all backend.

The draft's ParallelConfig is built before this config, so it holds the target's backend from before any fallback, while both share one EP communicator.

_uses_breakable_cudagraph_for_batch_invariance()

Avoid freezing runtime-M tile lookup in compiled forward (#54243). Breakable graphs look up tuned bf16, unquantized qkv/o/gate_up/down tiles at capture; lm_head runs outside compiled forward and does not benefit. gpt-oss MXFP4 quantizes only MoE experts; its dense Linear layers stay bf16. Plain "mxfp4" is excluded: as an online shorthand it also quantizes Linear layers. An online quantization_config that quantizes Linear layers (linear or targets) is excluded; a moe-only one is not.

_validate_batch_sharded_sampling()

Validate enable_batch_sharded_sampling against the rest of the config.

_validate_mm_processor_device()

Hand the EC config to MultiModalConfig, which owns the rule.

_verify_aux_output_compatibility()

Reject configurations unsupported by enabled auxiliary outputs.

_verify_direct_reload_compat()

Reject configurations that direct weight reload cannot support.

_verify_kv_transfer_compat()

Reject configurations that silently corrupt KV transfers.

adjust_dcp_kv_cache_interleave_size(kv_cache_groups)

Resolve the NIXL and MoRIIO P/D DCP interleave from the global KV cache groups.

Called once by the engine core before profiling; workers only assign the result via set_kv_cache_layout.

compile_debug_dump_path()

Returns a rank-aware path for dumping torch.compile debug information.

compile_factors(include_version=True)

WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.

Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.

Parameters:

  • include_version

    (bool, default: True ) –

    Include the vLLM version in the hash.

enable_trace_function_call_for_thread()

Set up function tracing for the current thread, if enabled via the VLLM_TRACE_FUNCTION environment variable.

get_decode_cudagraph_query_lens(decode_query_len)

Map each uniform decode query length of a target-shaped runner, whose widest is decode_query_len, to the most requests its batches have.

Dynamic speculative decoding drafts as many tokens as its schedule gives the batch size, so a query length only runs up to the largest batch size that drafts its number of tokens.

get_draft_decode_cudagraph_request_sizes()

Request counts of the FULL graphs of one-token draft decodes (see SpeculatorConfig.one_token_draft_decodes): the request-count grid up to max_num_seqs. The target's decode cap can be far lower: off SM100 its default is 512 / (1 + K) requests, 64 at K=7. Above it the K - 1 draft steps would run eagerly and pay their host launch time on every step, while their graphs are small. Empty without such steps or decode graphs.

get_varlen_decode_cudagraph_token_sizes(decode_query_len)

Token counts of the FULL decode graphs for adaptive verification, whose decode batches mix query lengths up to decode_query_len: the token-count grid up to max_decode_cudagraph_capture_requests requests of decode_query_len tokens each, within the decode token budget.

validate_block_size()

Validate block_size against DCP and mamba constraints.

Called after Platform.update_block_size_for_backend() has finalised block_size.

WatchdogConfig

Configuration for the stack-dump watchdog.

The watchdog runs a background thread that periodically checks whether the main thread has fed it in time. If not, it dumps the stack traces of all threads to a dump file for debugging.

Attributes:

  • check_interval (int) –

    Interval in seconds at which the watchdog checks for feed timeouts.

  • dump_dir (str) –

    Directory to save stack dump files. Empty string disables the watchdog

  • timeout (int) –

    Timeout in seconds after which the watchdog considers the process to be

check_interval = Field(default=_DEFAULT_CHECK_INTERVAL, gt=0) class-attribute instance-attribute

Interval in seconds at which the watchdog checks for feed timeouts.

dump_dir = '' class-attribute instance-attribute

Directory to save stack dump files. Empty string disables the watchdog feature.

timeout = Field(default=_DEFAULT_TIMEOUT, gt=0) class-attribute instance-attribute

Timeout in seconds after which the watchdog considers the process to be stuck and dumps stack traces. Must be greater than 0.

WatermarkConfig

Configuration for text watermark generation.

Attributes:

  • algorithm (WatermarkingAlgorithm) –

    Algorithm used to watermark generated text.

  • allow_target_only_watermarking (bool) –

    Allow speculative decoding without watermarking draft tokens.

  • alpha (float) –

    Probability of selecting key B for dual-key watermarking.

  • context_width (int) –

    Number of prior tokens used by the watermark PRF.

  • deduplicate_contexts (WatermarkContextScope) –

    Which history is searched for a repeated context before a token is

  • deduplicate_contexts_max_history (int | None) –

    Number of most recent history positions searched (default 8192), or

  • enforce (bool) –

    Override request-level opt-outs; unsupported decoding remains unwatermarked.

  • key (int) –

    Secret key used to watermark generated text. Set either key or

  • key_file (str | None) –

    Path to a file holding the secret key as a decimal integer, such as a

  • prf (WatermarkPRFName) –

    Pseudorandom function used by the watermarking algorithm.

algorithm = 'gumbel' class-attribute instance-attribute

Algorithm used to watermark generated text.

allow_target_only_watermarking = False class-attribute instance-attribute

Allow speculative decoding without watermarking draft tokens.

alpha = Field(default=0.1, ge=0, le=1) class-attribute instance-attribute

Probability of selecting key B for dual-key watermarking.

context_width = Field(default=4, ge=1) class-attribute instance-attribute

Number of prior tokens used by the watermark PRF.

deduplicate_contexts = 'single_turn' class-attribute instance-attribute

Which history is searched for a repeated context before a token is sampled; a repeated context is sampled without the watermark. none disables the search. single_turn (default) searches this request's generated tokens. all also searches the prompt and samples the first context_width generated tokens without watermarking.

deduplicate_contexts_max_history = Field(default=8192, ge=1) class-attribute instance-attribute

Number of most recent history positions searched (default 8192), or None for the whole scope. Each position is compared over the context_width tokens before it. Ignored when deduplicate_contexts is none.

enforce = False class-attribute instance-attribute

Override request-level opt-outs; unsupported decoding remains unwatermarked.

key = Field(ge=0, repr=False, exclude=True) class-attribute instance-attribute

Secret key used to watermark generated text. Set either key or key_file.

key_file = None class-attribute instance-attribute

Path to a file holding the secret key as a decimal integer, such as a Docker or Kubernetes secret. It is read once at startup.

prf = 'philox' class-attribute instance-attribute

Pseudorandom function used by the watermarking algorithm.

WeightTransferConfig

Configuration for weight transfer during RL training.

Attributes:

  • backend (Literal['nccl', 'ipc', 'sparse_nccl', 'sparse_disk', 'sharded_rdt', 'nccl_m2n'] | str) –

    The backend to use for weight transfer. Validated against the

backend = 'nccl' class-attribute instance-attribute

The backend to use for weight transfer. Validated against the WeightTransferEngineFactory registry at engine creation time.

config(cls=None, *, config=None, **kwargs)

config(cls: type[ConfigT]) -> type[ConfigT]
config(
    *, config: ConfigDict | None = None, **kwargs: Any
) -> Callable[[type[ConfigT]], type[ConfigT]]

Decorator to create a pydantic dataclass with default config. The default config for the dataclass forbids extra fields.

All config classes in vLLM should use this decorator.

Parameters:

  • cls

    (type[ConfigT] | None, default: None ) –

    The class to decorate

  • config

    (ConfigDict | None, default: None ) –

    The pydantic ConfigDict to use. If provided, it will be merged with the default config.

  • **kwargs

    (Any, default: {} ) –

    Additional arguments to pass to pydantic.dataclass.

get_attr_docs(cls)

Get any docstrings placed after attribute assignments in a class body or its bases.

get_cached_compilation_config() cached

Cache config to avoid repeated calls to get_current_vllm_config()

get_layers_from_vllm_config(vllm_config, layer_type, layer_names=None)

Get layers from the vLLM config.

Parameters:

  • vllm_config

    (VllmConfig) –

    The vLLM config.

  • layer_type

    (type[T]) –

    The type of the layer to get.

  • layer_names

    (Iterable[str] | None, default: None ) –

    The names of the layers to get. If None, return all layers.

replace(dataclass_instance, /, **kwargs)

Like dataclasses.replace, but compatible with Pydantic dataclasses which use pydantic.fields.Field instead of dataclasses.field

set_current_vllm_config(vllm_config, check_compile=False, prefix=None)

Temporarily set the current vLLM config. Used during model initialization. We save the current vLLM config in a global variable, so that all modules can access it, e.g. custom ops can access the vLLM config to determine how to dispatch.