Skip to content

test(qwen4_exp): pin chained snapshot restores to the cold partition - #2975

Merged
inureyes merged 1 commit into
mainfrom
fix/issue-2974-chained-hit-partition
Nov 12, 2026
Merged

inureyes merged 1 commit into
mainfrom
fix/issue-2974-chained-hit-partition

Conversation

@inureyes

Copy link
Copy Markdown
Member

#2974 reported that chained multi-turn prompt-cache hits on qwen4_exp gave greedy completions different from a cold run, and called the gap much larger than last-bit noise. Investigation shows the restore chain is exact and the gap comes from the prefill partition, at rounding size.

Findings

  • A new tiny-fixture test, a_chained_restore_matches_a_cold_run_of_the_same_partition, runs the server's chain: prefill, snapshot, restore, prefill more, snapshot, keep running (suffix plus decode), restore again, prefill. It matches a cold run that forwards the same pieces bit for bit, at mid-block and whole-block boundaries in the sparse QSA regime.
  • On the real model, the cold partition alone moves the first token of the qwen4_exp: chained prompt-cache hits diverge materially from a cold prefill #2974 request, with no snapshot involved:
Cold prefill of A5 (19,984 tokens) First token (runner-up)
split at the history boundary The -0.125 (Not -2.25)
boundary snapshot off, chunk 2048, 4096 or one piece The -0.25 (Not -1.875)
boundary snapshot off, chunk 512 Not -0.625 (The -1.0)
chained hit from the 17,120 boundary The -0.5 (Not -1.625)
  • The weights and logits are bfloat16, and its spacing at this magnitude is 0.125. Every difference above is one to three units in the last place, which is the near-tie class docs/CONTINUOUS_BATCHING.md already describes. The issue's "materially larger" reading was wrong.

Decision

No code change. Making chained hits match cold exactly would require adopting and splitting only on a fixed grid: periodic checkpoints at a small interval, with history-boundary snapshots no longer adopted. That re-prefills up to one interval per turn, about 1 to 2 s at 2048 tokens on this model, against a 2.8 s turn today. The doc records this table and the trade-off.

Validation

qwen4_exp snapshot tests (17) pass, and clippy -D warnings and fmt are clean. The real-model rows come from fresh mlxcel-server processes on M3 Ultra with temperature 0 and logprobs.

Closes #2974

On Qwen3.8-Flash-Next a chained multi-turn prompt-cache hit gave a different greedy completion than a cold run of the same request. A tiny-fixture test now drives the server's chain (restore, prefill, snapshot, keep running, restore again, prefill) and requires bit-for-bit equality with a cold run that forwards the same pieces, so the restore chain loses no state.

The real-model gap is the partition effect: switching a cold prefill between chunk 2048 and 512, with no snapshot at all, flips the first token, and every measured difference is one to three bfloat16 units in the last place of the logits. CONTINUOUS_BATCHING.md records the table and why exact chained hits would need a fixed adoption grid, which is not done.

Closes #2974
@inureyes inureyes added type:bug Bug fixes, error corrections, or issue resolutions area:inference Generation, sampling, decoding (incl. speculative, DRY) status:review Under review labels Nov 11, 2026
@inureyes
inureyes merged commit e33150c into main Nov 12, 2026
31 checks passed
@inureyes
inureyes deleted the fix/issue-2974-chained-hit-partition branch November 12, 2026 07:52
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 12, 2026
inureyes added a commit that referenced this pull request Nov 18, 2026
Bumps every version-tracking workspace crate (mlxcel, mlxcel-core, mlxcel-mlx-pin, mlxcel-surgery, mlxcel-xla) to 0.9.0-beta.1 through `make bump-version` and syncs Cargo.lock. `make verify-versions` passes.

Renames the Unreleased changelog section to v0.9.0-beta.1 and records the 190 commits since v0.8.1. The existing entries covered the MLA, prefill-memory and OpenXLA decode work; the section gains grouped bullets for background Responses, the qwen4_exp prompt-cache snapshots and the opt-in checkpoints, MiMo-V2.6, IndicOCR, YOLO11, compressed-tensors FP8, the OpenXLA CUDA GEMV and 31 fixes, plus Performance, Dependencies, CI/CD and Docs sections and the v0.8.1...v0.9.0-beta.1 compare link. The stale Known Issues entry that said DeepSeek V2 keeps the decompressed cache on CUDA and ROCm is removed, since #3149 and #3152 made the latent the default there, and the open issues (#3142, #3144, #2817, the qwen4_exp chained-hit rounding from #2975, and the fp16 fallback for quantized KV on MLA latents) are listed.

Regenerates `recipes/registry/` with the 0.9.0-beta.1 snapshot and repoints CURRENT. The snapshot came from `mlxcel arch --json` on a debug build of this tree instead of the release build `make recipes-registry` runs; its output matches a release binary built from the same code apart from the version field. The only family delta from 0.8.1 is the new `mimo_v2_vlm` entry.

Updates the release pointers: the README main-branch line with highlights for the DeepSeek V2 latent default and background Responses, the bug report placeholder, CITATION.cff, and the cluster note in `docs/distributed.md` and `cluster_handshake.rs`, since v0.8.1 and v0.9.0-beta.1 cannot share a cluster. SECURITY.md is unchanged because 0.8.x remains the supported stable line.
inureyes added a commit that referenced this pull request Nov 28, 2026
Bumps every version-tracking workspace crate (mlxcel, mlxcel-core, mlxcel-mlx-pin, mlxcel-surgery, mlxcel-xla) to 0.9.0-beta.3 through `make bump-version` and syncs Cargo.lock. `make verify-versions` passes.

Renames the Unreleased changelog section to v0.9.0-beta.3 and covers the 58 commits since v0.9.0-beta.2. The existing entries are kept, and the commits that had none gain entries: the OpenXLA hybrids (Falcon-H1, Jamba, PLaMo 2, Mamba1, Falcon-Mamba) and sigmoid MoE routing, the speculative exactness work, the vision resize and parser parity fixes, ERNIE-4.5 and Nemotron 3 Nano loading, and the CLI and Responses validation fixes. Dependencies, CI/CD, Docs and Known Issues sections and the compare link are added. The chrono to jiff entry that #3462 wrote into the beta.2 section moves here. Known Issues drop #2975 and #3407, which are closed, and add the open Raon-1 mini follow-ups.

Regenerates `recipes/registry/` from a release build and repoints CURRENT. It adds `raon1_mini` and the `llava_onevision2` model type on Mage-VL, and removes nothing.

Updates the release pointers: the README main-branch line and a Raon-1 mini highlight, CITATION.cff, the bug report placeholder, the cluster note in `docs/distributed.md` and `cluster_handshake.rs`, and the version example in `TECHNICAL_REPORTS/README.md`. The reports index is unchanged because 0.9 is still the line under development; `make verify-reports-index` passes.
inureyes added a commit that referenced this pull request Nov 30, 2026
Bumps every version-tracking workspace crate (mlxcel, mlxcel-core, mlxcel-mlx-pin, mlxcel-surgery, mlxcel-xla) and the Helm chart's `version` and `appVersion` to 0.9.0 through `make bump-version`, and syncs Cargo.lock. `make verify-versions` passes.

Consolidates the Unreleased section and the v0.9.0-beta.1, beta.2 and beta.3 sections into one v0.9.0 section that follows v0.8.1, with a compare link from v0.8.1. Adds entries for the commits since beta.3 that had none: Spark-X2.5, PLaMo 3, Talkie, Nanbeige4.2, Lille 130M, the Laya and d1-omni decision models, the CUDA container images and Helm chart, graceful shutdown, the Linux ROCm release target and runtime bundle, the WebUI redesign, the DeepSeek-VL2 and DeepSeek-OCR prompt fixes, the server and cache fixes, and the CI and docs changes. Known Issues are rebuilt from the current state: #3474 and #3467 move to Fixed, and the entries for closed #2975, #3142, #3144 and #3158 are dropped. Two en dashes are rewritten.

Regenerates `recipes/registry/` from a release build and repoints CURRENT. It adds 14 model types (depth_pro_2, flint, gptj, lfm3, lille-130m and lille_130m, minicpm_ocr, nanbeige, nemotron_parse_v3_5, oxr, plamo3, raon1_nano, spark2_5, talkie) and removes none.

Updates the release pointers: the README main-branch line plus highlights for the container images and Helm chart and the WebUI redesign, SECURITY.md's supported line (0.9.x), CITATION.cff, the bug report placeholder, the cluster note in `docs/distributed.md` and `cluster_handshake.rs`, the first-image and first-chart release in the Docker and Kubernetes guides (en and ko), and the version example in `TECHNICAL_REPORTS/README.md`. 0.9 stays the current report line, so the reports index is unchanged; `make verify-reports-index` passes.
@inureyes inureyes added this to the 0.9 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qwen4_exp: chained prompt-cache hits diverge materially from a cold prefill

1 participant