Repository navigation
feat(dashboard): Arc Pro ModelPicker, smooth auto-scroll, and sidebar shift fixes - #433
Conversation
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
…perf/parity, Work-mode images, and barrier KV eviction (#435) ## 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**. ```mermaid 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 --> UI ``` --- ## Key Changes ### 1. Hy4-flash: DFly2-B6 + GGUF Vision (`mmproj-Hy4-flash-bf16.gguf`) + Barrier KV Reclamation - **DFly2-B6 (`crates/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. - **GGUF Vision (`vision.rs`, `media.rs`, `indexer.rs`, `persist_codec.rs`)**: - SigLIP2-So400m ViT (27 blocks, exact erf GELU, bilinear-interpolated `128×128` position embeddings) + `rmsnorm_mlp_adapter` (`mm.pre_norm` → `2×2 s=2` Conv2d → GELU → `1×1` Conv2d → row-end `v.image_newline`). - Interleaved `[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 causal `rope_delta`), Indexer pooled-key 3D M-RoPE + `open_pos` / `recent_group_pos` rollback ring persisted in `HY4S v3`. - Image prefix caching + ViT skipping, zero-copy header-only planning (`expandedPromptTokenCount`), lazy `mmproj` load with open-fd fingerprint re-verification, zero-transfer Engram bypass + lookahead filtering on masked image rows, and `supportsImages()` / `expandedPromptTokenCount()` NAPI exports. - **TS / Catalog / CLI (`packages/lm`, `packages/agent`, `packages/cli`)**: Auto-discovery of `mmproj-Hy4-flash-*.gguf` and `hy4-flash-dfly2-b6` (Metal-only draft gating preserving Windows/Linux SPARK builds), catalog globs + sizes, and projector download tests. - **Exclusive-Barrier KV Reclamation (`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-only `SessionContinue` owners and published prefix checkpoints. ### 2. Qwen 3.8 Flash Next (`qwen4_exp`): 4L > 1L Metal Optimizations + Vision + Barrier Decode KV Reclamation - **Zero-JIT Metal & Batching (`crates/mlx-sys/src/metal/qwen4/`, `crates/mlx-core/src/models/qwen4_exp/`)**: - AOT `qwen4_q8_nax_m16` dense NAX (routing `M = 1..16` directly to `m16`, skipping narrow `N < 1024` / `(N == 1024 && R <= 8)`), grouped MoE, batched deferred-fold GDN & paged QSA, compiled batched DFlash2, `AlignConstant4` (0 dispatches on aligned `R = 1..4`), and batched unquantized small projections (`count >= 5`, eliminating 3,840 serial matmuls/wave). - Compile-time `QWEN4_*_RUN(A)` `switch (active)` in `dense_decode.metal.inc` & `mixer_act_decode.metal.inc` eliminating register spills (`-14 ms/cyc` wall, `-16.7 ms` GPU on 1L SPEC). - Restored **4/4 exact 1L AR greedy parity** (`0.0` ULP `state_out` diff) via `metal::fast::log` in `gdn_verify_batch.metal`. - Bounded `WaveCostModel` priors & per-width observation tracking; paged QSA command-buffer memory budget scaling. - **Multimodal & Prefix Persistence**: GGUF `mmproj` vision, 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`) - Enabled direct `kind: 'image'` attachments in Work mode whenever `modelRow?.images === true`. - Enforced per-family `conversationImagesMax(family)` (`4` for Flash Next, `64` otherwise) in both UI blockers and chat service, plus `recheckModel()` preflight race guard. --- ## Benchmarks & Live E2E Results (Apple M5 Max, 128 GiB) ### Standalone Real-Weights Benchmarks | Model | Workload | Baseline | **This PR** | Parity / Notes | |---|---|---:|---:|---| | **Qwen 3.8 Flash Next** (`UD-Q4_K_XL` + DFlash2, 48/48 direct banks, 4L) | `1L AR` warm (128 tok avg) | 54.07 tok/s | **58.47–58.99 tok/s** (+9.1%) | `4/4` exact 1L AR parity | | | `1L SPEC` warm (128 tok avg) | ~68–75 tok/s | **83.03–84.22 tok/s** (math `110.4`, `1.43×`) | `-14.0 ms/cyc` wall (`-16.7 ms` GPU) | | | `4L greedy` (512 tok wall / steady dec) | 30.82 → 81.33 | **93.5–95.6 aggTok/s** (**141.9** steady) | `-65%` dispatches/wave (`85.8 ms/wave`) | | | `4L sampled topK=0` (512 tok wall / steady) | 57.66 → 82.09 | **88.7–92.0 aggTok/s** (**131–137** steady) | **+55% to +60%** wall over baseline | | **Hy4-flash** (`Q4_K_M` + `mmproj` + DFly2-B6) | Cold screenshot → Warm Turn 2 → Cross-owner | — | **46.7 → 52.8 tok/s** (`τ = 3.90`, `158 ms` hit TTFT) | Pixel-exact OCR, `576/597` ViT-skipped hit, exact 128-tok AR match | | **Qwen 3.8 27B** (`UD-Q4_K_XL` + DFlash2) | `1L` / `4L` greedy / `4L` sampled | — | **35.6** / **55.8** / **57.2 aggTok/s** | `exactMatchSolo = 4/4` (`2.78×` AR) | | **Inkling-2-Mini** (DFlash2 / Bundled DSpark) | `4L` greedy / `4L` DSpark | — | **71.1–81.6** / **87.7 aggTok/s** | `exactMatchSolo = 4/4`, `Inline AR = 4/4` | ### Live `mlx agent` Multi-Subagent E2E With Image Input (`napi-rs` Security Audit) | Model | Exit | Turns | Gen Tokens | Active Agg Decode | Peak Per-Lane | Avg `τ` | Errors | |---|---:|---:|---:|---:|---:|---:|---:| | **Hy4-flash** (`Q4_K_M`, 100% Direct MoE `85.2 GiB`, `mmproj` + DFly2-B6) | **0** | **574** | **244,106** | **32.7 tok/s** (`1L: 28.5` → `4L+: 44.4`) | **52.0 tok/s** | **2.71** | **0** | | **Qwen 3.8 Flash Next** (`UD-Q4_K_XL`, `mmproj`, 95k+ concurrent ctx) | **0** | **185** | **180,794** | **31.1 tok/s** (`1L: 26.4` → `3L: 49.3`) | **59.0 tok/s** | AR | **0** | --- ## Verification - `cargo fmt --all -- --check`: PASS - `cargo 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 failed** - `yarn 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** (plus `chat-mode-page.test.ts` **81/81** re-verified after PR #433 rebase)
Summary
Arc Pro
ModelPickerrefactor (Chat/Work + System One)ModelPickeron@radix-ui/react-dropdown-menumatching Arc Pro's Model Picker block: gliding highlight (useGlide), springAutoHeight, crossfading width-morphing pill (TriggerLabel), desktop hover/keyboard submenus (Effort,More models, multi-buildQuantization), narrow (<= 640px) sliding in-menu pages (← Back),Tab-reachable footer/Unloadcontrols, andside/alignplacement (side="bottom" align="end"in System One header).MODEL_CATALOG, visiblechatandsystemoneentries) to render outside at top level with 1-line blurbs (recommended,recommendedOrder,description), and grouped all other installed models inside More models by family/provider (or outside when no installed models are recommended).Sidebar conversation list layout shift fixes
popLayoutoverflow insideButton(overflow: clip) and fixedComposerTrayexit/height collapse,ConversationListscroll container stability, andAppShellFrozenLocation+ live location context (live-location.ts) so switching conversations, navigating away from/chat, or returning via back/forward keeps< 0.5pxshift.chat.tsx(matchPath('/chat', live.pathname)) and post-remount rewind toast restoration.Smooth auto-scroll in running agent chat
stick-to-bottom.tswith smooth rAF exponential chase (CHASE_TAU_MS = 85,overflowAnchor = 'none'during chase) while respecting user wheel/touch/keyboard disengagement (Ctrl+wheel, directional scroll containers,touchHold,window-levelkeydown).overscroll-behavior: containand viewport clipping inChatFrame.Verification
vp fmt --check,vp lint(0 warnings, 0 errors),yarn typecheck@mlx-node/dashboardtest suite (vp test packages/dashboard --run): all 246 active test files passed, includingpack.test.tsproductionyarn build:ui+ bundle checks500px): zero console/page errors,0pxtrigger-morph overflow,< 0.5pxlayout shift on conversation switches, smooth auto-scroll, short-viewport scrolling, narrow-page highlight, and Work mode effort switching