Qwen3-4B-NeuralRouter-df-e3
A WhiFlash-Neural token-level router for Qwen/Qwen3-4B (paper · code).
This is not a language model. At each decoding step it maps the target's final hidden state to the predicted acceptance-length gain (ΔAL) of switching drafters; a threshold turns that scalar into the routing decision, so the operating point is tunable per hardware without retraining.
Model Details
| Target model | Qwen/Qwen3-4B |
| Router | 2-layer MLP (hidden state → GELU → scalar ΔAL) |
Drafter pair (--whiflash-drafters) |
df-e3 — DFlash (diffusion, parallel) vs EAGLE-3 (autoregressive) |
DDTree budget (--ddtree-tree-budget) |
n/a (no DDTree drafter in this pair) |
| Training data | Dolci Instruct SFT — task-agnostic, since the router conditions only on the hidden state |
| Objective | MSE on ΔAL = AL_pos − AL_neg |
Installation
git clone https://github.com/SamsungLabs/WhiFlash.git
cd WhiFlash
uv sync
Quick Usage
uv run benchmark.py \
--speculative-algorithm WHIFLASH \
--model-name-or-path Qwen/Qwen3-4B \
--draft-name-or-path z-lab/Qwen3-4B-DFlash-b16 \
--whiflash-eagle-draft WhiFlash/Qwen3-4B-EAGLE3 \
--whiflash-drafters df-e3 \
--whiflash-router neural \
--whiflash-neural-router-path WhiFlash/Qwen3-4B-NeuralRouter-df-e3 \
--whiflash-neural-router-threshold 1.0 \
--dataset mt-bench --max-samples 10 --max-new-tokens 2048
--whiflash-neural-router-path also accepts a local directory or an exported
.safetensors file, so this repo id can be swapped for a router you trained yourself.
This router was trained for one drafter pair and budget, both recorded in config.json.
In the repo id, df = DFlash, ddt = DDTree, e3 = EAGLE-3 and bN = DDTree tree
budget N.
Evaluation
Per-category throughput gain of WhiFlash-Neural over the standalone drafters it chooses between, on an NVIDIA H100 with greedy decoding and 2048 max new tokens:
| Category | vs. EAGLE-3 | vs. DFlash |
|---|---|---|
| Chat | +7.8% | +33.7% |
| Math | +69.6% | +4.8% |
| Coding | +63.4% | +6.5% |
| Agentic | +19.9% | +3.4% |
Categories aggregate Chat (MT-Bench, Alpaca, UltraChat, WildChat), Math (GSM8K, MATH-500, AIME'24/'25), Coding (HumanEval, MBPP, LiveCodeBench) and Agentic (SWE-bench, τ-bench, AgentBench, AgentInstruct). Full acceptance-length and speedup tables are in the paper.
Citation
@misc{kwon2026whiflash,
title={{WhiFlash: Accelerating Speculative Decoding with Token-Level Cross-Paradigm Routing}},
author={Young D. Kwon and Miles Williams and Rui Li and Alexandros Kouris and Stylianos I. Venieris},
year={2026}, eprint={2606.07710}, archivePrefix={arXiv}, primaryClass={cs.LG},
url={https://arxiv.org/abs/2606.07710},
}
The Qwen3 EAGLE-3 drafters used with this router were trained with SpecVocab:
@inproceedings{williams-etal-2026-speculative,
title = "Speculative Decoding with a Speculative Vocabulary",
author = "Williams, Miles and Kwon, Young D. and Li, Rui and Kouris, Alexandros and Venieris, Stylianos I.",
editor = "Liakata, Maria and Moreira, Viviane P. and Zhang, Jiajun and Jurgens, David",
booktitle = "Findings of the {A}ssociation for {C}omputational {L}inguistics: {ACL} 2026",
month = jul,
year = "2026",
address = "San Diego, California, United States",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.findings-acl.2000/",
doi = "10.18653/v1/2026.findings-acl.2000",
pages = "40240--40254",
ISBN = "979-8-89176-395-1"
}
- Downloads last month
- 141