Skip to content

Protect long Flash Next snapshots while admitting 2K prompts - #4

Draft
cwschroeder wants to merge 3 commits into
review/flashnext-batching-e7c523efrom
perf/flashnext-protected-admission
Draft

cwschroeder wants to merge 3 commits into
review/flashnext-batching-e7c523efrom
perf/flashnext-protected-admission

Conversation

@cwschroeder

@cwschroeder cwschroeder commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

What this changes

Admit Flash Next RAM snapshots from 2048-token prompts while preventing new marks below position 4096 from evicting snapshots saved at 4096 or later. Other families keep the existing policy; admission accounts for the entire selected mark set and preserves entries when it refuses a short save.

This is a dependent draft against the current-upstream rebase of batching PR #606. The follow-up can target upstream after that prerequisite lands. Its runtime, tests and HTTP helpers match the hardware-qualified source byte for byte.

Receipt

The receipt contains all 800 completed HTTP responses, eight native logs, an independent auditor, corruption checks, source/binary pins and cleanup evidence.

Measured workload 4K admission Protected 2K Time reduction
Complete 2K dialog 8.976 s 3.834 s 57.29%
Complete 2K thinking dialog 10.340 s 5.119 s 50.49%
Warm group of four sessions 9.861 s 2.272 s 76.96%
Mixed short/long trace 37.194 s 37.237 s -0.12%

Both protected traces retain 16377 and 8185 cached tokens on their long revisits. Unprotected 2K loses both prefixes and takes 53.358 s. The 0.12% difference against 4K is not a claimed improvement. Long snapshots can fill the budget and refuse new short snapshots; conservative pool accounting can also refuse a feasible admission.

  • Environment: Apple M3 Ultra, 256 GB, macOS 26.7.1 (25G241), Zig 0.17.0, native Metal inference. Python 3.11.17 runs clients and control; installed MLX is 0.32.3. Upstream e7c523ebfa16b8094cf9e35e3773a7d25befcc5b, qualified source c3abc209398a5db614610c731954e5ad85529087, dependent base 7f0430e027616e8a99586a39049a94afd4c70ad5. Checkpoint Qwen3.8-Flash-Next-MLX-6bit-MTP, revision metadata 45032a193a5d4126ba8534822cbaf8fb30b3e368; existing weights, fresh checkpoint gate, no new full weight rehash. Four slots, 24576-token context, 2 GiB RAM snapshots, MTP chaining and learned disk states off. Binary SHA256 and compiler/SDK pins are in build-pins.json and manifest.json.
  • Exactness: fresh checkpoint gate compares full generated tokens for drafts on/off, four streams, restored prefixes, cancellation and slot reuse. The HTTP auditor checks answer/reasoning, finish reason, token counts and 12-hex generation fingerprints against cache-off references across 800 replies, including 96 completed thinking replies and eight cancellation checks. HTTP fingerprints alone do not prove full token-ID equality.
  • Decode speed: bench_openai.py was not run; this receipt measures complete dialogs and four-session groups, rather than isolated tokens/s.
  • Prompt speed: cold first-prompt timings are included for 2047/2048/2049, 8K and 16K. prefill_cold.py and a previous-release comparison were not run, so last-release prefill performance remains unqualified.
  • Local tests: 70 cache tests passed; host/native/golden 1327 passed, two skipped; workflow target 881 passed. Golden corpus: 309 equal, ten inherited differences, zero unexpected differences. Formatting passed. Lean has 534 inherited findings and no new normalized finding. Seven corrupted receipt copies are rejected, after the original receipt passes the same auditor.
  • Not run: CUDA, other Metal GPUs, the production four-bit checkpoint, more slots/larger contexts, vision, Thunderbolt/tensor parallelism, and release/MLX-server baselines. Qualification covers the stated M3 Ultra configuration. Physical footprint is sampled, not a lifetime peak; all swap probes are zero. The original service was restored healthy with an unchanged configuration; the candidate was not promoted. GitHub No GPU and Zig format both passed on published head 775522f50fad21071f2c326f3ff110716fe0b5a8. These checks do not qualify an additional GPU or a service promotion.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

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