Qwen4-35B-A3B W4A16 (INT4 experts + Qwen's FP8 n-gram table) for 2x RTX 3090

A day-0 vLLM W4A16 recipe for 2x RTX 3090: a quantized build of Qwen/Qwen4-35B-A3B (image + text) that runs with vLLM tensor parallel 2 on two 24 GB Ampere cards, tested on 2x RTX 3090.

  • Routed experts: INT4 (W4A16, group size 32, symmetric, compressed-tensors pack-quantized).
  • N-gram (PLE / Engram) embedding table: FP8 E4M3, byte-for-byte from Qwen's own Qwen/Qwen4-35B-A3B-FP8.
  • Everything else: BF16, unchanged.
  • Checkpoint 45.7 GB (42.6 GiB); 12.0 GiB of weights per GPU at TP2. The 20.5 GB FP8 n-gram table stays on NVMe (vLLM --engram-config.disk_offload) and only the rows each step needs are read.

Scripts (quantizer, launcher, bench): https://github.com/tonyd2wild/Qwen4-35B-A3B-RTX3090

Tiers: which setup to run

The GitHub repo has a launcher for each tier, a "which tier should I run?" guide, and the raw results. All rows were measured on 2x RTX 3090 with an NVLink bridge, TP2:

  • thinking off, 512-token answers, Qwen's non-thinking sampling;
  • speeds in tok/s;
  • tiers 2-4 at util 0.94; tier 1 at util 0.90.
Tier Best for Launch (from the repo) 1 stream, prose / code 4 streams, prose / code (total) KV pool / max context
1. Default: MTP=1, BF16 KV (stock) chat, assistants, agents P2P=1 ./launch/launch_tp2.sh 163.8 / 187.1 499 / 572 386,103 / 262,144
2. DFlash2 drafter coding agents P2P=1 ./launch/launch_tp2_dflash2.sh 152.2 / 329.4 418 / 855 343,826 / 262,144
3. MTP=1 + FP8 KV long documents P2P=1 KV=fp8 MAXLEN=491520 ./launch/launch_tp2.sh 151.1 / 170.5 473 / 539 684,195 / 491,520
4. DFlash2 + FP8 KV long-context coding P2P=1 KV=fp8 MAXLEN=491520 ./launch/launch_tp2_dflash2.sh 150.7 / 322.6 398 / 822 612,976 / 491,520
5. No NVLink bridge (MTP=1) two cards, no bridge ./launch/launch_tp2.sh 151.1 (mixed prompts) n/a as tier 1
  • DFlash2 (tiers 2 and 4) uses RadixArk's drafter RadixArk/Qwen4-35B-A3B-Dflash2.
    • It needs a 2-file vLLM patch, shipped as a diff in the repo. The patch adds Qwen4 aux hidden-state taps at layers 20/24/28/32/36 (the same tensor that SGLang PR #55182 captures) and allows the dflash method for Qwen4.
    • The launcher downloads the drafter. It is not part of this checkpoint.
  • FP8 KV (--kv-cache-dtype fp8) works on Ampere with no patch. It gives 1.6-1.8x the BF16 KV pool.
    • With DFlash2 it also needs --block-size 2304; the launcher adds it.
    • Needle recall (3 of 3) passed at 420K tokens on both FP8 tiers.

Results (2x RTX 3090, TP2, vLLM qwen4 image)

Speed. Every bench request starts with a random run id so the prefix cache cannot help.

Config Single stream decode 4 concurrent, per stream 4 x 512 tokens, total TTFT short / 2.3K / 9.1K
NCCL P2P off, MTP off 113 tok/s 84-86 tok/s 330 tok/s 0.04 / 0.59 / 2.33 s
NCCL P2P off, MTP=1 151 tok/s 113 tok/s n/a 0.05 / 0.64 / 2.46 s
NVLink P2P, MTP off 118 tok/s 98-99 tok/s 388 tok/s 0.04 / 0.30 / 1.15 s
NVLink P2P, MTP=1 172-174 tok/s 135-141 tok/s 495 tok/s 0.05 / 0.29 / 1.16 s

"NVLink P2P" needs an NVLink bridge between the two cards (-e NCCL_P2P_LEVEL=NVL instead of the two NCCL_* settings in the command below). MTP=3 (Qwen's recipe value) measured 147 tok/s single stream with P2P off, slightly below MTP=1. Full matrix: results/ in the GitHub repo.

VRAM: 12.0 GiB of weights per GPU; KV cache, activations and CUDA graphs use the rest of the --gpu-memory-utilization 0.94 budget (peak 22.4 of 24 GiB per card under load).

Quality (temperature 0, thinking off), against Qwen's own FP8 release:

Check This build Qwen4-35B-A3B-FP8
Chat (capital of Australia + 17 x 23) pass pass
Image (synthetic: red circle, blue square, the number 43) pass pass
Tool call (get_weather, Tokyo, celsius) pass pass
Mean NLL, 6 fixed texts, 885 tokens 0.979 (PPL 2.66) 0.987 (PPL 2.68)
Top-1 next-token agreement with FP8 92.7% n/a

Thinking mode (default) also answered the bat-and-ball and "r's in strawberry" questions correctly. Bench and comparison scripts: bench/ in the GitHub repo.

What was quantized

Part Params Format here Source
Routed experts, 40 layers + MTP layer (256 experts each; gate, up, down) 33.0B INT4 W4A16, group 32, symmetric, BF16 scales quantized from the BF16 release
N-gram embedding table (layers.1.ple.ple_embedding.ngram_embedding, 128 shards) + its global scale 20.5B FP8 E4M3 unchanged bytes from Qwen/Qwen4-35B-A3B-FP8
Token embeddings, lm_head, Gated DeltaNet linear attention, sparse attention + indexer, shared experts, routers, hyper-connections, PLE projections/norms, vision tower, MTP non-expert weights 3.3B BF16 unchanged from the BF16 release

The n-gram table is a lookup table, not a matrix multiply, so GPTQ/AWQ-style quantization does not apply. In BF16 it is 41 GB on its own; Qwen's FP8 release already ships it as FP8, so those bytes are reused as-is.

How it was made

  1. Downloaded the BF16 release (minus files 00001-00010, which hold only the BF16 n-gram table) and the FP8 release's table files.
  2. Routed experts: data-free round-to-nearest INT4. For each group of 32 weights the scale is picked by an MSE search over 11 clip ratios (1.0 down to 0.75), with the scale rounded to BF16 before it is scored. No calibration data. The fused BF16 gate_up_proj was split into gate_proj (rows 0-511) and up_proj (rows 512-1023); that split was checked against Qwen's FP8 per-expert weights (cosine 0.9996 on the right pairing, ~0 on the swapped one). Mean relative RMSE of the INT4 experts vs BF16: 0.090 (range 0.088-0.099 over 123 expert tensors).
  3. N-gram table: the FP8 shards and the global weight_scale were copied unchanged.
  4. config.json: added quantization_config (compressed-tensors, targets .experts.) and text_config.ple_embedding_dtype: "float8_e4m3fn" so vLLM reads the table as FP8.

Requirements

  • 2x 24 GB NVIDIA GPUs (tested: RTX 3090, driver 580.178.04, CUDA 13.0 driver API)
  • Docker image vllm/vllm-openai:qwen4 (tested digest sha256:63a160daa7b2c7eac713d2097c6d84d52d4ccf9a935788acdd610a563d39d286, vLLM commit f247de72). Qwen4 support (vllm-project/vllm#71659) was not in a vLLM release when this was made.
  • Local NVMe for the checkpoint: the FP8 table is read from disk at runtime.
  • Host RAM is not a constraint: tested on a box with 31 GB total.

Quick start (2x RTX 3090, TP2)

hf download Tech2wild/Qwen4-35B-A3B-W4A16-FP8PLE --local-dir ~/models/Qwen4-35B-A3B-W4A16-FP8PLE

docker run -d --name qwen4-w4a16 --gpus '"device=0,1"' --ipc=host -p 8017:8000 \
  -e NCCL_P2P_DISABLE=1 -e NCCL_CUMEM_ENABLE=0 -e VLLM_USE_RUST_FRONTEND=1 \
  -v ~/models/Qwen4-35B-A3B-W4A16-FP8PLE:/models/model:ro \
  vllm/vllm-openai:qwen4 /models/model \
  --served-model-name qwen4-35b-a3b-w4a16 --trust-remote-code \
  --tensor-parallel-size 2 --disable-custom-all-reduce \
  --engram-config.disk_offload true \
  --max-model-len 262144 --gpu-memory-utilization 0.94 \
  --limit-mm-per-prompt '{"image":4,"video":0}' \
  --enable-auto-tool-choice --tool-call-parser qwen4 --reasoning-parser qwen4 \
  --speculative-config '{"method":"mtp","num_speculative_tokens":1,"index_share_for_mtp_iteration":true}'

Ready when the log says OpenAI server is ready to accept requests (about 3 minutes). With an NVLink bridge, replace -e NCCL_P2P_DISABLE=1 -e NCCL_CUMEM_ENABLE=0 with -e NCCL_P2P_LEVEL=NVL (fastest setting measured).

Thinking is on by default (reasoning_effort: "high"); send "reasoning_effort": "none" for direct answers.

MTP: the built-in MTP head is in the checkpoint (its experts are INT4 too). One draft token (num_speculative_tokens: 1) was the fastest setting on 2x 3090; Qwen's recipe uses 3. Drop the --speculative-config line to turn it off.

Limits

  • Data-free quantization. No calibration set was used. A GPTQ/AWQ-calibrated build may score better.
  • The quality reference is Qwen's FP8 release served by SGLang, not BF16 (BF16 does not fit the test hardware), so part of the difference is the engine. Speed numbers come from a handful of prompts.
  • Speed was measured with prompts up to 9.1K tokens.
  • Tested only with the image above, on RTX 3090s, with vLLM. Loading with plain transformers was not tested.
  • The n-gram table is read from storage every step; put the checkpoint on NVMe.
  • Context: 262,144 tokens at util 0.94 (BF16 KV pool 386,103 tokens). Checked with needle recall (3/3) on a 150K request alongside 4 streams, two 180K requests and one 250K request; no full long-context benchmark. --kv-cache-dtype fp8 grows the pool to 684,195 tokens at util 0.94 and serves 491,520 tokens of context (420K needle 3/3, 4-9% slower; tier 3 above).

License and change notice

This checkpoint is a derivative of Qwen/Qwen4-35B-A3B by the Qwen team (Alibaba Cloud), released under the Apache License 2.0, and is distributed under the same license (see LICENSE, copied unchanged from the original repository).

Changes made (Apache-2.0 §4b):

  • The routed expert weights were quantized from BF16 to INT4 and stored per expert in the compressed-tensors format (model-w4a16-*.safetensors).
  • The BF16 n-gram embedding table was replaced by the FP8 table from Qwen/Qwen4-35B-A3B-FP8 (model-fp8-ple-*.safetensors, bytes unchanged).
  • config.json: quantization_config added; text_config.ple_embedding_dtype added.
  • model.safetensors.index.json rewritten for the new files; quant_log.jsonl added (per-tensor INT4 error).

All other files (tokenizer, processor, chat-template compat files, generation config, Python helper files, LICENSE) are unchanged copies of the original. This is an unofficial build, not affiliated with or endorsed by the Qwen team.

Credits

Thank you to everyone whose work this builds on:

  • Qwen team (Alibaba Cloud): Qwen/Qwen4-35B-A3B, the base model, and Qwen/Qwen4-35B-A3B-FP8, whose FP8 n-gram table is reused byte-for-byte and which is the quality reference. Apache-2.0; see the license and change notice above.
  • vLLM project (vllm-project/vllm): the vllm/vllm-openai:qwen4 image this was built and tested in, its Qwen4 implementation, and the Engram disk-offload path. Apache-2.0.
  • Thien Tran for the vLLM Qwen 4 recipe (recipes.vllm.ai, PR #71737), whose MTP speculative config the quick start uses.
  • compressed-tensors by Red Hat AI and the vLLM project (vllm-project/compressed-tensors): the checkpoint format.
  • Marlin by Elias Frantar, Roberto L. Castro, Jiale Chen, Torsten Hoefler and Dan Alistarh (IST-DASLab/marlin, paper): the INT4 kernel design behind vLLM's MarlinExperts, which runs these INT4 experts on the 3090s.
  • RadixArk for the DFlash2 drafter RadixArk/Qwen4-35B-A3B-Dflash2 used in tiers 2 and 4. It is not part of this checkpoint, and its card lists no license.
  • DFlash by Jian Chen, Yesheng Liang and Zhijian Liu (paper, z-lab/dflash) and DFlash 2 by Inco AI (blog): the block-drafting method the drafter is built on.
  • SGLang (sgl-project/sglang): Qwen 4 day-0 support in PR #55182 by Qiaolin Yu and co-authors, the reference for the DFlash2 tap location. SGLang also served the FP8 reference in the quality table.
  • NVIDIA NCCL (NVIDIA/nccl): the TP2 all-reduce, over NVLink with NCCL_P2P_LEVEL=NVL.
  • Greg Kamradt for the needle-in-a-haystack test (gkamradt/needle-in-a-haystack) behind the context checks.
Downloads last month
-
Safetensors
Model size
57B params
Tensor type
BF16
·
I64
·
I32
·
F8_E4M3
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Tech2wild/Qwen4-35B-A3B-W4A16-FP8PLE

Quantized
(244)
this model

Papers for Tech2wild/Qwen4-35B-A3B-W4A16-FP8PLE