Repository navigation
Opt-in DFly2 drafter (AngelSpec) for DeepSeek-V4.1-Flash as an alternative to the stock MTP head #5725
NikolayGusev-astra
started this conversation in
Ideas
Replies: 1 comment
|
PR #5724 is currently draft under the large-PR first-time-contributor rule. This discussion is the linked pre-implementation proposal; the implementation remains opt-in and off by default pending maintainer feedback here. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Idea. Port the DFly2 block drafter that Tencent trained for DeepSeek-V4.1-Flash (AngelSpec, weights AngelSlim/DS-V4.1-Flash-DFly2-B6) as an opt-in replacement for the checkpoint's stock MTP head, behind a single setting:
{ "mtp_enabled": true, "dfly2_checkpoint": "/path/to/AngelSlim/DS-V4.1-Flash-DFly2-B6" }Hy4 (#5463) already drives a DFly2 drafter through the
_dsparkgenerator contract, but that one ships inside the checkpoint. The AngelSlim drafter is a separate 8.8 GB bfloat16 checkpoint (three layers, KV + index sharing with DSA layers 28/32/36,block_size6,index_topk512), so for V4.1-Flash it has to be loaded from a path and attached at model-load time. The generator side is unchanged: the samedspark_prepare_block / dspark_forward / dspark_step_logitspath, the same cycle log line (it saysbackend=DFly2).Why opt-in and not default — numbers from an M3 Ultra 512 GB (oQ4 build, prefill on an M5 Ultra helper):
DFly2 accepts ~3 pp more and wins +3–6 % at concurrency 1, but under a batch it is at parity with the stock head: on M3 Ultra drafting costs ≈ 6 % of the cycle for both drafters, so a higher accept rate does not pay for itself once the batch saturates compute. That matches the paper (its +7 / +19 % are versus DSpark on tp8, where drafting is < 1 % of the cycle) — we simply don't reproduce those gains against the built-in MTP on this hardware.
So the value is: correct, cheap to keep, off unless configured, and lets anyone with the AngelSlim weights compare drafter vs stock head on their own profile and hardware (especially where drafting is a smaller share of the cycle). Not a proposal to change any default.
Draft-layer parity vs the PyTorch reference:
max_abs 7.2e-07,max_rel 1.7e-06; greedy token IDs bit-deterministic per path; exact verify equals token-by-token decode. 48 tests (tests/patches/test_dfly2_*.py), including a torch-vs-mlx oracle for attentive correction.PR with the implementation: #5724
All reactions