Skip to content

feat: Qwen3.5 dense deep-context speed (32-token key pages, DFlash2 lanes), Flash Next partial-store decode, app wait states - #389

Merged
Brooooooklyn merged 12 commits into
mainfrom
feat/qwen38-deep-context-dflash2-lanes
Nov 20, 2026
Merged

Brooooooklyn merged 12 commits into
mainfrom
feat/qwen38-deep-context-dflash2-lanes

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Summary

Deep-context speed for Qwen3.5 / 3.8 dense with a DFlash2 draft, real concurrency for DFlash2 turns, Flash Next decode on a partial store, and the app changes that go with them.

Area What changed
Key pages Dense Qwen3.5 (heads 24/4) stores K on 32-token pages, token-major, with their own prefill, verify and AR kernels. MoE keeps the 16-token page.
Store move The first load after this change moves stored chats from the 16-token page form to the new one. It runs inside the load, before the first turn, and is safe to cut: the next load goes on.
DFlash2 lanes Dense DFlash2 text turns are scheduler lanes and verify in waves of 2-4. Sampled lanes take their rows on the device. A lane gives the tokens it gives alone.
Decode cycle int8 KV queries for loads with a DFlash2 draft, a joined mixed projection, sampled DFlash2 rows on the device.
GGUF planes A GGUF load can plan Splash's weight-plane layout (kernels under metal/splash_gguf, Apache-2.0, listed in THIRD_PARTY_NOTICES).
Flash Next A partial store reads every missing expert of a lease in one fill; a store the host gate refused moves up to a direct store when the gate later admits it; a switch to a model that loads alone disposes the idle old model first.
Host / app Chat and Work wait states, run cards, context ring, compaction mark, composer hints; turn and runtime trace fields; model switch disposal merged with #385.
Docs CLAUDE.md limits, docs/concurrent-inference.md, docs/paged-cache.md, docs/perf.md, docs/ffi-cpp.md, docs/qwen38-flash-next.md, docs/dashboard.md.

Measured (M5 Max, 128 GB, Qwen3.8-27B UD-Q4_K_XL + DFlash2 draft, one trial per row)

Row at 146K context Before key pages This PR Splash 1.6.1 (stored rows, no same-hold pair)
Decode, sampled, ms per cycle 84.9 74.6 73.6
Decode, greedy, ms per cycle 79.8 72.7 73.2
Cold 146K prompt 317 s (16-token page) 292 s 312 s

The clock speed of the GPU differed between rows, so the Splash column is an indication only.

Two no-harm cells at 25K (greedy alone, 3 lanes) read slower in one engine while another project compiled on the machine. They have no clean pair and are not decided. The other 25K cells in the same hold read 0.96-0.98 of the old build.

Exactness

  • Same request, same state: same tokens (10 of 10 greedy repeats).
  • A DFlash2 lane equals the same request alone (23 of 23 on the real model; fixture pins for sampled lanes with a fixed seed).
  • A restored chat equals the chat with no restore, also after the store move, a restart, and three kills inside a move.

Limits

  • Downgrade: a build without 32-token pages does not read moved chats; they prefill again.
  • First load after the update: longer by one read and one write of the stored chats (24 GB took about 58 s). The UI shows a plain load.
  • AR rows in one fused step are not lane-exact: on a dense load with K-quant or affine projections, autoregressive turns that decode in one [N,1] step take other kernels than a one-row step, so at temperature 0 such a turn can give other tokens than it gives alone. The route split is in main already; the docs said the opposite and now state the limit. DFlash2 lanes are not on this route.
  • Not proven: Windows and Linux compiles of the new unix-gated code (checked by reading only; CI decides).

Test plan

  • cargo fmt --check, cargo clippy --all --all-targets -D warnings: clean
  • cargo test -p mlx-core lib: 5,552 passed, 0 failed, 245 ignored; integration: 161 passed, 0 failed
  • cargo test -p mlx-paged-attn: 370 passed, 0 failed
  • vp run test: 8,214 passed, 0 failed
  • vp check --no-fmt, vp fmt --check on the changed files: pass
  • yarn build:native, yarn build:ts; the two index.d.cts files are equal
  • Real-model holds: store move on a clone of a live 24 GB store (81 of 81 states), kills inside the move, restore after restart, lanes equal alone
  • CI

🤖 Generated with Claude Code

Brooooooklyn and others added 6 commits November 20, 2026 03:28
…ime move of stored chats

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…device, joined mixed projection

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…del-switch disposal rule; trace fields

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…t store promotion, env inventory

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2af49b6f-b402-498f-87a5-7d7e9ea7fbf2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T19:33:37.930571Z 241c632 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 241c6327a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Brooooooklyn and others added 6 commits November 20, 2026 03:37
… revision arrives

TranscriptReducer.seed() now indexes seeded workflow entries, so a later workflow_updated for the same run sets the card in place.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…te version

Removing mlx_test_gguf_planes_library changed mlx_gguf_planes.cpp, whose hash ROUTE_SOURCES pins, and route_version_pins_the_planes_sources failed. The file is back at the pinned bytes.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…xers project per lane, part-page image keys, a raced source stays

- A failed eval of the sampled rows gives the error to every lane of the step.
- A mixer whose K-quant projection is off the lane tier projects each lane with the lane's own call.
- Part-page states that differ by an image key on the part page are both adopted.
- A source namespace that another process holds leaves this load's idle list; one with no lock stays in it.
- A GGUF whose tensor data is not 4-byte aligned plans no weight planes.
- Tests that need Metal or unix calls are gated.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…n is reported; docs say what the code holds

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…hes their kernels

The route check looked only at Metal. On a GPU with no Apple family the row kernels write no record and a sampled cycle accepted empty records. The launcher checks the family and the pipelines' threadgroup limits once; a turn on another GPU keeps the host filter chain.

Tests of device-only kernels skip on a GPU that cannot launch them.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… write-time stamp

A state record's header holds last_used, the recency stamp at write time, and the checksum covers it. A turn that outlasts the 10 s write delay is written before its end restamps it, so the byte-for-byte check failed on a slow runner. The test compares names, the header without last_used and checksum, and the payload; a new test forces the early write.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Brooooooklyn
Brooooooklyn merged commit 7e04c3c into main Nov 20, 2026
16 of 19 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/qwen38-deep-context-dflash2-lanes branch November 20, 2026 03:11
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
## Summary

Follow-ups to #448: items 2 to 9 of its owner list.

| Item | Change |
|---|---|
| 2 | `packages/trl/README.md`: the custom training loop awaits
`trainStep` and counts each step once. Nine more examples in that README
now use the real API. All 14 examples type-check. |
| 3 | Docs: Hy4-flash and Qwen3.8-Flash-Next take images through their
`mmproj` file. They are no longer called text only. |
| 4 | Portato: a **Licenses** tab in Settings (and in ⌘K), built from
Arc components. |
| 5 | `vp fmt` on the two `Cargo.toml` files. Repo-wide `vp fmt --check`
exits 0. |
| 6 | `mlx serve --help` and `docs/cli.md` name every family each flag
applies to, with each family's limits and defaults. |
| 7 | Website: the Arc Pro lightbox returns focus to its thumbnail after
Escape, Close or a backdrop click. |
| 8 | No change. `website.yml` from #448 already runs `check-samples`. |
| 9 | Website mocks: the capture folder is mapped to `/path/to/todo-lib`
in every string. A check fails if a capture path is left. |

### Licenses tab

```
vite build ─ main bundle ─┐
           └ worker ──────┼─▶ collector ─▶ third-party-licenses.json (238 KB, cap 400 KB)
fonts, grammars,          │              └▶ third-party-notices.txt
vendored code, overrides ─┘
Settings ▸ Licenses ── fetch over app:// when the tab opens (no license text in the main chunk)
```

- 113 entries: Portato, 68 interface packages and the bundler runtime, 5
fonts, 29 grammars, 9 adapted files.
- The build fails when a shipped item has no non-empty license text,
when an override is stale, or when a license expression is not allowed.
The expression is parsed (`AND`, `OR`, `WITH`, parentheses), not split.
- The allow list holds SPDX ids only. Three reviewed exceptions are
approved one entry at a time: Liberation Sans, Arc Pro and the TOML
grammar.
- Components: Arc `Tabs`, `SearchField`, `Select`, `Badge`,
`EmptyState`, `Alert` and `Button`, and the app's `Disclosure` and
`CodePanel`. Three opt-in props were added: `Disclosure.stickyTop`,
`CodePanel.keepToggleInPlace` and Arc `Select.menuWidth` (recorded in
`PROVENANCE.md`). Other callers are unchanged.
- Main chunk: 3,291,298 B (cap 4,000,000). Worker: unchanged.

## How it was checked

- `yarn typecheck`, repo-wide `vp fmt --check` and `vp lint --type-aware
--type-check`.
- Tests: dashboard and CLI, 7,354 passed, with a throwaway HOME.
- The site: build, the 4 checks and `tsc`.
- Licenses tab:
- The real `app://` handler in Electron, packaged and dev layouts: 200,
`application/json`, no CSP block.
  - Each build-failure rule fires on a planted fault.
  - License texts compared with upstream at the pinned commits.
- The dev harness at 720×480, 1180×800 and 1440×900, light and dark, by
keyboard. A design review was done, and its findings are fixed.
- Lightbox: 12/12 focus cases fail before the fix and pass after it, in
Chromium and WebKit.
- One Codex adversarial review. All 6 findings were reproduced and
fixed: Windows paths, the SPDX parser, the Vite runtime notice, empty
texts, the Liberation pin and the `--max-context` limits.

## Owner items (not changed here)

1. **Liberation Sans source offer.** The app ships pdf.js's four
Liberation Sans 1.07.4 fonts (GPL-2.0 with the font exception). This was
true before this PR. GPLv2 §3 asks for the source with the binaries, or
a written offer. A link to the upstream commit is neither. The options:
   - Ship or host the 2.8 MB source tarball.
   - Add a written offer.
   - Move to Liberation 2.x (OFL). This needs a pdf.js patch.
   - Stop shipping the fonts.
2. The README pictures `images/portato-work-{light,dark}.webp` still
show `/private/var/tmp/todo-lib`. New pictures need a new isolated run.
3. Not done in this PR:
   - Stage B: the 59 Node packages that the desktop app stages.
   - Electron and Chromium notices in the macOS `.app`.
   - The native addon's crate notices.
   - The `mlx-agent` license assets.
4. The "Int8 queries" section of `docs/models.md` still says 7,168
tokens. The code says 256 (since #389).
5. At 720 px, license text lines break short. A fix changes padding that
every `CodePanel` user shares.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant