DFlash 2:保持并行草拟
DFlash 2: Keep Drafting Parallel

原始链接: https://inco.ai/blog/dflash2/

Inco AI 发布了 **DFlash 2**,这是投机采样(speculative decoding)技术的一次重大演进,旨在解决“智能体时代”的推理瓶颈。传统的自回归解码速度较慢,而 DFlash 2 通过并行草稿机制同时预测多个 token 块,显著提升了吞吐量。 基于初代 DFlash 的成功(该版本下载量已超过 350 万次,并被 NVIDIA 和 Meta 等行业巨头采用),DFlash 2 推出了两项关键创新: 1. **轻量级路径选择器:** DFlash 2 不再仅依赖单一的最佳候选 token,而是保留每个位置的前 16 个候选项,并通过对相邻对进行评分,确保整个草稿块的逻辑连贯性。 2. **动态短卷积:** 该技术取代了以往为修复“后缀衰减”(即块末尾准确率下降)而添加高计算成本 Transformer 层的方法,能以极低的延迟开销有效地模拟局部依赖关系。 这些功能结合使用,使接受长度(acceptance length)提升了 16%–25%,吞吐量达到标准自回归解码的 2.7–4.6 倍。DFlash 2 现已集成于 SGLang、vLLM 和 llama.cpp 等主流引擎中,为高需求的智能体工作流提供了一种高效且可扩展的解决方案。

```Hacker News最新 | 往期 | 评论 | 提问 | 展示 | 招聘 | 提交登录DFlash 2:保持并行草稿 (inco.ai)11点 由 mike-the-brain 于 35 分钟前发布 | 隐藏 | 往期 | 收藏 | 1条评论 帮助 verdverm 31 分钟前 [–] DFlash2 的 vllm PR:https://github.com/vllm-project/vllm/pull/52816回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:```
相关文章

原文

Inference is the bottleneck of the agent era. Agents read, plan, and call tools, often for hours or days. They consume tokens at a rate chat never approached. Every one of those tokens takes a full forward pass over the model. At Inco AI, we are building the inference stack scaled to the token economics of tomorrow. This post is a sneak peek.

Our team released DFlash in January; it now runs in SGLang, vLLM, TensorRT-LLM, and llama.cpp. NVIDIA measured up to 15× throughput with it on Blackwell GPUs; Google reported 3× more tokens per second on TPUs; CoreWeave's production Kimi K2.7 Code endpoint, the fastest for that model on Artificial Analysis, runs DFlash by default. The ecosystem now builds on it: NVIDIA, Red Hat, and Modal have all published DFlash drafters; Meta (Muse Glimmer), Poolside (Laguna), Xiaomi (MiMo-V2.5-Pro), and NVIDIA (Nemotron 3.5 Lightning) ship official drafters with their own models. On Hugging Face, DFlash models have been downloaded more than 3.5 million times (as of August 2026).

Speculative decoding is a core piece of the modern inference stack.1 A small draft model guesses a block of tokens, and the target model verifies the whole block in one forward pass. Good guesses turn one pass into several tokens; bad ones just get thrown away. For years, though, the draft itself stayed autoregressive: one token at a time. DFlash made it one-pass too: the entire block, every position, predicted in parallel.

DFlash 2 drafting for Qwen3.8-27B on an Apple M5 Max with oMLX, side by side with autoregressive decoding.

DFlash 2 pushes parallel drafting one step further: over 20% more output from every verification pass, for around 1% added cycle latency, with the output provably unchanged. Across benchmarks the gain runs 16–25%. With the Qwen3.8-27B drafter released today, SGLang serves at 2.7–3.4× the throughput of autoregressive decoding at batch size 1. Predicting every position independently leaves headroom in two places: choosing the right tokens and holding accuracy to the end of the block. DFlash 2 recovers both without giving up the one-pass design.

DFlash 2 already runs in the mainstream inference engines:

pip install "sglang[all] @ git+https://github.com/sgl-project/sglang.git#subdirectory=python"
 
python -m sglang.launch_server \
  --model-path Qwen/Qwen3.8-27B \
  --speculative-algorithm DFLASH \
  --speculative-draft-model-path incoai/Qwen3.8-27B-DFlash2 \
  --speculative-num-draft-tokens 8
pip install -U "vllm @ git+https://github.com/vllm-project/vllm.git@refs/pull/52816/head"
 
vllm serve Qwen/Qwen3.8-27B \
  --speculative-config '{
    "method": "dflash",
    "model": "incoai/Qwen3.8-27B-DFlash2",
    "num_speculative_tokens": 7
  }'
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
git fetch origin pull/27342/head:pr-27342
git switch pr-27342
 
# NVIDIA CUDA
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON
cmake --build build -j
 
# Apple Silicon
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_METAL=ON
cmake --build build -j
 
./build/bin/llama-server \
  -hf ggml-org/Qwen3.8-27B-GGUF:Q4_K_M \
  -hfd incoai/Qwen3.8-27B-DFlash2-GGUF:Q4_K_M \
  --spec-type draft-dflash \
  --spec-draft-n-max 7

Download and install the prebuilt oMLX with DFlash 2 support.

To run Qwen3.8-27B with DFlash 2:

  1. Open the oMLX Model Downloader and download:

  2. Open the Model Manager and edit mlx-community/Qwen3.8-27B-4bit. Configure DFlash with the following settings:

    • DFlash: enabled
    • Draft model: incoai/Qwen3.8-27B-DFlash2
    • Draft quantization: enabled
    • Runtime block size: 5
    • Verify mode: dflash
  3. Save the settings and load the target model.

DFlash predicts every position independently, in parallel. Each pick is plausible on its own. Yet nothing makes them fit together, and an incoherent block is cut short at verification. Recent methods such as Domino and DSpark buy coherence with sequential heads that rewrite each position's full-vocabulary distribution. But is that costly autoregressive correction really necessary?

No. The evidence is already in DFlash's own candidate lists. Take the first position: DFlash's top pick is right 85.4% of the time, but the right token is in its top 16 candidates 99.5% of the time. Even when the top pick is wrong, the right token is usually on the list.

Metric0123456Acceptance length
Recall@185.4%80.3%79.4%78.3%77.5%75.9%72.9%4.27
Recall@1699.5%97.3%94.8%92.6%90.8%89.4%87.8%6.79
Table 1. Recall@1 (how often the top pick is right) and Recall@16 (how often the right token is in the top 16) at each draft position, conditioned on every earlier position being right. Five-layer Qwen3-4B DFlash on GSM8K. Acceptance length includes the verifier's next token.

An oracle that always picks the right candidate from the top 16 would lift the acceptance length from 4.27 to 6.79. That gap is pure selection headroom. We just need to select the right path through the candidates.

Diffusionisgood⟨mask⟩⟨mask⟩⟨mask⟩Independent Top-1 Picksforsame word, twiceposition 1decodingspeculativeslowposition 2decodingthinkingmodelsposition 3⟨eos⟩againall adjacent pairs scored at once → one path keptaccepted outputfor

Figure 1. The selector in one cycle. With DFlash alone, each position keeps its top pick; here two neighbors both pick the same word, and the stutter dies at verification. DFlash 2 keeps each position's top candidates, and the selector traces one coherent path through them; here, the whole block survives.

A Lightweight Path Selector

Coherence is mostly local: a candidate's fit depends mainly on the token just before it, so scoring neighboring pairs should be enough. DFlash 2 keeps the top 16 candidates at each position and scores every adjacent pair: for predecessor aa and current candidate bb,

St(a,b)=Ut(b)+A(a)H(ht),B(b).S_t(a,b)=U_t(b)+\langle A(a)\odot H(h_t),B(b)\rangle.
联系我们 contact @ memedata.com