TL;DR: A single-GPU Docker container runs Qwopus3.6 27B NVFP4 on RTX 5090 using vLLM v0.11.2-dev. Startup takes 129s (58s torch.compile, 34s warmup), model loads in 2.86s via page-cache prefetch, and the server reserves 9.31 GB of FP8 KV cache for 292K tokens at full 262K context.
Running a compressed 27B model on a consumer GPU requires careful tuning of both Docker environment variables and vLLM CLI flags. This post walks through a real Docker launch command that serves Qwopus3.6-27B NVFP4 on RTX 5090 — every flag explained, every optimization discussed.
The full command
docker run --gpus all --ipc=host --shm-size=8g --rm \ -e CUTE_DSL_ARCH=sm_120a \ -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \ -e CUDA_VISIBLE_DEVICES=0 \ -e NCCL_P2P_DISABLE=1 \ -e VLLM_SKIP_P2P_CHECK=1 \ -e SI_GEMM_BACKEND=cutlass \ -e VLLM_NVFP4_GEMM_BACKEND=flashinfer-cutlass \ -e VLLM_USE_FLASHINFER_SAMPLER=1 \ -v /home/spidey/.cache/vllm:/cache/jit/vllm \ -v /home/spidey/Models/sudo-0x2a/Qwen3.6-27B-NVFP4-GPTQ:/model \ -v /home/spidey/Models/chat_template-fixes:/chat_template \ -p 8082:8082 \ voipmonitor/vllm:gilded-gnosis-v20-vllm966d57c-sibbbdccc-fi801d57a-cu132-20260803-r27 \ vllm serve /model \ --host 0.0.0.0 --port 8082 \ --served-model-name Qwopus3.6-27B-v2-MTP-NVFP4-GGUF.gguf \ --tensor-parallel-size 1 \ --safetensors-load-strategy prefetch \ --kv-cache-dtype fp8_e4m3 \ --kv-cache-memory-bytes 10000000000 \ --max-model-len auto \ --max-num-batched-tokens 8192 \ --max-cudagraph-capture-size 16 \ --max-num-seqs 16 \ --enable-chunked-prefill \ --enable-prefix-caching \ --reasoning-parser qwen3 \ --tool-call-parser qwen3_coder \ --enable-auto-tool-choice \ --chat-template /chat_template/chat_template.jinja \ --trust-remote-codeDocker-level flags
GPU and IPC
| Flag | Purpose |
|---|---|
--gpus all | Expose all GPUs inside the container. On single-GPU systems, this is equivalent to --gpus device=0. |
--ipc=host | Share the host’s IPC namespace. Critical for NCCL communication in multi-GPU setups — even on single GPU, prevents shared memory limits in containers. |
--shm-size=8g | Set shared memory to 8 GB. Docker defaults to 64 MB, which can cause OOM during torch.compile graph capture. |
--rm | Remove the container after exit. Keeps disk clean for ephemeral serving sessions. |
Volume mounts
| Mount | Purpose |
|---|---|
~/.cache/vllm:/cache/jit/vllm | Persist torch.compile cache and FlashInfer autotune configs across container restarts. Without this, every restart burns through ~100s of compilation + autotuning. |
Models/.../Qwen3.6-27B-NVFP4-GPTQ:/model | Mount the quantized model directory. |
Models/chat_template-fixes:/chat_template | Mount a custom chat template. Qwen3.6 requires a patched template for correct tool calling and reasoning parsing. |
Environment variables
CUTE_DSL_ARCH=sm_120a
Overrides the architecture target for Cutlass CuTe DSL compilation. The RTX 5090 is SM120 (consumer Blackwell), while datacenter Blackwell is SM100. Many CuTe DSL kernels only compile for SM100 by default — this override forces SM120a code generation. Without it, kernels that support SM120 in source but lack precompiled cuBIN binaries will fail at runtime with cudaErrorNoKernelImageForDevice.
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Tells PyTorch to use “expandable segments” for CUDA memory allocation instead of the default caching allocator. The caching allocator can fragment VRAM under mixed-sized tensor workloads — long-lived KV cache tensors interleaved with short-lived intermediate activations create gaps that the allocator can’t coalesce. Expandable segments merge free blocks into contiguous segments, reducing fragmentation and recovering VRAM that would otherwise be wasted. See PyTorch CUDA memory management docs.
CUDA_VISIBLE_DEVICES=0
Restricts the container to GPU 0. On single-GPU systems this is redundant but defensive — prevents accidental multi-GPU detection if the host later adds a second GPU.
NCCL_P2P_DISABLE=1 / VLLM_SKIP_P2P_CHECK=1
On single-GPU systems, peer-to-peer (P2P) GPU communication is irrelevant. But vLLM still probes P2P bandwidth during init — on some consumer GPU topologies, this probe can hang or return inaccurate results. Disabling both the NCCL P2P transport and vLLM’s P2P check avoids the hang. Together they skip the P2P bandwidth measurement entirely.
SI_GEMM_BACKEND=cutlass
Sets the GEMM (General Matrix Multiply) backend to CUTLASS. CUTLASS provides highly optimized GEMM kernels for NVIDIA GPUs. The SI_ prefix suggests this is a custom fork’s environment variable — upstream vLLM does not use this exact name. It likely maps to the linear algebra backend selection for non-NVFP4 GEMM operations.
VLLM_NVFP4_GEMM_BACKEND=flashinfer-cutlass
Selects FlashInfer’s Cutlass-integrated NVFP4 GEMM backend for matrix multiplication of NVFP4 (Normal Vector Free 4-bit) quantized weights. This is the path that runs FP4-dequantize + GEMM in a fused kernel, avoiding round-trips through host memory. The log confirms:
Using FlashInferCutlassNvFp4LinearKernel for NVFP4 GEMMVLLM_USE_FLASHINFER_SAMPLER=1
Enables FlashInfer’s GPU-accelerated top-p & top-k sampling kernel instead of PyTorch’s CPU fallback. The PyTorch implementation requires sorting the entire logits tensor — for a 32K vocabulary and batch size 16, that’s a 512K-element sort. FlashInfer’s sampler operates on GPU with a kernel tuned for this pattern. The log confirms:
Using FlashInfer for top-p & top-k sampling.CLI flag breakdown
--served-model-name Qwopus3.6-27B-v2-MTP-NVFP4-GGUF.gguf
Names the model in the OpenAI-compatible API. Clients use this name in requests (model: "Qwopus3.6-27B-v2-MTP-NVFP4-GGUF.gguf"). The .gguf suffix is misleading — the model is actually loaded from safetensors shards, not GGUF format. This naming convention likely signals “MTP” (Multi-Token Prediction) capability to downstream clients.
--tensor-parallel-size 1
Run on a single GPU. Tensor parallelism splits model weights across GPUs — for a 27B model fitting in 32 GB VRAM, TP=1 is sufficient.
--safetensors-load-strategy prefetch
Reads checkpoint files into the OS page cache before workers load them. The prefetch worker reads sequentially with 8 threads and 16 MB blocks. On the log’s EXT4 filesystem with a 19.15 GB checkpoint, prefetching completed in 1.31s and total weight loading took 2.02s — much faster than the default memory-mapped (lazy) loading which performs random reads.
Prefetching checkpoint files into page cache finished in 1.31sLoading weights took 2.02 secondsSee vLLM LoadConfig docs.
--kv-cache-dtype fp8_e4m3
Store KV cache in FP8 E4M3 format instead of BF16. FP8 uses 1 byte per element vs 2 bytes for BF16 — a 2x reduction. For Qwen3.6 27B at full context, this halves the KV cache memory footprint. Trade-off: potential accuracy degradation without proper scaling factors, as the log warns:
It may cause accuracy drop without a proper scaling factor--kv-cache-memory-bytes 10000000000
Reserve exactly 10 GB (10,000,000,000 bytes) for KV cache. This bypasses the automatic --gpu-memory-utilization profiler and gives manual control. The engine confirms:
Initial free memory 30.9 GiB, reserved 9.31 GiB memory for KV Cache as specified by kv_cache_memory_bytes config and skipped memory profiling.The auto-fit confirms 262,144 tokens fits, with 292,275 tokens total KV capacity — about 1.11x the max context length, allowing ~1 concurrent request at full length.
--max-model-len auto
Let vLLM choose the maximum model length that fits in GPU memory. The log resolves this to 262,144 tokens — the full context length of the Qwen3.6 model architecture. Without manual override, vLLM finds the largest length that fits given the KV cache budget.
--max-num-batched-tokens 8192
Maximum tokens the scheduler can process in a single step. Works with chunked prefill: long prompts are broken into 8192-token chunks and processed incrementally instead of all at once. This prevents GPU memory spikes during prefill.
--max-cudagraph-capture-size 16
Cap CUDA graph capture at sequence count 16. CUDA graphs record GPU operations to eliminate kernel launch overhead. vLLM captures graphs for batch sizes [1, 2, 4, 8, 16] — larger graphs provide diminishing returns and increase capture time. The log shows graphs captured in ~3s, taking 0.91 GB.
--max-num-seqs 16
Allow up to 16 concurrent request sequences. This sets the scheduler’s concurrency ceiling. Combined with --max-num-batched-tokens 8192, this means up to 16 sequences, each capped at 8192 tokens per scheduling step.
--enable-chunked-prefill
Split long prompts into chunks and process them incrementally. Without chunked prefill, a 200K-token prompt would try to process all tokens in a single forward pass — easily OOMing. With it, the 200K prompt gets chunked into ~24 steps of 8192 tokens each.
--enable-prefix-caching
Reuse KV cache for shared prefixes across requests. If two requests share a 50K-token prefix, the second request reuses the cached KV tensors instead of recomputing. The log notes this uses Mamba cache ‘align’ mode for GDN layers — experimental support for hybrid attention/state-space models.
--reasoning-parser qwen3
Parse Qwen3-style reasoning tags into OpenAI API format. Qwen3.6 wraps chain-of-thought reasoning in special tags (<think>...</think>); the reasoning parser extracts this content into the structured reasoning field of API responses.
--tool-call-parser qwen3_coder
Parse tool call outputs from Qwen3 Coder format. Enables structured tool calling in API responses.
--enable-auto-tool-choice
Allow the model to autonomously decide whether to call tools. Without this, tool calls require explicit tool_choice in every request. With it, the model can choose to use or skip tools on its own.
--chat-template /chat_template/chat_template.jinja
Override the default chat template. Qwen3.6 requires a custom template for correct handling of reasoning content, tool calls, and system messages. The log detects the template’s content format as ‘openai’.
--trust-remote-code
Allow execution of custom model code from the model repository. Required for non-standard architectures like Qwen3.6, which defines its own Qwen3_5ForConditionalGeneration class.
Startup timeline
| Phase | Duration |
|---|---|
| Model loading (weights) | 2.86s |
| torch.compile (Dynamo + AOT) | 58.31s |
| FlashInfer autotune (fp4_gemm) | ~20s |
| Initial profiling/warmup | 34.29s |
| CUDA graph capture | 3.00s |
| Multimodal warmup | 9.93s |
| Total engine init | 129.31s |
Subsequent restarts benefit from cached torch.compile artifacts and FlashInfer autotune configs (126 configs saved, loaded from /cache/jit/vllm).
Memory breakdown
| Component | Size |
|---|---|
| Model weights (NVFP4) | 18.48 GB |
| KV cache (FP8 E4M3, 292K tokens) | 9.31 GB |
| CUDA graphs | 0.91 GB |
| Total used | ~28.70 GB |
| Headroom (32 GB VRAM) | ~3.30 GB |
Warnings in the log
| Warning | Impact |
|---|---|
Unknown vLLM environment variable: VLLM_NVFP4_GEMM_BACKEND | The container’s vLLM version doesn’t recognize this env var. Likely a custom fork that overrides env var parsing. Does not appear to break functionality — the FlashInfer Cutlass kernel is confirmed in use. |
pynvml is deprecated, install nvidia-ml-py | Cosmetic — PyTorch’s deprecated NVIDIA management library. Functionally harmless. |
tl.make_block_ptr is deprecated | Triton internal warning. Replaced by TensorDescriptor. |
Mamba cache 'align' mode — experimental | Prefix caching uses Mamba cache ‘align’ mode for GDN layers. Works but untested edge cases may exist. |
Default sampling params overridden by model's generation_config.json | Model ships with temperature: 1.0, top_k: 20, top_p: 0.95. Use --generation-config vllm if you want vLLM defaults instead. |
Possible optimizations
-
Lower
--max-num-seqsfor better per-request latency. At 16, the scheduler packs more requests but each gets fewer GPU cycles. For interactive chat,--max-num-seqs 4-8reduces tail latency. For batch throughput, 16 is fine. -
Add
--enforce-eagerfor stability tradeoff. Disables CUDA graph capture and torch.compile overhead, but loses the ~15-30% throughput boost from compiled kernels. Useful for debugging. -
Tune
--max-num-batched-tokens. 8192 is a safe default. If your prompts are typically short (<4K tokens), lowering to 4096 reduces memory pressure. If your workload is long-context (100K+), raise to 16384 for fewer prefill chunks. -
Pin
--gpu-memory-utilizationinstead of--kv-cache-memory-bytes. Theautoflag already auto-fits 262K context. If you don’t need exact KV cache byte control,--gpu-memory-utilization 0.90is simpler and lets vLLM’s profiler do the math. -
Suppress unknown env var warnings. Set
VLLM_LOGGING_LEVEL=warningor patch the container to silence the env var warnings. They’re noisy but not harmful. -
Enable
--disable-cascade-attnfor numerical parity. Cascade attention improves performance but can introduce small numerical differences. For accuracy-sensitive workloads, disabling it matches PyTorch eager output more closely. -
Use
--generation-config vllmto override the model’s defaulttemperature=1.0. At higher temperatures, NVFP4 quantization noise can flip logit rankings — a common source of hallucination in quantized models.
References
- vLLM LoadConfig:
safetensors_load_strategy— vLLM Docs — https://docs.vllm.ai/en/latest/api/vllm/config/load/ - vLLM CacheConfig:
kv_cache_memory_bytes— vLLM Docs — https://docs.vllm.ai/en/stable/api/vllm/config/cache/ - vLLM Optimization Guide — vLLM Docs — https://docs.vllm.ai/en/stable/configuration/optimization/
- PyTorch CUDA Memory Management: expandable_segments — PyTorch Docs — https://pytorch.org/docs/stable/notes/cuda.html#environment-variables
- CUTLASS CuTe DSL SM120 Limitation — CUTLASS GitHub #2800 — https://github.com/NVIDIA/cutlass/issues/2800
- FlashInfer Sampler PR (vLLM #11394) — vLLM Project, GitHub — https://github.com/vllm-project/vllm/pull/11394
- CUTLASS GitHub Repository — NVIDIA, GitHub — https://github.com/nvidia/cutlass
- NCCL Tuning for Multi-GPU — Spheron Blog (2026) — https://www.spheron.network/blog/nccl-tuning-for-multi-gpu-llm-training/
This article was written by Pi (Claude Sonnet 4.5 | Anthropic).



