Qwen3.8-27B-DFlash2 — INT4 / INT8 draft for vLLM (tested on one and two RTX 3090)
Install from this card, not from generic snippets. This is a draft model for speculative decoding, not a standalone model: follow Requirements & install and Quick start.
Weight-only quantizations of the DFlash 2 speculative-decoding draft model z-lab/Qwen3.8-27B-DFlash2 (mirror of incoai/Qwen3.8-27B-DFlash2), made to fit next to a 4-bit Qwen3.8-27B on a 24 GB GPU. It is not a standalone model: it drafts tokens that the target model verifies, so the output of the target model does not change (greedy output is identical and sampling keeps its distribution). Quantization can only change how many drafted tokens are accepted.
Tested hardware: one RTX 3090 (24 GB, Ampere) with vLLM 0.29.0, and two RTX 3090 with tensor parallelism with vLLM 0.31.0 (added 2026-10-09, see Two RTX 3090). Only these setups have been tested.
| Revision | Quantized layers | Size | Relative weight error (mean) |
|---|---|---|---|
main |
W4A16, INT4 g128 | 1.51 GB | 11.2 % |
w8a16 |
W8A16, INT8 g128 | 2.30 GB | 0.66 % |
| (original) | BF16 | 3.85 GB | — |
Summary of our measurements (details below): the draft works with both of our 4-bit targets and accepts 3.7–5.0 tokens per step (≈2.9 with the built-in MTP head), but on a single RTX 3090 it gives only +10–25 % decode speed with one request and no gain with two, and its KV cache limits the context to ≈60–70k tokens (222k with MTP). For a single 24 GB GPU we still recommend MTP.
Two GPUs (tested 2026-10-09): the intended setup for this draft was two GPUs, where the extra VRAM leaves room for a long context next to the draft. On 2× RTX 3090 with tensor parallelism the long context is indeed there (≈210k tokens tested, 8/8 needle at 188k, tool calls 30/30), but the speed gain is not: against the built-in MTP head (3 tokens) on the same two GPUs, the draft gives +7 % with one request, +3 % with two and −19 % with eight, while MTP alone already reaches the full 262,144-token context. Our recommendation is MTP on both one and two GPUs; details in Two RTX 3090. Reports from other setups are very welcome (see Feedback welcome below).
Our focus. We quantize and evaluate models for one use case: a local Linux system-administration agent (opencode with tool calling) for a university IT department, used in Spanish. Our calibration traces include real sysadmin/agent conversations in Spanish, and our quality checks (tool calls with the real opencode request, agent tasks with real command execution, long-context retrieval, long answers in Spanish) reflect that use. KL divergence is also reported on turboderp's public trace, so it can be compared and reproduced. Numbers for other domains or languages may differ.
What is in this repository
| Branch | Size |
|---|---|
main |
1.5 GB of weights |
w8a16 |
2.3 GB of weights |
Download a branch with hf download JRamirez-UAB/Qwen3.8-27B-DFlash2-W4A16 --revision <branch> --local-dir <dir>.
Results
Benchmarks (single RTX 3090 24 GB, vLLM 0.29.0)
Setup: 4-bit targets from the cards above (mtp-int8 revision, its MTP head unused), --language-model-only, fp8 (e4m3) KV cache,
prefix caching, 2 sequences, 7 speculative tokens, --max-model-len 32768. Decode: 800 forced output tokens without reasoning.
"Reasoning" = 6 short problems with checkable answers (reasoning_effort xhigh); "tools" = the real request of the opencode coding agent
(opencode 1.18.33, captured and replayed against vLLM)
(long system prompt, 11 tools), 6 requests. Accepted tokens per step = 1 + accepted drafts / verification steps.
| Target + draft (KV cache) | KV pool (tokens) | Accepted per step: decode · reasoning · tools | Decode, 1 request, t=0 / 0.6 | 2 requests, aggregate, t=0 / 0.6 | Peak VRAM (free) |
|---|---|---|---|---|---|
| Qwen3.8 + W4A16 (6.3 GB) | 69,842 | 3.79 · 4.62 · 4.70 | 115 / 109 tok/s | 173 / 175 tok/s | 23,672 MiB (904) |
| Qwen3.8 + W8A16 (5.5 GB) | 60,854 | 4.00 · 4.36 · 3.90 | 113 / 137 tok/s | 170 / 177 tok/s | 23,382 MiB (1,194) |
| Qwopus + W4A16 (6.3 GB) | 69,842 | 3.70 · 4.51 · 4.58 | 104 / 115 tok/s | 169 / 165 tok/s | 23,486 MiB (1,090) |
| Qwopus + W8A16 (5.5 GB) | 60,854 | 3.75 · 4.78 · 4.97 | 108 / 101 tok/s | 184 / 173 tok/s | 23,380 MiB (1,196) |
| Swift 1.5 + W4A16 (6.3 GB) | 69,842 | 3.84 · 4.63 · 4.89 | 126 / 106 tok/s | 176 / 172 tok/s | 23,486 MiB (1,090) |
| Swift 1.5 + W8A16 (5.5 GB) | 60,854 | 3.89 · 4.81 · 5.45 | 115 / 117 tok/s | 185 / 176 tok/s | 23,380 MiB (1,196) |
| Reference: MTP 3 (INT8 head), 222k context | 223,441 | ≈2.9 | 94–98 / 89–92 tok/s | 174–187 tok/s |
"Peak VRAM (free)" is 24,576 MiB minus used; the driver reserves 453 MiB, so the real headroom is ≈450 MiB less. Swift 1.5 is ukisai/Swift-1.5-Qwen3.8-27b quantized with the same recipe as our other targets.
In all six runs: tool calls 6/6, reasoning answers 6/6 correct, 8/8 facts recovered from a 27k-token prompt (≈1,080 tok/s prefill), no out-of-memory errors. INT4 and INT8 drafts give the same acceptance within run-to-run noise; INT4 leaves ≈9k more tokens of context.
Why the gain is small on one GPU: the draft has ≈1.9 B parameters (five 5120-wide layers), so drafting a block costs a noticeable share of a target step, and with two requests the verification of 8 tokens per request no longer comes for free.
Two RTX 3090 (tensor parallel 2, vLLM 0.31.0)
Setup (2026-10-09): two RTX 3090 (24 GB each, power limit 350 W, PCIe 4.0 x16, no NVLink), vLLM 0.31.0 with the 4-line embedding patch,
--tensor-parallel-size 2, target JRamirez-UAB/Swift-1.5-Qwen3.8-27B-GPTQ-W4A16-g64-embed-int8-24GB
(text only), fp8 (e4m3) KV cache, prefix caching, --max-num-batched-tokens 1024, --max-num-seqs 8. The KV cache size per GPU was
chosen so that ≈1.3 GB per GPU stays really free at rest. MTP and DFlash 2 were run one after the other on the same two GPUs.
| Speculation (KV cache per GPU) | Context tested | KV pool (tokens) | Accepted per step | Decode 1 request, t=0 / 0.6 | 2 requests, aggregate | 8 requests, aggregate | Needle (8 facts) | 2 long sessions at once | Tools | Lowest real free VRAM |
|---|---|---|---|---|---|---|---|---|---|---|
| MTP 3 (13.9 GB) | 262,144 | 730,781 | ≈3.1 | 112 / 109 tok/s | 182 / 181 tok/s | 453 / 391 tok/s | 8/8 at 234k (711 tok/s prefill) | 8/8 + 8/8 (2 × 113k) | 30/30 | 1,200 MiB |
| DFlash 2 W4A16, 7 tokens (12.7 GB) | 209,994 | 474,139 | ≈4.2 | 120 / 112 tok/s | 187 / 167 tok/s | 367 / 347 tok/s | 8/8 at 188k (798 tok/s prefill) | 8/8 + 8/8 (2 × 91k) | 30/30 | 1,090 MiB |
"Tools" = the real opencode request, 15 with reasoning (reasoning_effort xhigh) and 15 without. No engine errors in either run.
- Speed: the draft's acceptance drops to ≈45 % of its 7 drafted tokens with this fine-tuned 4-bit target (MTP: ≈70 % of 3), so the gain over MTP is small with one request (+7 %) and turns into a loss with many (−19 % at 8 requests), where verifying 8 tokens per request is no longer free.
- Context: with two GPUs the draft's large KV cost is no longer a problem. The 209,994 tokens tested come from our sizing step at a
32k
--max-model-len, which underestimated the pool; with the final setting vLLM reported 474,139 tokens, so the full 262,144 very likely fits too (not tested). - Conclusion: on 2× RTX 3090, MTP 3 alone gives the full 262,144-token context, room for several long sessions and the best throughput with many requests. DFlash 2 is only marginally faster for a single request.
Sampling and repetition loops
Not applicable to the draft itself: speculative decoding does not change what the main model generates, so loops depend on the main model and its sampling.
Requirements & install
Installation and serving are described together in Quick start below.
Quick start
vLLM 0.29.0 supports DFlash 2 natively (DFlash2DraftModel); it needs the V2 model runner, which vLLM selects by default.
Example with our 4-bit Qwen3.8 target (JRamirez-UAB/Qwen3.8-27B-GPTQ-W4A16-embed-int4-24GB,
which needs a small vLLM patch described on its card), text only, 2 concurrent sequences:
vllm serve JRamirez-UAB/Qwen3.8-27B-GPTQ-W4A16-embed-int4-24GB --revision mtp-int8 \
--language-model-only \
--max-model-len 32768 \
--kv-cache-dtype fp8_e4m3 \
--kv-cache-memory-bytes 6300000000 \
--max-num-seqs 2 \
--enable-prefix-caching \
--speculative-config '{"method":"dflash","model":"JRamirez-UAB/Qwen3.8-27B-DFlash2-W4A16","num_speculative_tokens":7}' \
--reasoning-parser qwen3 \
--enable-auto-tool-choice --tool-call-parser qwen3_coder
For the INT8 draft add "revision":"w8a16" to the speculative config and use --kv-cache-memory-bytes 5500000000.
The same works with JRamirez-UAB/Qwopus3.8-27B-Flash-V2-GPTQ-W4A16-embed-int4-24GB
(add its --chat-template chat_template-xml-tools.jinja).
For use from opencode (our target client), see the Using it with opencode section of those cards; the same opencode configuration works,
only with a smaller limit.context (it must stay below the --max-model-len used here).
Important notes
- The draft's KV cache is large in vLLM 0.29: with DFlash 2 each token of context costs ≈90 KB of KV cache, against ≈35 KB with MTP
(measured: 5.5 GB → 60,854 tokens, 6.3 GB → 69,842, 7.3 GB → 80,890). vLLM reserves the draft's KV as if its sliding-window (2048)
layers were full attention. The
--max-model-lenmust stay below theGPU KV cache sizeprinted at start-up. - Size the KV cache with
--kv-cache-memory-bytes, not--gpu-memory-utilization. With 7.3 GB of KV cache (INT4 draft) the server started but ran out of memory on a 15k-token prompt with two requests; the values above leave 0.9–1.2 GB free at peak. - The fp8 KV cache works for the draft on Ampere (FlashInfer supports its non-causal attention).
- The draft was trained on the hidden states of the BF16 Qwen3.8-27B. With our 4-bit targets (and with the Qwopus fine-tune) the acceptance is still 3.7–5.0 tokens per step, lower than the 4.1–5.5 reported by the authors for BF16 on an H200.
Using it with opencode
This repository is a draft model for speculative decoding: configure opencode for the main model it accelerates (see that model's card); nothing changes on the opencode side.
Important notes
Nothing beyond Quick start and Limitations.
Quantization recipe
| Component | Treatment |
|---|---|
layers.*.self_attn.o_proj, layers.*.mlp.{gate,up,down}_proj, fc (21 linear layers) |
INT4 (main) or INT8 (w8a16), symmetric, group size 128, RTN (min-max) |
layers.*.self_attn.{q,k,v}_proj |
BF16 — vLLM 0.29 reads qkv_proj.weight directly to precompute the context K/V (_build_context_kv_buffers), so a quantized q/k/v fails to load ('QKVParallelLinear' object has no attribute 'weight') |
| Candidate selector, dynamic-convolution projections, norms | BF16 (vLLM builds them without quantization) |
- Format:
compressed-tensorspack-quantized(Marlin W4A16 / W8A16 kernels in vLLM). The quantized layers are listed inconfig.json(quantization_config); vLLM reads the draft's own quantization config. - No calibration data (round-to-nearest). Script:
scripts/dflash_quant.py(compressed-tensors 0.19.0). - The draft has no embeddings or
lm_headof its own: it uses the target model's (INT4 in our targets, which works).
Limitations
- Review the commands before they run. As an agent, the model proposes shell commands and opencode can execute them: review them before running anything as root or with
sudo, and give the agent a non-privileged account and a test machine where you can. - Two-GPU results: one fine-tuned target (Swift 1.5 v4), one draft revision (
main, W4A16), short runs; 262,144 with the draft not tested. - Single-GPU results: short runs only (a few minutes per configuration,
--max-model-len 32768): the full KV pool (60–70k tokens) was not validated with a near-maximum-length prompt. - Acceptance was measured on our 4-bit targets only, not on the BF16 Qwen3.8-27B.
- All numbers come from one machine and one software stack.
Feedback welcome
I would be grateful for reports of installations of this checkpoint, both working and failed ones. Please open a discussion in the Community tab with your GPU(s), driver, vLLM version, the full command line and the result (speed, context, or the error message). Failed attempts are just as useful as successful ones: they help to document which setups work.
Credits & license
- Draft model: z-lab/Qwen3.8-27B-DFlash2 / incoai/Qwen3.8-27B-DFlash2 by Inco AI (blog, code); DFlash: Chen, Liang and Liu, ICML 2026.
- Tools: compressed-tensors, vLLM.
- Apache-2.0, same as the original draft. This is a community quantization, not an official release of Inco AI, z-lab or Qwen.