vllm.config ¶
Modules:
-
attention– -
cache– -
compilation– -
device– -
diffusion–Configuration for discrete diffusion (dLLM) models.
-
ec_transfer– -
kernel– -
kv_events– -
kv_transfer– -
load– -
lora– -
mamba– -
model– -
model_arch– -
multimodal– -
observability– -
offload–Configuration for model weight offloading.
-
parallel– -
pooler– -
profiler– -
quantization– -
reasoning– -
scheduler– -
speculative– -
speech_to_text– -
structured_outputs– -
utils–Utility functions for vLLM config dataclasses.
-
vllm– -
weight_transfer–
Classes:
-
AttentionConfig–Configuration for attention mechanisms in vLLM.
-
CUDAGraphMode–Constants for the cudagraph mode in CompilationConfig.
-
CacheConfig–Configuration for the KV cache.
-
CompilationConfig–Configuration for compilation.
-
CompilationMode–The compilation approach used for torch.compile-based compilation of the
-
DeviceConfig–Configuration for the device to use for vLLM execution.
-
DiffusionConfig–Configuration for discrete diffusion language models (dLLMs).
-
ECTransferConfig–Configuration for distributed EC cache transfer.
-
EPLBConfig–Configuration for Expert Parallel Load Balancing (EP).
-
KVEventsConfig–Configuration for KV event publishing.
-
KVTransferConfig–Configuration for distributed KV cache transfer.
-
KernelConfig–Configuration for kernel selection and warmup behavior.
-
LoRAConfig–Configuration for LoRA.
-
LoadConfig–Configuration for loading the model weights.
-
MambaConfig–Configuration for Mamba SSM backends.
-
ModelConfig–Configuration for the model.
-
MultiModalConfig–Controls the behavior of multimodal models.
-
ObservabilityConfig–Configuration for observability - metrics and tracing.
-
OffloadConfig–Configuration for model weight offloading to reduce GPU memory usage.
-
ParallelConfig–Configuration for the distributed execution.
-
PassConfig–Configuration for custom Inductor passes.
-
PoolerConfig–Controls the behavior of output pooling in pooling models.
-
PrefetchOffloadConfig–Configuration for prefetch-based CPU offloading.
-
ProfilerConfig–Dataclass which contains profiler config for the engine.
-
ReasoningConfig–Configuration for reasoning models.
-
SchedulerConfig–Scheduler configuration.
-
SpeculativeConfig–Configuration for speculative decoding.
-
SpeechToTextConfig–Configuration for speech-to-text models.
-
SpeechToTextParams–All parameters consumed by
get_generation_prompt(). -
StructuredOutputsConfig–Dataclass which contains structured outputs config for the engine.
-
UVAOffloadConfig–Configuration for UVA (Unified Virtual Addressing) CPU offloading.
-
VllmConfig–Dataclass which contains all vllm-related configuration. This
-
WeightTransferConfig–Configuration for weight transfer during RL training.
Functions:
-
config–Decorator to create a pydantic dataclass with default config. The default config
-
get_attr_docs–Get any docstrings placed after attribute assignments in a class body.
-
get_cached_compilation_config–Cache config to avoid repeated calls to get_current_vllm_config()
-
get_layers_from_vllm_config–Get layers from the vLLM config.
-
replace–Like
dataclasses.replace, -
set_current_vllm_config–Temporarily set the current vLLM config.
AttentionConfig ¶
Configuration for attention mechanisms in vLLM.
Methods:
-
compute_hash–Provide a hash that uniquely identifies all the configs
-
validate_backend_before–Enable parsing of the
backendenum type from string. -
validate_mla_prefill_backend_before–Enable parsing of the
mla_prefill_backendenum type from string.
Attributes:
-
backend(AttentionBackendEnum | None) –Attention backend to use. Use "auto" or None for automatic selection.
-
disable_flashinfer_q_quantization(bool) –If set, when using fp8 kv, do not quantize Q to fp8.
-
flash_attn_max_num_splits_for_cuda_graph(int) –Flash Attention max number splits for cuda graph decode.
-
flash_attn_version(Literal[2, 3, 4] | None) –Force vllm to use a specific flash-attention version (2, 3, or 4).
-
flex_attn_block_m(int | None) –Triton kernel BLOCK_M tile size for flex attention.
-
flex_attn_block_n(int | None) –Triton kernel BLOCK_N tile size for flex attention.
-
flex_attn_kv_block_size(int | None) –Logical KV block size for the flex attention block mask.
-
flex_attn_q_block_size(int | None) –Logical Q block size for the flex attention block mask.
-
indexer_kv_dtype(IndexerKVDType) –Data type for the sparse-attention indexer K cache. Quantized formats
-
mla_prefill_backend(MLAPrefillBackendEnum | None) –MLA prefill backend to use. If None, will be selected automatically.
-
tq_max_kv_splits_for_cuda_graph(int) –TurboQuant max NUM_KV_SPLITS for cuda graph decode.
-
use_fp4_indexer_cache(bool) –If set, use fp4 indexer cache for dsv32 family model (not support yet)
-
use_non_causal(bool) –Whether to use non-causal (bidirectional) attention.
-
use_prefill_decode_attention(bool) –Use separate prefill and decode kernels for attention instead of
-
use_prefill_query_quantization(bool) –If set, quantize query for attention in prefill.
-
use_trtllm_attention(bool | None) –If set to True/False, use or don't use the TRTLLM attention backend
Source code in vllm/config/attention.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
backend = None class-attribute instance-attribute ¶
Attention backend to use. Use "auto" or None for automatic selection.
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 power of 2 and divisible by flex_attn_block_n. If None, uses the default (kv_cache_block_size on PyTorch >= 2.9, 128 otherwise).
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 the default (16 on PyTorch >= 2.9, 128 otherwise).
indexer_kv_dtype = 'bf16' class-attribute instance-attribute ¶
Data type for the sparse-attention indexer K cache. Quantized formats (fp8, mxfp4, nvfp4) require indexer kernel support in the backend.
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.
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.
use_fp4_indexer_cache = False class-attribute instance-attribute ¶
If set, use fp4 indexer cache for dsv32 family model (not support yet)
use_non_causal = False class-attribute instance-attribute ¶
Whether to use non-causal (bidirectional) attention.
use_prefill_decode_attention = False class-attribute instance-attribute ¶
Use separate prefill and decode kernels for attention instead of the unified triton kernel.
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.
compute_hash() ¶
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.
Source code in vllm/config/attention.py
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.
Source code in vllm/config/attention.py
validate_mla_prefill_backend_before(value) classmethod ¶
Enable parsing of the mla_prefill_backend enum type from string.
Source code in vllm/config/attention.py
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.
Source code in vllm/config/compilation.py
CacheConfig ¶
Configuration for the KV cache.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
block_size(int) –Size of a contiguous cache block in number of tokens.
-
cache_dtype(CacheDType) –Data type for kv cache storage. If "auto", will use model data type.
-
calculate_kv_scales(bool) –Deprecated: This option is deprecated and will be removed in v0.19.
-
enable_prefix_caching(bool) –Whether to enable prefix caching.
-
gpu_memory_utilization(float) –The fraction of GPU memory to be used for the model executor, which can
-
hash_block_size(int | None) –Block size (in tokens) used for computing Request's block_hashes.
-
is_attention_free(bool) –Whether the model is attention-free. This is primarily set in
-
kv_cache_dtype_skip_layers(list[str]) –Layer patterns to skip KV cache quantization. Accepts layer indices
-
kv_cache_max_concurrency(float | None) –Per-DP-engine maximum concurrency at max_model_len tokens.
-
kv_cache_memory_bytes(int | None) –Size of KV Cache per GPU in bytes. By default, this is set to None
-
kv_cache_size_tokens(int | None) –Per-DP-engine KV cache capacity in tokens (group-aware). Uses
-
kv_offloading_backend(KVOffloadingBackend) –The backend to use for KV cache offloading. Supported backends include
-
kv_offloading_size(float | None) –Size of the KV cache offloading buffer in GiB. When TP > 1, this is
-
kv_sharing_fast_prefill(bool) –This feature is work in progress and no prefill optimization takes place
-
mamba_block_size(int | None) –Size of a contiguous cache block in number of tokens for mamba cache.
-
mamba_cache_dtype(MambaDType) –The data type to use for the Mamba cache (both the conv as well as the
-
mamba_cache_mode(MambaCacheMode) –The cache strategy for Mamba layers.
-
mamba_page_size_padded(int | None) –Optional override for mamba page size; used by hybrid mamba/attention
-
mamba_ssm_cache_dtype(MambaDType) –The data type to use for the Mamba cache (ssm state only, conv state will
-
num_cpu_blocks(int | None) –The number of blocks to allocate for CPU memory.
-
num_gpu_blocks(int | None) –The number of blocks to allocate for GPU memory.
-
num_gpu_blocks_override(int | None) –Number of GPU blocks to use. This overrides the profiled
num_gpu_blocks -
prefix_caching_hash_algo(PrefixCachingHashAlgo) –Set the hash algorithm for prefix caching:
-
sliding_window(int | None) –Sliding window size for the KV cache. This is primarily set in
-
user_specified_block_size(bool) –Whether block_size was explicitly provided. Derived automatically.
-
user_specified_mamba_block_size(bool) –Whether mamba_block_size was explicitly provided. Derived automatically.
Source code in vllm/config/cache.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
_block_size_resolved = field(default=False, init=False) class-attribute instance-attribute ¶
Guard against pydantic re-running _apply_block_size_default.
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. 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.
calculate_kv_scales = False class-attribute instance-attribute ¶
Deprecated: This option is deprecated and will be removed in v0.19. It enables dynamic calculation of k_scale and v_scale when kv_cache_dtype is fp8. If False, the scales will be loaded from the model checkpoint if available. Otherwise, the scales will default to 1.0.
enable_prefix_caching = True class-attribute instance-attribute ¶
Whether to enable prefix caching.
gpu_memory_utilization = Field(default=0.92, 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. If unspecified, will use the default value of 0.92. 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.
hash_block_size = Field(default=None, gt=0) class-attribute instance-attribute ¶
Block size (in tokens) used for computing Request's block_hashes.
This can be set to a finer granularity than the physical KV cache block sizes (e.g. 8) as long as every KV cache group's block_size is divisible by it. This enables prefix-caching keys to be computed at the finest common granularity and then merged for larger physical block sizes.
This config is not static default. If left unspecified, vLLM will choose a default based on the resolved KV cache groups (typically the smallest KV cache block size when there are multiple groups).
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_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 ¶
This feature is work in progress and no prefill optimization takes place with this flag enabled currently.
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)
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. Value must be a multiple of 8 to align with causal_conv1d kernel.
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_cache_mode = 'none' class-attribute instance-attribute ¶
The cache strategy for Mamba layers. - "none": set when prefix caching is disabled. - "all": cache the mamba state of all tokens at position i * block_size. This is the default behavior (for models that support it) when prefix caching is enabled. - "align": only cache the mamba state of the last token of each scheduler step and when the token is at position i * block_size.
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_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
xxhashpackage. 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
xxhashpackage.
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.
user_specified_block_size = field(default=False, init=False) class-attribute instance-attribute ¶
Whether block_size was explicitly provided. Derived automatically.
user_specified_mamba_block_size = field(default=False, init=False) class-attribute instance-attribute ¶
Whether mamba_block_size was explicitly provided. Derived automatically.
compute_hash() ¶
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.
Source code in vllm/config/cache.py
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:
- Top-level Compilation control:
- CudaGraph capture:
- Inductor compilation:
compile_sizes- [
compile_ranges_endpoints] [vllm.config.CompilationConfig.compile_ranges_endpoints] inductor_compile_configinductor_passes- custom inductor passes
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:
-
compute_hash–Provide a hash that uniquely identifies all the configs
-
custom_op_log_check–This method logs the enabled/disabled custom ops and checks that the
-
get_compile_ranges–Get the compile ranges for the compilation config.
-
init_backend–Initialize the backend for the compilation config from a vllm config.
-
post_init_cudagraph_sizes–To complete the initialization after cudagraph related
-
validate_cudagraph_mode_before–Enable parsing of the
cudagraph_modeenum type from string. -
validate_mode_before–Enable parsing the
modefield from string mode names. -
validate_pass_config_before–Enable parsing of the
pass_configfield from a dictionary.
Attributes:
-
backend(str) –The backend for compilation. It needs to be a string:
-
cache_dir(str) –The directory to store the compiled graph, to accelerate Inductor
-
compilation_time(float) –time taken for compilation
-
compile_cache_save_format(Literal['binary', 'unpacked']) –Format for saving torch compile cache:
-
compile_mm_encoder(bool) –Whether or not to compile the multimodal encoder.
-
compile_ranges_endpoints(list[int] | None) –Endpoints for Inductor compile ranges.
-
compile_sizes(list[int | str] | None) –Sizes to compile for inductor. In addition
-
cudagraph_capture_sizes(list[int]) –Sizes to capture cudagraph.
-
cudagraph_copy_inputs(bool) –Whether to copy input tensors for
-
cudagraph_mm_encoder(bool) –Enable CUDA graph capture for multimodal encoder (ViT).
-
cudagraph_mode(CUDAGraphMode) –The mode of the cudagraph:
-
cudagraph_num_of_warmups(int) –Number of warmup runs for cudagraph.
-
cudagraph_specialize_lora(bool) –Whether to create separate cuda graphs for cases with and without active
-
custom_ops(list[str]) –Fine-grained control over which custom ops to enable/disable. Use 'all'
-
debug_dump_path(Path | None) –The path to dump the debug information.
-
disabled_custom_ops(Counter[str]) –custom ops that are disabled
-
dynamic_shapes_config(DynamicShapesConfig) –Configuration for dynamic shapes options
-
enabled_custom_ops(Counter[str]) –custom ops that are enabled
-
encoder_compilation_time(float) –time taken for multimodal encoder compilation
-
encoder_cudagraph_max_frames_per_batch(int | None) –Maximum total video frames per batch for encoder CUDA graph capture.
-
encoder_cudagraph_max_vision_items_per_batch(int) –Maximum number of images/videos per batch for encoder CUDA graph capture.
-
encoder_cudagraph_token_budgets(list[int]) –Token budget levels for encoder CUDA graph capture.
-
fast_moe_cold_start(bool | None) –Optimization for fast MOE cold start.
-
inductor_compile_config(dict) –Additional configurations for inductor.
-
inductor_passes(dict[str, str]) –Additional passes for inductor. It is a dictionary
-
ir_enable_torch_wrap(bool) –If True, enable vllm_ir torch custom op wrapping during the forward pass.
-
local_cache_dir(str) –local cache dir for each rank
-
max_cudagraph_capture_size(int) –The maximum cudagraph capture size.
-
mode(CompilationMode) –The compilation approach used for torch.compile-based compilation of the
-
pass_config(PassConfig) –Custom inductor passes, see PassConfig for more details
-
splitting_ops(list[str] | None) –A list of ops to exclude from cudagraphs, used in piecewise compilation.
-
static_all_moe_layers(list[str]) –The names of all the MOE layers in the model
-
static_forward_context(dict[str, Any]) –Per-model forward context
-
traced_files(set[str]) –files that are traced for compilation
-
use_inductor_graph_partition(bool) –Use inductor graph partition to split the graph at cudagraph_unsafe ops.
Source code in vllm/config/compilation.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 | |
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.
cudagraph_copy_inputs = False class-attribute instance-attribute ¶
Whether to copy input tensors for cudagraph. If the caller can guarantee that the same input buffers are always used, it can set this to False. Otherwise, it should set this to True, and the compiler will copy the input to an internally managed buffer. Default is False. Note that this flag is only effective when cudagraph_mode is PIECEWISE.
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.
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_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.
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, images are greedy-packed into the smallest fitting budget and the corresponding CUDA graph is replayed. If empty (default), auto-inferred from model architecture as power-of-2 levels from the model's estimated min budget to max 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 set to min(max_num_seqs*2, 512) by default. This voids OOM in tight memory scenarios with small max_num_seqs, and prevents capture of many large graphs (>512) that would greatly increase startup time with limited performance benefit.
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.compilecompilation 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
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_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.
Source code in vllm/config/compilation.py
compute_hash() ¶
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.
Source code in vllm/config/compilation.py
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.
Source code in vllm/config/compilation.py
get_compile_ranges() ¶
Get the compile ranges for the compilation config.
Source code in vllm/config/compilation.py
init_backend(vllm_config, prefix='', is_encoder=False) ¶
Initialize the backend for the compilation config from a vllm config. Arguments: vllm_config: The vllm config to initialize the backend from. prefix: Cache directory prefix for this compiled module. is_encoder: Whether this module is used in an encoder (as opposed to a text backbone). Returns: The backend for the compilation config.
Source code in vllm/config/compilation.py
post_init_cudagraph_sizes() ¶
To complete the initialization after cudagraph related configs are set. This includes: - initialize compile_sizes
Source code in vllm/config/compilation.py
validate_cudagraph_mode_before(value) classmethod ¶
Enable parsing of the cudagraph_mode enum type from string.
Source code in vllm/config/compilation.py
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.
Source code in vllm/config/compilation.py
validate_pass_config_before(value) classmethod ¶
Enable parsing of the pass_config field from a dictionary.
Source code in vllm/config/compilation.py
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.compilecompilation pipeline. -
VLLM_COMPILE–Custom vLLM Inductor-based backend with caching, piecewise compilation,
Source code in vllm/config/compilation.py
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:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
device(SkipValidation[Device | device | None]) –Device type for vLLM execution.
-
device_type(str) –Device type from the current platform. This is set in
Source code in vllm/config/device.py
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__.
compute_hash() ¶
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.
Source code in vllm/config/device.py
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(int) –Length of the denoising canvas (block). Also determines the number of
-
max_denoising_steps(int | None) –Maximum number of denoising iterations per canvas block.
Source code in vllm/config/diffusion.py
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.
ECTransferConfig ¶
Configuration for distributed EC cache transfer.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
ec_buffer_device(str | None) –The device used by ec connector to buffer the EC cache.
-
ec_buffer_size(float) –The buffer size for TorchDistributedConnector. Measured in number of
-
ec_connector(str | None) –The EC connector for vLLM to transmit EC caches between vLLM instances.
-
ec_connector_extra_config(dict[str, Any]) –any extra config that the connector may need.
-
ec_connector_module_path(str | None) –The Python module path to dynamically load the EC connector from.
-
ec_ip(str) –The EC connector ip, used to build distributed connection.
-
ec_parallel_size(int) –The number of parallel instances for EC cache transfer. For
-
ec_port(int) –The EC connector port, used to build distributed connection.
-
ec_rank(int | None) –The rank of this vLLM instance in the EC cache transfer. Typical value:
-
ec_role(ECRole | None) –Whether this vLLM instance produces, consumes EC cache, or both. Choices
-
engine_id(str | None) –The engine id for EC transfers.
Source code in vllm/config/ec_transfer.py
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.
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_parallel_size = 1 class-attribute instance-attribute ¶
The number of parallel instances for EC cache transfer. For PyNcclConnector, this should be 2.
ec_port = 14579 class-attribute instance-attribute ¶
The EC connector port, used to build distributed connection.
ec_rank = None class-attribute instance-attribute ¶
The rank of this vLLM instance in the EC cache transfer. Typical value: 0 for encoder, 1 for pd instance. Currently only 1P1D is supported.
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.
compute_hash() ¶
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.
Source code in vllm/config/ec_transfer.py
EPLBConfig ¶
Configuration for Expert Parallel Load Balancing (EP).
Attributes:
-
communicator(EPLBCommunicatorBackend | None) –Backend for EPLB expert weight communication:
-
log_balancedness(bool) –Log the balancedness each step of expert parallelism.
-
log_balancedness_interval(int) –Interval for logging the balancedness.
-
num_redundant_experts(int) –Number of redundant experts to use for expert parallelism.
-
policy(EPLBPolicyOption) –The policy type for expert parallel load balancing (EPLB).
-
step_interval(int) –Interval for rearranging experts in expert parallelism.
-
use_async(bool) –Whether to use non-blocking EPLB.
-
window_size(int) –Window size for expert load recording.
Source code in vllm/config/parallel.py
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 - "nixl": Use NIXL/ RIXL with staged send/recv buffers - "pynccl": Use PyNccl send/recv - None: Auto-select backend (prefers "nixl", falls back to "torch_gloo")
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.
num_redundant_experts = Field(default=0, ge=0) class-attribute instance-attribute ¶
Number of redundant experts to use for expert parallelism.
policy = 'default' class-attribute instance-attribute ¶
The policy type for expert parallel load balancing (EPLB).
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.
use_async = True class-attribute instance-attribute ¶
Whether to use non-blocking EPLB.
window_size = Field(default=1000, gt=0) class-attribute instance-attribute ¶
Window size for expert load recording.
KVEventsConfig ¶
Configuration for KV event publishing.
Attributes:
-
buffer_steps(int) –The number of steps to cache for replay endpoint. Will only save
-
enable_kv_cache_events(bool) –If True, enable KV cache events for tracking block storage and removal.
-
endpoint(str) –The zmq endpoint to use for publishing kv 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 kv events. Can be "null", "zmq".
-
replay_endpoint(str | None) –The zmq endpoint to use for replaying kv events.
-
topic(str) –The topic to use for the event publisher. Consumers can subscribe to
Source code in vllm/config/kv_events.py
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.
enable_kv_cache_events = False class-attribute instance-attribute ¶
If True, enable KV cache events for tracking block storage and removal. Events can be published externally by zmq using the event publisher config.
endpoint = 'tcp://*:5557' class-attribute instance-attribute ¶
The zmq endpoint to use for publishing kv 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 kv events. Can be "null", "zmq".
replay_endpoint = None class-attribute instance-attribute ¶
The zmq endpoint to use for replaying kv events.
topic = '' class-attribute instance-attribute ¶
The topic to use for the event publisher. Consumers can subscribe to this topic to receive events.
KVTransferConfig ¶
Configuration for distributed KV cache transfer.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
enable_permute_local_kv(bool) –Experiment feature flag to enable HND to NHD KV Transfer
-
engine_id(str | None) –The engine id for KV transfers.
-
kv_buffer_device(str) –The device used by kv connector to buffer the KV cache. Choices are
-
kv_buffer_size(float) –The buffer size for TorchDistributedConnector. Measured in number of
-
kv_connector(str | None) –The KV connector for vLLM to transmit KV caches between vLLM instances.
-
kv_connector_extra_config(dict[str, Any]) –any extra config that the connector may need.
-
kv_connector_module_path(str | None) –The Python module path to dynamically load the KV connector from.
-
kv_ip(str) –The KV connector ip, used to build distributed connection.
-
kv_load_failure_policy(Literal['recompute', 'fail']) –Policy for handling KV cache load failures.
-
kv_parallel_size(int) –The number of parallel instances for KV cache transfer.
-
kv_port(int) –The KV connector port, used to build distributed connection.
-
kv_rank(int | None) –The rank of this vLLM instance in the KV cache transfer. Typical value:
-
kv_role(KVRole | None) –Whether this vLLM instance produces, consumes KV cache, or both. Choices
Source code in vllm/config/kv_transfer.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
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_buffer_size = 1000000000.0 class-attribute instance-attribute ¶
The buffer size for TorchDistributedConnector. Measured in number of bytes. Recommended value: 1e9 (about 1GB).
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_ip = '127.0.0.1' class-attribute instance-attribute ¶
The KV connector ip, used to build distributed connection.
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_parallel_size = 1 class-attribute instance-attribute ¶
The number of parallel instances for KV cache transfer.
kv_port = 14579 class-attribute instance-attribute ¶
The KV connector port, used to build distributed connection.
kv_rank = None class-attribute instance-attribute ¶
The rank of this vLLM instance in the KV cache transfer. Typical value: 0 for prefill instance, 1 for decode instance. Currently only 1P1D is supported.
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'.
compute_hash() ¶
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.
Source code in vllm/config/kv_transfer.py
KernelConfig ¶
Configuration for kernel selection and warmup behavior.
Methods:
-
compute_hash–Produces a hash unique to the pass configuration.
-
set_platform_defaults–Set platform-specific defaults for the kernel config.
Attributes:
-
enable_flashinfer_autotune(bool) –If True, run FlashInfer autotuning during kernel warmup.
-
ir_op_priority(IrOpPriorityConfig) –vLLM IR op priority for dispatching/lowering during the forward pass.
-
linear_backend(LinearBackend) –Backend for quantized linear layer GEMM kernels. Available options:
-
moe_backend(MoEBackend) –Backend for MoE expert computation kernels. Available options:
Source code in vllm/config/kernel.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
enable_flashinfer_autotune = None class-attribute instance-attribute ¶
If True, run FlashInfer autotuning during kernel warmup.
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.
linear_backend = 'auto' class-attribute instance-attribute ¶
Backend for quantized linear layer GEMM kernels. Available options:
- "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 (NVFP4, MXFP8)
- "flashinfer_trtllm": Use FlashInfer with TensorRT-LLM kernels
- "flashinfer_cudnn": Use FlashInfer with cuDNN kernels
- "flashinfer_b12x": Use FlashInfer b12x CuteDSL NVFP4 GEMM (SM120+)
- "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)
moe_backend = 'auto' class-attribute instance-attribute ¶
Backend for MoE expert computation kernels. Available options:
- "auto": Automatically select the best backend based on model and hardware
- "triton": Use Triton-based fused MoE kernels
- "deep_gemm": Use DeepGEMM kernels (FP8 block-quantized only)
- "deep_gemm_mega_moe": Use DeepGEMM mega MoE kernels
- "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 (FP4 only)
- "flashinfer_b12x": Use FlashInfer CuteDSL fused MoE for SM12x (RTX Pro 6000 / DGX Spark)
- "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)
- "flydsl": Use AMD FlyDSL kernels (ROCm only)
- "hpc": Use HPC kernels (FP8 and Hopper only)
- "emulation": use BF16/FP16 GEMM, dequantizing weights and running QDQ on activations.
_skip_none_validation(value, handler) classmethod ¶
Skip validation if the value is None when initialization is delayed.
Source code in vllm/config/kernel.py
compute_hash() ¶
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.
Source code in vllm/config/kernel.py
set_platform_defaults(vllm_config) ¶
Set platform-specific defaults for the kernel config.
Source code in vllm/config/kernel.py
LoRAConfig ¶
Configuration for LoRA.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
default_mm_loras(dict[str, str] | None) –Dictionary mapping specific modalities to LoRA model paths; this field
-
enable_mixed_moe_lora_format(bool) –If True, force the engine to use the universal 2D MoE LoRA wrapper
-
enable_tower_connector_lora(bool) –If
True, LoRA support for the tower (vision encoder) and connector -
fully_sharded_loras(bool) –By default, only half of the LoRA computation is sharded with tensor
-
lora_dtype(dtype | LoRADType) –Data type for LoRA. If auto, will default to base model dtype.
-
max_cpu_loras(int | None) –Maximum number of LoRAs to store in CPU memory. Must be >= than
-
max_lora_rank(MaxLoRARanks) –Max LoRA rank.
-
max_loras(int) –Max number of LoRAs in a single batch.
-
specialize_active_lora(bool) –Whether to construct lora kernel grid by the number of active LoRA adapters.
-
target_modules(list[str] | None) –Restrict LoRA to specific module suffixes (e.g., ["o_proj", "qkv_proj"]).
Source code in vllm/config/lora.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
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_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 forMoE models; ignored otherwise. Default False keeps the existing model-driven behavior.
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_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.
target_modules = None class-attribute instance-attribute ¶
Restrict LoRA to specific module suffixes (e.g., ["o_proj", "qkv_proj"]). If None, all supported LoRA modules are used. This allows deployment-time control over which modules have LoRA applied, useful for performance tuning.
compute_hash() ¶
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.
Source code in vllm/config/lora.py
LoadConfig ¶
Configuration for loading the model weights.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
device(str | None) –Device to which model weights will be loaded, default to
-
download_dir(str | None) –Directory to download and load the weights, default to the default
-
ignore_patterns(list[str] | str) –The list of patterns to ignore when loading the model. Default to
-
load_format(str | LoadFormats) –The format of the model weights to load.
-
model_loader_extra_config(dict | TensorizerConfig) –Extra config for model loader. This will be passed to the model loader
-
pt_load_map_location(str | dict[str, str]) –The map location for loading pytorch checkpoint, to support loading
-
safetensors_load_strategy(SafetensorsLoadStrategy | None) –Specifies the loading strategy for safetensors weights.
-
safetensors_prefetch_block_size(int) –Read size in bytes for each safetensors checkpoint file prefetch.
-
safetensors_prefetch_num_threads(int) –Number of worker threads used to prefetch safetensors checkpoint files
-
use_tqdm_on_load(bool) –Whether to enable tqdm for showing progress bar when loading model
Source code in vllm/config/load.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
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.
- "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.
- "bitsandbytes" will load the weights using bitsandbytes quantization.
- "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.
use_tqdm_on_load = True class-attribute instance-attribute ¶
Whether to enable tqdm for showing progress bar when loading model weights.
compute_hash() ¶
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.
Source code in vllm/config/load.py
MambaConfig ¶
Configuration for Mamba SSM backends.
Methods:
-
validate_backend_before–Enable parsing of the
backendenum type from string.
Attributes:
-
backend(MambaBackendEnum) –Mamba SSU backend to use.
-
enable_stochastic_rounding(bool) –Enable stochastic rounding when writing SSM state to fp16 cache.
-
stochastic_rounding_philox_rounds(int) –Number of Philox PRNG rounds for stochastic rounding random number
Source code in vllm/config/mamba.py
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.
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 type from string.
Source code in vllm/config/mamba.py
ModelConfig ¶
Configuration for the model.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
-
get_diff_sampling_param–This method returns a dictionary containing the non-default sampling
-
get_mamba_chunk_size–Returns the mamba chunk size if it exists
-
get_multimodal_config–Get the multimodal configuration of the model.
-
get_num_kv_heads–Returns the number of KV heads per GPU.
-
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–Pull model/tokenizer from Object Storage to temporary
-
try_get_generation_config–This method attempts to retrieve the non-default values of the
-
using_transformers_backend–Check if the model is using the Transformers modeling backend class.
-
validate_model_config_after–Called after post_init
Attributes:
-
allow_deprecated_quantization(bool) –Whether to allow deprecated quantization methods.
-
allowed_local_media_path(str) –Allowing API requests to read local images or videos from directories
-
allowed_media_domains(list[str] | None) –If set, only media URLs that belong to this domain can be used for
-
architecture(str) –The architecture vllm actually used.
-
attn_type(AttnTypeStr) –Determine the attention type based on model configuration.
-
code_revision(str | None) –The specific revision to use for the model code on the Hugging Face Hub.
-
config_format(str | ConfigFormat) –The format of the model config to load:
-
convert(ConvertOption) –Convert the model using adapters defined in
-
disable_cascade_attn(bool) –Disable cascade attention for V1. While cascade attention does not
-
disable_sliding_window(bool) –Whether to disable sliding window. If True, we will disable the sliding
-
dtype(ModelDType | dtype) –Data type for model weights and activations:
-
enable_cumem_allocator(bool) –Enable the custom cumem allocator to leverage advanced GPU memory
-
enable_prompt_embeds(bool) –If
True, enables passing text embeddings as inputs via the -
enable_return_routed_experts(bool) –Whether to return routed experts.
-
enable_sleep_mode(bool) –Enable sleep mode for the engine (only cuda and
-
enforce_eager(bool) –Whether to always use eager-mode PyTorch. If True, we will disable CUDA
-
generation_config(str) –The folder path to the generation config. Defaults to
"auto", the -
head_dtype(dtype) –"head" refers to the last Linear layer(s) of an LLM,
-
hf_config(PretrainedConfig) –The Hugging Face config of the model.
-
hf_config_path(str | None) –Name or path of the Hugging Face config to use. If unspecified, model
-
hf_overrides(HfOverrides) –If a dictionary, contains arguments to be forwarded to the Hugging Face
-
hf_text_config(PretrainedConfig) –The Hugging Face config of the text model (same as hf_config for text models).
-
hf_token(bool | str | None) –The token to use as HTTP bearer authorization for remote files . If
-
io_processor_plugin(str | None) –IOProcessor plugin name to load at model startup
-
is_diffusion(bool) –Detect discrete diffusion (dLLM) models from HF config.
-
is_encoder_decoder(bool) –Extract the HF encoder/decoder model flag.
-
logits_processors(list[str | type[LogitsProcessor]] | None) –One or more logits processors' fully-qualified class names or class
-
logprobs_mode(LogprobsMode) –Indicates the content returned in the logprobs and prompt_logprobs.
-
max_logprobs(int) –Maximum number of log probabilities to return when
logprobsis -
max_model_len(int) –Model context length (prompt and output). If unspecified, will be
-
model(str) –Name or path of the Hugging Face model to use. It is also used as the
-
model_impl(str | ModelImpl) –Which implementation of the model to use:
-
model_weights(str) –Original model weights path. Used when the model is pulled from object
-
multimodal_config(MultiModalConfig | None) –Configuration for multimodal model. If
None, this will be inferred -
override_attention_dtype(str | None) –Override dtype for attention
-
override_generation_config(dict[str, Any]) –Overrides or sets generation config. e.g.
{"temperature": 0.5}. If -
pooler_config(PoolerConfig | None) –Pooler config which controls the behaviour of output pooling in pooling
-
quantization(QuantizationMethods | str | None) –Method used to quantize the weights. If
None, we first check the -
quantization_config(dict[str, Any] | QuantizationConfigArgs | None) –User-facing quantization configuration. Carries per-layer-kind specs
-
renderer_num_workers(int) –Number of worker threads in the renderer thread pool. The pool is
-
revision(str | None) –The specific model version to use. It can be a branch name, a tag name,
-
runner(RunnerOption) –The type of model runner to use. Each vLLM instance only supports one
-
score_type(ScoreType) –Scoring API handles score/rerank for:
-
seed(int) –Random seed for reproducibility.
-
served_model_name(str | list[str] | None) –The model name(s) used in the API. If multiple names are provided, the
-
skip_tokenizer_init(bool) –Skip initialization of tokenizer and detokenizer. Expects valid
-
spec_target_max_model_len(int | None) –Specify the maximum length for spec decoding draft models.
-
tokenizer(str) –Name or path of the Hugging Face tokenizer to use. If unspecified, model
-
tokenizer_mode(TokenizerMode | str) –Tokenizer mode:
-
tokenizer_revision(str | None) –The specific revision to use for the tokenizer on the Hugging Face Hub.
-
trust_remote_code(bool) –Trust remote code (e.g., from HuggingFace) when downloading the model
-
use_fp64_gumbel(bool) –Whether to use FP64 (instead of FP32) random noise for Gumbel-max and
Source code in vllm/config/model.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 | |
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.
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_cascade_attn = True class-attribute instance-attribute ¶
Disable cascade attention for V1. While cascade attention does not change the mathematical correctness, disabling it could be useful for preventing potential numerical issues. This defaults to True, so users must opt in to cascade attention by setting this to False. Even when this is set to False, cascade attention will only be used when the heuristic tells that it's beneficial.
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_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_return_routed_experts = False class-attribute instance-attribute ¶
Whether to return routed experts.
enable_sleep_mode = False class-attribute instance-attribute ¶
Enable sleep mode for the engine (only cuda and hip platforms are supported).
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.
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 ¶
"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.
head_dtype currently only supports pooling models.
- The pooling model defaults to using fp32 head, you can use --hf-overrides '{"head_dtype": "model"}' to disable it.
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 = None 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.
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.
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.
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_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_attention_dtype = None class-attribute instance-attribute ¶
Override dtype for attention
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 :class:QuantizationConfigArgs. Auto-populated from the matching online shorthand when quantization is one of the values in ONLINE_QUANT_SHORTHAND_NAMES.
renderer_num_workers = 1 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.
The offline LLM entrypoint uses the synchronous renderer path and processes prompts (including multimodal preprocessing) serially, so this setting has no effect there.
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 = 0 class-attribute instance-attribute ¶
Random seed for reproducibility.
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.
spec_target_max_model_len = None class-attribute instance-attribute ¶
Specify the maximum length for spec decoding draft models.
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_commonfor Mistral models if available, otherwise it will use the "hf" tokenizer. - "hf" will use the fast tokenizer if available.
- "slow" will always use the slow tokenizer.
- "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. - 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.
_apply_dict_overrides(config, overrides) ¶
Apply dict overrides, handling both nested configs and dict values.
Source code in vllm/config/model.py
_get_transformers_backend_cls() ¶
Determine which Transformers modeling backend class will be used if model_impl is set to transformers or auto.
Source code in vllm/config/model.py
_skip_none_validation(value, handler) classmethod ¶
Skip validation if the value is None when initialisation is delayed.
Source code in vllm/config/model.py
_update_nested(target, updates) ¶
Recursively updates a config or dict with nested updates.
Source code in vllm/config/model.py
_verify_bnb_config() ¶
The current version of bitsandbytes (0.46.1) with 8-bit models does not yet support CUDA graph.
TODO Remove this when bitsandbytes supports.¶
Source code in vllm/config/model.py
compute_hash() ¶
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.
Source code in vllm/config/model.py
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.jsonifself.generation_config="path/to/generation_config/dir"
Returns:
Source code in vllm/config/model.py
get_mamba_chunk_size() ¶
Returns the mamba chunk size if it exists
Source code in vllm/config/model.py
get_multimodal_config() ¶
Get the multimodal configuration of the model.
Raises:
-
ValueError–If the model is not multimodal.
Source code in vllm/config/model.py
get_num_kv_heads(parallel_config) ¶
Returns the number of KV heads per GPU.
Source code in vllm/config/model.py
get_sliding_window() ¶
get_total_num_kv_heads() ¶
maybe_pull_model_tokenizer_for_runai(model, tokenizer) ¶
Pull model/tokenizer from Object Storage to temporary directory when needed.
Parameters:
Source code in vllm/config/model.py
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:
Source code in vllm/config/model.py
using_transformers_backend() ¶
Check if the model is using the Transformers modeling backend class.
Source code in vllm/config/model.py
validate_model_config_after() ¶
Called after post_init
Source code in vllm/config/model.py
MultiModalConfig ¶
Controls the behavior of multimodal models.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
-
get_limit_per_prompt–Get the maximum number of input items allowed per prompt
-
merge_mm_processor_kwargs–Get the keyword arguments to pass to the multi-modal processor
Attributes:
-
enable_mm_embeds(bool) –If
True, enables passing multimodal embeddings: -
interleave_mm_strings(bool) –Enable fully interleaved support for multimodal prompts, while using
-
language_model_only(bool) –If True, disables all multimodal inputs by setting all modality limits to 0.
-
limit_per_prompt(MMDummyOptions) –The maximum number of input items and options allowed per
-
media_io_kwargs(dict[str, dict[str, Any]]) –Additional args passed to process media inputs, keyed by modalities.
-
mm_encoder_attn_backend(AttentionBackendEnum | None) –Optional override for the multi-modal encoder attention backend when
-
mm_encoder_attn_dtype(Literal['fp8'] | None) –Optional dtype override for ViT encoder attention. Set to
"fp8"to -
mm_encoder_fp8_scale_path(str | None) –Path to a JSON file containing per-layer FP8 Q/K/V scales for ViT
-
mm_encoder_fp8_scale_save_margin(float) –Safety margin multiplied onto scales when auto-saving. A value > 1
-
mm_encoder_fp8_scale_save_path(str | None) –When set with dynamic FP8 scaling (
mm_encoder_attn_dtype="fp8" -
mm_encoder_only(bool) –When enabled, skips the language component of the model.
-
mm_encoder_tp_mode(MMEncoderTPMode) –Indicates how to optimize multi-modal encoder inference using tensor
-
mm_ipc_gpu_memory_gb(float) –Amount of GPU memory (in GiB) sequestered on the engine's device for
-
mm_processor_cache_gb(float) –The size (in GiB) of the multi-modal processor cache, which is used to
-
mm_processor_cache_type(MMCacheType) –Type of cache to use for the multi-modal preprocessor/mapper. If
shm, -
mm_processor_kwargs(dict[str, object] | None) –Arguments to be forwarded to the model's processor for multi-modal data,
-
mm_shm_cache_max_object_size_mb(int) –Size limit (in MiB) for each object stored in the multi-modal processor
-
mm_tensor_ipc(MMTensorIPC) –IPC (inter-process communication) method for multimodal tensors.
-
skip_mm_profiling(bool) –When enabled, skips multimodal memory profiling and only profiles with
-
video_pruning_rate(float | None) –Sets pruning rate for video pruning via Efficient Video Sampling.
Source code in vllm/config/multimodal.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
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=dict) class-attribute instance-attribute ¶
The maximum number of input items and options allowed per prompt for each modality.
Defaults to 999 for each modality.
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}}
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_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_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).
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_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_rate = Field(default=None, ge=0.0, lt=1.0) class-attribute instance-attribute ¶
Sets pruning rate for video pruning via Efficient Video Sampling. Value sits in range [0;1) and determines fraction of media tokens from each video to be pruned.
compute_hash() ¶
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.
Source code in vllm/config/multimodal.py
get_limit_per_prompt(modality) ¶
Get the maximum number of input items allowed per prompt for the given modality (backward compatible).
Source code in vllm/config/multimodal.py
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.
Source code in vllm/config/multimodal.py
ObservabilityConfig ¶
Configuration for observability - metrics and tracing.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
collect_detailed_traces(list[DetailedTraceModules] | None) –It makes sense to set this only if
--otlp-traces-endpointis set. If -
collect_model_execute_time(bool) –Whether to collect model execute time for the request.
-
collect_model_forward_time(bool) –Whether to collect model forward time for the request.
-
cudagraph_metrics(bool) –Enable CUDA graph metrics (number of padded/unpadded tokens, runtime cudagraph
-
enable_layerwise_nvtx_tracing(bool) –Enable layerwise NVTX tracing. This traces the execution of each layer or
-
enable_logging_iteration_details(bool) –Enable detailed logging of iteration details.
-
enable_mfu_metrics(bool) –Enable Model FLOPs Utilization (MFU) metrics.
-
enable_mm_processor_stats(bool) –Enable collection of timing statistics for multimodal processor operations.
-
jit_monitor_mode(Literal['warn', 'error']) –How to handle post-warmup JIT compilation events.
-
jit_monitor_verbose(bool) –Log every monitored JIT compile with runtime details. This can emit many
-
kv_cache_metrics(bool) –Enable KV cache residency metrics (lifetime, idle time, reuse gaps).
-
kv_cache_metrics_sample(float) –Sampling rate for KV cache metrics (0.0, 1.0]. Default 0.01 = 1% of blocks.
-
otlp_traces_endpoint(str | None) –Target URL to which OpenTelemetry traces will be sent.
-
show_hidden_metrics(bool) –Check if the hidden metrics should be shown.
-
show_hidden_metrics_for_version(str | None) –Enable deprecated Prometheus metrics that have been hidden since the
Source code in vllm/config/observability.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
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).
enable_layerwise_nvtx_tracing = False class-attribute instance-attribute ¶
Enable layerwise NVTX tracing. This traces the execution of each layer or module in the model and attach information such as input/output shapes to nvtx range markers. Noted that this 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 the elapsed cpu time for the iteration.
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.
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.
_validate_collect_detailed_traces(value) classmethod ¶
Handle the legacy case where users might provide a comma-separated string instead of a list of strings.
Source code in vllm/config/observability.py
compute_hash() ¶
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.
Source code in vllm/config/observability.py
OffloadConfig ¶
Configuration for model weight offloading to reduce GPU memory usage.
Methods:
-
compute_hash–Provide a hash that uniquely identifies all the offload configs.
-
validate_offload_config–Validate offload configuration constraints.
Attributes:
-
offload_backend(OffloadBackend) –The backend for weight offloading. Options:
-
prefetch(PrefetchOffloadConfig) –Parameters for prefetch offloading backend.
-
uva(UVAOffloadConfig) –Parameters for UVA offloading backend.
Source code in vllm/config/offload.py
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.
compute_hash() ¶
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.
Source code in vllm/config/offload.py
validate_offload_config() ¶
Validate offload configuration constraints.
Source code in vllm/config/offload.py
ParallelConfig ¶
Configuration for the distributed execution.
Methods:
-
compute_hash–Provide a hash that uniquely identifies all the configs
-
get_next_dp_init_port–We might need to initialize process groups in multiple
-
sync_dp_state–Combined all-reduce for DP state synchronization.
Attributes:
-
all2all_backend(All2AllBackend) –All2All backend for MoE expert parallel communication. Available options:
-
assigned_physical_gpu_ids(list[int] | None) –Mapping from vLLM-local logical GPU IDs to physical GPU IDs.
-
cp_kv_cache_interleave_size(int) –Interleave size of kv_cache storage while using DCP or PCP.
-
cpu_distributed_timeout_seconds(int | None) –Timeout (in seconds) for cpu communication groups. If None, PyTorch's
-
data_parallel_backend(DataParallelBackend) –Backend to use for data parallel, either "mp" or "ray".
-
data_parallel_external_lb(bool) –Whether to use "external" DP LB mode. Applies only to online serving
-
data_parallel_hybrid_lb(bool) –Whether to use "hybrid" DP LB mode. Applies only to online serving
-
data_parallel_index(int) –Equal to the data parallel rank but not used for torch process groups
-
data_parallel_master_ip(str) –IP of the data parallel master.
-
data_parallel_master_port(int) –Port of the data parallel master.
-
data_parallel_rank(int) –Rank of the data parallel group. The runtime check at
-
data_parallel_rank_local(int | None) –Local rank of the data parallel group, set only in SPMD mode.
-
data_parallel_rpc_port(int) –Port for data parallel messaging.
-
data_parallel_size(int) –Number of data parallel groups. MoE layers will be sharded according to
-
data_parallel_size_local(int) –Number of local data parallel groups. A value of 0 is a sentinel used by
-
dbo_decode_token_threshold(int) –The threshold for dual batch overlap for batches only containing decodes.
-
dbo_prefill_token_threshold(int) –The threshold for dual batch overlap for batches that contain one or more
-
dcp_comm_backend(DCPCommBackend) –Communication backend for Decode Context Parallel (DCP).
-
dcp_kv_cache_interleave_size(int) –Interleave size of kv_cache storage while using DCP.
-
decode_context_parallel_size(int) –Number of decode context parallel groups, because the world size does
-
disable_custom_all_reduce(bool) –Disable the custom all-reduce kernel and fall back to NCCL.
-
disable_nccl_for_dp_synchronization(bool | None) –Forces the dp synchronization logic in vllm/v1/worker/dp_utils.py
-
distributed_executor_backend(str | DistributedExecutorBackend | type[Executor] | None) –Backend to use for distributed model workers, either "ray" or "mp"
-
distributed_timeout_seconds(int | None) –Timeout in seconds for distributed operations (e.g., init_process_group).
-
enable_dbo(bool) –Enable dual batch overlap for the model executor.
-
enable_elastic_ep(bool) –Enable elastic expert parallelism with stateless NCCL groups for DP/EP.
-
enable_ep_weight_filter(bool) –Skip non-local expert weights during model loading when expert
-
enable_eplb(bool) –Enable expert parallelism load balancing for MoE layers.
-
enable_expert_parallel(bool) –Use expert parallelism instead of tensor parallelism for MoE layers.
-
eplb_config(EPLBConfig) –Expert parallelism configuration.
-
expert_placement_strategy(ExpertPlacementStrategy) –The expert placement strategy for MoE layers:
-
is_moe_model(bool | None) –Whether the deployed model is MoE (if known).
-
local_engines_only(bool) –Client manages local+remote EngineCores in pure internal LB case.
-
master_addr(str) –distributed master address for multi-node distributed
-
master_port(int) –distributed master port for multi-node distributed
-
max_parallel_loading_workers(int | None) –Maximum number of parallel loading workers when loading model
-
nnodes(int) –num of nodes for multi-node distributed
-
node_rank(int) –distributed node rank for multi-node distributed
-
numa_bind(bool) –Enable NUMA binding for GPU worker subprocesses.
-
numa_bind_cpus(list[str] | None) –Optional CPU lists to bind each GPU worker to.
-
numa_bind_nodes(list[int] | None) –NUMA node to bind each GPU worker to.
-
pipeline_parallel_size(int) –Number of pipeline parallel groups.
-
placement_group(PlacementGroup | None) –ray distributed model workers placement group.
-
prefill_context_parallel_size(int) –Number of prefill context parallel groups.
-
rank(int) –Global rank in distributed setup.
-
ray_runtime_env(RuntimeEnv | None) –Ray runtime environment to pass to distributed workers.
-
ray_workers_use_nsight(bool) –Whether to profile Ray workers with nsight, see https://docs.ray.io/en/latest/ray-observability/user-guides/profiling.html#profiling-nsight-profiler.
-
sd_worker_cls(str) –The full name of the worker class to use for speculative decoding.
-
tensor_parallel_size(int) –Number of tensor parallel groups.
-
ubatch_size(int) –Number of ubatch size.
-
worker_cls(str) –The full name of the worker class to use. If "auto", the worker class
-
worker_extension_cls(str) –The full name of the worker extension class to use. The worker extension
-
world_size(int) –world_size is TPxPP, it affects the number of workers we create.
-
world_size_across_dp(int) –world_size_across_dp is TPxPPxDP, it is the size of the world
Source code in vllm/config/parallel.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | |
_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.
all2all_backend = 'allgather_reducescatter' class-attribute instance-attribute ¶
All2All backend for MoE expert parallel communication. Available options:
- "allgather_reducescatter": All2all based on allgather and reducescatter
- "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
- "mori_low_latency": MoRI EP with InterNodeV1LL for multi-node
- "nixl_ep": Use nixl-ep kernels
- "flashinfer_nvlink_two_sided": Use flashinfer two-sided kernels for mnnvl
- "flashinfer_nvlink_one_sided": Use flashinfer high-throughput a2a kernels
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 or PCP. For total_cp_rank = pcp_rank * dcp_world_size + dcp_rank, and total_cp_world_size = pcp_world_size * dcp_world_size. store interleave_size tokens on total_cp_rank i, then store next interleave_size tokens on total_cp_rank i+1. Interleave_size=1: token-level alignment, where token i is stored on total_cp_rank i % total_cp_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.
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_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 = 29550 class-attribute instance-attribute ¶
Port for data parallel messaging.
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 parallel size and data parallel size.
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.
dcp_comm_backend = 'ag_rs' class-attribute instance-attribute ¶
Communication backend for Decode Context Parallel (DCP). - "ag_rs": AllGather + ReduceScatter (default, 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.
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.
decode_context_parallel_size = Field(default=1, ge=1) class-attribute instance-attribute ¶
Number of decode context parallel groups, because the world size does not change by dcp, it simply reuse the GPUs of TP group, and tp_size needs to be divisible by dcp_size.
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.
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). 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.
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.
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.
nnodes = Field(default=1, ge=1) class-attribute instance-attribute ¶
num of nodes for multi-node distributed inference when distributed_executor_backend is mp.
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 = False class-attribute instance-attribute ¶
Enable NUMA binding for GPU worker subprocesses.
By default, workers are pinned to their GPU's NUMA-local CPUs and memory; on PCT-capable Xeons they also auto-bind to the SKU's PCT priority cores.
numa_bind_cpus = None class-attribute instance-attribute ¶
Optional CPU lists to bind each GPU worker to.
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.
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.
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 prefill context parallel groups.
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.
sd_worker_cls = 'auto' class-attribute instance-attribute ¶
The full name of the worker class to use for speculative decoding. If "auto", the worker class will be determined based on the platform.
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.
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 ¶
world_size_across_dp is TPxPPxDP, it is the size of the world including data parallelism.
_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.
Source code in vllm/config/parallel.py
_skip_none_validation(value, handler) classmethod ¶
Skip validation if the value is None when initialisation is delayed.
Source code in vllm/config/parallel.py
compute_hash() ¶
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.
Source code in vllm/config/parallel.py
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.
Source code in vllm/config/parallel.py
sync_dp_state(dp_group, has_unfinished, pending_pause) staticmethod ¶
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:
Source code in vllm/config/parallel.py
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:
-
compute_hash–Produces a hash unique to the pass configuration.
-
flashinfer_max_size–Returns the max communication size in bytes for flashinfer
-
log_enabled_passes–Log the enabled custom fusion passes.
Attributes:
-
eliminate_noops(bool) –Eliminate no-op ops.
-
enable_qk_norm_rope_fusion(bool) –Enable fused Q/K RMSNorm + RoPE pass.
-
enable_sp(bool) –Enable sequence parallelism. Requires TP>1. Automatically disabled
-
fi_allreduce_fusion_max_size_mb(float | None) –The threshold of the communicated tensor sizes under which
-
fuse_act_padding(bool) –Fuse the custom RMSNorm + padding ops.
-
fuse_act_quant(bool) –Fuse the custom SiluMul + quant ops.
-
fuse_allreduce_rms(bool) –Enable flashinfer allreduce fusion.
-
fuse_attn_quant(bool) –Fuse the custom Attention and MLAAttention + quant ops.
-
fuse_gemm_comms(bool) –Enable async TP.
-
fuse_mla_dual_rms_norm(bool) –Fuse paired q/kv RMS norms in MLA attention.
-
fuse_norm_quant(bool) –Fuse the custom RMSNorm + quant ops.
-
fuse_rope_kvcache(bool) –Fuse the QK rope + KV cache ops.
-
fuse_rope_kvcache_cat_mla(bool) –Enable fused MLA KV cache update with RoPE.
-
rope_kvcache_fusion_max_token_num(int) –The threshold for ROCm AITER RoPE+KVCache fusion e.g. for small batch decode.
-
sp_min_token_num(int | None) –The minimum number of tokens above which vllm should use
Source code in vllm/config/compilation.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
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.
enable_sp = None class-attribute instance-attribute ¶
Enable sequence parallelism. Requires TP>1. Automatically disabled if the model's hidden_size is too small for SP to be beneficial (threshold is device-capability dependent).
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. FI_ALLREDUCE_FUSION_MAX_SIZE_MB = { 90: { 2: 64, # 64MB 4: 2, # 2MB 8: 1, # 1MB }, 100: { 2: 64, # 64MB 4: 32, # 32MB 8: 1, # 1MB }, }, where key is the 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_gemm_comms = None class-attribute instance-attribute ¶
Enable async TP.
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_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.
sp_min_token_num = None class-attribute instance-attribute ¶
The minimum number of tokens above which vllm should use sequence parallelism. Specified as an integer token count. Unspecified will fallback to default values which are compute capability and world size dependent.
_skip_none_validation(value, handler) classmethod ¶
Skip validation if the value is None when initialisation is delayed.
Source code in vllm/config/compilation.py
compute_hash() ¶
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.
Source code in vllm/config/compilation.py
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.
Source code in vllm/config/compilation.py
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.
Source code in vllm/config/compilation.py
PoolerConfig ¶
Controls the behavior of output pooling in pooling models.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
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
-
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_idin 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.
Source code in vllm/config/pooler.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
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. Defaults to False.
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.
compute_hash() ¶
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.
Source code in vllm/config/pooler.py
PrefetchOffloadConfig ¶
Configuration for prefetch-based CPU offloading.
Groups layers and uses async H2D prefetch to hide transfer latency.
Attributes:
-
offload_group_size(int) –Group every N layers together. Offload last
offload_num_in_group -
offload_num_in_group(int) –Number of layers to offload per group.
-
offload_params(set[str]) –The set of parameter name segments to target for prefetch offloading.
-
offload_prefetch_step(int) –Number of layers to prefetch ahead.
Source code in vllm/config/offload.py
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:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
active_iterations(int) –Number of active iterations for PyTorch profiler schedule.
-
delay_iterations(int) –Number of engine iterations to skip before starting profiling.
-
ignore_frontend(bool) –If
True, disables the front-end profiling of AsyncLLM when using the -
max_iterations(int) –Maximum number of engine iterations to profile after starting profiling.
-
profiler(ProfilerKind | None) –Which profiler to use. Defaults to None. Options are:
-
torch_profiler_dir(str) –Directory to save torch profiler traces. Both AsyncLLM's CPU traces and
-
torch_profiler_dump_cuda_time_total(bool) –If
True, dumps total CUDA time in torch profiler traces. Enabled by default. -
torch_profiler_record_shapes(bool) –If
True, records tensor shapes in the torch profiler. Disabled by default. -
torch_profiler_use_gzip(bool) –If
True, saves torch profiler traces in gzip format. Enabled by default -
torch_profiler_with_flops(bool) –If
True, enables FLOPS counting in the torch profiler. Disabled by default. -
torch_profiler_with_memory(bool) –If
True, enables memory profiling in the torch profiler. -
torch_profiler_with_stack(bool) –If
True, enables stack tracing in the torch profiler. Enabled by default -
wait_iterations(int) –Number of wait iterations for PyTorch profiler schedule.
-
warmup_iterations(int) –Number of warmup iterations for PyTorch profiler schedule.
Source code in vllm/config/profiler.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
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.
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.
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.
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.
compute_hash() ¶
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.
Source code in vllm/config/profiler.py
ReasoningConfig ¶
Configuration for reasoning models.
Set reasoning_start_str and reasoning_end_str to the strings that delimit the reasoning block (e.g. "<think>" and "</think>"). The corresponding token IDs are derived automatically via initialize_token_ids and are not intended to be set directly.
Methods:
-
initialize_token_ids–Initialize reasoning token IDs from strings using the tokenizer.
Attributes:
-
enabled(bool) –Returns True if reasoning is enabled (i.e. if token IDs have been
-
reasoning_end_str(str) –String that indicates the end of reasoning content.
-
reasoning_end_token_ids(list[int] | None) –Token IDs derived from
reasoning_end_str. Set automatically by -
reasoning_parser(str) –The name of the ReasoningParser to use for this model.
-
reasoning_start_str(str) –String that indicates the start of reasoning.
-
reasoning_start_token_ids(list[int] | None) –Token IDs derived from
reasoning_start_str. Set automatically by
Source code in vllm/config/reasoning.py
_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.
_reasoning_end_token_ids = field(default=None, init=False, repr=False) class-attribute instance-attribute ¶
Private backing field for reasoning_end_token_ids. Set by initialize_token_ids. Not intended to be configured directly.
_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.
reasoning_end_str = '' class-attribute instance-attribute ¶
String that indicates the end of reasoning content.
reasoning_end_token_ids property ¶
Token IDs derived from reasoning_end_str. Set automatically by initialize_token_ids. Not intended to be configured directly.
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.
Source code in vllm/config/reasoning.py
SchedulerConfig ¶
Scheduler configuration.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
-
default_factory–Factory method to create
SchedulerConfigwith default values forInitVars.
Attributes:
-
async_scheduling(bool | None) –If set to False, disable async scheduling. Async scheduling helps to
-
disable_chunked_mm_input(bool) –If set to true and chunked prefill is enabled, we do not want to
-
disable_hybrid_kv_cache_manager(bool | None) –If set to True, KV cache manager will allocate the same size of KV cache
-
enable_chunked_prefill(bool) –If True, prefill requests can be chunked based
-
encoder_cache_size(int) –Multimodal encoder cache size, only used in V1.
-
is_multimodal_model(bool) –True if the model is multimodal.
-
long_prefill_token_threshold(int) –For chunked prefill, a request is considered long if the prompt is
-
max_long_partial_prefills(int) –For chunked prefill, the maximum number of prompts longer than
-
max_num_batched_tokens(int) –Maximum number of tokens that can be processed in a single iteration.
-
max_num_encoder_input_tokens(int) –Multimodal encoder compute budget, only used in V1.
-
max_num_partial_prefills(int) –For chunked prefill, the maximum number of sequences that can be
-
max_num_scheduled_tokens(int | None) –Maximum number of tokens that the scheduler may issue in a single iteration.
-
max_num_seqs(int) –Maximum number of sequences to be processed in a single iteration.
-
policy(SchedulerPolicy) –The scheduling policy to use:
-
prefill_schedule_interval(int) –For data-parallel deployments, only admit new prefill requests
-
runner_type(RunnerType) –The runner type to launch for the model.
-
scheduler_cls(str | type[object] | None) –The scheduler class to use. "vllm.v1.core.sched.scheduler.Scheduler" is
-
scheduler_reserve_full_isl(bool) –If True, the scheduler checks whether the full input sequence length
-
stream_interval(int) –The interval (or buffer size) for streaming in terms of token length.
-
watermark(float) –Fraction of total KV cache blocks to keep free (the watermark) when
Source code in vllm/config/scheduler.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
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.
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(init=False) class-attribute instance-attribute ¶
Multimodal encoder cache size, 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.
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.
max_long_partial_prefills = Field(default=1, ge=1) class-attribute instance-attribute ¶
For chunked prefill, the maximum number of prompts longer than long_prefill_token_threshold that will be prefilled concurrently. Setting this less than max_num_partial_prefills will allow shorter prompts to jump the queue in front of longer prompts in some cases, improving latency.
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_partial_prefills = Field(default=1, ge=1) class-attribute instance-attribute ¶
For chunked prefill, the maximum number of sequences that can be partially prefilled concurrently.
max_num_scheduled_tokens = Field(default=None, ge=0) 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).
prefill_schedule_interval = Field(default=1, ge=1) class-attribute instance-attribute ¶
For data-parallel deployments, only admit new prefill requests once every N engine steps, aligned across DP ranks, to better balance per-step forward-pass times.
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.
Source code in vllm/config/scheduler.py
compute_hash() ¶
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.
Source code in vllm/config/scheduler.py
default_factory(**kwargs) staticmethod ¶
Factory method to create SchedulerConfig with default values for InitVars.
Source code in vllm/config/scheduler.py
SpeculativeConfig ¶
Configuration for speculative decoding.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
-
create_draft_parallel_config–Create a parallel config for use by the draft worker.
-
update_arch_–EagleConfig and ExtractHiddenStatesConfig update architectures, so update all
Attributes:
-
attention_backend(AttentionBackendEnum | None) –Attention backend to use for the draft model. When
None, the backend is -
code_revision(str | None) –The specific revision to use for the draft model code on Hugging Face
-
disable_padded_drafter_batch(bool) –Disable input padding for speculative decoding. If set to True,
-
draft_load_config(LoadConfig | None) –Load config for the draft model. If not specified, will use the load
-
draft_model_config(SkipValidation[ModelConfig]) –The configuration of the draft model initialized internal.
-
draft_parallel_config(SkipValidation[ParallelConfig]) –The parallel configuration for the draft model initialized internal.
-
draft_sample_method(DraftSampleMethod) –How the draft model samples tokens. 'greedy' always picks the argmax
-
draft_tensor_parallel_size(int | None) –The degree of the tensor parallelism for the draft model. Can only be 1
-
enforce_eager(bool | None) –Override the default enforce_eager from model_config
-
max_model_len(int | None) –The maximum model length of the draft model. Used when testing the
-
max_num_new_slots_for_drafting(int) –Calculate the maximum number of new slots that might be added to the batch
-
method(SpeculativeMethod | None) –The name of the speculative method to use. If users provide and set the
-
model(str | None) –The name of the draft model, eagle head, or additional weights, if
-
moe_backend(MoEBackend | None) –MoE backend to use for the draft model. When
None, the draft model -
num_speculative_tokens(int) –The number of speculative tokens, if provided. It will default to the
-
num_speculative_tokens_per_batch_size(list[tuple[int, int, int]] | None) –Batch-size schedule used to dynamically choose speculative-token count.
-
parallel_drafting(bool) –Enable parallel drafting, where all speculative tokens are generated
-
prompt_lookup_max(int | None) –Maximum size of ngram token window when using Ngram proposer, required
-
prompt_lookup_min(int | None) –Minimum size of ngram token window when using Ngram proposer, if
-
quantization(QuantizationMethods | str | None) –Quantization method that was used to quantize the draft model weights.
-
rejection_sample_method(RejectionSampleMethod) –The rejection sampling method to use. 'standard' uses probabilistic
-
revision(str | None) –The specific model version to use for the draft model. It can be a
-
suffix_decoding_max_cached_requests(int) –The maximum number of requests to cache in the global suffix tree. If
-
suffix_decoding_max_spec_factor(float) –The maximum spec factor for suffix decoding. The spec factor controls
-
suffix_decoding_max_tree_depth(int) –The maximum depth of the suffix decoding global and prompt trees. The
-
suffix_decoding_min_token_prob(float) –The minimum token probability for suffix decoding. Will only speculate
-
synthetic_acceptance_length(float | None) –Target mean acceptance length for synthetic rejection sampling, in
-
synthetic_acceptance_rates(list[float] | None) –Per-position unconditional acceptance rates for synthetic rejection
-
target_model_config(SkipValidation[ModelConfig]) –The configuration of the target model.
-
target_parallel_config(SkipValidation[ParallelConfig]) –The parallel configuration for the target model.
-
tensor_parallel_size(int | None) –Users should pass "draft_tensor_parallel_size". This parameter's purpose is to
-
use_local_argmax_reduction(bool) –Use vocab-parallel local argmax instead of all-gathering full logits
Source code in vllm/config/speculative.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | |
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 non-causal-capable backend like FLASH_ATTN).
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.
disable_padded_drafter_batch = False class-attribute instance-attribute ¶
Disable input padding for speculative decoding. If set to True, speculative input batches can contain sequences of different lengths, which may only be supported by certain attention backends. This currently only affects the EAGLE method of speculation.
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.
enforce_eager = None class-attribute instance-attribute ¶
Override the default enforce_eager from model_config
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 ¶
Calculate the maximum number of new slots that might be added to the batch when drafting.
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.
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 = False class-attribute instance-attribute ¶
Enable parallel drafting, where all speculative tokens are generated in parallel rather than sequentially. This can improve performance but requires the speculative model be trained to support parallel drafting. Only compatible with EAGLE and draft model methods.
prompt_lookup_max = Field(default=None, ge=1) class-attribute instance-attribute ¶
Maximum size of ngram token window when using Ngram proposer, required when method is set to ngram.
prompt_lookup_min = Field(default=None, ge=1) class-attribute instance-attribute ¶
Minimum size of ngram token window when using Ngram proposer, if provided. Defaults to 1.
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.
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.
suffix_decoding_max_cached_requests = 10000 class-attribute instance-attribute ¶
The maximum number of requests to cache in the global suffix tree. If exceeded, will trigger eviction in FIFO order. If set to 0, the global suffix tree is disabled and past responses are not cached (prompt trees are still used).
suffix_decoding_max_spec_factor = 1.0 class-attribute instance-attribute ¶
The maximum spec factor for suffix decoding. The spec factor controls speculation lengths based on the prefix match length: max_spec_tokens = max_spec_factor * prefix_match_length.
suffix_decoding_max_tree_depth = 24 class-attribute instance-attribute ¶
The maximum depth of the suffix decoding global and prompt trees. The tree depth limits the sum of the prefix match and speculation lengths.
suffix_decoding_min_token_prob = 0.1 class-attribute instance-attribute ¶
The minimum token probability for suffix decoding. Will only speculate tokens with estimated probability (based on frequency counts) greater than or equal to this value.
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.
_acceptance_length_to_rates(length, n) staticmethod ¶
Mean acceptance length to unconditional per-position rates, using the minimum-variance schedule.
Source code in vllm/config/speculative.py
_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.
Source code in vllm/config/speculative.py
_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).
Source code in vllm/config/speculative.py
_verify_and_get_draft_tp(target_parallel_config, speculative_draft_tensor_parallel_size, draft_hf_config) staticmethod ¶
Verifies and adjusts the tensor parallel size for a draft model specified using speculative_draft_tensor_parallel_size.
Source code in vllm/config/speculative.py
compute_hash() ¶
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.
Source code in vllm/config/speculative.py
create_draft_parallel_config(target_parallel_config, speculative_draft_tensor_parallel_size) staticmethod ¶
Create a parallel config for use by the draft worker.
This is mostly a copy of the target parallel config, except the tp_size.
Source code in vllm/config/speculative.py
update_arch_() ¶
EagleConfig and ExtractHiddenStatesConfig update architectures, so update all architectures-related fields in self.draft_model_config
Source code in vllm/config/speculative.py
SpeechToTextConfig ¶
Configuration for speech-to-text models.
Attributes:
-
max_audio_clip_s(int | None) –Maximum duration in seconds for a single audio clip without chunking.
-
min_energy_split_window_size(int | None) –Window size in samples for finding low-energy (quiet) regions to split
-
overlap_chunk_second(int) –Overlap duration in seconds between consecutive audio chunks when
-
sample_rate(float) –Sample rate (Hz) to resample input audio to. Most speech models expect
Source code in vllm/config/speech_to_text.py
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(ndarray) –Resampled audio waveform for a single chunk.
-
hotwords(str | None) –hotwords refers to a list of important words or phrases that the model
-
language(str | None) –ISO 639-1 language code (validated / auto-detected).
-
model_config(ModelConfig) –Model configuration.
-
request_prompt(str) –Optional text prompt to guide the model.
-
stt_config(SpeechToTextConfig) –Server-level speech-to-text configuration.
-
task_type(str) –"transcribe"or"translate". -
to_language(str | None) –Target language for translation (model-dependent).
Source code in vllm/config/speech_to_text.py
audio instance-attribute ¶
Resampled audio waveform for a single chunk.
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:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
backend(StructuredOutputsBackend) –Which engine will be used for structured outputs (e.g. JSON schema,
-
disable_additional_properties(bool) –If
True, theguidancebackend will not useadditionalProperties -
disable_any_whitespace(bool) –If
True, json output will always be compact without any whitespace. -
enable_in_reasoning(bool) –Whether to use structured input for reasoning.
-
reasoning_parser(str) –Select the reasoning parser depending on the model that you're using.
-
reasoning_parser_plugin(str) –Path to a dynamically reasoning parser plugin that can be dynamically
Source code in vllm/config/structured_outputs.py
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.
compute_hash() ¶
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.
Source code in vllm/config/structured_outputs.py
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(float) –The space in GiB to offload to CPU, per GPU. Default is 0, which means
-
cpu_offload_params(set[str]) –The set of parameter name segments to target for CPU offloading.
Source code in vllm/config/offload.py
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:
-
__post_init__–Verify configs are valid & consistent with each other.
-
compile_debug_dump_path–Returns a rank-aware path for dumping
-
compute_hash–WARNING: Whenever a new field is added to this config,
-
enable_trace_function_call_for_thread–Set up function tracing for the current thread,
-
validate_block_size–Validate block_size against DCP and mamba constraints.
Attributes:
-
additional_config(dict | SupportsHash) –Additional config for specified platform. Different platforms may
-
attention_config(AttentionConfig) –Attention configuration.
-
cache_config(CacheConfig) –Cache configuration.
-
compilation_config(CompilationConfig) –torch.compileand cudagraph capture configuration for the model. -
device_config(DeviceConfig) –Device configuration.
-
diffusion_config(DiffusionConfig | None) –Diffusion LLM (dLLM) configuration.
-
ec_transfer_config(ECTransferConfig | None) –The configurations for distributed EC cache transfer.
-
instance_id(str) –The ID of the vLLM instance.
-
kernel_config(KernelConfig) –Kernel configuration.
-
kv_events_config(KVEventsConfig | None) –The configurations for event publishing.
-
kv_transfer_config(KVTransferConfig | None) –The configurations for distributed KV cache transfer.
-
load_config(LoadConfig) –Load configuration.
-
lora_config(LoRAConfig | None) –LoRA configuration.
-
mamba_config(MambaConfig) –Mamba configuration.
-
model_config(ModelConfig) –Model configuration.
-
needs_dp_coordinator(bool) –Determine if the DPCoordinator process is needed.
-
observability_config(ObservabilityConfig) –Observability configuration.
-
offload_config(OffloadConfig) –Model weight offloading configuration.
-
optimization_level(OptimizationLevel) –The optimization level. These levels trade startup time cost for
-
parallel_config(ParallelConfig) –Parallel configuration.
-
performance_mode(PerformanceMode) –Performance mode for runtime behavior, 'balanced' is the default.
-
profiler_config(ProfilerConfig) –Profiling configuration.
-
quant_config(QuantizationConfig | None) –Quantization configuration.
-
reasoning_config(ReasoningConfig | None) –The configurations for reasoning model.
-
scheduler_config(SchedulerConfig) –Scheduler configuration.
-
shutdown_timeout(int) –Shutdown grace period for in-flight requests. Shutdown will be delayed for
-
speculative_config(SpeculativeConfig | None) –Speculative decoding configuration.
-
structured_outputs_config(StructuredOutputsConfig) –Structured outputs configuration.
-
weight_transfer_config(WeightTransferConfig | None) –The configurations for weight transfer during RL training.
Source code in vllm/config/vllm.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | |
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.
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_transfer_config = None class-attribute instance-attribute ¶
The configurations for distributed EC cache transfer.
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.
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.
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.
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.
Source code in vllm/config/vllm.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 | |
_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:
Source code in vllm/config/vllm.py
_get_quantization_config(model_config, load_config) staticmethod ¶
Get the quantization config.
Source code in vllm/config/vllm.py
_get_v2_model_runner_unsupported_features() ¶
Collect features not yet supported by the V2 model runner.
Source code in vllm/config/vllm.py
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 | |
_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.
Source code in vllm/config/vllm.py
_set_compile_ranges() ¶
Set the compile ranges for the compilation config.
Source code in vllm/config/vllm.py
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | |
_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).
Source code in vllm/config/vllm.py
_set_cudagraph_sizes() ¶
vLLM defines the default candidate list of batch sizes for CUDA graph capture as:
```python max_graph_size = min(max_num_seqs * 2, 512)
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.
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 512 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.
Source code in vllm/config/vllm.py
1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 | |
_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. However for some speculative decoding methods, the drafter model may insert additional slots into the batch when drafting. To account for this, we need to decrease the max_num_scheduled_tokens by an upper bound on the number of slots that can be added.
Source code in vllm/config/vllm.py
_validate_v2_model_runner() ¶
Check for features not yet supported by the V2 model runner.
Source code in vllm/config/vllm.py
_verify_kv_transfer_compat() ¶
Reject configurations that silently corrupt KV transfers.
Source code in vllm/config/vllm.py
compile_debug_dump_path() ¶
Returns a rank-aware path for dumping torch.compile debug information.
Source code in vllm/config/vllm.py
compute_hash() ¶
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.
Source code in vllm/config/vllm.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
enable_trace_function_call_for_thread() ¶
Set up function tracing for the current thread, if enabled via the VLLM_TRACE_FUNCTION environment variable.
Source code in vllm/config/vllm.py
validate_block_size() ¶
Validate block_size against DCP and mamba constraints.
Called after Platform.update_block_size_for_backend() has finalised block_size.
Source code in vllm/config/vllm.py
WeightTransferConfig ¶
Configuration for weight transfer during RL training.
Attributes:
-
backend(Literal['nccl', 'ipc'] | str) –The backend to use for weight transfer. Validated against the
Source code in vllm/config/weight_transfer.py
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) ¶
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.
Source code in vllm/config/utils.py
get_attr_docs(cls) ¶
Get any docstrings placed after attribute assignments in a class body.
https://davidism.com/mit-license/
Source code in vllm/config/utils.py
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.
Source code in vllm/config/vllm.py
replace(dataclass_instance, /, **kwargs) ¶
Like dataclasses.replace, but compatible with Pydantic dataclasses which use pydantic.fields.Field instead of dataclasses.field
Source code in vllm/config/utils.py
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.