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

Đang mở
#1,176 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C++
Star
2.1k
Fork
184
Merge trung bình
12 giờ 22 phút
Pull request đã merge (30 ngày)
239

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ROCm/FastFlowLM

Tất cả issue của ROCm/FastFlowLM

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.