Repository navigation
feat(inkling2): DFlash2 speculative decoding, M<=16 verify tree, M5 Max fusions, and App co-download - #403
Conversation
…M5 Max fusions, and App co-download
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ck, verify-tree routing, and sync index.d.cts
…ore VERIFY_ROWS=8, atomic KV commit, target-first materialization, and update wizard test
…rden exclusive reclaim (seq 0, SSD wait, SWA-scoped)
Summary
Brings Splash-class 200+ tok/s decode performance to Inkling-2-Mini on Apple M5 Max 128 GB out of the box (zero custom env vars), adds full DFlash2 (
incoai/Inkling-2-Mini-DFlash2) speculative decoding +M <= 16Verify Tree / SAM Lookup support across both GGUF (UD-Q4_K_M/UD-Q4_K_XL) and Original SafeTensors (NVFP4 + MXFP8 + BF16), and wires automatic companion co-download in the App and CLI wizard.flowchart LR A["Inkling-2-Mini Load"] --> B{"DFlash2 Companion?<br/>(<modelDir>/draft/ or autoDraftModelPath<br/>or inkling-2-mini-dflash2/)"} B -- Yes --> C["DFlash2 5L Draft + M<=16 Verify Tree & SAM<br/>(zero-sync 1D chain + adaptive SAM tree)"] B -- No / Corrupt Auto --> D{"Bundled DSpark?<br/>(mtp.safetensors / dspark-*.gguf)"} D -- Yes --> E["DSpark Fallback (~3.1 tok/cyc)"] D -- No --> F["Pure AR Fallback"]Key Changes
DFlash2 Core & Inkling-2-Mini Speculative Decoding
final_logit_softcapping = 30.0,selector_softcap_mode = "after_correction") to Metal/CUDAmlx_dflash2_selector_edges, active-vs-codebook vocab split (200058vs201024), final-norm tap capture (layer 48), optionalmask_embedding.safetensors, compiled embedded draft path, and fixedctx >= 2048ring-wrap contract (> 2056) inmlx_dflash2_attention.cpp.crates/mlx-core/src/models/inkling2/dflash2.rs(Inkling2TargetView,Inkling2Dflash2Context,Inkling2VerifyTreeMode::Autoadaptive zero-sync 1D chain /M = 8..16SAM Verify Tree routing) and wired it through whole-turn and scheduled lanes,execution_plan(), andresolve_params().autoDraftModelPath(auto_draft_model_path) soft-fallback external companion hint so corrupt/incompatible auto-discovered external companions warn and fall back cleanly to bundled DSpark or AR, while explicitdraftModelPathkeeps strict hard-error semantics.M <= 16Verify Tree Metal Kernels & Zero-Rollback Path Committemplate <bool HasTree>paged attention (paged_attention_inkling2.h), single-tile_r16MPP verify kernels (paged_prefill_attention_inkling2.h), tree causal taps across all 4 ShortConv streams (k,v,attn_post,mlp_post), and in-place ascending-orderinkling2_paged_kv_path_commitwith pre/post encoder barriers and ShortConv tape path commit.M5 Max Target Fusions & Out-of-the-Box Runtime Defaults
set_input_array_with_budget(eliminating 56–68 CB splits/step andMAX_ACTIVE_TASKS=10stalls;host_graph_build6.18 → 0.51 ms/tok).set_buffer + register_output_array.qr_clip + sconv + kv_prep_paged,o_proj + attn_post_conv + residual, andloop_ctrl3-way QKV norm split, cutting total MLX ops/step from ~850–900 to ~380–430 (< 500default CB limit).MLX_INKLING2_Q8_SIMD_MAX_M=0(NAXlm_head+ dense Q8 on M5+) andSWA_MPP_VERIFY(4 <= M <= 16, ctx >= 512), eliminatedq_stagedtemp allocs, and made all 3 persistent Metal scratch arenasthread_localwithenc.retain_inputs(owner)+ teardown/cache-clear hooks.App Catalog, Server Host & CLI Co-Download
INKLING2_DFLASH2(incoai/Inkling-2-Mini-DFlash2,autoInstall: true) toInkling-2-Miniinpackages/agent/src/catalog.tscovering all 3 builds (UD-Q4_K_XL,UD-Q4_K_M,Original).packages/lm,packages/dashboard(server + UI Models & Onboarding pages),packages/server/src/host/index.ts, andpackages/cliwizard.Benchmarks (Apple M5 Max 40-core, 128 GB — Zero Custom Env Vars)
Inkling-2-Mini-UD-Q4_K_M.gguf(15.99 GiB+420 MiBDFlash2)M=1)M=8)M=8..16)127ctx)64.1 tok/s224.2 tok/s(3.50x,6.35 tok/cyc,28.3 ms/cyc,128/128)195.6 tok/s(3.05x,128/128)1511ctx)64.3 tok/s175.4 tok/s(2.73x,5.52 tok/cyc,128/128)218.9 tok/s(3.40x,7.94 tok/cyc)127ctx)63.5 tok/s189.1 tok/s(2.98x,5.55 tok/cyc,29.4 ms/cyc)1511ctx)63.9 tok/s160.1 tok/s178.8 tok/sHybrid (2.80x,5.94 tok/cyc)M=8target forward (ctx=512):32.25 → 27.68 ms(-4.58 ms)M=16verify forward (ctx=512):51.84 → 41.18 ms(-10.66 ms)propose(5L DFlash2vs3L DSpark):3.19 → 2.42 msOriginal SafeTensors (
NVFP4 + MXFP8 + BF16,17.75 GiB+420 MiBDFlash2, 512 out tok)M=1)M=8)M=8..16)127ctx)54.3 tok/s160.7 tok/s(2.96x,5.32 tok/cyc)133.5 tok/s1511ctx)55.0 tok/s140.2 tok/s(2.55x)154.0 tok/s(2.80x,5.81 tok/cyc)2048ctx)53.3 tok/s104.8 tok/s(1.97x)132.6 tok/s(2.49x,5.11 tok/cyc)54.3 tok/s119.1 tok/s(2.19x)131.5 tok/s(2.42x,4.91 tok/cyc)Verification
cargo fmt --all -- --check&cargo clippy --locked --all-targets -- -D warnings: 0 warningscargo test --release -p mlx-paged-attn(239+ tests): passedbridge_metallib_names(9/9),dflash2_selector_edges(4/4),inkling2_scratch_release(2/2): passedmodels::inkling2::(73/73),models::qwen3_5::dflash2::(41/41),models::qwen3_5::verify_tree::(26/26): 140/140 passedinkling2_dspark_greedy_parity(scheduled + whole-turn): passedvp lint --type-aware --type-check(0 warnings, 0 errors),yarn build:ts,packages/dashboard/uitsc+build, TS Vitest suites: passed