Skip to content

Additional Configuration

Additional configuration is a mechanism provided by vLLM to allow plugins to control internal behavior by themselves. VLLM Ascend uses this mechanism to make the project more flexible.

Migration Guide

Starting from PR #9064, vLLM Ascend is migrating supported environment variables to --additional-config.

Important Notice

  • Current Support: Both environment variables and --additional-config are supported during the transition period
  • Recommendation: Use --additional-config for new deployments and migrate existing configurations
  • Future Plan: Environment variables will be removed in a future release; only --additional-config will be supported

How to use

With either online mode or offline mode, users can use additional configuration. Take Qwen3 as an example:

Online mode:

vllm serve Qwen/Qwen3-8B --additional-config='{"config_key":"config_value"}'

Offline mode:

from vllm import LLM

LLM(model="Qwen/Qwen3-8B", additional_config={"config_key":"config_value"})

Configuration options

The following table lists additional configuration options available in vLLM Ascend:

Name Type Default Description
xlite_graph_config dict {} Configuration options for Xlite graph mode
finegrained_tp_config dict {} Configuration options for fine-grained tensor parallelism. See Fine-Grained Tensor Parallelism.
kv_trace dict {} Per-engine KV cache address diagnostics for Model Runner V2. enabled defaults to false; action accepts "log" (default) or "raise". See KV Trace.
ascend_compilation_config dict {} Configuration options for Ascend compilation
ascend_warmup_config dict {} Configuration options for startup warmup that overlaps weight loading
sparse_kv_offload_config dict {} (offload disabled) Sparse Decode KV offload. Enable only on D; 950 DT&950PR products are not supported. See Mooncake V2 with SFA KV Offload for the Mooncake configuration and parameter defaults.
eplb_config dict {} Ascend extensions for upstream EPLB. See Expert Parallelism Load Balancer.
scheduler_config dict {} Configuration options for Ascend scheduler extensions, including balance scheduling, recompute scheduling, DyntraLB, ShortRequestFirst, and dynamic chunked pipeline parallel.
refresh bool False Whether to refresh global Ascend configuration content. This is usually used by rlhf or UT/E2E test case.
runtime_config_path str None Path to Runtime Guard JSON config. Default: <cwd>/runtime/config/runtime_config.json. See Runtime Guard.
runtime_config_hot_reload bool False Enable hot-reload of runtime_config.json (startup-only; not a JSON field).
runtime_config dict None Startup overlay merged into runtime config defaults (detectors, dump quota, report flags).
runtime_report_dir str None Override report root directory. Default: <cwd>/runtime/report.
runtime_dump_dir str None Seed KV dump root (dump.dump_dir). Default derived from report root.
dump_config dict None Inline msprobe dump configuration. vLLM Ascend will materialize it to a temporary JSON file and pass that file to the debugger.
dump_config_path str None Configuration file path for msprobe dump (compatible legacy option).
enable_shared_expert_dp bool False Replicate shared-expert weights across TP ranks and run the shared expert with data parallelism. This option is independent of upstream MoE sequence parallelism; either feature or both can be enabled. It improves performance but consumes more memory.
enable_force_eplb bool False Force a deterministic round-robin expert routing to measure the EPLB performance ceiling. Analysis and profiling only — never enable in production. It replaces the real MoE router output, so model results and accuracy are invalid.
multistream_overlap_shared_expert bool False Whether to enable multi-stream shared expert. This option only takes effect on MoE models with shared experts.
enable_cpu_binding bool True Enables Ascend-native CPU binding on ARM servers. Set to False to disable. See CPU Binding.
pa_shape_list list [] The custom shape list of page attention ops.
enable_kv_nz bool False Whether to enable KV cache NZ layout. This option only takes effect on models using MLA (e.g., DeepSeek).
kv_pool_range_debug bool False Emit JSON audit logs for KV pool whole-key operations, per-layer ranges, and commits. Use instead of the legacy VLLM_ASCEND_KVPOOL_RANGE_DEBUG environment variable; keep disabled during normal operation to avoid per-layer logging overhead.
mc2_comm_alg str "" set dispatch/combine op's comm_alg param, only supports ""/"fullmesh"/"hierarchy"/"fullmesh_v2". "hierarchy" is supported by A2/A3/A5, and "fullmesh_v2" is only supported by A3 now. For "hierarchy", keep fused MC2 disabled (the default).
enable_prefill_mc2 bool False Whether to reserve mc2_token_capacity for prefill batches. When enabled, max_num_batched_tokens is used to calculate the mc2_token_capacity instead of the decode-only capacity. In this scenario, the recommended maximum value of max_num_batched_tokens is tp_size * 512. This is a temporary switch; once MC2 operators are complete for all scenarios, this switch will be removed and MC2 will be enabled by default.
mega_moe_max_tokens int 65536 Reference per-rank token capacity after dispatch in the fused MC2/MegaMoe path. It is passed as dispatch_ffn_combine's max_output_size and CANN MegaMoe buffer's max_recv_token_num. If a rank's actual MoE load exceeds this value, precision degradation may occur. The absolute safe upper bound is num_max_tokens_per_rank * int(self.token_dispatcher.ep_world_size) * min(num_topk, expert_per_rank), but using it directly can consume very large device memory. Tune this value based on actual expert load distribution.
msmonitor_use_daemon bool False Whether to use daemon mode for msmonitor. The legacy MSMONITOR_USE_DAEMON environment variable is no longer supported.
enable_mlapo bool True Whether to enable MLAPO (Model Layer-wise Adaptive Parallel Optimization). The legacy VLLM_ASCEND_ENABLE_MLAPO environment variable is no longer supported.
mlapo_keep_prefill_weights bool False When True, keep MLAPO prefill weights on NPU instead of freeing them on kv_consumer (decode-only D) nodes. D nodes have normal local-prefill paths (recompute / fallback / preempt) that crash when the weights are freed (issue #11882). Enable this to trade NPU memory for stability.
weight_nz_mode int 1 Weight NZ mode. 0 disables NZ, 1 enables NZ only for quantized weights, and 2 also enables NZ for BF16/FP16 weights when supported. The legacy VLLM_ASCEND_ENABLE_NZ environment variable is no longer supported.
fp8_mode str "mxfp8" How a block-wise FP8 checkpoint (quant_method: "fp8") is executed. "mxfp8" re-quantizes the weights to MXFP8, one E8M0 scale per 32 elements. "native" keeps the checkpoint's float8 weights and their 128x128 block scales for the block-wise FP8 matmul. "mxfp8" remains the default because it is currently the faster of the two; both this option and the MXFP8 implementation will be deprecated and removed once the native path is optimized. See Native FP8 checkpoints.
enable_fused_mc2 int 0 Fused MC2 configuration. 0 disables the fused path, 1 selects dispatch-FFN-combine, and 2 selects CANN MegaMoe when the model and parallel configuration support it. Supported fused modes (1, 2, and 3) fall back to 0 when the target model or MTP draft uses per-layer SwiGLU limits. On 950 DT&950PR products, SiTU models require a CANN MegaMoe wrapper exposing activation and activation_params; both SiTU parameters are bound from the MoE configuration during initialization. The legacy VLLM_ASCEND_ENABLE_FUSED_MC2 environment variable is no longer supported.
enable_transpose_kv_cache_by_block bool True Whether to enable transpose KV cache by block. The legacy VLLM_ASCEND_FUSION_OP_TRANSPOSE_KV_CACHE_BY_BLOCK environment variable is no longer supported.
enable_flashcomm1 bool False Whether to enable SP MoE. See Sequence Parallelism.
enable_pcp_o_proj_weight_sharding bool True Whether PCP shards O-projection weights across the PCP group. This option controls SFA-PCP o_proj and DSA-PCP two-stage O-projection (wo_a/wo_b). If the weight method or PCP partition does not support sharding, the option is disabled with a warning. Set it to false at server startup to disable sharding. Other attention backends do not use this option.
enable_pcp_embedding_lmhead_weight_sharding bool True Whether PCP shards embedding and LM Head weights across PCP ranks inside each TP shard. This option is enabled by default, takes effect when PCP size is greater than 1, and is incompatible with batch-sharded sampling (enable_batch_sharded_sampling) and fine-grained TP for these modules.
rejection_sampler_config dict {} Configures entropy verification for speculative decoding.
multistream_dsv4_dsa_overlap bool True Whether to enable DSA multi-stream overlap for DeepSeek V4. For PCP batches with global prefill, this option controls overlap of local Q projection with global cache preparation on nonempty query shards. Set it to false to run these operations serially.
rl_config dict {} One-click RL mode configuration. See rl_config for all fields, the two deployment modes, usage examples, and the migration guide.
combine_quant_mode int 0 Controls communication quantization for the MC2 combine operation. The default (0) lets the runtime select the mode. Set 2, 3, or 4 to override the comm_quant_mode argument to torch_npu.npu_moe_distribute_combine_v2.
expert_offload_config dict {} Single-device MoE expert offload and optional lossy DSpark expert-pool routing. See expert_offload_config.

The details of each configuration option are as follows:

expert_offload_config

Single-device expert offload keeps part of the MoE expert weights in CPU memory and loads selected experts onto the device. It requires ModelRunner V2, compatible quantized expert layers, and Ascend 950 hardware. Tensor, data, pipeline, expert, and context parallelism are not supported by this offload path.

Name Type Default Description
enabled bool false Enable expert-weight offload.
num_device_experts int or null null Required when enabled. Resident expert slots per layer; must satisfy top_k <= num_device_experts < num_experts.
protected_positions int or null null Leading protected verification positions, including the anchor. Range: 1 through num_speculative_tokens + 1. Set together with suffix_experts to enable expert-pool routing.
suffix_experts int or null null Candidates contributed by each restricted verification row, from 0 through the supported router's TopK. Each row still selects TopK experts from the shared pool.

The optional DSpark expert pool is a lossy optimization: restricting expert choices can change generated text and model accuracy. Both routing fields must be set to enable it; omitting both, or setting both to null, keeps native routing. Setting only one field, setting them with offload disabled, or enabling the pool without DSpark raises an error. The pool supports compatible sqrtsoftplus routers with the model-specific TopK, checkpoint-native DSpark, eager drafting, and fixed verification.

--additional-config '{"expert_offload_config":{"enabled":true,"num_device_experts":84,"protected_positions":2,"suffix_experts":2}}'

For P2E2, the anchor and first draft position each contribute TopK experts, while each later position contributes two candidates. Every verification row selects TopK experts. In a batch without prefill, real one-token decode requests with no scheduled drafts also contribute their TopK experts and use the pool computation. Padding rows never contribute. Any batch containing prefill uses native routing for the whole batch, since offload already loads all experts for prefill. Mixed or short verification retains the eager fallback; supported uniform verification batches can replay a full decode graph. Draft-model execution, profiling, and incompatible routers use native routing.

For the algorithm, input constraints, and tests, see the expert-pool operator document.

runtime_guard

Runtime Guard provides online anomaly detection, structured incident reports, and optional native KV cache dump. See the Runtime Guard for usage and the runtime_config reference for JSON fields.

Name Type Default Description
runtime_config_path str None Path to runtime_config.json. When omitted, vLLM Ascend uses <cwd>/runtime/config/runtime_config.json (created with defaults on first start).
runtime_config_hot_reload bool False Enable hot-reload (startup-only; not a JSON field). false = static config after startup.
runtime_config dict None Startup overlay: defaults ← runtime_config. Bootstrap overwrites the JSON file with this effective config. Hot-reload re-reads the JSON file only.
runtime_report_dir str None Report and KV dump root. Default <cwd>/runtime/report.
runtime_dump_dir str None Seed dump.dump_dir at startup; JSON hot-reload of dump.dump_dir wins afterwards.

Example (online):

vllm serve Qwen/Qwen3-8B --additional-config '{
  "runtime_config_path": "/data/runtime/config/runtime_config.json",
  "runtime_config_hot_reload": true,
  "runtime_config": {
    "detector": {
      "token_repeat": { "enabled": true, "on_trigger": ["report", "dump_kv"] }
    },
    "dump": { "auto_max_times": 3 }
  }
}'

Design / ops (analysis branch): docs/source/developer_guide/Design_Documents/runtime_guard_{design,ops}.md.

xlite_graph_config

Name Type Default Description
enabled bool False Whether to enable Xlite graph mode. See Using XliteGraph for the supported models, the decode-only vs. full-mode distinction, and examples.
full_mode bool False Token budget sizing for the xlite runtime. Batches are routed by token count: those within the budget run on the xlite runtime, larger ones fall back to the runnable under ACLGraph. By default (False), the budget is sized for decode steps (max_num_seqs × (1 + num_speculative_tokens)), so prefill and large mixed batches typically fall back. When True, the budget is max_num_batched_tokens, so xlite handles prefill and decode alike, ACLGraph capture is not used, and --enforce-eager is recommended (unless speculative decoding is configured, etc.). Since v0.28.0, routing is by token count instead of the batch attention state.

finegrained_tp_config

Name Type Default Description
oproj_tensor_parallel_size int 1 The custom tensor parallel size of o_proj.
mlp_tensor_parallel_size int 1 The custom tensor parallel size of mlp.
lmhead_tensor_parallel_size int 1 The custom tensor parallel size of lm_head.
embedding_tensor_parallel_size int 1 The custom tensor parallel size of embedding.
shared_expert_tensor_parallel_size int 1 Independent shared-expert TP along DP. Requires graph-dispatched PD decode with global TP=PCP=DCP=PP=1. See shared-expert TP.
qkv_iproj_tensor_parallel_size int 1 The custom tensor parallel size of QKV input projections. See QKV IProj preconditions.
gproj_tensor_parallel_size int 1 Independent Kimi full-rank output-gate projection TP. Requires the Kimi graph-decode conditions in QKV IProj preconditions.

ascend_compilation_config

Name Type Default Description
enable_npugraph_ex bool True Whether to enable npugraph_ex backend.
enable_static_kernel bool False Whether to enable static kernel. Suitable for scenarios where shape changes are minimal and some time is available for static kernel compilation. Works under both full-graph and piecewise cudagraph modes.
enable_super_kernel bool Inherits enable_static_kernel Whether to enable Super Kernel optimization. When omitted, it follows enable_static_kernel; set it explicitly to override that behavior. Super Kernel requires static kernel.
fuse_norm_quant bool True Whether to enable fuse_norm_quant pass.
fuse_qknorm_rope bool True Whether to enable fuse_qknorm_rope pass. If Triton is not in the environment, set it to False.
fuse_muls_add bool True Whether to enable fuse_muls_add pass.

ascend_warmup_config

Both warmups run on a background thread during weight loading. The worker waits for them at the end of model loading, before memory profiling and KV cache allocation.

Name Type Default Description
enable_early_kernel_warmup bool False Compile the rejection sampler, penalty, and RMS norm Triton warmup kernels while weights load, so the regular kernel warmup hits the Triton cache.
enable_early_nz_warmup bool False Pay the one-time lazy initialization of the first NZ format cast while weights load. Independent of the quantization scheme.

eplb_config

Accepts load_collection_phase, mode, expert_placement_path, and stair_config. Configure upstream EPLB through --enable-eplb and --eplb-config. Ascend uses the STAIR policy by default and moves expert weights asynchronously over HIXL when it is available on every EPLB rank, falling back to Gloo CPU staging otherwise. Select default or stair only through the upstream --eplb-config.policy option. See the EPLB tuning suggestions table for the advanced STAIR fields and their defaults.

Name Type Default Description
load_collection_phase str "all" Select "all", "prefill", or "decode" load submission. Only effective with the STAIR policy; a value other than "all" requires --enable-eplb. Any batch containing a prefill request is classified entirely as prefill.
mode str "dynamic" Select "dynamic" or "static". "dynamic" runs runtime load collection and asynchronous expert rearrangement; "static" loads expert weights directly according to a version: 1 placement snapshot from expert_placement_path without expert rearrangement, skipping runtime load recording unless log_balancedness=true (requires --enable-eplb and expert_placement_path).
expert_placement_path str None JSON file path on global rank 0's host for expert placement snapshots. When mode="dynamic", committed placements are atomically exported whenever a rearranged layout achieves a new lowest observed whole-model peak-to-mean rank-load ratio before the next rearrangement (requires one EP group per PP stage covering all worker ranks). When mode="static", required input snapshot path. Requires --enable-eplb and elastic EP disabled.
stair_config dict {} Advanced STAIR policy tuning. See the EPLB tuning suggestions table for all fields, defaults, and ranges.

scheduler_config

The legacy top-level enable_balance_scheduling, recompute_scheduler_enable, short_request_first_config keys remain supported during the migration period, but are deprecated. If both formats provide the same field, the value in scheduler_config takes precedence.

Balance scheduling deprecated in v0.33.0

Balance scheduling is deprecated as of v0.33.0 and is planned for removal in a future release. Enabling it through either configuration format still activates the feature and emits a startup warning. Moving an enabled value from the legacy key to scheduler_config does not remove the feature deprecation. See RFC #23229.

To migrate, merge the following setting into your existing --additional-config object and remove the legacy top-level enable_balance_scheduling key:

{"scheduler_config": {"enable_balance_scheduling": false}}

This uses the normal scheduler path without the global admission gate. You can also remove both forms of the option, since the default is false.

Name Type Default Description
enable_balance_scheduling bool False Deprecated as of v0.33.0; planned for removal in a future release. Enabling balance scheduling emits a startup warning; keep false to use the normal scheduler path. See RFC #23229. The legacy VLLM_ASCEND_BALANCE_SCHEDULING environment variable is no longer supported.
recompute_scheduler_enable bool False Whether to enable the recompute scheduler. Only valid on PD-disaggregated D nodes (kv_role is kv_consumer). Do not enable on P nodes or in PD-mixed mode (no kv_transfer_config, kv_role is kv_producer, or kv_role is kv_both); startup will fail with a clear error.
short_request_first_config dict {} Configuration options for ShortRequestFirst prefill scheduling on FCFS synchronous or asynchronous, PD-prefill (P), or PD-mixed nodes.
batch_job_sched_config dict {} Configuration options for the batch-job-aware scheduler. See Batch-Job-Aware Scheduler for details.
dyntra_lb_config dict {} Configuration options for DyntraLB load balancing on PD-disaggregated decode nodes.

scheduler_config.dyntra_lb_config

DyntraLB balances decode requests across data-parallel ranks. It is supported only on PD-disaggregated decode nodes (kv_role="kv_consumer") with data_parallel_size > 1. dyntra_lb_config.enabled and recompute_scheduler_enable are independent sibling settings; enabling both selects the combined DyntraLB recompute scheduler. For deployment requirements, tuning, and diagnostics, see the DyntraLB guide.

Name Type Default Description
enabled bool False Enable DyntraLB and select a DyntraLB-aware scheduler.
mode str "dynamic" Use "static" or "dynamic" activation.
start_step int 250 First completed engine-step snapshot allowed to generate a plan.
end_step int -1 Exclusive final snapshot step; -1 means no upper bound.
bubble_threshold float 5.0 Minimum maximum-to-average rank-load difference required to modify scheduling. Values greater than or equal to 1 are KV-cache blocks; values below 1 are normalized ratios.
long_req_block_threshold int 700 In dynamic mode, a newly added request above this block count activates balancing. The default threshold corresponds to approximately 89,600 tokens when block_size=128.
dynamic_max_step int 256 Stop dynamic balancing after this many active steps without another newly added long request.
enable_diagnostics bool False Enable verbose logs for feature validation and debugging only. It is disabled by default and should remain disabled in production.

rejection_sampler_config

Enable Entropy Verify with enable_entropy_verify=true and speculative_config.rejection_sample_method="standard". Entropy Verify and upstream "block" verification are mutually exclusive. See Block Verify and Entropy Verify for usage and sampling semantics.

Note: Entropy verify improves speculative decoding performance (higher acceptance rate, lower latency) at the cost of reduced sampling precision. A larger posterior_alpha makes the adjustment more aggressive — it further lowers the acceptance threshold for high-entropy tokens, improving throughput but degrading output quality. Users should tune these parameters based on their specific model weights and application scenario to find the right trade-off between performance and precision.

Setting the legacy enable_block_verify flag to true fails at startup. To use block verification, set speculative_config.rejection_sample_method="block" and leave entropy verification disabled.

Name Type Default Description
enable_entropy_verify bool False Whether to enable entropy verify mode. Entropy verify adjusts the acceptance threshold based on the entropy of the target distribution — higher entropy (uncertain) tokens get a lower threshold (easier to accept), while lower entropy (confident) tokens get a stricter threshold.
posterior_threshold float 0.95 Upper bound for the entropy-adjusted acceptance threshold. Must be in (0, 1]. The effective threshold is min(exp(-entropy * posterior_alpha), posterior_threshold).
posterior_alpha float 0.4 Scaling factor for entropy in the threshold computation. Must be >= 0. Higher values make the threshold more sensitive to entropy — high-entropy tokens become much easier to accept, improving performance but reducing precision.

scheduler_config.short_request_first_config

ShortRequestFirst is a waiting-queue policy for FCFS synchronous or asynchronous scheduling on prefill and PD-mixed paths. It can be combined with profiling-chunk scheduling, but it does not support batch-job-aware or PD-disaggregated D-node scheduling. See ShortRequestFirst Prefill Scheduling for usage, behavior, and tuning guidance.

Name Type Default Description
enabled bool False Whether to enable ShortRequestFirst scheduling.
threshold int 256 Prompt-length threshold (tokens). Requests with num_prompt_tokens <= threshold are treated as short prefills and prioritized over long prefills.
long_max_wait_ms float 0.0 Maximum time a long prefill may wait behind short prefills before it can be promoted ahead of them. 0 disables long-request promotion and keeps strict short-request priority.

scheduler_config.batch_job_sched_config

Name Type Default Description
enabled bool False Enable the batch-job-aware scheduler.
max_jobs int 20 Maximum number of tracked jobs. 0 means unlimited.
reserve_margin_blocks int 2 Extra block margin added to the KV cache reserve as safety buffer.
reserve_max_blocks int 8 Maximum number of blocks that can be reserved.
low_available_tokens_threshold int 4096 Threshold for prioritising long vs short decode jobs. When available tokens > threshold, long decode jobs are prioritised; when ≤ threshold, short decode jobs are prioritised.
short_decode_token_threshold int 32 Threshold for classifying a job as "short decode".

rl_config

rl_config is a one-click RL mode switch. When enabled is true, it refreshes the global Ascend configuration on every initialization, forces AscendConfig.weight_nz_mode=0, sets VLLM_SERVER_DEV_MODE=1, and removes the expandable_segments entry from PYTORCH_NPU_ALLOC_CONF with an informational log. These fixed RL behaviors are not configurable as rl_config sub-fields. When enabled is false, all other sub-fields are ignored.

When RL mode is enabled, its fixed NZ setting takes precedence over the top-level weight_nz_mode configuration. VLLM_BATCH_INVARIANT=1 remains enabled when rl_config.enable_batch_invariant is false.

Name Type Default Description
enabled bool False Master switch for RL mode. When true, all RL best-practice defaults below are applied.
sleep_mode_extra_cleanup bool False Same-device mode. Enables HCCL process-group release + ACL graph workspace cleanup during sleep, returning more NPU memory to the trainer at the cost of increased wakeup latency. This option is available only under rl_config; the former top-level enable_sleep_mode_extra_cleanup key has been removed.
enable_training_consistency bool False Both modes. Enables the FA3 attention backend used for training-inference consistency. Requires the flash_attn_npu_v3 package and does not implicitly enable batch invariance.
enable_batch_invariant bool False Both modes. Provides an additional way to enable batch-invariant deterministic computation: when true, sets VLLM_BATCH_INVARIANT=1 before workers are started. Worker-side batch-invariant initialization then sets HCCL_DETERMINISTIC=strict and LCCL_DETERMINISTIC=1. When false, an existing VLLM_BATCH_INVARIANT environment setting is preserved. Requires building vllm-ascend from source with COMPILE_CUSTOM_KERNELS=1; RL mode already forces weight_nz_mode=0.

Deployment modes

  • Same-device mode (sleep/wake + IPC weight transfer): the inference engine and trainer share the same NPU card. Use enable_sleep_mode=True and optionally sleep_mode_extra_cleanup=True for extra memory.
  • Cross-device mode (pause/resume + HCCL weight transfer): the inference engine and trainer use different NPU cards. Use --weight-transfer-config '{"backend": "nccl"}'.

Example (online, same-device):

vllm serve DeepSeek-V4 \
    --enable-sleep-mode \
    --enable-return-routed-experts \
    --weight-transfer-config '{"backend": "ipc"}' \
    --additional-config '{"rl_config": {"enabled": true, "enable_training_consistency": true, "enable_batch_invariant": true, "sleep_mode_extra_cleanup": true}}'

Example (online, cross-device):

vllm serve DeepSeek-V4 \
    --weight-transfer-config '{"backend": "nccl"}' \
    --additional-config '{"rl_config": {"enabled": true}}'

Example (offline):

from vllm import LLM

llm = LLM(
    model="DeepSeek-V4",
    enable_sleep_mode=True,  # same-device mode only
    additional_config={
        "rl_config": {
            "enabled": True,
            "enable_training_consistency": True,
            "enable_batch_invariant": True,
        },
    },
)

Migration guide

Before After
export VLLM_ASCEND_ENABLE_NZ=0 "rl_config": {"enabled": true}
export VLLM_SERVER_DEV_MODE=1 "rl_config": {"enabled": true}
export VLLM_BATCH_INVARIANT=1 "rl_config": {"enabled": true, "enable_batch_invariant": true}
--attention-backend FLASH_ATTN for FA3 consistency mode "rl_config": {"enabled": true, "enable_training_consistency": true}
top-level "weight_nz_mode": 0 for RL "rl_config": {"enabled": true}
top-level "enable_sleep_mode_extra_cleanup": true "rl_config": {"enabled": true, "sleep_mode_extra_cleanup": true}

Example

An example of additional configuration is as follows:

{
    "finegrained_tp_config": {
        "oproj_tensor_parallel_size": 8,
        "mlp_tensor_parallel_size": 8,
        "lmhead_tensor_parallel_size": 8,
        "embedding_tensor_parallel_size": 8,
    },
    "enable_kv_nz": False,
    "multistream_overlap_shared_expert": True,
    "rejection_sampler_config": {
        "enable_entropy_verify": True,
        "posterior_threshold": 0.95,
        "posterior_alpha": 0.4,
    },
    "refresh": False
}

KV pipeline parallelism (KVPP)

Set enable_kvpp: true in --additional-config to distribute persistent KV-cache layers across TP and PCP ranks within the same DP replica and PP stage. The group size is TP × PCP: TP4 + PCP2 uses eight ranks, and TP1 + PCP2 also enables KVPP. DP replicas and PP stages use separate groups.

KVPP supports non-hybrid MLA/SFA models with eager execution or PIECEWISE graphs. Full graph modes and DCP are not supported. For PIECEWISE, set --compilation-config '{"cudagraph_mode":"PIECEWISE"}'; for eager execution, use --enforce-eager instead.

KVPP can be combined with MooncakeConnectorV2 for P/D disaggregation and AscendStoreConnector for KV pooling under the connector-specific restrictions in the KVPP guide. Enable KVPP only on the prefill node for P/D disaggregation. MultiConnector can combine these connectors; each child must satisfy its own type and role requirements.

PCP gathers prefill KV before cache writes. KVPP layer broadcasts restore prior-forward cache contents before attention; the broadcast decision uses the global scheduled batch rather than PCP-local segment offsets.

Quantized all-reduce

Quantized communication is lossy and may reduce model accuracy; it is not a lossless speedup. The feature is disabled by default. If accuracy degradation is unacceptable, explicitly set quantized_all_reduce_config.enable=false or omit quantized_all_reduce_config from --additional-config on every worker.

Configure quantized_all_reduce_config to enable quantized communication for large BF16 inputs. A2 supports INT8; 950DT Products support INT8 and MXFP8. A3 is unsupported.

Parameter Valid values and default Recommendation
enable true or false; default false Set true to enable quantized all-reduce.
quant_dtype "int8" or "mxfp8"; defaults to "int8" on A2 and "mxfp8" on 950DT Products Use INT8 on A2 and MXFP8 on 950DT Products. Users of 950DT Products can explicitly select "int8".
min_numel Positive integer; default 16777216 Start with 16777216 (32 MiB BF16) for both INT8 and MXFP8. If enabling quantized communication degrades performance, raise it to 41943040 (80 MiB) or 83886080 (160 MiB) and compare again.

The threshold counts elements in each rank's original full BF16 tensor. Quantized communication requires numel >= min_numel. Use the same configuration on every worker.

Supported configurations

  • INT8: TP=2 to 8; BF16 inputs with at least two dimensions and a last dimension of at least 64.
  • MXFP8: TP=2/4/8; BF16 inputs with at least two dimensions, a last dimension divisible by 64, and a flattened row count divisible by the communication group size.
  • TP=1 bypasses communication. Inputs outside the supported tensor conditions use ordinary all-reduce.
  • MXFP8 requires matching torch_npu/CANN versions providing torch_npu.npu_dynamic_mx_quant and torch_npu.npu_anti_mx_quant.

INT8 example

{
    "quantized_all_reduce_config": {
        "enable": true,
        "quant_dtype": "int8",
        "min_numel": 16777216
    }
}

MXFP8 example (950DT Products)

Omitting quant_dtype selects MXFP8 on 950DT Products:

{
    "quantized_all_reduce_config": {
        "enable": true,
        "min_numel": 16777216
    }
}

GDN internal prefill checkpoints

Enable with --additional-config '{"gdn_internal_prefill_checkpoints": true}'. The option remains disabled by default pending numerical and performance qualification of the alternate prefill recurrence on supported NPUs. Requires prefix caching in align mode and vLLM with #60050. The optimization is experimental. Eligible GDN layers require BF16, K=V=128, PCP=1 and no ubatching. The upstream all-layer capability check preserves split prefill when another recurrent layer cannot export checkpoints. KV transfer configurations and legacy EAGLE/MTP block dropping without lookahead hashes fall back to existing prefill scheduling: the scheduler and worker cannot safely assume the same internal checkpoint boundary in these modes.

Checkpoint-bearing prefill uses the existing Triton recurrence instead of the AscendC FwdH implementation to export only selected FP32 chunk-start states. Convolution history and recurrent state are written through the shared upstream checkpoint exporter. Enabled layers use the same Triton recurrence for cold prefills and cache-hit tails, including tails without a new checkpoint. At an exported boundary, the cold FP32 accumulator is rounded to the configured SSM cache dtype before continuing, matching the state restored by a cache hit. Decode is unchanged. This backend change needs numerical and performance qualification; skipping a model forward does not guarantee a net speedup. A persistent FP32 scratch buffer is allocated during profiling, of size max_num_seqs * local_value_heads * 128 * 128 * 4 bytes. Eligible layers with the same VllmConfig, device and state shape share it; ubatching is excluded. Checkpoint export retains a view of the pre-convolution input; the pinned FLA convolution allocates its output separately. Small prefix match units can increase checkpoint traffic.

Validate correctness, quality and performance on the deployment hardware before deploying in production.