SGLang on RTX 5090: Qwen3.6 for Local Coding

·5 min readlocal-ai

TL;DR: Qwen3.6-27B FP8 fits on RTX 5090 (32 GB) with ~54 tok/s baseline. The Ex0bit EAGLE-3 drafter pushes this to ~183 tok/s (1.97×) on BF16 — the fastest single-GPU coding agent path. Qwen3.6-35B-A3B FP8 exceeds 32 GB and needs CPU offload or NVFP4.

Why Qwen3.6 for Local Coding

Qwen3.6-27B scores 77.2% on SWE-bench Verified, outperforming Claude 4.5 Opus on Terminal-Bench. The 35B-A3B MoE variant adds agentic coding capabilities with tool calling and repository-level reasoning. Both support 262K context and native MTP (Multi-Token Prediction) for speculative decoding via SGLang.

For local coding agents, the 27B dense variant is the sweet spot on a single RTX 5090. The 35B-A3B MoE requires careful memory management.

Hardware Reality Check

ModelPrecisionWeight VRAMKV Cache (headroom)Fits on 5090?
Qwen3.6-27BBF16~54 GB—No
Qwen3.6-27BFP8~27 GB~5 GBYes, tight
Qwen3.6-27BNVFP4~14 GB~18 GBYes, comfortable
Qwen3.6-35B-A3BBF16~70 GB—No
Qwen3.6-35B-A3BFP8~35 GBOOMNo (needs offload)
Qwen3.6-35B-A3BNVFP4~17.5 GB~14.5 GBYes

Setup SGLang with uv

uv is the fastest way to get SGLang running — it resolves and caches deps in seconds:

Terminal window
# 1. Create isolated environment
uv venv .sglang --python 3.12
source .sglang/bin/activate
# 2. Install SGLang with all extras (FlashInfer, ModelOpt, etc.)
uv pip install "sglang[all]>=0.5.12" --prerelease=allow
# 3. Verify installation
python3 -m sglang.check_env

Pre-requisites:

  • CUDA 12.9 or 13.0 — verify with nvcc --version. RTX 5090 needs CUDA 12.8+ minimum.
  • CUDA_HOME — set if missing: export CUDA_HOME=/usr/local/cuda
  • FlashInfer — installed automatically via [all] extras. Requires sm75+ (RTX 5090 is sm_120, fully supported).
  • ModelOpt — for NVFP4, install separately: uv pip install nvidia-modelopt accelerate

Skip [all] extras if you don’t need ModelOpt or speculative decoding — the base sglang package is ~2 GB smaller:

Terminal window
uv pip install "sglang>=0.5.12" --prerelease=allow

Deploying Qwen3.6-27B-FP8

Terminal window
sglang serve \
--model-path Qwen/Qwen3.6-27B-FP8 \
--quantization fp8 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4 \
--mem-fraction-static 0.85 \
--max-running-requests 128 \
--cuda-graph-max-bs 256 \
--chunked-prefill-size 8192 \
--schedule-conservativeness 0.5 \
--host 0.0.0.0 \
--port 30000

Flag Breakdown for Coding Workloads

FlagValueWhy
--model-pathQwen/Qwen3.6-27B-FP8FP8 cuts weight VRAM to 27 GB
--mem-fraction-static0.85Reserves ~5 GB for activations/CUDA graphs
--max-running-requests128Balance concurrency vs KV cache pressure
--cuda-graph-max-bs256Graph capture for batch 256; lower than defaults to save VRAM
--chunked-prefill-size8192Splits long code contexts into manageable chunks
--schedule-conservativeness0.5Admit requests aggressively; watch for OOM
--speculative-algorithm EAGLEMTPNative speculative decoding via MTP heads

Deploying NVFP4 (Blackwell-native, Experimental)

NVFP4 drops weights to ~14 GB, leaving ~18 GB for KV cache. Requires --quantization modelopt to load the pre-quantized checkpoint correctly.

Terminal window
sglang serve \
--model-path nvidia/Qwen3.6-27B-NVFP4 \
--quantization modelopt \
--mem-fraction-static 0.92 \
--max-running-requests 256 \
--cuda-graph-max-bs 512 \
--host 0.0.0.0 \
--port 30000

35B-A3B on RTX 5090

Qwen3.6-35B-A3B FP8 weights (~35 GB) exceed the 5090’s 32 GB. Two paths exist:

Path 1: CPU Offload

Terminal window
sglang serve \
--model-path Qwen/Qwen3.6-35B-A3B-FP8 \
--quantization fp8 \
--cpu-offload-gb 8 \
--mem-fraction-static 0.9 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder

Offloads ~8 GB to system RAM. Expect 20–40% speed penalty on layers that spill.

Path 2: NVFP4 (Experimental)

Official nvidia/Qwen3.6-35B-A3B-NVFP4 (~22 GB) fits entirely on the 5090:

Terminal window
sglang serve \
--model-path nvidia/Qwen3.6-35B-A3B-NVFP4 \
--quantization modelopt \
--mem-fraction-static 0.90 \
--max-running-requests 192 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder

Speculative Decoding: MTP vs EAGLE-3 Drafter

Qwen3.6 ships with mtp.safetensors — native Multi-Token Prediction heads. SGLang uses these via the EAGLE algorithm for built-in speculative decoding. For deeper speedup, the community Ex0bit EAGLE-3 drafter trains a separate draft model tuned for long-horizon coding work.

ConfigurationDecode SpeedSpeedup
Qwen3.6-27B BF16, no spec~54–93 tok/sbaseline
Qwen3.6-27B BF16 + MTP~80–120 tok/s1.4–1.8×
Qwen3.6-27B BF16 + Ex0bit EAGLE-3~183 tok/s1.97×

Native MTP (No Patch Required)

Qwen3.6’s built-in MTP heads work out of the box:

Terminal window
sglang serve \
--model-path Qwen/Qwen3.6-27B-FP8 \
--quantization fp8 \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4

MTP speedup depends on the task. Coding with high token repetition (boilerplate, imports) benefits more than creative writing. Accept length of ~2–3 means each target forward pass verifies 2–3 tokens instead of 1.

Ex0bit/Qwen3.6-27B-PRISM-EAGLE3 is a 0.6B trainable draft head validated on both Qwen/Qwen3.6-27B (stock) and its PRISM-PRO variant. The compressed variant (32K vocab, 1.1 GB) is recommended for serving.

Setup (SGLang ≥ 0.5.12):

Terminal window
# 1. Clone and patch SGLang for EAGLE-3 on Qwen3.6
huggingface-cli download Ex0bit/Qwen3.6-27B-PRISM-EAGLE3 --local-dir eagle3-drafter
python3 eagle3-drafter/patch_sglang_eagle3.py
# 2. Serve with the compressed drafter
SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \
--model-path Qwen/Qwen3.6-27B \
--speculative-algorithm EAGLE3 \
--speculative-draft-model-path eagle3-drafter/compressed \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4 \
--mamba-scheduler-strategy extra_buffer \
--mm-attention-backend sdpa \
--dtype bfloat16 \
--trust-remote-code

Key flags (required for hybrid GatedDeltaNet targets):

  • SGLANG_ENABLE_SPEC_V2=1 — V2 scheduler; SGLang rejects spec decoding without it
  • --mamba-scheduler-strategy extra_buffer — enables overlap scheduling
  • --mm-attention-backend sdpa — avoids fa4 kernel SM version asserts on Blackwell (sm_103)
  • --speculative-eagle-topk 1 — chain drafting recommended; tree (topk 4) raises accept length to ~3.35 but is throughput-neutral on this target

The one-shot patch (patch_sglang_eagle3.py) adds EAGLE-3 aux-hidden capture hooks to Qwen3.6’s decoder. It is idempotent, writes a .eagle3-bak backup, and touches qwen3_5.py only.

Trade-off: The drafter adds ~1.1 GB (compressed) to model VRAM. On 27B FP8 (27 GB weights), total model VRAM rises to ~28 GB, leaving ~4 GB for KV cache — tighter but still functional.

Mamba Radix Cache (Qwen3.6-specific)

Qwen3.6’s Gated Delta Networks (GDN) backbone supports mamba-style state caching. Two strategies:

Terminal window
# V1: Default, lower memory
--mamba-scheduler-strategy no_buffer
# V2: Better throughput, more memory
--mamba-scheduler-strategy extra_buffer --page-size 64

V2 enables overlap scheduling and branching point caching via the FLA kernel backend (NVIDIA only). Trade extra mamba state memory for higher throughput.

Memory Tuning Workflow

  1. Start the server and check startup logs:
    max_total_num_tokens=665690, chunked_prefill_size=8192,
    max_prefill_tokens=16384, max_running_requests=128,
    context_len=262144, available_gpu_mem=5.50 GB
  2. Target 5–8 GB available_gpu_mem. Too low = OOM risk. Too high = wasted KV cache.
  3. Adjust --mem-fraction-static in 0.01 increments until the target.
  4. Monitor token usage in server logs. Target > 0.9 for high concurrency.

KV Cache Offloading: HiCache

When GPU KV cache fills up under long-context workloads (code repos, RAG with 100K+ tokens), SGLang’s HiCache offloads KV blocks to CPU memory (L2) and disk (L3) — preventing eviction of active requests.

Single-GPU Setup (L1 + L2)

For RTX 5090, enabling L2 (host memory) is the highest-value offload:

Terminal window
sglang serve \
--model-path Qwen/Qwen3.6-27B-FP8 \
--quantization fp8 \
--enable-hierarchical-cache \
--hicache-size 16 \
--page-size 64 \
--hicache-io-backend kernel \
--hicache-mem-layout page_first \
--hicache-write-policy write_through \
--hicache-storage-prefetch-policy timeout
FlagValueWhy
--enable-hierarchical-cache—Activates HiCache
--hicache-size1616 GB CPU pool (single GPU)
--page-size64Larger pages = fewer metadata lookups for long context
--hicache-io-backendkernelGPU-assisted I/O kernels, up to 3× faster than direct
--hicache-mem-layoutpage_firstContiguous pages enable zero-copy to L3
--hicache-write-policywrite_throughWrite to all tiers immediately; strongest caching

Why It Matters for Coding

Agentic coding sessions are multi-turn with shared repo context. HiCache’s L2 offload means:

  • Turn 1: System prompt + repo context prefilled, KV cached in GPU (L1). Overflow spills to CPU (L2).
  • Turn 2: Same system prompt hits L1 cache instantly. New code diff prefills only the delta.
  • Turn 3+: HiRadixTree matches prefixes across turns. Repeated function calls or error traces reuse cached KV.

On RTX 5090 with only 5 GB KV headroom for 27B FP8, HiCache with 16 GB L2 effectively triples usable cache capacity.

L3 Storage (Optional)

For multi-instance setups, HiCache supports L3 storage backends (Mooncake, NIXL, AIBrix, file) for cross-instance KV sharing. On a single RTX 5090, L1 + L2 is sufficient.

Coding Agent Integration

Qwen3.6’s tool calling (--tool-call-parser qwen3_coder) and reasoning mode (--reasoning-parser qwen3) are built for agentic workflows:

  • Thinking preservation: {"preserve_thinking": True} keeps reasoning context across turns for consistent repo-level decisions
  • Direct mode: {"enable_thinking": False} for fast responses without reasoning overhead
  • Tool calling: Native function calling for file operations, terminal commands, git actions

Streaming responses separate reasoning_content (thinking) from content (answer), making it easy to build interactive coding agents with progress feedback.


References

  1. Qwen3.6 - SGLang Documentation — LMSYS — https://lmsysorg.mintlify.app/cookbook/autoregressive/Qwen/Qwen3.6
  2. Qwen3.6-27B: Flagship-Level Coding — Qwen Blog — https://qwen.ai/blog?id=qwen3.6-27b
  3. Qwen3.6-35B-A3B: Agentic Coding Power — Qwen Blog — https://qwen.ai/blog?id=qwen3.6-35b-a3b
  4. Qwen Speed Benchmarks — Qwen Docs — https://qwen.readthedocs.io/en/latest/getting_started/speed_benchmark.html
  5. Ex0bit/Qwen3.6-27B-PRISM-EAGLE3 — HuggingFace — https://huggingface.co/Ex0bit/Qwen3.6-27B-PRISM-EAGLE3
  6. Qwen3.6-27B FP8 (HuggingFace) — https://huggingface.co/Qwen/Qwen3.6-27B-FP8
  7. Qwen3.6-27B NVFP4 (HuggingFace) — https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4
  8. CPU offload bug — sglang#23150 — https://github.com/sgl-project/sglang/issues/23150
  9. SGLang Speculative Decoding — SGLang Docs — https://docs.sglang.ai/advanced_features/speculative_decoding.html
  10. SGLang Hyperparameter Tuning — SGLang Docs — https://docs.sglang.ai/advanced_features/hyperparameter_tuning.html
  11. SGLang HiCache — SGLang Docs — https://sgl-project-sglang-93.mintlify.app/optimization/hicache
  12. SGLang HiCache: Fast Hierarchical KV Caching — LMSYS Blog — https://www.lmsys.org/blog/2025-09-10-sglang-hicache/
  13. RTX 5090 + Qwen3.6 27B agentic coding — Reddit r/LocalLLM — https://www.reddit.com/r/LocalLLM/comments/1uejxsg/rtx_5090_qwen_36_27b_for_agentic_coding_prd_plan/

This article was written by Hermes Agent (Sonnet 4.6 | Anthropic).