Repository navigation
feat(hy4,qwen4_exp,dashboard): Hy4-flash vision & DFly2-B6, Qwen4 4L perf/parity, Work-mode images, and barrier KV eviction - #435
Conversation
…nc/bubble optimizations
…x, and Codex review fixes
…and multimodal DFlash2
…eases, and persist media prefix states
…-fold GDN & paged QSA, compiled batched DFlash2
…ched linear_rows, and CostModel
…p, and multimodal DFly2-B6
…e/verify KV exhaustion
Codex Review Summary: ❌ FailedThis 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. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…oE down kernels and stabilize CI tolerances
Summary
End-to-end speculative decoding, vision (
mmproj), multi-lane Metal kernel optimization, Dashboard Work-mode image attachments, and exclusive-barrier KV reclamation across Hy4-flash, Qwen 3.8 Flash Next, Qwen 3.8 27B, and Inkling-2-Mini.flowchart LR subgraph Models["Native Engine & Metal Kernels"] HY4["Hy4-flash<br/>• DFly2-B6 speculative decoding<br/>• GGUF mmproj vision + 3D M-RoPE<br/>• Image prefix cache + ViT skip<br/>• Exclusive-barrier KV eviction"] Q4["Qwen 3.8 Flash Next<br/>• GGUF mmproj + image prefix cache<br/>• AOT dense NAX + grouped MoE<br/>• Batched GDN/QSA + DFlash2<br/>• 0.0-ULP 1L GDN parity<br/>• Barrier decode/verify KV eviction"] Q3["Qwen 3.8 27B & Inkling-2-Mini<br/>• Image prefix cache + ViT skip<br/>• Multimodal DFlash2 & DSpark<br/>• BF16 sampler & sync fixes"] end subgraph App["LM, CLI, Agent & Dashboard"] TS["Model discovery, catalog & CLI<br/>• Hy4-flash mmproj + DFly2-B6<br/>• Qwen4 mmproj discovery"] UI["Dashboard Work Mode<br/>• Direct image attachments<br/>• Per-family image caps"] end HY4 --> TS Q4 --> TS Q3 --> TS TS --> UIKey Changes
1. Hy4-flash: DFly2-B6 + GGUF Vision (
mmproj-Hy4-flash-bf16.gguf) + Barrier KV Reclamationcrates/mlx-core/src/models/hy_v4_flash/dfly2/): 3-layer Eagle/DFly2 speculative drafter (block_size = 6) integrated with paged KV cache, lock-free Engram batching,WINDOW_SLACK = 6, and multimodal verify.vision.rs,media.rs,indexer.rs,persist_codec.rs):128×128position embeddings) +rmsnorm_mlp_adapter(mm.pre_norm→2×2 s=2Conv2d → GELU →1×1Conv2d → row-endv.image_newline).[12, 10, 10]3D M-RoPE in GPT-J pair order with hybrid 1D/3D multi-chunk prefill (pure-text chunks stay on fused 1D Metal kernels with causalrope_delta), Indexer pooled-key 3D M-RoPE +open_pos/recent_group_posrollback ring persisted inHY4S v3.expandedPromptTokenCount), lazymmprojload with open-fd fingerprint re-verification, zero-transfer Engram bypass + lookahead filtering on masked image rows, andsupportsImages()/expandedPromptTokenCount()NAPI exports.packages/lm,packages/agent,packages/cli): Auto-discovery ofmmproj-Hy4-flash-*.ggufandhy4-flash-dfly2-b6(Metal-only draft gating preserving Windows/Linux SPARK builds), catalog globs + sizes, and projector download tests.owner.rs,sched.rs): LRU idle-owner KV eviction on prefill, warm continuation, and decode/verify block boundaries with host-headroom-capped partial grow while preserving history-onlySessionContinueowners and published prefix checkpoints.2. Qwen 3.8 Flash Next (
qwen4_exp): 4L > 1L Metal Optimizations + Vision + Barrier Decode KV Reclamationcrates/mlx-sys/src/metal/qwen4/,crates/mlx-core/src/models/qwen4_exp/):qwen4_q8_nax_m16dense NAX (routingM = 1..16directly tom16, skipping narrowN < 1024/(N == 1024 && R <= 8)), grouped MoE, batched deferred-fold GDN & paged QSA, compiled batched DFlash2,AlignConstant4(0 dispatches on alignedR = 1..4), and batched unquantized small projections (count >= 5, eliminating 3,840 serial matmuls/wave).QWEN4_*_RUN(A)switch (active)indense_decode.metal.inc&mixer_act_decode.metal.inceliminating register spills (-14 ms/cycwall,-16.7 msGPU on 1L SPEC).0.0ULPstate_outdiff) viametal::fast::logingdn_verify_batch.metal.WaveCostModelpriors & per-width observation tracking; paged QSA command-buffer memory budget scaling.mmprojvision, image prefix caching + ViT skipping, pinned prefill breaks, idle release draining, media prefix persistence, and exclusive-barrier decode & DFlash2 verify KV reclamation (paged.rs,mod.rs,decoder/draft_cycle/mod.rs).3. Dashboard Work-Mode Image Input (
packages/dashboard,docs/dashboard.md)kind: 'image'attachments in Work mode whenevermodelRow?.images === true.conversationImagesMax(family)(4for Flash Next,64otherwise) in both UI blockers and chat service, plusrecheckModel()preflight race guard.Benchmarks & Live E2E Results (Apple M5 Max, 128 GiB)
Standalone Real-Weights Benchmarks
UD-Q4_K_XL+ DFlash2, 48/48 direct banks, 4L)1L ARwarm (128 tok avg)4/4exact 1L AR parity1L SPECwarm (128 tok avg)110.4,1.43×)-14.0 ms/cycwall (-16.7 msGPU)4L greedy(512 tok wall / steady dec)-65%dispatches/wave (85.8 ms/wave)4L sampled topK=0(512 tok wall / steady)Q4_K_M+mmproj+ DFly2-B6)τ = 3.90,158 mshit TTFT)576/597ViT-skipped hit, exact 128-tok AR matchUD-Q4_K_XL+ DFlash2)1L/4Lgreedy /4LsampledexactMatchSolo = 4/4(2.78×AR)4Lgreedy /4LDSparkexactMatchSolo = 4/4,Inline AR = 4/4Live
mlx agentMulti-Subagent E2E With Image Input (napi-rsSecurity Audit)τQ4_K_M, 100% Direct MoE85.2 GiB,mmproj+ DFly2-B6)1L: 28.5→4L+: 44.4)UD-Q4_K_XL,mmproj, 95k+ concurrent ctx)1L: 26.4→3L: 49.3)Verification
cargo fmt --all -- --check: PASScargo clippy -p mlx-core --lib --tests -- -D warnings: PASS (0 warnings)cargo test -p mlx-core --lib models::hy_v4_flash::: 464 passed, 0 failed (32 vision & barrier KV tests)cargo test -p mlx-core --lib models::qwen4_exp::: 514 passed, 0 failedyarn build:native+tsc -b tsconfig.json+yarn --cwd packages/dashboard build+yarn lint: PASS (0 warnings, 0 errors)vp test run(dashboard,lm,agent/catalog,cli/wizard,cli/download-projector,agent-wizard): 6,940+ passed, 0 failed (pluschat-mode-page.test.ts81/81 re-verified after PR feat(dashboard): Arc Pro ModelPicker, smooth auto-scroll, and sidebar shift fixes #433 rebase)