Repository navigation
perf(glm): price measured restore time in complete-checkpoint ready receipts - #1590
Closed
jonathan308 wants to merge 1 commit into
Closed
jonathan308 wants to merge 1 commit into
jonathan308 wants to merge 1 commit into
Conversation
…eceipts A complete-checkpoint ready receipt priced a future restore as its file bytes at the 1.5 GB/s planning rate. GLM-5.3-Flash restores take about 0.9 s more than that on an M5 Ultra, mostly the device's first work after idling, so the receipt said 478 ms for a 716 MB checkpoint that restored in 1.1-1.4 s and 125 ms for a 187 MB one that took 1.0-1.1 s. The coordinator scores a holder with this value until a hit's measured lookup replaces it, so it overstated the saving of short cached GLM prompts. SSDCheckpointStageCost adds to the byte price an exponentially weighted average (newest weight 0.25) of how much longer this store's first-attempt restores took than their byte price; a retried restore also paid for its refused first attempt and is not recorded. The first restore replaces the layout's prior: 935 ms for GLM5-Next, the median of the nine qualification restores beyond their byte price; 0 for other layouts, so their receipts are unchanged until they stage a file. With this estimator (prior 900 ms in that build), 8,192-token GLM ready receipts said 1,101 ms against 16 measured restores of 882-1,229 ms (median 1,088 ms) on the M5 Ultra. Tests: SSDCheckpointStageCostTests (layout priors and the exact GLM estimate, replace-then-average updates, invalid samples, the protocol ceiling, and a store's ready receipt after a first-attempt and a retried restore on an injected stage clock).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 24, 2026
jonathan308
added a commit
that referenced
this pull request
Oct 24, 2026
…features Queue up to six SSD prefix-cache writes (SSDPrefixCachePolicy. writeQueueMaxJobs = 6, was 2) for both writers: attention blocks (SSDWriteBehind) and complete checkpoints (SSDHybridCheckpointStore, whose gate and writer buffer now both use the constant). Approved head 78c904a. Owner decision: one shared write-queue depth for every model. #1589's GLM-only depth is folded into #1584's constant: - SSDHybridCheckpointStore+Write.swift (conflict): the prepareWriteJob gate is #1584's writing.count < writeQueueMaxJobs (six unsettled jobs, the one being written included), not #1589's per-store writing.count <= config.writeQueueJobs. - SSDHybridCheckpointStore.swift (conflict): #1590's stage-cost initializer, then #1584's comment and writer buffer (capacity: writeQueueMaxJobs). #1589's Config.writeQueueJobs is removed. - SSDHybridCheckpointStoreFactory.swift / SSDPrefixCachePolicy.swift: #1589's GLM override (glm5NextCompleteCheckpointWriteQueueJobs = 8, completeCheckpointWriteQueueJobs(backendLayout:)) and its MLXLMCommon import are removed. - docs/reference/ssd-kv-cache.md (conflict): #1584's attention and complete-checkpoint queue rows; #1589's GLM-only row is dropped. - changelog.d/glm-capture-under-load.md: the eight-deep GLM queue bullet is dropped (ssd-write-queue-six-jobs.md states the shared depth). - Tests: #1589's SSDCheckpointWriteQueueTests (GLM 8 / others 1 and a three-deep store) is removed; #1584's fleet-priority and writer-buffer tests cover the shared bound. The fixture loses #1589's writeQueueJobs parameter, and GLM5NextProtectedFactoryTests now checks that the GLM store's writer buffer is the shared writeQueueMaxJobs. #1589's capture-boundary partition and GLM adopters' ordinary chunking are unchanged.
Collaborator
Author
|
Superseded by #1592; consolidated per owner request |
6 of 10 tasks
jonathan308
added a commit
that referenced
this pull request
Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog entry from the 27 fragments added since v0.10.1, ordered by theme behind an upgrade and rollout section: Nemotron 3.5 Super prefix caching (#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590); 4-bit SSD checkpoints and the SSD prefix cache on every model (#1592 (mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and GLM-5.3-Flash (#1564); OpenRouter compatibility: GLM-5.3-Flash and MiMo-V2.6-Flash requests no longer refused (#1585, #1592); Speed: MTP and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx-swift-lm#357), #1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift-lm#362), #1594); Provider diagnostics: refusal reasons and load memory (#1592, #1603); MLX stack (#1596); Desktop release workflow (#1580). Apply 12 corrections reviewed against the code. #1580 is already in the v0.10.1 tag but merged after the 0.10.1 preparation, so its fragment is rendered here. Mark v0.10.1 as published on 2026-10-24. Record in the provider release runbook the SDK pin check, the enablement order (darkbloom-platform#464 before any catalog logprobs change, the GLM allowlist tuple, then both models' logprobs after the rollout and Super's tuple after a signed restart check), the platform evidence and the published history. No tag, registration, upload, deployment or enablement is performed.
jonathan308
added a commit
that referenced
this pull request
Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog entry from the 27 fragments added since v0.10.1, ordered by theme behind an upgrade and rollout section: Nemotron 3.5 Super prefix caching (#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590); 4-bit SSD checkpoints and the SSD prefix cache on every model (#1592 (mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and GLM-5.3-Flash (#1564); OpenRouter compatibility: GLM-5.3-Flash and MiMo-V2.6-Flash requests no longer refused (#1585, #1592); Speed: MTP and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx-swift-lm#357), #1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift-lm#362), #1594); Provider diagnostics: refusal reasons and load memory (#1592, #1603); MLX stack (#1596); Desktop release workflow (#1580). Apply 14 corrections reviewed against the code. #1580 is already in the v0.10.1 tag but merged after the 0.10.1 preparation, so its fragment is rendered here. Mark v0.10.1 as published on 2026-10-24. Record in the provider release runbook the SDK pin check, the enablement order (darkbloom-platform#464 before any catalog logprobs change, the GLM allowlist tuple, then both models' logprobs after the rollout and Super's tuple after a signed restart check), the platform evidence and the published history. No tag, registration, upload, deployment or enablement is performed.
Gajesh2007
pushed a commit
that referenced
this pull request
Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog entry from the 20 fragments added since v0.10.1, ordered by theme behind an upgrade and rollout section: Nemotron 3.5 Super prefix caching (#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590); 4-bit SSD checkpoints and the SSD prefix cache on every model (#1592 (mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and GLM-5.3-Flash (#1564); GLM-5.3-Flash OpenRouter request controls (#1585, #1592); Speed: MTP and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx- swift-lm#357), #1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift- lm#362), #1594); Provider diagnostics (#1592); MLX stack (#1596); Desktop release workflow (#1580). Apply 12 corrections reviewed against the code. #1580 is already in the v0.10.1 tag but merged after the 0.10.1 preparation, so its fragment is rendered here. Mark v0.10.1 as published on 2026-10-24. Record in the provider release runbook the SDK pin check, the enablement order (darkbloom-platform#464 before any catalog logprobs change, the GLM allowlist tuple, then both models' logprobs after the rollout and Super's tuple after a signed restart check), the platform evidence and the published history. No tag, registration, upload, deployment or enablement is performed. Co-authored-by: Jonathan Spangler <5055076+jonathan308@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A complete-checkpoint ready receipt (
prefix_cache_ready_v2.stage_ms) priced a future restore as the file's bytes at the 1.5 GB/s planning rate. A GLM-5.3-Flash restore takes about 0.9 s more than that on an M5 Ultra, so the receipt said a third to a half of the measured stage (qualification F3). The coordinator scores a holder with this value until a hit's measured lookup replaces it (Holder.StageCostAt), so it overstated the saving of short cached GLM prompts.SSDCheckpointStageCostadds to the byte price an exponentially weighted average (newest weight 0.25) of how much longer this store's first-attempt restores took than their byte price. The first measured restore replaces the layout's prior: 935 ms for GLM5-Next (median of the nine qualification restores beyond their byte price), 0 for other layouts. A retried (shorter-endpoint) restore also paid for its refused first attempt and is not recorded.Before
flowchart LR subgraph Before["Before: ready receipt for an 8,192-token GLM checkpoint (300.5 MB)"] direction LR b1(["durable write"]):::req --> b2["stage_ms = bytes ÷ 1.5 GB/s<br/>= 201 ms"]:::bad b2 --> b3["coordinator credit:<br/>prefill saved − 201 ms"]:::flow b4(["actual restore"]):::req --> b5["1.0–1.2 s"]:::check end classDef req fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a classDef flow fill:#f3f4f6,stroke:#4b5563,color:#111827 classDef check fill:#fef3c7,stroke:#b45309,color:#78350f classDef bad fill:#fee2e2,stroke:#b91c1c,color:#7f1d1dAfter
flowchart LR subgraph After["After: SSDCheckpointStageCost per store"] direction LR a1(["durable write"]):::req --> a2["stage_ms = bytes ÷ 1.5 GB/s<br/>+ measured overhead"]:::good a3(["first-attempt restore<br/>(stage)"]):::req --> a4["overhead = elapsed − byte price<br/>first replaces the prior, then EWMA 0.25"]:::flow a4 --> a2 a5["prior: GLM5-Next 935 ms,<br/>other layouts 0"]:::flow --> a2 a2 --> a6["8,192-token GLM receipt ≈ 1.1 s<br/>(measured 0.9–1.2 s)"]:::good end classDef req fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a classDef flow fill:#f3f4f6,stroke:#4b5563,color:#111827 classDef good fill:#dcfce7,stroke:#15803d,color:#14532dLinked issue
None; follow-up from the GLM-5.3-Flash cache qualification (finding F3).
Stacking: none. It targets
master(9034a5a0f) and changes no SDK pin; it touches only the SSD store, not #1587's or #1589's files, so it merges independently of that stack (tested on top of #1589 as well). The GLM prior was measured on #1587's BF16 files; on 0.10.1's FP32 files the overhead was 1.0–1.3 s, and the first restore replaces the prior either way.Evidence
M5 Ultra #1, real GLM-5.3-Flash, BF16 checkpoint files.
Qualification restores (old estimate vs measured, all 3 hits each):
stage_msstage_ms(prior 935)Live, this commit's code (prior 935 ms) in a dev build with #1589 (M5 Ultra #1, 8,192-token files):
stage_mssentEarlier dev builds of the same estimator with a 900 ms prior:
stage_mssentWhat the fixed part is (stage phase timing, experiment build, 8,192-token file): manifest 2 ms, plan 0.7 ms, page allocation 0.9 s, stream/decrypt/copy 72–86 ms, finish 0.3 ms. Almost all of the allocation is the device zero-fill waiting on the GPU, and only when the GPU has idled: the same hit stages in 92–96 ms when it starts within about 0.6 s of other GPU work, 0.75–1.0 s after 1 s or more of idle, and 2.8 s while another request's 32k prefill holds the engine. The wake is not restore work: on the same build a novel 2k prompt's cold TTFT is 2.10–2.15 s after 16 s idle and 1.18 s right after a 49-token request, which itself takes 1.1 s after idle. The estimate cannot know which case the next restore lands in; the EWMA follows the provider's recent restores.
Test plan
SSDCheckpointStageCostTests: layout priors and the exact GLM estimate (201 + 935 ms for the 8,192-token file); the first sample replaces the prior and later ones average in at 0.25; a stage faster than its byte price counts as no overhead; zero bytes, NaN and negative samples are ignored; the protocol ceiling holds. A store's ready receipt prices a first-attempt restore of 600 ms on an injected stage clock at 600 ms, and ignores a retried restore (both arguments).swift test --skip-build --no-parallel --filter 'SSD|PrefixCache|Checkpoint|GLM5Next|Demanded|EngineV2Factory'(runner-isolated suites and the fixture-dependentMiMoV26DiscoveryLoadFootprintTestsskipped): Swift Testing 753 tests in 151 suites passed; XCTest 4 executed, 1 skipped, 0 failures../scripts/docs-check.sh(196 OK),python3 scripts/docs-impact-check.py --base origin/master(OK),python3 scripts/changelog.py check.Components touched
Protocol / interface changes
stage_mskeeps its unit, range and clamp (PrefixCacheReadyResult.maxStageMs); only its value is closer to the measured restore.Documentation impact
docs/reference/ssd-kv-cache.md(ready stage estimate row),changelog.d/glm-ready-stage-estimate.md.Merge Danger
Door: two-way. No persisted state; a restart starts again from the prior.
Blast Radius: SSD-complete-checkpoint receipts. Other layouts start from a zero prior, so their receipts are unchanged until the store stages a file; after that they also include measured overhead. Attention-block SSD receipts (
SSDPrefixCache) are untouched.Limitations
stage_msmatches what the coordinator measures after a hit, but understates the cache's advantage over a cold prefill on the same idle provider.Refactor pass
Done: no change was needed, and the head stays
3260db104.Reviewed and kept:
SSDCheckpointStageCostis one small, lock-guarded type with one job: the byte price plus the moving average of measured overhead. The prior, and the rule that the first sample replaces it (observed), are explicit, and its clamp matchesestimatedStageMillisDouble.stage), and only on the first attempt.publishReadyis the only reader, and no other receipt path changes.priorOverheadMilliseconds(backendLayout:)has the same kind of layout switch as perf(glm): capture GLM prefix checkpoints beside decoding requests #1589's write-queue depth. This PR targetsmasterindependently, so the two cannot share a helper without stacking.import MLXmatches the siblingSSDShorter*suites, whose fixtures it reuses.Validation on
3260db104itself, withmaster's SDK pin6148b6da. The earlier evidence above ran it on top of #1589.CFFIXED_USER_HOMEpointed at a temp dir.~/.darkbloom/usage-history.jsonwas byte-identical before and after.swift test --skip-build --no-parallel --filter 'SSD|PrefixCache|Checkpoint|GLM5Next|Demanded|EngineV2Factory|Receipt', skipping the runner's fresh-process suites and the MiMo XCTests that need fixtures:SSDCheckpointStageCostTests.SSDShorterNativeBlockRestoreTests,SSDNativeCheckpointOracleTestsandstageDeltapassed.DARKBLOOM_TEST_GLM5_PROTECTED_FACTORY=1,GLM5NextProtectedFactoryTests|GLM5NextEncryptedCheckpointTests|GLM5NextProviderLoopTests: 14 tests in 3 suites passed../scripts/docs-check.sh(196 OK),python3 scripts/docs-impact-check.py --base origin/master(OK),python3 scripts/changelog.py check(2 valid) andpython3 scripts/test-docs-impact-check.py(OK).