Skip to content

[Engine] feat: inkling2 dflash2 - #358

Draft
drakarah wants to merge 3 commits into
simplexai-labs:mainfrom
drakarah:feat/inkling2-dflash2
Draft

drakarah wants to merge 3 commits into
simplexai-labs:mainfrom
drakarah:feat/inkling2-dflash2

Conversation

@drakarah

Copy link
Copy Markdown
Contributor

The title must start with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], for example "[Engine] fix decode stop on long prompts" or "[GUI] keep the model list after a tab switch".

Problem and result

Add Dflash2 support for inkling 2 (issue #330)

This is a WIP

Related discussion

Approach

Validation

Passed:

Failed:

Not run:

Limits

drakarah and others added 2 commits November 26, 2026 11:34
…labs#339)

A dflash GGUF with selector_hidden.weight (incoai/Inkling-2-Mini-DFlash2 as qwen.py converts it) runs as a DFlash2
drafter: two-tap dynamic grouped convolutions around attention and MLP, a fusion matrix over the four features, and a
selector walk over the top 16 candidates of each mask row. It reuses DSpark's layer caches, feature capture, rope,
attention and graph recording. DSpark files take the old path unchanged; Metal refuses a DFlash2 file.

Compiles for HIP gfx1010. Not run: no card here holds Inkling 2 Mini with a drafter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lexai-labs#339)

The drafter has its own attention: 32 query heads over 8 KV heads, while Inkling 2 Mini's target has 24. The
engine checked the drafter's head count against the target's and refused the file, and it took the query width
from the target too. Now the drafter's heads are read from its file (ds_heads_) for its weights, RoPE, attention
and buffers. The attention kernel takes 32 query rows a KV head (4 heads of 8 block rows), up from 24.

A DFlash2 file has no dflash.sample_from_anchor (a DSpark key), so absent means drafting from the mask rows.

The converter: a DFlash2 file keeps target_layer_ids as they are. Its last id is the final state (48 of 48 layers),
so the +1 the other DFlash drafters take would put it past the last layer. A target whose architecture the converter
does not know (Inkling 2 Mini's loop model) gives the drafter its size and mask token only: the engine takes the
tokenizer from the target's file.

Measured on RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, 8-token prompt, 64 new tokens,
--window 4: the DFlash2 file loads, and with the drafter forced on (a test-only change, reverted) 7 of 13 guesses
were accepted. Without forcing it, the drafter does not guess on this card: blocks are asked only when every routed
expert is in VRAM (3072 experts; 758 fit here), so the output equals the no-drafter run at the same window.
Not measured: the drafted output against the no-drafter output over longer runs (batched numerics differ at the
window size), DSpark files (none here), and the Metal backend.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs-format Title or description does not follow CONTRIBUTING.md yet label Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Thanks for the pull request. To keep the tracker readable, every item needs an area prefix in the title and the parts of the pull request template filled in. This one is missing:

  • Fill in "Validation": the exact commands, the revision and environment tested, what you saw. Keep Passed, Failed and Not run apart.

Edit the pull request (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

simplexai-labs#339)

ds2_topk() took the 16 best of the whole vocabulary in one block a mask row, so with 8 rows only 8 blocks ran. Now each
row's vocabulary is cut into 32 ranges, one block each (ds2_topk_part_kernel), and a merge kernel takes the 16 best of
the 512 partial candidates (ds2_topk_merge_kernel). Same ordering as before: value descending, a tie the lower id first.

Measured on RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, the 8-token prompt, 64 tokens, --window 4,
drafter forced on (a test-only change, reverted): the output is byte-identical to the build before this commit; kernel
time per round went from 193 us (ds2_topk) to 46 us (34 us split + 12 us merge); drafter kernels summed to 5.9 ms
against 12.2 ms over the traced run. Acceptance counts differ between runs (25 of 67 and 25 of 65 guesses) because the
guess policy reads wall-clock timings.

DSpark files take no part in this: ds2_topk runs only on a DFlash2 file.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-format Title or description does not follow CONTRIBUTING.md yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant