Skip to content

[Engine] feat: Implement Dflash2 for Inkling 2 Mini #339

Backlog

Description

@drakarah

https://huggingface.co/incoai/Inkling-2-Mini-DFlash2

From my own implementation in my edge-llm fork on an AGX Orin:

  • Hybrid decode on the 36 prompts:
    Drafter, K Decode tok/s Tokens per round
    DFlash2, K=3 39.57 3.21
    DFlash2, K=4 39.27 3.53
    DSpark, K=3 36.75 2.86
    Plain 25.99 1
  • That is +7.7% over DSpark at K=3 and +52% over plain.
  • A DFlash2 call costs about 2 ms more than DSpark's, at about 15 ms.

Edit: after optimizing the draft kernel work with K=4 --> 44.35tok/s

Hardware: AGX Orin 32GB unified memory, linux (jetpack 7.2).

Activity

  1. github-actions commented on Nov 25, 2026

    @github-actions

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

    • Add your graphics card with its VRAM, your RAM and your operating system.

    Edit the issue (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

  2. added
    needs-format
    and removed
    needs-format
    on Nov 25, 2026
  3. github-actions commented on Nov 25, 2026

    @github-actions

    Thanks, this follows the format now.

  4. VecSzn commented on Nov 25, 2026

    @VecSzn
    Collaborator

    Interesting numbers comparing DFlash2 against DSpark on Orin. Right now Inkling 2 Mini uses DSpark (--draft-model, enabled by default on Macs and full-VRAM NVIDIA cards in \�0.2.20-poly.5), and a PR is welcome if you want to contribute DFlash2 support.

  5. drakarah commented on Nov 25, 2026

    @drakarah
    ContributorAuthor

    I could but I can't test it properly, the discrete GPUs I have available only have 8gb vram and any drafter would slow it down due to having to fetch experts from ram, so making a proper performance comparison is going to be hard and skewed.

    So I could ask Claude to port drakarah/TensorRT-Edge-LLM@c18ec8c but I have no way of verifying.

    Hopefully someone else that can already run the dspark drafter can pick it up to make a fair comparison.

  6. cobra91 commented on Nov 26, 2026

    @cobra91
    Contributor

    Happy to help test and run fair A/B benchmarks (DFlash2 vs DSpark on v0.2.20-poly.5) whenever a branch or PR is ready!

    We have a Windows 11 test rig with an RTX 5080 16 GB (sm_120, where Inkling-2-Mini-UD-IQ3_XXS + DSpark fits 100% in VRAM at 237.99 tok/s on a 302-token prompt / 363.26 tok/s on a 16-token prompt) plus an RTX 4060 Ti 16 GB (sm_89, where UD-Q4_K_XL + DSpark runs 100% in VRAM via --layer-split 18 with #315). Ping me when you have a branch to benchmark.

  7. drakarah commented on Nov 26, 2026

    @drakarah
    ContributorAuthor

    Happy to help test and run fair A/B benchmarks (DFlash2 vs DSpark on v0.2.20-poly.5) whenever a branch or PR is ready!

    We have a Windows 11 test rig with an RTX 5080 16 GB (sm_120, where Inkling-2-Mini-UD-IQ3_XXS + DSpark fits 100% in VRAM at 237.99 tok/s on a 302-token prompt / 363.26 tok/s on a 16-token prompt) plus an RTX 4060 Ti 16 GB (sm_89, where UD-Q4_K_XL + DSpark runs 100% in VRAM via --layer-split 18 with #315). Ping me when you have a branch to benchmark.

    @cobra91 #358 It built on RTX4060 8GB here and forcing the drafter to work on 8GB made it run. I have no idea how it will perform compared to DSpark

    Instructions from Claude:

    1. Get the code and build

    git clone https://github.com/drakarah/PolyStrata
    cd PolyStrata
    git checkout feat/inkling2-dflash2 # commit 015a56c or later
    cd engine

    Build only the engine target. The full build also compiles test targets, and pinned_shared_test has a link error on this branch. That error hasn't been
    confirmed as pre-existing.

    • NVIDIA: cmake --preset cuda-compile -S . -B build -G Ninja && cmake --build build --target strata-poly
    • AMD: cmake --preset hip-compile -S . -B build -G Ninja && cmake --build build --target strata-poly

    Report whether the build succeeded, the backend, and the GPU. The HIP build hasn't been re-checked since the last changes, so a HIP build failure is
    useful information.

    1. Convert the DFlash2 drafter

    You need:

    • incoai/Inkling-2-Mini-DFlash2 from Hugging Face (config.json and model.safetensors)
    • The config of the target, thinkingmachines/Inkling-2-Mini (config.json only; no weights needed)
    python engine/third_party/strata-gguf-py/converter/convert_hf_to_gguf.py \
     <dir with incoai config.json + model.safetensors> \
     --target-model-dir <dir with thinkingmachines config.json> \
     --outtype bf16 \
     --outfile Inkling-2-Mini-DFlash2.gguf  
    

    Expected: about 81 tensors, about 990 MB, and a warning that the drafter writes no vocabulary. That warning is normal. The engine takes the tokenizer from the target file. Keep the log.

    1. Get the DSpark drafter for the comparison

    Use the DSpark file for the same Inkling 2 Mini target that your build's setup uses, for example dspark-Inkling-2-Mini-Q8_0.gguf. Record its exact file name and hash.

    1. Run each drafter with the same prompt

    Use the same target GGUF for both runs. Run each configuration three times and take the median. Change only the draft file and the window size.

    baseline: no drafter
    strata-poly --model <Inkling target>.gguf --tokens <ids> --max-new 256 --no-draft --window 4

    DFlash2, K=4 (4-token window, drafter guesses 3)
    strata-poly --model <Inkling target>.gguf --tokens <ids> --max-new 256 \ --draft-model Inkling-2-Mini-DFlash2.gguf --window 4

    DSpark, K=4
    strata-poly --model <Inkling target>.gguf --tokens <ids> --max-new 256 \ --draft-model <dspark file>.gguf --window 4

    Also run K=3 (--window 3) for both drafters, to match the issue's fork numbers. --window N means the drafter guesses N−1 tokens per round.

  8. cobra91 commented on Nov 26, 2026

    @cobra91
    Contributor

    @drakarah Here are the A/B benchmark results on our Windows 11 test rig (ecdfa5b21 on feat/inkling2-dflash2), following your protocol.

    1. Environment & Build

    • Commit: ecdfa5b21 (drakarah/PolyStrata, feat/inkling2-dflash2)
    • Backend / GPU: CUDA 13.4 (-DCMAKE_CUDA_ARCHITECTURES="89;120"), Ninja Release (--preset cuda-compile), built target strata-poly ([120/120] strata-poly.exe succeeded cleanly)
    • Active GPU: NVIDIA GeForce RTX 5080 16 GB (sm_120, Windows 11, 100.0% experts in VRAM)

    2. GGUF Conversion & Hashes

    • convert_hf_to_gguf.py (--outtype bf16) on incoai/Inkling-2-Mini-DFlash2 + thinkingmachines/Inkling-2-Mini/config.json:
      • n_tensors = 81, total_size = 990.2M (Inkling-2-Mini-DFlash2.gguf)
      • Expected warning observed: WARNING:hf-to-gguf:DFlash: no tokenizer handler for Inkling2LoopForConditionalGeneration; the drafter writes no vocabulary
    Role Filename SHA256
    Target Inkling-2-Mini-UD-IQ3_XXS.gguf BD7EF0865ADF119B5183E45E741C629BAFA649769B33B5EBF689BB4BCC4690D6
    DFlash2 Inkling-2-Mini-DFlash2.gguf B8723CC8FB58BEB16F8444EAE1CF3A38CEFA54F1CBF05B05DB1DD44A7D32E996
    DSpark dspark-Inkling-2-Mini-Q8_0.gguf 2EC78510DA837E8FC3BE54A14757A0C5FBD2D8D9E85A0D92853FAFDF674F3773

    3. A/B Benchmarks (302-token prompt, --max-new 256 --kv fp8 --max-context 32768, 3 runs -> median)

    Configuration Run 1 / 2 / 3 Decode (tok/s) Median Decode Median Prefill Accepted / Guessed
    Baseline (--no-draft --window 4) 215.47 / 215.81 / 215.90 215.81 tok/s 981.1 tok/s 122 / 184 (66.3%)*
    DFlash2 K=4 (--window 4) 205.46 / 205.55 / 205.37 205.46 tok/s 803.2 tok/s 144 / 195 (73.8%)
    DSpark K=4 (--window 4) 266.77 / 267.28 / 267.61 267.28 tok/s 1435.6 tok/s 180 / 212 (84.9%)
    DFlash2 K=3 (--window 3) 200.92 / 200.89 / 184.54 200.89 tok/s 798.4 tok/s 143 / 179 (79.9%)
    DSpark K=3 (--window 3) 247.56 / 250.37 / 250.23 250.23 tok/s 1423.1 tok/s 160 / 180 (88.9%)

    *Note: --no-draft --window 4 on Inkling-2-Mini-UD-IQ3_XXS.gguf still reported 122 of 184 guessed tokens right (built-in / STRATA_BLOCK_GUESS path).

    Takeaways on RTX 5080

    • Both K=4 (267.28 vs 205.46 tok/s, +30.1%) and K=3 (250.23 vs 200.89 tok/s, +24.6%) are currently significantly faster with DSpark Q8_0 than with DFlash2 BF16, both in acceptance rate (84.9% vs 73.8% at K=4; 88.9% vs 79.9% at K=3) and in drafter/prefill overhead (1435.6 vs 803.2 tok/s prompt).
    • Happy to re-test if you push further optimizations or quantized DFlash2 support!
  9. cobra91 commented on Nov 26, 2026

    @cobra91
    Contributor

    @drakarah Follow-up A/B run (K=4, --window 4) on our RTX 4060 Ti 16 GB (sm_89, CUDA_VISIBLE_DEVICES=1, same binary ecdfa5b21, Inkling-2-Mini-UD-IQ3_XXS.gguf, 302-token prompt, --max-new 256 --kv fp8 --max-context 32768, 100.0% VRAM, 3 runs -> median):

    Configuration (RTX 4060 Ti) Run 1 / 2 / 3 Decode (tok/s) Median Decode Median Prefill Accepted / Guessed
    Baseline (--no-draft --window 4) 98.92 / 98.81 / 98.99 98.92 tok/s 719.1 tok/s 132 / 188 (70.2%)
    DFlash2 K=4 (--window 4) 87.43 / 87.44 / 87.43 87.43 tok/s 507.8 tok/s 175 / 220 (79.5%)
    DSpark K=4 (--window 4) 125.99 / 126.04 / 126.02 126.02 tok/s 821.9 tok/s 181 / 210 (86.2%)

    On sm_89 (288 GB/s), DFlash2 BF16 (990 MiB) achieves a higher acceptance rate (79.5%) than on sm_120 (73.8%), while DSpark Q8_0 remains +44.1% faster (126.02 vs 87.43 tok/s) due to lower drafter/prefill bandwidth cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions