Skip to content

vllm.config.lora

Classes:

LoRAConfig

Configuration for LoRA.

Methods:

Attributes:

default_mm_loras = None class-attribute instance-attribute

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

enable_embedding_modules = False class-attribute instance-attribute

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

enable_mixed_moe_lora_format = False class-attribute instance-attribute

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

enable_moe_shared_loras = False class-attribute instance-attribute

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

enable_tower_connector_lora = False class-attribute instance-attribute

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

fully_sharded_loras = False class-attribute instance-attribute

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

lora_dtype = 'auto' class-attribute instance-attribute

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

max_cpu_loras = None class-attribute instance-attribute

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

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

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

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

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

max_lora_rank = 16 class-attribute instance-attribute

Max LoRA rank.

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

Max number of LoRAs in a single batch.

specialize_active_lora = False class-attribute instance-attribute

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

split_k_reduction = 'atomic' class-attribute instance-attribute

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

target_modules = None class-attribute instance-attribute

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

compile_factors()

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

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

verify_with_kernel_config(kernel_config)

Reject MegaMoE backends, which do not support LoRA.