跳转到内容

服务启动参数

xLLM 使用 gflags 管理服务启动参数。--model <PATH> 是唯一必填参数。使用 --config_json_file 时,JSON 文件中的值会覆盖命令行 flag 值。下表按 /xllm/core/framework/config 下的 Config 类分组,一个 Config 对应一节;ConfigJsonUtils 一节包含配置文件相关的通用参数。

参数名称类型默认值参数含义
config_json_filestring""JSON 配置文件路径;文件中的值会覆盖命令行 flag 值。
enable_dump_config_jsonboolfalse是否将最终生效的启动配置导出为 JSON。
dump_config_json_filestring"xllm_config.json"导出启动配置 JSON 的路径,仅在 enable_dump_config_json=true 时使用。
参数名称类型默认值参数含义
hoststring""bRPC 服务监听的主机名或 IP。
portint328010bRPC 服务监听端口。
rpc_idle_timeout_sint32-1连接在最近 rpc_idle_timeout_s 秒内无读写操作时关闭;-1 表示无限等待。
rpc_channel_timeout_msint32-1bRPC Channel 的最大等待时间,单位毫秒;-1 表示无限等待。
max_reconnect_countint3240worker 尝试连接 server 的最大重连次数。
num_threadsint328处理请求的线程数。
max_concurrent_requestsint32200实例可同时处理的最大请求数;设为 0 表示不限流。
num_request_handling_threadsint324处理输入请求的线程数。
num_response_handling_threadsint324处理响应输出的线程数。
health_check_interval_msint323000worker 健康检查间隔,单位毫秒。
参数名称类型默认值参数含义
model_idstring""Hugging Face 模型名称,非路径。
modelstring""Hugging Face 模型名称或模型路径。
backendstring""后端模型类型;llm 表示纯文本模型,vlm 表示多模态模型,dit 表示扩散模型。
taskstring"generate"模型任务类型,例如 generateembedmm_embed
devicesstring"npu:0"当前进程使用的设备,例如 npu:0npu:0,npu:1
limit_image_per_promptint324每个 prompt 允许的最大图片数量,仅用于多模态模型。
reasoning_parserstring""reasoning 交互解析器,例如 autoglm45glm47glm5qwen3qwen35deepseek-r1
tool_call_parserstring""tool-call 交互解析器,例如 autoqwen25qwen3qwen35qwen3_coderkimi_k2deepseekv3glm45glm47glm5
enable_qwen3_rerankerboolfalse是否启用 Qwen3 reranker。
enable_return_mm_full_embeddingsboolfalseVLM 模型是否返回 ViT embedding 与序列 embedding。
flashinfer_workspace_buffer_sizeint32134217728FlashInfer split-k attention 中用于保存中间 attention 结果的预留 workspace 大小,默认 128 MiB。
use_audio_in_videoboolfalse输入为视频时,是否同时解码音频和视频。
use_cpp_chat_templatebooltrue对支持的模型使用原生 C++ chat template,例如 deepseek_v32;设为 false 可回退到 Jinja 以便调试。
参数名称类型默认值参数含义
enable_manual_loaderboolfalse将 decoder layer 权重固定在 host 内存并使用异步 H2D 传输;enable_rolling_load 依赖该参数,enable_xtensor 也会隐式启用该能力。
enable_rolling_loadboolfalse启用 rolling weight load:HBM 中仅保留 N 个 decoder layer 权重槽位,并按层即时加载;需要 enable_manual_loader=true,仅 NPU 支持。
rolling_load_num_cached_layersint322enable_rolling_load=true 时 HBM 中保留的 decoder layer 权重槽位数量。
rolling_load_num_rolling_slotsint32-1decoder rolling load 使用的 rolling 槽位数量;固定槽位数为 rolling_load_num_cached_layers - rolling_load_num_rolling_slots-1 表示自动设置为 min(2, preload_count),取值需在 [-1, rolling_load_num_cached_layers] 范围内。
enable_prefetch_weightboolfalse是否启用权重预取,仅适用于 Qwen3-dense 模型;gateup 权重默认预取比例为 40%,可通过环境变量 PREFETCH_COEFFOCIENT 调整。
参数名称类型默认值参数含义
block_sizeint32128每个 KV Cache block 的 slot 数。
max_cache_sizeint640KV Cache 可使用的 GPU 显存大小;0 表示根据可用显存自动计算。
max_memory_utilizationdouble0.8模型推理可使用的 GPU 显存比例,包括模型权重和 KV Cache。
kv_cache_dtypestring"auto"KV Cache 量化数据类型;auto 表示与模型 dtype 对齐且不量化,int8 表示启用 INT8 量化,仅 MLU 后端支持。
enable_prefix_cachebooltrue是否在 block manager 中启用 prefix cache;详见 Prefix Cache
xxh3_128bits_seeduint321024XXH3 128-bit 哈希的默认 seed。
enable_xtensorboolfalse是否为模型权重启用基于物理页池的 XTensor。
phy_page_granularity_sizeint642097152单个物理页的粒度大小,单位 byte,默认 2 MiB;用于连续 KV Cache。
参数名称类型默认值参数含义
prefetch_timeoutuint320从 KV Cache Store 预取数据的超时时间。
prefetch_batch_sizeuint322从 KV Cache Store 预取并拷贝的 batch size。
layers_wise_copy_batchsuint324按层执行 H2D 拷贝的 batch 数。
host_blocks_factordouble0.0host block 系数,例如 host block num = host_blocks_factor * hbm block num
enable_kvcache_storeboolfalse是否启用 KV Cache Store。
enable_cache_uploadboolfalse是否将 cache 信息上传到 service;仅在启用 service routing 时可用。
store_protocolstring"tcp"KV Cache Store 协议,例如 tcprdma
store_master_server_addressstring""Store master service 的地址信息。
store_metadata_serverstring""KV Cache Store metadata service 的地址。
store_local_hostnamestring""KV Cache Store client 的本地主机名。
enable_control_h2d_block_numboolfalse是否控制 H2D 拷贝的 block 数。
参数名称类型默认值参数含义
enable_beam_search_kernelboolfalse是否启用 beam search kernel。
beam_widthint321Beam search 的 beam width。
enable_block_copy_kernelbooltrue(NPU/CUDA);false(其他后端)是否在支持的后端使用 block copy kernel。
enable_topk_sortedbooltrue是否启用 top-k 结果排序输出。
参数名称类型默认值参数含义
max_tokens_per_batchint3210240每个 batch 可处理的最大 token 数。
max_seqs_per_batchint321024每个 batch 可处理的最大 sequence 数。
enable_schedule_overlapboolfalse是否启用 schedule overlap(异步调度);详见 异步调度
prefill_scheduling_memory_usage_thresholddouble0.95prefill 调度时的内存使用阈值。
enable_chunked_prefillbooltrue是否启用 chunked prefill。
max_tokens_per_chunk_for_prefillint32-1prefill 阶段每个 chunk 的最大 token 数;-1 表示使用默认策略。
chunked_match_frequencyint322sequence prefix cache 匹配频率。
use_zero_evictboolfalse是否使用 ZeroEvictionScheduler;详见 Zero Evict Scheduler
max_decode_token_per_sequenceint32256ZeroEvictionScheduler 中每个 sequence 的最大 decode token 数。
priority_strategystring"fcfs"请求优先级策略,例如 fcfsprioritydeadline
use_mix_schedulerboolfalse是否使用 MixScheduler 统一处理 prefill 和 decode。
enable_online_preempt_offlinebooltrue是否允许在线请求抢占离线请求。
aggressive_coeffdouble1.0MixScheduler 紧急度判断的激进系数。
starve_thresholddouble1.0MixScheduler 的饥饿阈值系数。
enable_starve_preventbooltrue是否启用 MixScheduler 的防饥饿机制。
参数名称类型默认值参数含义
dp_sizeint321MLA attention 的 data parallel 规模。
ep_sizeint321MoE 模型的 expert parallel 规模。
cp_sizeint321DSA attention 的 context parallel 规模。
kv_split_sizeint320KV Cache split 宽度;0 表示沿用 cp_size1 表示不切分 KV,其他可整除 cp_size 的 K 表示 KV 在 K 个 rank 间分片。
prefill_kv_split_sizeint320远端 prefill 实例的 KV Cache split 宽度;decode 节点在 PD 模式下用于匹配 prefill 的逻辑 block 布局,0 表示回退到本地 cp_size
tp_sizeint641Tensor parallel 规模,仅 DiT 模型使用。
sp_sizeint641Sequence parallel 规模,仅 DiT 模型使用。
cfg_sizeint641Classifier-free guidance parallel 规模,仅 DiT 模型使用。
communication_backendstring"hccl"NPU 通信后端,例如 lcclhccl;启用 DP 时使用 hccl
enable_prefill_spboolfalse是否启用仅 prefill 阶段的 sequence parallel;支持 enable_chunked_prefill=true,但仅限纯 prefill batch(PREFILL / CHUNKED_PREFILL)。
enable_multi_stream_parallelboolfalse是否在 prefill 阶段通过双 stream 和双 micro batch 启用计算通信并行;详见 多流并行
micro_batch_numint321多流并行使用的 micro batch 数。
enable_dp_balanceboolfalse是否启用 DP 负载均衡;启用后会 shuffle 单个 DP batch 内的 sequences。
参数名称类型默认值参数含义
enable_eplbboolfalse是否启用 expert parallel load balance;详见 EPLB
redundant_experts_numint321每个 device 上的冗余 expert 数量。
eplb_update_intervalint641000EPLB 更新间隔。
eplb_update_thresholddouble0.8EPLB 更新阈值。
expert_parallel_degreeint320Expert parallel degree。
rank_tablefilestring""ATB HCCL rank table 文件。
参数名称类型默认值参数含义
master_node_addrstring"127.0.0.1:19888"多机分布式服务的 master 地址,例如 10.18.1.1:9999
xtensor_master_node_addrstring"127.0.0.1:19889"XTensor 分布式服务的 master 地址,例如 10.18.1.1:9999
nnodesint321多机节点数量。
node_rankint320当前节点 rank。
device_ipstring""KV Cache 传输使用的 device IP 地址。
etcd_addrstring""保存实例元信息的 etcd 地址。
etcd_namespacestring""xLLM etcd key 使用的可选 namespace 前缀,例如 prod-a
enable_service_routingboolfalse是否启用 xLLM service routing。
heart_beat_intervaldouble0.5心跳间隔。
etcd_ttlint323etcd key 的 TTL。
参数名称类型默认值参数含义
enable_disagg_pdboolfalse是否启用 Prefill-Decode 分离执行;详见 PD 分离
enable_pd_oocboolfalse是否在 PD 分离模式下启用在线/离线混部。
disagg_pd_portint327777PD 分离 bRPC server 的监听端口。
instance_rolestring"DEFAULT"当前实例角色,例如 DEFAULTPREFILLDECODEMIX
kv_cache_transfer_typestring"LlmDataDist"KV Cache 传输类型,例如 LlmDataDistMooncakeHCCL
kv_cache_transfer_modestring"PUSH"KV Cache 传输模式,例如 PUSHPULL
transfer_listen_portint3226000KV Cache Transfer 的监听端口。
kv_push_dst_rotatebooltruepush_kv_blocks 中按 KV-split rank 轮转遍历目标 worker,用于分散对 decode worker 的流量。
kv_push_timing_logboolfalse是否输出 push_kv_blocks 的逐 step 与逐调用耗时日志。
参数名称类型默认值参数含义
draft_modelstring""draft 模型路径;MTP 使用方式详见 MTP
draft_devicesstring"npu:0"draft 模型使用的设备,例如 npu:0npu:0,npu:1
num_speculative_tokensint320每轮 speculative decoding 生成的 speculative token 数。
speculative_algorithmstring"MTP"Speculative decoding 算法,支持 MTPEagle3Suffix
speculative_suffix_cache_max_depthint3264Suffix speculative decoding 的后缀树最大深度。
speculative_suffix_max_spec_factordouble1.0Suffix speculation 相对于匹配长度的最大 token 系数。
speculative_suffix_max_spec_offsetdouble0.0Suffix speculation 的最大 token 加性偏移。
speculative_suffix_min_token_probdouble0.1Suffix speculation 使用的最小 token 概率。
speculative_suffix_max_cached_requestsint32-1Suffix speculation 全局最大缓存请求数;-1 表示不限,0 表示禁用。
speculative_suffix_use_tree_specboolfalse是否使用 tree-based suffix speculation,而不是 path speculation。
enable_opt_validate_probsboolfalsevalidate 阶段是否直接使用 selected-only draft_probs [B,S];设为 false 时会将 selected-only cache 值恢复为 dense [B,S,V]
enable_atb_spec_kernelboolfalse是否使用 ATB speculative kernel。
参数名称类型默认值参数含义
enable_profile_step_timeboolfalse是否启用 step time profiling。
enable_profile_token_budgetboolfalse是否启用 token budget profiling。
enable_latency_aware_scheduleboolfalse是否使用预测 latency 进行 latency-aware schedule。
profile_max_prompt_lengthint322048profiling 使用的最大 prompt 长度。
max_global_ttft_msint32std::numeric_limits<int32_t>::max()全局 TTFT 阈值,单位毫秒。
max_global_tpot_msint32std::numeric_limits<int32_t>::max()全局 TPOT 阈值,单位毫秒。
enable_profile_kv_blocksbooltrueprofiling 时是否生成 KV Cache blocks。
disable_ttft_profilingboolfalse是否禁用 TTFT profiling。
enable_forward_interruptionboolfalse是否启用 forward interruption。
参数名称类型默认值参数含义
enable_graphboolfalse是否在 decode 阶段启用图执行以降低 kernel launch 开销和设备空闲时间;支持 CUDA Graph、ACL Graph(NPU)和 MLU Graph,详见 图执行
enable_graph_mode_decode_no_paddingboolfalsedecode 阶段是否按实际 num_tokens 捕获 graph,而不是按 padding 后 shape 捕获。
enable_prefill_piecewise_graphboolfalse是否在 prefill 阶段启用 piecewise CUDA graph;attention 使用 eager 模式,其他操作捕获进 CUDA graph。
enable_graph_vmm_poolbooltrue是否启用 VMM-backed CUDA graph memory pool,用于多 shape graph 的显存复用。
max_tokens_for_graph_modeint322048图执行最大 token 数;0 表示不限制。
enable_shmboolfalse是否为模型执行启用共享内存。
use_contiguous_input_bufferbooltrue是否使用连续的 device input buffer 执行模型。
input_shm_sizeuint641024输入共享内存大小,默认 1GB。
output_shm_sizeuint64128输出共享内存大小,默认 128MB。
random_seedint32-1随机数生成器 seed;-1 表示不固定 seed。
参数名称类型默认值参数含义
enable_customize_mla_kernelboolfalse是否启用自定义 MLA kernel。
npu_kernel_backendstring"AUTO"NPU kernel 后端,支持 AUTOATBTORCH
enable_intralayer_addnormboolfalse是否启用 fused intralayer addnorm ops。
参数名称类型默认值参数含义
max_requests_per_batchint321每个 batch 的最大 request 数。
dit_cache_policystring"TaylorSeer"DiT cache 策略,例如 NoneFBCacheTaylorSeerFBCacheTaylorSeerResidualCache
dit_cache_warmup_stepsint640warmup step 数量。
dit_cache_n_derivativesint643TaylorSeer 使用的 derivative 数量。
dit_cache_skip_interval_stepsint643derivative 计算的跳步间隔。
dit_cache_residual_diff_thresholddouble0.09cache reuse 的 residual difference 阈值。
dit_cache_start_stepsint645起始阶段跳过的 step 数。
dit_cache_end_stepsint645末尾阶段跳过的 step 数。
dit_cache_start_blocksint645起始阶段跳过的 block 数。
dit_cache_end_blocksint645末尾阶段跳过的 block 数。
dit_sp_communication_overlapint641sequence parallel 的通信计算 overlap 设置。
dit_debug_printboolfalse是否打印 DiT 模型 debug 信息。
dit_generation_image_area_maxint640图像生成请求允许的最大图像面积(宽 * 高);0 表示不限制。
参数名称类型默认值参数含义
enable_rec_fast_samplerbooltrue是否为 Rec pipeline 启用 RecSampler fast sampling path。
enable_rec_prefill_onlyboolfalse是否启用 Rec prefill-only 模式,不分配 decoder self-attention blocks。
enable_xattention_one_stageboolfalse是否在 Rec multi-round 模式下强制使用 xattention one-stage decode。
max_decode_roundsint320multi-step decoding 的最大 decode round 数;0 表示禁用。
enable_constrained_decodingboolfalse是否启用 constrained decoding,用预定义规则约束输出格式或结构。
output_rec_logprobsboolfalse是否输出 Rec multi-round token-aligned logprobs;启用后缺失的 per-token logprobs 会用最终 beam logprob 填充。
enable_convert_tokens_to_itemboolfalse是否在 REC/OneRec response 中将 token ids 转换为 item id。
enable_output_sku_logprobsboolfalse是否输出 REC/OneRec token-aligned logprobs tensor。
enable_extended_item_infoboolfalse是否解析并输出 REC extended item info tensors。
each_conversion_thresholdint3250每个 REC token triplet 最多输出的 item 数。
total_conversion_thresholdint321000单个 REC response 最多输出的 item 总数。
request_queue_sizeint32100000scheduler request queue 大小。
rec_worker_max_concurrencyuint321Rec worker 并行执行并发度;小于等于 1 表示禁用并发 Rec worker。