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

Abierto
#1,176 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
C++
Estrellas
2.1k
Forks
184
Merge medio
12 h 22 min
PR fusionados (30 d)
239

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ROCm/FastFlowLM

Todos los issues de ROCm/FastFlowLM

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.