Four-GPU DeepSeek-V4.1-Flash-1017 Engineering Guide: 373 tok/s Code, 454 tok/s 1M Decode, 6×1M Concurrency & Pitfalls on 4× RTX PRO 6000
Running DeepSeek-V4.1-Flash-1017 with a full 1,048,576-token context window on 4 × NVIDIA RTX PRO 6000 Blackwell Server Edition 96 GB (384 GB total VRAM) is a rewarding systems challenge. Out of the box, PCIe peer-to-peer access often fails under default Linux IOMMU settings, naive environment flags can silently bypass W4A8 fused MoE kernels, and multi-threaded prefill pipelines can trigger severe CPython GIL stalls inside a single PP=1 worker process.
This engineering playbook shares the exact, reproducible path KINGSING used to take four RTX PRO 6000 Blackwell GPUs from initial bring-up (255.7 tok/s code, 222.55 s 1M cold prefill) to our promoted Speed10 production build: 373.5 tok/s single-stream code generation (T=1.0), 454.1 tok/s sustained decode at 1M context, 9.17 s / 62.01 s cold prefill (163K / 1M), 6×1M simultaneous resident sessions (439.2 tok/s, zero preemptions), 10×500K simultaneous sessions (637.4 tok/s), and 8×1M cold burst overflow queueing with zero OOMs. We also document all 9 historical dead ends and regressions we measured so fellow four-GPU operators can skip straight to a verified configuration.
Every numerical precision guardrail remains intact: W4A8 MoE experts (b12x), fp8_ds_mla KV cache at 11.00 GiB per GPU (5,238,588 startup tokens, max_num_seqs=16), FP8 Lightning Indexer, DSpark dynamic K=5/3, BF16 global dtype, zero FP4 KV conversion and zero GPU overclocking. All measurements evaluate mrfakename/DeepSeek-V4.1-Flash-1017-abliterated (revision 517efab9ccfef7f714dbd7d679f181a86f43ccf9); they are not new benchmarks of the unmodified official checkpoint, and refusal rates were not evaluated.
1Host & OS Foundation: Three Prerequisites Before Tuning vLLM
Before touching inference flags, three host-level steps decide whether a four-GPU PCIe 5.0 server runs at peak speed or hits silent bottlenecks:
1. Unlock PCIe P2P (iommu=pt) 12/12 Links
On stock Linux boot parameters, our CUDA peer-access test failed across 12 of 12 GPU-to-GPU directions. Adding iommu=pt to GRUB and rebooting immediately resolved 12/12 directions with zero errors, unlocking FlashInfer PCIe IPC and Moet P2P AllReduce/AllGather.
2. Pin All 4 GPUs to NUMA 0 Zero UPI Hops
Keep all four GPUs under one CPU socket and bind both container CPUs (--cpuset-cpus=0-47,96-143) and vLLM workers (--numa-bind-nodes 0 0 0 0). The ~189 GiB pinned THP Engram tables sit in local Socket 0 DDR5 with zero cross-socket UPI hops and zero pipeline bubbles.
3. Enforce MemorySwapMax=0 Zero Swap
Cap the serving container at 238 GiB RAM and explicitly enforce memory.swap.max=0 at the systemd cgroup level (re-verified after daemon reloads). Preventing Engram memory from ever paging out eliminates catastrophic tail-latency stalls.
TP=4, PP=1 + single-NUMA CPU Engram offload topology on GPUs 0–3 (NUMA 0): all 40 layers + DSpark K5/3 in one process with PREFILL_PIPE=0, PREFILL_SP=1, MXFP8 all-gather, bounded wo_a MXFP8 GEMV (T ≤ 48), exact CUDA graph buckets [1..64], and 11.00 GiB/GPU FP8 KV.2How We Got Here: Four-Stage Optimization Journey (222.6s → 62.0s)
Seeing only the final numbers hides why each setting matters. Across four structured engineering stages on the exact same four GPUs and checkpoint, every major leap came from verifying real execution paths and profiling real bottlenecks:
PIPE=2 GIL contention (Stage 3), to the promoted Speed10 configuration (Stage 4).| Stage | Core Configuration | C1 Code (T=0) | 1M Cold TTFT | FP8 KV / GPU | What We Learned |
|---|---|---|---|---|---|
| Stage 1: Bring-up | A16 MoE, K3, batch=1024 | 255.7 tok/s | 222.55 s | 6.0 GiB (seq=8) | iommu=pt + CPU Engram worked, but FORCE_A16=1 silently skipped W4A8 and small chunks stalled 1M prefill |
| Stage 2: W4A8 + 8192 | FORCE_A16=0, batch=8192, SP=1, fixed K5/K3 | 327.8 tok/s (+28%) | 55.33 s (−75%) | 6.0 GiB (seq=8) | True W4A8 unlocked massive prefill & decode gains; fixed K forced a C1-vs-C8 trade-off (K5 328 vs K3 272; C8 K3 851 vs K5 800) |
Stage 3: PIPE=2 Pitfall | Single-process PP=1 + PREFILL_PIPE=2 | 345.8 tok/s | 85.95 s (regressed) | 9.5 GiB (tight) | Torch Profiler exposed 2 threads fighting one CPython 3.12 GIL (~18K CUDA launches/step: 228ms GPU → 774ms wall) + 2.54 GiB extra buffers |
| Stage 4: Speed10 Winner | PIPE=0 + SP=1 + mxfp8 + BMM_MAX_T=48 + exact graphs + dynamic K5/3 | 344.2 (T=1: 373.5) | 62.01 s (163K: 9.17s) | 11.0 GiB (seq=16) | Eliminated GIL stall, reclaimed 2.54 GiB/GPU to expand KV, hit 454.1 tok/s 1M decode & 6×1M resident |
3Six Key Techniques & Ready-to-Adapt Launch Reference
1. Single-Process PREFILL_PIPE=0 −39.6% / −27.9% TTFT
With all 40 layers inside one Python process (PP=1), dual-thread PREFILL_PIPE=2 serialized on the CPython 3.12 GIL and consumed ~2.54 GiB/GPU for duplicate row buffers and a second NCCL communicator. Disabling PREFILL_PIPE while keeping PREFILL_SP=1, SP_RS=nccl and SP_GATHER=mxfp8 cut 163K/1M TTFT from 15.18s / 85.95s to 9.17s / 61.97s and unlocked 11.00 GiB/GPU KV.
2. Verify True W4A8 (FORCE_A16=0) Zero Silent Bypass
Setting B12X_MOE_FUSED=1 does nothing if VLLM_B12X_MOE_FP4_FORCE_A16=1 remains active—vLLM silently falls back to B12X_MXFP4_BF16. Explicitly set FORCE_A16=0, verify B12X_MXFP4_MXFP8 in startup logs, and put "indexer_tp_shard_min_rows": 2048 directly inside --attention-config.
3. Bounded wo_a GEMV + Exact Graphs T ≤ 48 · Buckets [1..64]
VLLM_LANGCHAO_BMM_MAX_T=48 routes small/medium decode steps (T ≤ 48) to FP8 GEMV and larger batches to a load-time cached BF16 weight (zero runtime dequant). Exact capture buckets [1,2,4,6,8,12,16,18,20,24...64] eliminate 33% padding waste at C1 and align cleanly with max_num_seqs=16 × (1+K=3) = 64.
4. Dynamic DSpark K5/3 & Fair Prefill 0.67 s Short TTFT
Dynamic DSpark ([[1,4,5],[5,32,3]]) uses K=5 at C1–C4 (pushing code to 373.5 tok/s) and shifts to K=3 at C5–C32 (protecting multi-stream efficiency). Adaptive fair prefill (--long-prefill-token-threshold 2048 --long-prefill-token-threshold-adaptive) dropped short-request TTFT injected during a 128K prefill from 26.5 s to 0.67 s.
# Sanitized Speed10 4-GPU Launch Reference (4 × RTX PRO 6000 Blackwell 96 GB, NUMA 0 pinned) export VLLM_B12X_MOE_FP4_FORCE_A16=0 VLLM_ALLREDUCE_USE_FLASHINFER_PCIE_IPC=1 VLLM_USE_BREAKABLE_CUDAGRAPH=1 export VLLM_MOET_SM120_GEMV=1 VLLM_MOET_SM120_GEMV_BMM=1 VLLM_LANGCHAO_BMM_MAX_T=48 VLLM_MOET_MOE_MEGA=0 export VLLM_MOET_B12X_MOE_FUSED=1 VLLM_MOET_B12X_MOE_PREFILL_FAST=1 VLLM_MOET_TARGET_LM_HEAD_MXFP8=1 VLLM_MOET_DRAFTER_LM_HEAD_MXFP8=0 export VLLM_MOET_MHC_MXFP8=1 VLLM_MOET_P2P_AR=1 VLLM_MOET_P2P_AG=1 VLLM_MOET_P2P_AR_FUSED_MAX_ROWS=8 export VLLM_MOET_PREFILL_SP=1 VLLM_MOET_PREFILL_SP_RS=nccl VLLM_MOET_PREFILL_SP_GATHER=mxfp8 VLLM_MOET_PREFILL_PIPE=0 export VLLM_MOET_SPARSE_MLA_PREFILL_BF16=0 VLLM_MOET_KV_FP4_FAKE=0 VLLM_LANGCHAO_GRAPH_AUDIT=0 python3 -m vllm.entrypoints.openai.api_server --model /model --dtype bfloat16 --tensor-parallel-size 4 --pipeline-parallel-size 1 --disable-custom-all-reduce --max-model-len 1048576 --max-num-seqs 16 --max-num-batched-tokens 8192 --gpu-memory-utilization 0.92 --kv-cache-memory-bytes 11811160064 --kv-cache-dtype fp8_ds_mla --block-size 128 --engram-config '{"cpu_offload": true, "use_thp": true}' --numa-bind --numa-bind-nodes 0 0 0 0 --attention-backend FLASHINFER_MLA_SPARSE_DSV41 --linear-backend flashinfer_cutlass --moe-backend b12x --attention-config '{"indexer_kv_dtype": "fp8", "indexer_tp_shard_min_rows": 2048}' --long-prefill-token-threshold 2048 --long-prefill-token-threshold-adaptive --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY","compile_sizes":[],"cudagraph_capture_sizes":[1,2,4,6,8,12,16,18,20,24,28,32,36,40,44,48,52,56,60,64],"max_cudagraph_capture_size":64,"cudagraph_decoder_replay":false}' --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"standard","enable_adaptive_verification":false,"num_speculative_tokens_per_batch_size":[[1,4,5],[5,32,3]]}'
4Stage 2 Screening & Production Decode / Prefill Benchmarks
PREFILL_PIPE=0 eliminates GIL stalls and frees 2.54 GiB/GPU.| Stage 2 Candidate (4-GPU A/B) | Key Experimental Variable | C1 Geo (T=0) | 163K Cold TTFT | 1M Cold TTFT | 1M Peak VRAM | Decision |
|---|---|---|---|---|---|---|
cand1_base_pipe2nccl | PIPE=2, comm2prio, KV=9.5G | 303.75 tok/s | 15.18 s | 85.95 s | 97,051 MiB | Reference (GIL-bound) |
cand2_pipe0_sp_mxfp8 | PIPE=0, SP=1, GATHER=mxfp8 | 307.62 tok/s | 9.17 s (−39.6%) | 61.97 s (−27.9%) | 93,913 MiB | Promoted → KV 11G |
cand3_pipe2_sharedtail_replay | PIPE=2 + SHARED_TAIL + REPLAY | 303.24 tok/s | 15.17 s | 85.42 s | 96,453 MiB | Rejected |
cand4_sp_rs_p2p | SP_RS=p2p + PREWARM=1 | 306.50 tok/s | 14.11 s | 89.51 s | 96,269 MiB | Rejected |
cand5_drafter_lmhead8 | DRAFTER_LM_HEAD_MXFP8=1 | 302.03 tok/s | 14.18 s | 84.09 s | 96,143 MiB | Rejected |
| Stage 3 Production Workload (11 GiB/GPU KV) | Chinese | Code | English | Notes |
|---|---|---|---|---|
C1 single-stream (T=1.0, prod default) | 291.67 tok/s | 373.51 tok/s | 263.33 tok/s | Stage 2 repeat: 297.15 / 366.52 / 262.20 tok/s |
C1 single-stream (T=0, deterministic) | 311.07 tok/s | 344.20 tok/s | 270.51 tok/s | Live post-promotion check: 309.9 / 340.1 / 264.7 |
C4 batch aggregate (T=0) | 519.83 tok/s | 584.61 tok/s | 462.54 tok/s | 123.7–157.9 tok/s median per stream |
C8 batch aggregate (T=0) | 821.43 tok/s | 863.64 tok/s | 749.96 tok/s | 99.6–115.6 tok/s median per stream |
| Single 1M sustained decode (61.0 s hold) | — | 454.11 tok/s | — | Cold TTFT 62.31 s · Peak KV 19.3% · 1/1 retrieval |
| Single cold prefill TTFT (0 prefix hits) | 163K: 9.17 s | 1M: 62.01 s | — | Live re-check: 9.35 s / 62.53 s · 100% retrieval |
5Long-Context Concurrency Envelope (6×1M, 10×500K & 8×1M Zero-OOM)
Although startup reports 5,238,588 KV tokens (nominally 5.00× at 1M), vLLM V1's unified physical block pool leverages sliding-window-attention (SWA) compactness so a single steady 1M context consumes only ~15.3% of total KV blocks. That enables six simultaneous cold 1M sessions to reside in VRAM together for 60 seconds with zero preemptions, and ten simultaneous 500K sessions at 78.2% KV utilization.
6×1M and 10×500K with zero preemptions, graceful 8×1M overflow queueing with zero OOMs, and mixed C4×128K + 1M throughput recovery.| Concurrency Workload (0 Prefix Hits) | Hold Window | Aggregate Decode | Cold TTFT (Min / Med / Max) | Peak KV | Status & Notes |
|---|---|---|---|---|---|
4 × 1,000,000 simultaneous | 60.8 s | 320.8 tok/s | 214.3 / 228.3 / 232.1 s | 63.0% | PASS 4/4 retrieval · 75–83/stream · 0 wait |
5 × 1,000,000 simultaneous | 61.0 s | 410.3 tok/s | 214.5 / 232.8 / 331.1 s | 77.5% | PASS 5/5 retrieval · 76–95/stream · 0 preempt |
6 × 1,000,000 simultaneous | 60.0 s | 439.2 tok/s | 214.5 / 235.6 / 355.6 s | 92.9% | PASS 6/6 retrieval · 65–88/stream · 0 preempt |
10 × 500,000 simultaneous | 46.0 s | 637.4 tok/s | 99.5 / 210.1 / 273.6 s | 78.2% | PASS 10/10 retrieval · 59–68/stream · 0 preempt |
8 × 1,000,004 overflow shock | Complete | — | 214.6 / 339.9 / 458.0 s | 67.3% | PASS 8/8 HTTP 200 · max_run=7, max_wait=4 · 0 OOM |
Mixed C4×128K + 1M prefill | 3 windows | 525.1 → 61.9 → 603.3 | New 1M TTFT: 105.85 s | — | PASS 5/5 retrieval · full recovery |
69 Four-GPU Dead Ends to Skip (Tested & Rejected)
We invested hundreds of GPU hours auditing community tuning tips so other four-GPU operators don't have to repeat the same failed experiments. Every item below was measured on this exact hardware:
PREFILL_PIPE=2 on Single-Process PP=1 −39.6% Slower
Dual Python pipeline threads fight over the same CPython 3.12 GIL (~18K CUDA launches/step), dragging 163K/1M cold TTFT to 15.18 s / 85.95 s and wasting ~2.54 GiB/GPU VRAM. Always keep VLLM_MOET_PREFILL_PIPE=0.
FORCE_A16=1 & Env-Only Indexer Sharding Silent Bypass
Leaving VLLM_B12X_MOE_FP4_FORCE_A16=1 silently bypasses W4A8 even when fused flags are set. Direct api_server launches ignore INDEXER_TP_SHARD_MIN_ROWS unless placed inside --attention-config.
NCCL_P2P_LEVEL=SYS & SP_RS=p2p Prefill Regressed
Forcing NCCL_P2P_LEVEL=SYS slowed 128K cold TTFT from 6.84 s → 8.08 s and 1M from 55.73 s → 65.28 s. Switching SP_RS=p2p slowed 1M prefill to 89.51 s. Leave NCCL topology automatic and keep SP_RS=nccl.
DRAFTER_LM_HEAD_MXFP8=1 −0.56% / +0.33 GiB
Quantizing the speculative drafter LM head slowed C1 decode and added 0.33 GiB/GPU VRAM overhead. Keep TARGET_LM_HEAD_MXFP8=1 and DRAFTER_LM_HEAD_MXFP8=0.
LDG on Pure FP8 KV & Adaptive Verify No-Op / Unsupported
Kernel traces across 8 runs proved LDG invoked 0 kernels under pure FP8 KV (requires mixed FP8/FP4 KV). Meanwhile, DeepseekV41IndexerBackend rejects enable_adaptive_verification=true on Blackwell SM120.
CPU Governor, stream_interval=4, K4 & block No Net Gain
75-request A/B/A/B/A CPU governor tests showed only 0.1–0.2% noise; stream_interval=4 slowed end-to-end code by −2.12%; fixed K=4 and block rejection showed no advantage over dynamic K5/3 + standard.
7Quality, Hardware Telemetry & Dedicated Four-GPU Repository
| Verification Gate | Measured Result | Status & Notes |
|---|---|---|
GSM8K fixed 200-question subset (1,024 budget, chat) | 197 / 200 | PASS 0 truncated; failed IDs [380, 515, 1019] |
| Deterministic short tasks (chat / low thinking) | 29/30 / 30/30 | PASS Batch c=10: 28/30 & 30/30 |
Production sampling quality (T=1.0, 90 tasks) | 81/90 (repeats 79, 82, 81) | PASS Initial run had 3 equation-format matches (84/90 value-correct); matches 79–84/90 variance |
Long text reasoning (long_quality, cold) | 12 / 12 | PASS Includes two 1M-token exact arithmetic tasks |
| Application & multimodal vision checks | App 10/10 · Vision 2/2 · Long 4/4 | PASS Long vision verified at 19,037 prompt tokens |
| Public HTTPS & three-protocol verification | Accept 10/10 · Cold cancel 3/3 | PASS Chat / Messages (literal tokens) / Responses (tool call) all HTTP 200 |
| Hardware telemetry (8,253 samples @ 0.5 s) | 96,681 MiB · 1,523.6 W · 72 °C | PASS 1,206 MiB free VRAM · 0 allocator retries · swap=0 |
Supervised by systemd (active/enabled) with a GPU-scoped health watchdog inspecting only GPUs 0–3 (DS_GPU_DEVICES=0,1,2,3) and enforcing cgroup MemorySwapMax=0 (swap_current=0), with zero container restarts and full OpenAI Chat, Anthropic Messages, OpenAI Responses and Gemini GenAI gateway compatibility.
Built on vLLM 0.32.1rc1.dev117+gdf3bd094a and PyTorch 2.14.0+cu130 with Moet kernels, bounded wo_a GEMV/BF16-BMM dispatch and targeted CLI protocol patches—not a full from-scratch vLLM/PyTorch rebuild. Local container digests are not publicly pullable registry images, no second-host rebuild is claimed, and finite evaluation suites do not prove universal equivalence across every downstream task.
Additional references: Full English engineering guide · Chinese engineering guide · Upstream vLLM-Moet · GSM8K dataset.
English
