[Feature]: DFlash2 speculative decoding for Inkling-2-Mini (like qwen3.8-dflash2)

オープン
#1,176 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

Start with flm-dev-kit/FLM_DLL/detail/inkling2_npu, the speculation hook in include/AutoModel/model_extension.h, and the closest template qwen3_8mtp_npu/speculate/dflash2_draft.hpp. Trace multi-token verification, target-layer hidden states, and checkpoint/restore behavior before modifying the NPU path. Done means Inkling-2-Mini can use the DFlash2 drafter, reject invalid speculative tokens correctly, and demonstrate the expected decode-throughput gain with the reported model settings.

索引モデルが issue の本文から書いたものです。

説明

Suggestion Description

Please add DFlash2 speculative decoding for inkling-2 (Inkling-2-Mini-NPU2), the way qwen3.8-dflash2 does it for Qwen3.8.

The drafter exists. incoai/Inkling-2-Mini-DFlash2 is Apache-2.0 and comes with an sglang reference (sglang_inkling_dflash2.py). From its config.json:

  • 5 sliding-window layers, hidden size 2304, block size 8;
  • a low-rank selector (rank 256, top-k 16);
  • target_layer_ids [5, 23, 41, 48], counted over the 48 logical layer visits (num_target_layers 48).

What it gains on the iGPU. We ran it with llama.cpp on the Radeon 890M (Vulkan, --spec-type draft-dflash2):

  • Setup: target Inkling-2-Mini with NVFP4 experts and Q8_0 elsewhere; drafter converted to Q8_0; draft length 2.
  • Method: decode throughput on the same 24 chat prompts with and without the drafter, paired per prompt.
machine draft 2 prose prompts only draft 3 draft 4
Ryzen AI 9 HX PRO 375 +13.7 % (p < 0.05) +0.5 % +11.1 % +4.5 % (n.s.)
Ryzen AI 9 HX PRO 370 +12.2 % (p < 0.05) -1.7 % (n.s.)

Why we'd like it on the NPU. Same requests on the HX PRO 375, FLM v1.0.14 against llama.cpp Vulkan without a drafter (document summaries at 1k to 32k context, 128 decoded tokens each):

1k 2k 4k 8k 16k 32k
FLM NPU prefill, tok/s 387 552 564 642 644 606
Vulkan prefill, tok/s 157 166 162 156 140 118
FLM NPU decode, tok/s 12.4 12.5 12.2 11.7 10.9 9.7
Vulkan decode, tok/s 13.2 12.8 12.8 12.4 11.7 10.5

So the NPU prefills 2.5 to 5 times faster and decodes 6 to 8 % slower. With a drafter at the iGPU's gain, FLM would lead on both.

An honest caveat. On these long-document summaries the drafter helped less on Vulkan:

  • decode 13.4 / 14.6 / 12.9 tok/s at 1k / 2k / 4k;
  • 11.5 / 11.1 / 10.2 tok/s at 8k / 16k / 32k, below plain decode.

We think the cost there is the verify pass. On the 890M a 3-token verify takes about 135 ms against 78 ms for a 1-token decode, mostly because the MoE expert matmuls run once per token (2.9 times the expert time of one decode step). We don't know what a 3-token pass costs on the NPU. If it is close to one decode step, the NPU should gain at least as much as the iGPU.

What the engine would need, as far as we can tell from flm-dev-kit/FLM_DLL/detail/inkling2_npu and the speculation hook in include/AutoModel/model_extension.h:

  • a verify pass over 1 + n tokens that returns logits for every position;
  • the hidden states at the drafter's four target layers;
  • rollback of rejected positions. checkpoint() / restore() already exist, but we haven't checked whether they cover the cross-pass loop state.

qwen3_8mtp_npu/speculate/dflash2_draft.hpp looks like the closest template.

Related: #1110 (Inkling-2-Mini support). Happy to test a build on Strix Point under Linux and report numbers.

Operating System

Linux (Kali, kernel 7.2.15)

GPU

Ryzen AI 9 HX PRO 370 / HX PRO 375 (Strix Point: XDNA2 NPU, Radeon 890M)

ROCm Component

FastFlowLM


Assisted-by: Claude Code

主要言語
C++
スター
2.1k
フォーク
184
平均マージ
12時間 22分
マージ済み PR(30日)
239

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ROCm/FastFlowLM のほかの issue

ROCm/FastFlowLM の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。