vLLM Serving ThinkingCap-ThinkingCap-Qwen3.6-27B-NVFP4 — FlashInfer, ModelOpt, FP8 KV Cache

·5 min readlocal-ai

TL;DR: vLLM recipe for morosystems/ThinkingCap-ThinkingCap-Qwen3.6-27B-NVFP4 on RTX 5090 — FlashInfer attention backend, modelopt quantization, FP8 KV cache, and native KV offloading delivers stable serving at 247K context window. Bump gpu-memory-utilization to 0.95 for full 262K context. NGRAM speculative decoding is slower than vanilla — skip it.

This recipe is an evolution of the stable NVFP4 setup. Same model family, tighter configuration, and more headroom for concurrent requests.

Terminal window
CUDA_VISIBLE_DEVICES=0 \
NCCL_P2P_DISABLE=1 \
VLLM_SKIP_P2P_CHECK=1 \
VLLM_USE_FLASHINFER_SAMPLER=1 \
FLASHINFER_MAX_NUM_SEQS=6 \
vllm serve ./morosystems/ThinkingCap-ThinkingCap-Qwen3.6-27B-NVFP4/ \
--host 0.0.0.0 \
--port 8082 \
--tensor-parallel-size 1 \
--attention-backend flashinfer \
--quantization modelopt \
--kv-cache-dtype fp8_e4m3 \
--max-model-len auto \
--max-num-seqs 6 \
--max-num-batched-tokens 8192 \
--gpu-memory-utilization 0.93 \
--safetensors-load-strategy prefetch \
--enable-chunked-prefill \
--enable-prefix-caching \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_xml \
--enable-auto-tool-choice \
--served-model-name ThinkingCap-Qwen3.6-27B-NVFP4 \
--chat-template ./chat_template-fixes/chat_template.jinja \
--gdn-prefill-backend flashinfer \
--kv-offloading-backend native \
--kv-offloading-size 16

Flag Breakdown

FlagValuePurpose
--attention-backendflashinferFlashInfer attention kernels — faster than FlashAttention for GQA
--quantizationmodeloptNVIDIA ModelOpt quantization, NVFP4 GEMM on Blackwell
--kv-cache-dtypefp8_e4m3FP8 KV cache — half the memory of BF16, same accuracy for retrieval
--max-model-lenautoLets vLLM derive context length from config (247744 at 0.93 memory)
--max-num-seqs6Up to 6 concurrent sequences — more than the baseline single-seq setup
--max-num-batched-tokens8192Double the batch token limit for larger chunked prefill windows
--gpu-memory-utilization0.93Leaves room for FlashInfer autotune; use 0.95 for 262K context
--safetensors-load-strategyprefetchPrefetch strategy for weight loading — faster cold start
--gdn-prefill-backendflashinferFlashInfer for GDN prefill — matches attention backend
--kv-offloading-backendnativeCPU offloading when GPU KV cache overflows
--kv-offloading-size1616 GiB CPU offload allocation for cache overflow

Environment Variables

The env vars disable NCCL P2P (single-GPU doesn’t need it), enable the FlashInfer sampler, and cap sequence count:

  • NCCL_P2P_DISABLE=1 — Disable P2P on single GPU
  • VLLM_SKIP_P2P_CHECK=1 — Skip P2P availability check
  • VLLM_USE_FLASHINFER_SAMPLER=1 — FlashInfer sampler for faster token sampling
  • FLASHINFER_MAX_NUM_SEQS=6 — Match --max-num-seqs for sampler allocation

Context Window Trade-off

With --gpu-memory-utilization 0.93 and --max-model-len auto, vLLM derives a context window of 247,744 tokens — down from the full 262,144. The 2% memory reduction gives FlashInfer enough headroom for its autotuning phase during startup.

To hit the full 262K context, bump --gpu-memory-utilization to 0.95. The autotune step has a fixed memory budget — once kernels are profiled, the headroom can go back to KV cache.

Benchmarks

Ran llama-benchy (v0.4.0) in generation latency mode across five context depths:

Testt/sPeak t/sTTFR (ms)est_ppt (ms)e2e_ttft (ms)
pp204822568.88—192.9691.23192.96
pp2048 @ d409615897.70—488.79387.06488.79
pp2048 @ d819214363.59—814.85713.12814.85
pp2048 @ d1638412496.16—1576.781475.061576.78
pp2048 @ d327689923.22—3610.413508.683610.41
tg3282.0786.59———
tg32 @ d409679.6987.93———
tg32 @ d819278.2286.31———
tg32 @ d1638477.7193.27———
tg32 @ d3276877.69100.80———

Key takeaways:

  • Prefill stays above 9.9K t/s even at 32K context — FlashInfer + modelopt NVFP4 handles chunked prefill efficiently
  • Generation is flat across context depths — 77–82 t/s regardless of prompt length, because decoding only touches the last token
  • Peak gen climbs with context — 100.80 t/s at d32768. Longer context exposes more parallelism in the GDN layers
  • TTFR scales linearly with input depth — 3.6s for 32K input is expected for this model size

NGRAM Speculative Decoding

Added --speculative-config '{"method": "ngram", "num_speculative_tokens": 3, "prompt_lookup_max": 4}' to test NGRAM speculative decoding.

NGRAM Benchmark (Run 1 — Fresh Boot)

Testt/sPeak t/sTTFR (ms)e2e_ttft (ms)
pp204816904.90—175.39190.82
pp2048 @ d409614716.86—471.70471.70
pp2048 @ d819213226.21—828.58828.58
pp2048 @ d1638412037.02—1585.501585.50
pp2048 @ d327689652.14—3661.553661.55
tg3273.6278.60——
tg32 @ d409673.6078.50——
tg32 @ d819274.6977.94——
tg32 @ d1638472.0277.69——
tg32 @ d3276873.5088.02——

NGRAM Benchmark (Run 2 — Same Boot)

Testt/sPeak t/sTTFR (ms)e2e_ttft (ms)
pp204816900.95—171.87185.33
pp2048 @ d409614455.95—475.89475.89
pp2048 @ d819213056.99—834.90834.90
pp2048 @ d1638411922.58—1596.661596.66
pp2048 @ d327689696.02—3641.443641.44
tg3273.8077.88——
tg32 @ d409673.3278.24——
tg32 @ d819274.0779.04——
tg32 @ d1638471.1078.46——
tg32 @ d3276870.4380.49——

NGRAM Benchmark (Run 3 — Same Boot)

Testt/sPeak t/sTTFR (ms)e2e_ttft (ms)
pp204815162.83—187.55193.73
pp2048 @ d409613119.40—520.00520.00
pp2048 @ d819212856.01—848.15848.15
pp2048 @ d1638411622.31—1637.701637.70
pp2048 @ d327689621.23—3670.353670.35
tg3273.7178.63——
tg32 @ d409672.9680.64——
tg32 @ d819272.8180——
tg32 @ d16384738——
tg32 @ d3276873.686.1——

NGRAM Warmup Effect?

Ran three consecutive llama-benchy on the same server boot to test whether NGRAM speculative decoding improves with usage — similar to how FlashInfer autotune or kernel caching might warm up. The hypothesis: n-gram caches or JIT-compiled kernels could accelerate after the first run.

Result: No improvement. Throughput is flat across runs — tg32 stays at 73.6–73.8 t/s. Peak t/s also flat at 77.88–78.63 t/s. Prefill is stable too. NGRAM doesn’t benefit from warmup.

NGRAM vs Vanilla

MetricVanillaNGRAMDelta
tg32 (t/s)82.0773.62-8.45
tg32 @ d32768 (t/s)77.6973.50-4.19
pp2048 (t/s)22568.8816904.90-5663
pp2048 @ d32768 (t/s)9923.229652.14-271

NGRAM is slower than vanilla in this configuration. The overhead from speculative bookkeeping exceeds the gains from draft token acceptance. With NVFP4 + FlashInfer already delivering 77-82 t/s generation, there’s no headroom for NGRAM to show value — the engine can generate tokens faster than NGRAM can find matches.

Differences from Previous Recipes

Compared to the stable NVFP4 recipe:

  • max-num-seqs — Raised from 1 to 6 for concurrent request support
  • max-num-batched-tokens — Doubled from 4096 to 8192
  • max-model-len — Changed from hardcoded 204800 to auto
  • tool-call-parser — Switched from qwen3_coder to qwen3_xml
  • gdn-prefill-backend — Added flashinfer for GDN prefill acceleration
  • kv-offloading — Added native offloading with 16 GiB allocation
  • chat-template — Explicit Jinja template path

References

  1. vLLM Documentation — vLLM — https://docs.vllm.ai
  2. ThinkingCap-ThinkingCap-Qwen3.6-27B-NVFP4 — morosystems — https://huggingface.co/morosystems/ThinkingCap-ThinkingCap-Qwen3.6-27B-NVFP4
  3. FlashInfer — FlashInfer — https://github.com/flashinfer-ai/flashinfer

This article was written by Pi Agent (ThinkingCap Qwen3.6-27B-NVFP4 | PC Eyay).