Repository navigation
chore: remove training TUI - #383
Conversation
|
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. |
…heduler on by default (#384) ## Summary One branch with 23 commits, on `main` after #378 (the DFlash2 state disk tier) and #383. Replaces #382 (closed). | Area | What | |---|---| | `packages/server` | Turn traces and runtime samples (metadata only), measured prefill (`prefillMs` / `prefillTokens`), `POST /v1/models/unload`, GGUF model naming with quantization variants, a turn reports where it waits (`queued / slot / prepare / prefill / decode`), a tool call that misses its one object argument gets it rebuilt, a thinking budget with a cycle guard and an end text on the agent hosts, a reload of the same model closes the old model's state cache first | | `packages/desktop` | Control Panel host changes: folder dialog for Work, endpoint file fields, bundled skills. MAIN judges Control Panel liveness by ping; a slow page call no longer restarts the Control Panel | | `packages/dashboard` | Control Panel redesign on the free Arc components (MIT) plus own components; Chat / Work over ACP; permission modes Ask / Auto / Bypass; Web Search providers (keys in the macOS Keychain); Agent timeline; waiting orb; load card with the kernel warm-up; a Work turn continues once after a length stop; the Cache page lists the model caches under `prefix-cache/` and can delete an idle one | | `qwen4_exp` | Flash Next: tool calls parse (tokenizer special flags), the prefill window stays 1,024 rows on a partial expert store, a follow-up turn reuses its prefix to a message boundary, drafts after a restore. Its stored states live in a per-model SSD tier as fixed-span state records and are taken back at load | | `qwen3_5` | The scheduler is on by default for Qwen3.5 dense and MoE with no env; the lane count comes from the memory plan (up to 4, up to 8 from 256 GB); MoE MTP lanes keep their lone tokens; MTP norm shift rule; `stateTierNamespace()` | | `engine` | Thinking cycle guard and end text; the thinking cut is a row of a full-depth speculative verify; load-time warm-up of the scheduler's pipelines with start-class memory claims; stream progress phases and wait timers; the paged-attention metallib loads from memory (no temp file) | ## Behaviour changes - `MLX_CONTINUOUS_BATCHING` is gone. `MLX_SERVE_FORCE_SERIAL=1` is the one rollback. - Qwen3.5 lanes: plan one lane, then grant the most lanes that keep that context window. Lanes give way before the window. The lane table is pinned with the state tier off and on; with the tier on, one GDN cell of staging moves five memory-bound rows (for example 9B AR at 16 GB: 2 lanes to 1). - Qwen3.5 0.8B: the MTP norms were read as shifted and the MTP head accepted no draft. One decision for the whole MTP module from four norms. Only the 0.8B checkpoints change their decision. - Load warm-up (Qwen3.5 dense / MoE loads that serve chat turns on the scheduler): - Scratch turns per lane count and row class run before the load serves. The model state, the block pool and the state tier read as before, and the model's governor books are put back. - A warm-up claim is a Floor claim that tries once. A required step (`MaxPrefill`, each row class, width 1, and the width-1 draft step on a drafting model) that the engine limit refuses fails the load at once with `memory plan: the load's warm-up (<step>) could not be allocated: <cause>`; a host-pressure refusal runs the warm-up again every second for up to 30 s, then fails the load. Before a start claim is refused, MLX's free pool is cleared once. A KV block shortage still counts the step as skipped. - `mlx eval`, FP8 calibration and CLEF loads run no warm-up. - Thinking cut under speculation (MTP, DSpark, DFlash / DFlash2, scheduled lanes): a cycle keeps its depth near the budget. The cut is one row of the verify; rows from the cut take the end tokens, and end tokens replace the first proposals once no thinking token is left. Output equals plain decoding at T=0; tokens before the cut do not depend on where the cut is. There is no seed on the chat API, so sampled output is not repeatable (docs/vllm-speculative-alignment.md, X8). - Disk cache: the desktop engine, `mlx agent` and `mlx serve` use the mechanism of `main`. Qwen3.5 persists DFlash2 states in the per-model state tier. The whole-prompt capture of this PR (`persistWholePrompt`, on for the desktop engine and `mlx agent`) applies to the per-turn families only (Qwen3, Gemma4, Muse-Glimmer, LFM2). The refused-rung booking of an earlier head is dropped, because `main` deleted refused rungs. - A Qwen3.5 or Flash Next trace row carries `stateTier` (`persistent` / `temp` / `off`); the Cache page counts such a turn by it. `coldEnabled` keeps its meaning (the process tier). - Flash Next: `<tool_call>`, `</tool_call>`, `<think>`, `</think>` are no longer special tokens; the asset cache identity is bumped, so the tokenizer sidecar is rebuilt once. - Flash Next disk cache, now on the per-model tier `~/.mlx-node/cache/prefix-cache/<ns>` (lock, quota, 14-day rule, `--max-cache-disk`, `--cache-dir`, the persist switch, `closeCache`): - Persistent by default on every host. A load with the switch off, with no GGUF identity, or whose namespace another process holds for 20 s gets a temporary tier; `--max-cache-disk 0` gets none. - Only states of 2,048 tokens or more are written, 10 s after publication, as one fixed-span record (format `qwen4-prefix-v3`; older objects and objects under `paged/v1` are not read: one cold start). A state is durable only when its whole KV and draft chain is on disk. - States share the tier's one quota; a reopen under a lower limit trims before the tier serves. At load a persistent tier adopts every whole state as a disk-only entry that a turn reads back and promotes. - `closeCache` resolves true only when every waiting state and queued copy landed. After a failed state write the row reports the tier as off. - Staging: one state plus the block queues (about 240 to 260 MiB) is set aside on every load that opens a tier. - Flash Next and Qwen3.5 share the root limit under `prefix-cache/`: a load can remove another model's idle cache. - Same-model reload in one engine (A → B → A): the host awaits the old model's `closeCache` (up to 6 s) before the new load, so the new load opens the persistent namespace instead of a temporary tier. - Cache page: one panel per cache root (the configured root and each running engine's `--cache-dir`). A folder is a model cache only when it holds a regular `lock` file. Rows show size, files, last use and lock state, and the model name when a running engine reports that namespace (`stateNamespace` in the heartbeat). The walk is bounded by count and time. Delete: confirmed at the button, only an idle cache, refused when an engine holds the lock or opened the cache after the listing; the directory is held open and re-checked before every unlink; steps leave a 300 ms gap for an engine's lock retry. - New napi surface: `ChatConfig.thinkingCycleGuard` / `thinkingEndText`; `reasoningClose` / `reasoningCutAt` / `reasoningCyclePeriod` / `reasoningStrayCloses` on the result and the done chunk; `ChatStreamProgress.phase` (6 values) with `waitMs` / `slotMs` / `prepareMs`; `WarmupReport`, `LoadProgress`, `loadProgress(path)`, `pipelineStats()`, the `warmup` getter; `Qwen4ExpModel.closeCache` / `stateTierMode` (`persistent` / `temp` / `off`), `prefixDiskAdopted`, `Qwen4ExpLoadOptions.cacheDisk` / `cacheDir`; `stateTierNamespace()` on the Qwen3.5, Qwen3.5 MoE and Flash Next models. - Control Panel recovery: the page can no longer ask for a restart; a call with no reply fails alone with `E_TIMEOUT`. MAIN pings every 5 s and restarts the panel after 30 s of silence (120 s when a turn runs). A stuck database worker restarts alone. Each recovery writes metadata rows to `~/.mlx-node/ledger/`. ## Test plan - [x] `cargo test -p mlx-core --lib` (scoped: engine, model_thread, tokenizer, tools, paged KV adapter, sampling, qwen3, qwen3_5, qwen4_exp, gemma4, lfm2, nemotron_h, muse_glimmer, clef, memory_plan, disk_tier, cold_tier, quality, calibration): `3064 passed; 0 failed; 119 ignored` - [x] `cargo test -p mlx-paged-attn --lib`: `223 passed; 0 failed; 8 ignored`; `cargo test -p mlx-metal --lib`: `6 passed` - [x] `cargo clippy -p mlx-core -p mlx-metal -p mlx-paged-attn --all-targets -- -D warnings`, `cargo fmt --all -- --check` - [x] `yarn build:native` (full profile), both `index.d.cts` copies in sync - [x] `yarn build:ts`, `yarn typecheck`, `vp lint --type-aware --type-check` on the touched files, UI build, pack test - [x] `vp test` (dashboard, server, desktop, agent, lm, cli, `__test__/server`, `__test__/cli`): `Test Files 317 passed | 3 skipped`, `Tests 7126 passed | 15 skipped` - [x] Qwen3.5 0.8B, real weights, persistent state tier in a throwaway cache dir, one process: - warm-up 56 steps, 0 skipped, on the first load and on the reload; - T=0, thinking budget 64, no cached prefix: MTP off (80 decode batches for 80 tokens), scheduled MTP (23 batches, 23 cycles), whole-turn adaptive MTP (23 cycles); all close by `budget` at 64 with the end text; thinking and answer equal across the three; - a 5,691-token prompt, `closeCache` true, reload from the same cache dir: 1 state adopted, the next turn restores 5,680 tokens from disk and gives the same answer. - [x] Flash Next (Qwen3.8 Flash Next UD-Q4_K_XL GGUF), real weights, host defaults, throwaway home and cache dir, two processes: - load: `stateTierMode` `persistent`, the namespace directory and its `lock` exist; - a 6,087-token turn (cold), a tool turn (`finishReason: tool_calls`, one call with the right arguments), a follow-up turn that reuses 6,080 tokens from memory; - the state is durable 10 s after publication (one 115.8 MB state record plus its block chain); `closeCache` resolves true; - reload: `prefixDiskAdopted` 1; the same follow-up turn restores 6,080 tokens from disk (`prefixDiskRestored` 1, first token after 353 ms) and its answer is identical at T=0; one more follow-up turn; `closeCache` true. - [ ] Not run: the warm-up on real 27B / MoE geometry, MoE parity on a real checkpoint, the Control Panel recovery on a real Electron process, `__test__/cli/agent-e2e` ## Known limits - MoE scheduled MTP with 2 or more lanes is not bit-exact against one lane alone (batch-shape rounding). AR is exact. - The first turn can still compile a pipeline that takes the prompt length as a build-time constant (`qwen4_window_conv`, `qwen4_gdn_prepare` under 64 rows). - A load that came up with skipped warm-up steps can now fail when memory is short (see the warm-up rule above). - The first Flash Next turn after a load takes about 6 s to its first token (also for a 19-token prompt); later turns do not. - Flash Next state write: one 121.9 MiB state takes about 16 ms on the model thread (two copy passes), once per stored state. On a temporary tier the first state that memory drops is lost. - A load that does not get its namespace lock within 20 s keeps a temporary tier for its life. A Qwen3.5 `closeCache` waits behind a running turn, so a same-model reload during a long turn can still land there. - `stateTierMode()` and `stateTierNamespace()` take the tier's hold lock; the JS thread can wait for one remove (milliseconds). - Cache page: a cache of a stopped engine shows its short hash (the tier writes no model metadata); a `--cache-dir` root of a stopped engine is not listed; an engine that runs only Flash Next reports no limit; the delete keeps a microsecond window between its directory check and each unlink (Node has no `unlinkat`), usable only by a process of the same user. - The Auto `/tmp` rule ships as built by owner decision. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
Summary
mlx-tuicrate, itsmlx-trainbinary, TUI screenshot, and unique Rust dependency graph.MLX_TUI_MODE,tuiMode, stdin controls, prompts, sample reporting, and TUI wire-protocol exports from the GRPO/SFT trainers and examples.SyncDbReaderfrommlx-dband update the architecture and training documentation.Validation
vp checkfor all changed TypeScript and Markdown filesvp run typecheckvp run build:nativevp run build:tsvp test __test__/trainers— 121 tests passedcargo fmt --all -- --checkcargo check --workspacecargo test -p mlx-db