Qwen3.6 27B: From 20 t/s to 184 t/s — Full Optimization Pipeline

· 5 min read local-ai youtube

TL;DR: A single RTX 4090 running Qwen3.6-27B goes from 20 t/s (FP8 baseline) to 184 t/s peak through a pipeline of quantization (AWQ), MTP speculative decoding, DFlash diffusion-based acceleration with DDTree branching paths, and TurboQuant KV cache compression — without requiring multi-GPU setups for most workloads.

The host opens with a live benchmark: dual RTX 4090 vs single RTX 4090 running Qwen3.6-27B. The result defies intuition — the single card is competitive in many scenarios, and with proper optimization, it outperforms naive multi-GPU setups on latency-sensitive workloads.

The core thesis: optimization transforms your GPU from a toy into a nuclear-level productivity tool. The gap between “usable” and “production-grade” local inference is closing fast.

Baseline — FP8 on Single RTX 4090

A dense 27B model at FP8 precision on a single RTX 4090 outputs 20 tokens per second. That is not a misprint. At that speed, the model types out a function name before you lose patience and decide to write it yourself.

FP8 is nearly lossless in quality — but throughput matters more than marginal accuracy gains when the alternative is waiting.

Optimization 1 — Quantization (AWQ / GGUF)

The bottleneck on cards like the RTX 4090 is memory bandwidth, not compute. The GPU calculates too fast for the VRAM to feed it data. Less data means faster throughput.

Why quantization speeds things up

With FP8, weights occupy 2 bytes per parameter. At 4-bit, each weight is half a byte — 4× less memory traffic over the same bandwidth. Same compute, less waiting.

The host benchmarks two approaches:

MethodFormatFrameworkSpeedNotes
GGUF Q4_K_M4-bitllama.cpp~45 t/sBest size/quality balance for single-user
AWQ (int4)4-bit sparsevLLM~48 t/sHigh-concurrency, PagedAttention

Both double throughput compared to FP8 (from 20 → 48 t/s). Quality loss is minimal — mostly occasional errors requiring retry tokens, which still cost less than the time saved.

Quantization quality assessment

The host tested against three datasets derived from ToolCall15 (tool-calling success rate), data extraction, and instruction following — 45 scenarios total. Most users cannot perceive the difference between FP8 and 4-bit quantized output. The extra token cost of correcting rare errors is far less than the time penalty of running unquantized.

GGUF vs AWQ — when to use which

FactorGGUF (llama.cpp)AWQ (vLLM)
ConcurrencySingle-user, sequentialMulti-request, PagedAttention
FlexibilityQ4–Q8, dynamic budget per VRAMFixed int4 sparse
OffloadingGPU + CPU RAM hybridGPU-only (requires sufficient VRAM)
Best forPersonal use, limited VRAMServer/API, high throughput

Optimization 2 — MTP (Multi-Token Prediction)

MTP is part of speculative decoding. The model generates multiple prediction heads that forecast several future tokens simultaneously, then validates them in one batch pass: correct predictions kept, wrong ones discarded.

How MTP works

n valueBehaviorEffect
n=1Predict next token + verifyBaseline speculative step
n=5Predict 5 tokens ahead + verifyGPU fills idle cycles during data fetch

During single-token generation, the GPU sits idle waiting for memory reads. MTP keeps it busy — speculating on future tokens while the current one loads. It recovers wasted compute.

MTP benchmark results (vLLM)

ConfigurationSpeedImprovement over baseline
AWQ, no MTP48 t/s+140% vs FP8
AWQ, MTP n=171 t/s+253% vs FP8
AWQ, MTP n=399 t/s+395% vs FP8
AWQ, MTP n=5108 t/s440% vs FP8 (5× speedup)

FP8 also benefits dramatically from MTP:

ConfigurationSpeedImprovement over baseline
FP8, no MTP20 t/s
FP8, MTP n=138 t/s+90%
FP8, MTP n=360 t/s+200%
FP8, MTP n=572 t/s+260%

The RTX 4090 has native FP8 hardware acceleration (Tensor Cores), making FP8 + MTP competitive even against quantized models without speculative decoding.

Task-type variance

Speculative decoding speed depends on predictability of the output domain:

TaskDFlash SpeedWhy
Math problems~150 t/sFixed formula structures, highly deterministic
Code generation~125 t/sCustom variables/functions introduce unpredictability — user_id vs user_account breaks speculative chains
Creative writingLowestMaximum entropy, every token branch diverges

The host’s key insight: multi-agent coding workflows are ideal for speculative decoding because code has structural regularity (indentation, brackets) while remaining deterministic enough that small models predict well.

Optimization 3 — DFlash (Diffusion-Based Speculative Decoding)

MTP speculates along a single linear path. If one token is wrong, all subsequent predictions are wasted. DFlash takes a fundamentally different approach — borrowed from diffusion image generation.

Diffusion applied to text

The analogy: generating an image starts as noise and iteratively refines toward clarity. DFlash applies this to tokens:

  1. The draft sees [last_target_token, MASK x 15] plus 5 captured target hidden states from specific layers
  2. It denoises all 16 masks in a single forward pass — no chain dependency
  3. DDTree builds a best-first tree of up to 22 nodes (or flat chain without DDTree)
  4. One target forward verifies the entire tree via causal mask; committed tokens feed back, rejected branches discarded

Diffusion models are inherently parallel — they do not depend on sequential chain-of-thought like autoregressive generation. Qwen3.5-27B is a hybrid model (every 4th layer = full softmax attention, rest = Gated DeltaNet), which Lucebox handles via ggml_gated_delta_net — the only kernel needed beyond standard ggml.

DFlash benchmark

Lucebox ported DFlash to GGUF via a custom C++/CUDA engine on top of ggml (no libllama). Qwen3.5-27B Q4_K_M (~16 GB target + 3.46 GB BF16 draft) fits on one RTX 3090 with 24 GB VRAM:

EnvironmentModelBaseline ARWith DFlash (DDTree budget=22)Improvement
RTX 3090 (Lucebox demo)Qwen3.5-27B Q4_K_M38.0 t/s207.6 t/s peak5.46×
RTX 3090 (HumanEval bench)Qwen3.5-27B Q4_K_M37.78 t/s129.5 t/s mean3.43×
RTX 4090 (host)Qwen3.6 27B AWQ+MTP108 t/s141 avg / 184 peak+70% over MTP alone

The host achieves 184 tokens per second peak throughput on an RTX 4090 — nearly 10× the FP8 baseline on a single card. Lucebox’s demo hits 207 tok/s on a less powerful RTX 3090, proving DFlash scales beyond high-end hardware.

Optimization 4 — DDTree (Diffusion Draft Tree)

DFlash generates a block of tokens but chains them as a single linear path to the target model. If one token fails validation, all downstream predictions are wasted — same problem MTP had, just scaled up.

DDTree extends DFlash by exploring multiple candidate paths simultaneously:

  1. Diffusion generates a rough block of candidates
  2. Instead of one linear chain, DDTree branches into N parallel hypotheses (configured as 22 paths in Lucebox’s setup — budget=22)
  3. All 22 paths are validated against the target model via a causal mask
  4. The best path is committed; rejected branches discarded, recurrent state rolled back to the committed prefix

The metaphor: generate a forest, then find the best route through it. Lucebox’s implementation uses ~8.3 tokens committed per draft/verify step on HumanEval at this budget.

Multi-GPU: Dual RTX 4090 Results

The host tested dual RTX 4090s and found that multi-GPU does not mean “double speed”:

ConfigurationSingle Request10+ Concurrent Requests
FP8, MTP n=5120 t/s (+10 over single)Scales linearly — 2× throughput
AWQ + MTP n=5Similar latencySignificantly higher aggregate throughput

Why dual GPU is not 2× for single requests

The bottleneck is inter-card synchronization of model weights, not compute:

  • RTX 4090 has no P2P (peer-to-peer) VRAM communication between cards
  • Data must route through CPU → system RAM → PCIe → second card
  • Each hop introduces latency that erodes the benefit for single-token generation

Where multi-GPU shines: concurrency and context length

Dual GPUs unlock two things:

  1. More context — split model weights across two VRAM pools, enabling longer KV cache windows (e.g., TurboQuant enables 200K context on a single 24GB card; dual cards double that capacity)
  2. Concurrent throughput — 10+ simultaneous requests fill both cards like moving from 2-lane to 4-lane highway

The host’s multi-agent orchestration system relies on this: high-IQ models handle planning, while quantized, high-concurrency instances execute repetitive tasks simultaneously. The concept of “extreme leverage” — same hardware, same power draw, but 10×–50× token throughput through optimization and concurrency.

Optimization 5 — TurboQuant (KV Cache Compression)

TurboQuant compresses KV cache from FP16 to 3–4 bits — nearly 4× compression ratio with negligible quality loss.

CardModel FormatKV CacheContext Window
RTX 3090 (24GB)Q4 weightsFP16 cache~50K tokens (cache fills VRAM)
RTX 3090 (24GB)Q4 weightsTurboQuant 3-bit cache~200K tokens

With vLLM 0.20+ and locebox both supporting TurboQuant, this unlocks long-context workloads on consumer hardware that previously required A100-level VRAM.

Production Configuration

The host’s production setup prioritizes stability over peak speed:

ComponentChoiceRationale
Model precisionFP8Best quality, native 4090 Tensor Core acceleration
Speculative decodingMTP n=3 (not DFlash)Stable, supports multi-concurrency; n=3 is the pinned-comment default
FrameworkvLLM + PagedAttentionProduction-ready concurrency
Concurrency target~10 concurrent requests → 500+ t/s aggregateMulti-agent orchestration pipeline

Host’s Pinned vLLM Launch Command

Terminal window
VLLM_USE_MODELSCOPE=true \
uv run vllm serve qwen/Qwen3.6-27B-FP8 \
--speculative-config '{"method":"mtp","num_speculative_tokens":3}' \
--max-num-seqs 10 \
--max-model-len auto \
--port 5000 \
--enable-prefix-caching \
--gpu-memory-utilization 0.92 \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--served-model-name qwen3.6 \
--tool-call-parser qwen3_coder

Key flags:

FlagPurpose
VLLM_USE_MODELSCOPE=trueDownload from ModelScope (China mirror, faster than HuggingFace in Asia)
--speculative-config '{"method":"mtp","num_speculative_tokens":3}'MTP with 3 speculative tokens — balanced speed/stability for production
--max-num-seqs 10Up to 10 concurrent sequences
--gpu-memory-utilization 0.92Use 92% of VRAM for KV cache / model weights
--enable-prefix-cachingCache shared prefix across requests — critical for multi-agent workloads where prompts overlap
--reasoning-parser qwen3Parse Qwen3 reasoning output format
--tool-call-parser qwen3_coderParse tool calls from Qwen3-Coder style outputs
--enable-auto-tool-choiceLet model decide whether to call tools

RTX 5090 Alternative — GPTQ-MARLIN MoE at 211 t/s

A viewer reported that the host’s FP8+MTP config struggled on an RTX 5090 (stuck at ~25 t/s), but switching to GPTQ-Int4 with MARLIN quantization on the MoE variant Qwen3.5-35B-A3B delivered dramatically better results:

Terminal window
vllm serve Qwen/Qwen3.5-35B-A3B-GPTQ-Int4 \
--quantization gptq_marlin \
--dtype bfloat16 \
--kv-cache-dtype fp8 \
--gpu-memory-utilization 0.9 \
--max-model-len 32768 \
--max-num-batched-tokens 2096 \
--max-num-seqs 2 \
--enable-prefix-caching \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder \
--trust-remote-code \
--port 5000 \
--served-model-name qwen3
FlagPurpose
--quantization gptq_marlinGPTQ with MARLIN kernel — optimized for RTX 50-series Tensor Cores
--dtype bfloat16Compute in BF16 despite INT4 weights (MARLIN upcasts internally)
--kv-cache-dtype fp8FP8 KV cache — reduces memory pressure on long contexts
--max-model-len 32768Fixed context window (not auto, which can overallocate)
--max-num-batched-tokens 2096Limits per-step batch size to avoid OOM on MoE routing
--max-num-seqs 2Conservative concurrency — MoE models are memory-intensive per request
--trust-remote-codeRequired for Qwen3.5-MoE custom model code

Result: 211 t/s on a single RTX 5090 with the GPTQ-MARLIN + FP8 KV cache config — compared to only 25 t/s with the host’s original FP8+MTP setup. The MoE architecture (35B total, ~3B active per token) means far less memory bandwidth per step than dense models, and MARLIN is specifically optimized for the RTX 50-series compute path.

Hardware Economics — GPU as Asset

The host makes an argument for local compute as investment:

  • RTX 4090 (48GB) purchased one year ago has appreciated in value, not depreciated
  • RTX 3090 may also appreciate given DFlash + TurboQuant enabling previously impossible workloads
  • Lucebox team optimizing CUDA kernel-level scheduling — Apple M5 Max has better energy efficiency out of box; RTX GPUs waste power on suboptimal dispatch and idle waits, not compute itself

The host references the Luce megakernel project (fusing all 24 layers of Qwen into a single CUDA dispatch on an RTX 3090 at 220W, hitting 1.87 tok/J — matching M5 Max efficiency while delivering 1.8× throughput). Most GPU power consumption is scheduling overhead, not computation.

Complete Optimization Pipeline Summary

StepTechniqueSpeed (t/s)Improvement over FP8 baseline
0FP8, no optimization20
1AWQ quantization48+140%
2MTP n=5 speculative decoding108+440%
3DFlash diffusion-based acceleration141 avg / 184 peak+820%

From 20 t/s to 184 t/s — a 9.2× speedup on a single RTX 4090, achieved through compounding software optimizations rather than hardware upgrades.

Framework Support Status (June 2026)

FeaturevLLMllama.cppLucebox (GGUF/CUDA)
AWQ int4✅ PagedAttention
MTP speculative decoding✅ n=1–5⚠️ N-gram only (limited benefit)
DFlash diffusionNot mergedNot merged✅ (primary GGUF implementation)
DDTree branchingNot mergedNot merged✅ (budget=22, ~8.3 committed/step)
TurboQuant KV cache✅ vLLM 0.20+✅ (Q4_0, 128K context on 24 GB)

References

  1. Qwen3.6 27B,多种优化方式,从20t/s飙到184t/s,我是怎么做到的? — 小天fotos, YouTube (May 2026) — https://www.youtube.com/watch?v=edHNTFt5jYk
  2. DFlash on ggml: up to 207 tok/s Qwen3.5-27B on a RTX 3090 — Davide Ciffa, Lucebox Blog (April 2026) — https://lucebox.com/blog/dflash27b
  3. Luce megakernel: CUDA fusion beats Apple Silicon efficiencyhttps://lucebox.com/blog/megakernel
  4. Lucebox DFlash Repositoryhttps://github.com/Luce-Org/lucebox-hub/tree/main/dflash
  5. ToolCall15 — Tool-calling benchmark dataset, Twitter/X trending
  6. vLLM 0.20 release notes — TurboQuant KV cache support added

This article was written by Qwen Code (Qwen 3.5 Coder Plus | Alibaba Cloud), based on content from: https://www.youtube.com/watch?v=edHNTFt5jYk