Skip to content

Backend selection ​

Use this reference to select attention, mixture-of-experts (MoE), communication, and sampling kernels.

Set backend choices explicitly in production. Explicit selections keep production behavior stable and make benchmark comparisons and regressions easier to interpret. auto is useful for bring-up.

Backend parameters ​

The following table lists the backend selection parameters and their purposes:

ParameterPurpose
--attention-backendAttention kernel backend. Common values include mha, fa3, fa4, triton, flashinfer, trtllm_mla, and tokenspeed_mla. Names are checked against the backend registry at startup, after plugins load, so an installed plugin's backends are accepted too. On SM103 (B300/GB300), fa4 ranks below every other attention kernel: naming it here or in --drafter-attention-backend selects it, and the default selection is unchanged.
--drafter-attention-backendAttention backend for the speculative decoding drafter model; accepts the same names as --attention-backend.
--enable-qsa-prefill-bf16-scratchOff by default. Optimizes pure target QSA prefills of 2048 to --chunked-prefill-size rows with --kv-cache-dtype fp8_e4m3 (or fp8) on SM100 to SM107. On SM107 with 16 or 24 query heads and two KV heads per rank, grouped prefill reads the FP8 cache directly and reserves only the attention output. Other supported head layouts and GPUs reserve BF16 scratch from the KV budget for one context plus one chunk and use it when the context fits and spans at most 128 cache tokens per query row. Decode, verify, drafts and mixed batches keep the ordinary FP8 path. The decode role reserves no scratch. Part of the L3 storage identity when enabled.
--enable-ple-hot-cacheCache rows from offloaded PLE tables in GPU memory. Off by default. Requires a Qwen4-Exp target with PLE layers and PLE offloading. Unsupported targets and cache geometry fail at startup. See Cache PLE table rows in HBM for eligible formats, lookup sizes, and memory usage.
--qwen4-exp-flat-kv / --no-qwen4-exp-flat-kvQwen4-Exp target and draft KV, GDN, PLE, and QSA share one physical plane per pipeline stage. All GDN layers use one state group. PLE and QSA retain their own groups. Full-history tables translate scheduler blocks to contiguous atom pages. State and recent windows retain explicit strides. Requires uniform per-view K/V heads and excludes MXFP8 KV. On by default. Use --no-qwen4-exp-flat-kv for the plane-based layout. L3 identity follows the actual cache layout.
--moe-backendMoE backend.
--moe-cutlass-fused-finalize / --no-moe-cutlass-fused-finalizeGEMM2 atomic expert combine for unquantized FP16/BF16 MoE on flashinfer_cutlass, for both target and draft models. On by default and forced off by --numerics rl-bitwise. The fused reduction order is nondeterministic.
--moe-mxfp4-fp8-activationOpt-in: run MXFP4 routed experts with FP8 activations. On Hopper this is the FlashInfer cutlass W4A8 MoE (faster than the default W4A16 kernel, a few percent of extra error on expert outputs). Applies to every MXFP4 expert layer, target and draft; startup fails where the selected MoE backend has no FP8-activation kernel for a layer, when a model's routed experts are not MXFP4, when the model pins another activation precision (Kimi-K3 on Hopper Marlin), or when the layer's SwiGLU is unclamped (the W4A8 FC2 scale relies on the clamp).
--draft-moe-backendMoE backend for the speculative decoding draft model.
--all2all-backendMoE all-to-all backend.
--deepep-modeDeepEP mode: auto, normal, or low_latency. auto uses low_latency for decode batches and normal for prefill batches. normal reads its per-expert receive counts on the host, so it forces eager execution and disables CUDA graphs.
--sampling-backendSampling backend: greedy, flashinfer, flashinfer_full, triton, triton_full, ascend_full, or sonic (vendored sonic-sampler kernels: one fused Triton pipeline per step; a request with no top_k, top_p, or min_p samples its whole vocabulary (each vocabulary block keeps its best logit plus the request's Gumbel noise), the others select among the top-128 candidates; bf16 logits ranked at bf16 resolution, fp32 logits sampled exactly; under TP with a vocab-parallel LM head each rank selects its vocabulary shard's top-128 and only those are gathered, instead of whole logit rows; kernel configs from a table measured on Blackwell, no startup tuning; see the --sampling-backend help for its memory cost).
--disable-deepseek-v41-token-blacklistAllow DeepSeek V4.1 to generate BOS, PAD, and image control/placeholder token IDs 0, 2, 129262..129264; these are masked by default.

LongCat-Flash MoE requirements ​

LongCat-Flash computes top-k routing in the model to handle its zero experts. Its MoE layers require a backend that accepts precomputed expert IDs and weights, and request swiglu for their gated SiLU activation. These requirements apply to both unquantized and block-FP8 expert layers, including when selecting --moe-backend flashinfer_trtllm on Blackwell.

A LongCat layer runs two dense MLPs and one MoE off the same attention output. Its rows follow the dense comm pattern. When the MoE pattern differs (attention TP equal to the dense TP but not to the MoE TP x EP width, as under attention DP with --enable-expert-parallel), the layer re-gathers the MoE output into the dense layout. TokenSpeed rejects --enable-allreduce-fusion for that layout.

Data-parallel sampling ​

When --dp-sampling is enabled, the logits processor owns the per-forward logits layout decision and carries the resulting plan to the sampling backend with the logits output.

TokenSpeed documentation