Repository navigation
Serve Muse Glimmer 30B (NVFP4) with exact DFlash drafting and the prefix cache - #2149
Draft
jonathan308 wants to merge 34 commits into
Draft
jonathan308 wants to merge 34 commits into
jonathan308 wants to merge 34 commits into
Conversation
… lists MuseGlimmerModelPolicy is the one place that names the model: the catalog placeholder muse-glimmer-30b, the local download nvidia/Muse-Glimmer-30B-NVFP4, model_type muse_glimmer and the 131,072-token context. Each list reads it: - automatic KV selection is paged; - the SSD prefix cache defaults on; - mtp_mode auto names the exact target and its separately published drafter; draft depth adapts up to 7 and never past the engine's tested window; the built-in acceptance rule is exact; - omitted sampling fields take the model card's values (temperature 1.0, top_p 0.95, top_k 64), whatever the artifact's generation_config.json says; - the scan labels the identity nvfp4; - a slot advertises the trained context, bounded by the loaded model. The family is not in the engine's supported set: nothing advertises or loads it until the SDK's native model is pinned. No activation floor or load transient is added. Co-Authored-By: Claude <noreply@anthropic.com>
…ngth The model's template reads one reasoning control, reasoning_strength (low, medium, high or xhigh; high when absent), and nothing switches its reasoning off. An effort named as reasoning_effort or reasoning.effort renders: none, minimal, low -> low; medium -> medium; high -> high; xhigh, max -> xhigh With no effort the template keeps its default. A thinking switch set to off (reasoning.enabled, else enable_thinking) selects low and wins over an effort, the precedence the other families give an explicit Boolean. The template context carries reasoning_strength and the request date only. muse_glimmer joins the model types that reason, so an effort that is none of the names is refused. reasoning_effort_vectors.json gains the family's 29 cases (446 -> 475) from the generator; the platform copies that file byte for byte. A caller that declines reasoning (reasoning.exclude, include_reasoning false, reasoning.enabled false) gets the answer without the reasoning text; the request path that honors it follows. Co-Authored-By: Claude <noreply@anthropic.com>
The model writes framed messages after the prompt's <|start|>assistant: to=self is reasoning, to=user (or no recipient) is the answer, any other recipient is a tool channel of ATEM invokes; <|eom|> joins the messages of a turn and <|eot|> ends it. MuseGlimmerChannelSplitter reads that text for the native tool-stream router: - reasoning leaves as reasoning_content and the answer as content, with no framing in either at any chunking; a tail that may still become a marker or a to= header is held until it resolves; - tool markup is read on tool channels only, so an invoke quoted in reasoning or in the answer stays text; - a body also ends at the next header, so reasoning that runs into a bare to=<tool><|message|> keeps its call; - each invoke is parsed on its own: several in one block, or one per message, are that many tool_calls, and a call that reached </atem:invoke> is returned without its terminator; - the doubled name a bare tool draws (get_weather.get_weather) is the declared tool; nothing else is rewritten; - output cut at max_tokens inside reasoning is reasoning with finish reason length; a call cut off mid-invoke is dropped; any other invalid tool output fails the request and never becomes answer text. Around it: the ATEM parser is the request's tool parser and calls leave only at the engine terminal; required and named tool choice is prompt-forced and validated; no think-tag parser rereads the channels; generation stops at <|eot|> or <|end_of_text|> and never at <|eom|>; client stop strings match on the answer channel only; reasoning a caller declined is generated, counted and not sent. History reaches the template as it requires: tool-call arguments are always a mapping (text that is no JSON object replays as an empty one, as the reference servers render it), null arguments and schema nulls stay values, and a replayed answer carries no framing. Other families are unchanged: the router takes this path only for the muse_glimmer model type. Co-Authored-By: Claude <noreply@anthropic.com>
The template writes every tool's name, description and schema, and every
structured tool-call argument, through tojson. Transformers renders that as
Python json.dumps(ensure_ascii=False). Swift-Jinja's default writes compact
separators and escapes non-ASCII text and slashes, so 11 of 42 measured
cases (every one with tools) differed from the reference.
The Python-compatible writer the Nemotron templates already use moves to
PythonJSONTemplateFilter, unchanged for them, and the muse_glimmer model type
binds it as its tojson, in the runtime tokenizer and in the scan-time render
check alike (ReferenceTemplateFilters). Every other family keeps its prompt
bytes. Mapping keys still render sorted, as the Jinja bridge orders them for
every family.
Fixtures/MuseGlimmer holds the template a served artifact carries: Meta's
newer template with only its date block replaced by the direct
strftime_now('%Y-%m-%d') call. The published file tests
'strftime_now is defined', which the date guard rejects, so it yields no
prompt contract and no prefix cache; the guards are unchanged.
prompt-golden.json holds 36 request bodies with the prompt and token IDs a
Python Jinja2 reference renders, written by
scripts/muse-glimmer-qualification/prompt_golden.py. The tests send each body
through the production request pipeline and the pinned Swift-Jinja and
require the same text; with MUSE_GLIMMER_NVFP4_DIR set they also require the
same token IDs through the real tokenizer.
Co-Authored-By: Claude <noreply@anthropic.com>
… renderer The template passes a conditional as a call argument, namespace(name=tcid if tcid else ''). The coordinator's prompt renderer (minijinja) does not parse that spelling, and a template it cannot compile is never planned, so the model would get no cache scope. The served template writes namespace(name=(tcid if tcid else '')), which Jinja2, Swift-Jinja and minijinja read alike. No rendered byte changes: the corpus's 36 prompts and token IDs are identical; only the template hash moves. Served template: SHA-256 0bb1b6209e797a62fdd81d445ddf36cbb1a2d71f84400c141c9ec11049d7ce3c, 9,819 bytes (Meta's newer template, date block and this argument changed). The generator checks both edits against the publisher's file. Co-Authored-By: Claude <noreply@anthropic.com>
… found Splitter: - Nothing inside a dropped message opens another one. A <|message|> in another role's frame, or after an over-long header, used to open the answer channel and could show forged text or raw tool markup. - Text outside any message is judged the same at every chunking: the header probe now ends with the marker found, and an over-long header is handled alike whether it arrives whole or in pieces (the answer when no role was named, dropped after <|start|>). - A word too long to be a recipient is not held back, so the held tail and the rescans stay bounded; the tool body is scanned for an invoke only when the new text can have closed one. - Stray closing markup on a tool channel is malformed with or without the wrapper; markers are matched literally, so a combining scalar after one cannot hide it. Logprobs: the withheld-reasoning filter reads think tags and cannot tell this model's reasoning message from its answer, so a request that declines reasoning gets no logprob entries instead of its withheld reasoning's. Cleanups with no behavior change: one helper for the forced-call visible-text rule, declared tool names built only for this family, an unused parameter and a needless throws removed, the JSON writer private again, three comments corrected. Co-Authored-By: Claude <noreply@anthropic.com>
…23a6149) libs/mlx-swift-lm moves from 44ab1755 to 423a6149, the head of the SDK's feat/muse-glimmer-native branch: the native text tower MuseGlimmerTextModel, its strict pinned installer, CBv2 conformances on paged KV and complete historical checkpoints. An unmerged SDK branch head. This commit stands alone so it can be pointed at the merged SDK commit before the change lands. Co-Authored-By: Claude <noreply@anthropic.com>
Wires the SDK's native text tower into the generic slot: - Load. No SDK factory builds this model. MuseGlimmerServingLoad calls MuseGlimmerInstallation.stage, which verifies the pinned NVIDIA checkpoint (index and every shard by SHA-256) and installs the projections it reads from the verified shard headers. The installer reserves no memory, so it runs inside the slot owner's ordinary LOAD claim and weight-hash bracket. - Text first. ModelMediaPolicy advertises no media for the type: the vision tensors are verified and left unloaded, and the retained vision_config no longer selects the vision factory. - Dispatch. ProductionModelAdapter takes the tower's layer kinds and capabilities; the sizing snapshot takes its KV rate from the same kinds. - Paged or refuse. The tower's capabilities require paged KV, and backend preparation treats that as it treats Flint: automatic selection is an explicit paged request, and an explicit contiguous selection, the paged kill switch or the crash-loop guard refuses the load. No contiguous fallback, in benchmarks either (they route through the production session). - Admission. EngineV2SupportedModels admits the two exact identities; the type under any other id stays unsupported. Plain serving uses the generic CBv2 adapter. The SSD prefix cache needs no change: the tower declares complete historical attention checkpoints. No drafter is loaded and no activation floor or load transient is added. MuseGlimmerLiveTests is the opt-in real-checkpoint check behind a loopback StandaloneServer; it starts no service and contacts no coordinator. Co-Authored-By: Claude <noreply@anthropic.com>
…-cache root The live test configured the operator cache selection on the directory it was given, so the store's volume check refused the RAM disks it ran on. It now requires the isolated test root and an in-memory key: the run never opens the operator's cache directory or its persistent key. Co-Authored-By: Claude <noreply@anthropic.com>
Conflicts resolved: - NativeToolStreamRouter: dev's token-limit cut (`finishText(cutAtLimit:)`) replaces the branch's `truncated` flag; Muse Glimmer's splitter drops a call cut off mid-invoke at a cut and, like the other native families, does not refuse a frame there. `hasNativeToolFailure` counts its frames. - MultiModelBatchSchedulerEngine: `nativeGlimmerChannels` beside dev's `rewriteHarmonyFinalHeaders`; the all-logprob withholding for declined Muse Glimmer reasoning is kept. - LocalTokenizerLoader, TemplateRenderCheck: the family filters (`ReferenceTemplateFilters`, Nemotron and Muse Glimmer) beside dev's `HFTemplateFilters`, which does not list muse_glimmer. - EngineV2SamplingDefaults: card defaults beside dev's Qwen3.5-9B penalty. - libs/mlx-swift-lm stays at the Muse Glimmer SDK commit 423a6149; dev's pin 859f6415 is not its ancestor (12 SDK-main commits to merge there). Co-Authored-By: Claude <noreply@anthropic.com>
… cache) The live test now loads the slot explicitly and records load time and memory, then runs three opt-in phases: HTTP (greedy, sampled, streamed, cut-in-reasoning, ATEM tool calls streamed and not, tool result), speed (matched short-prompt decode and a 4k-token prefill with memory at each phase), and a six-turn conversation under one cache scope, built as the provider builds a coordinator request's engine, with each turn repeated under a fresh scope as the cold arm. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Canonical docs for the provider change: the native section and the reasoning-effort row in inference.md, the complete-checkpoint section in prefix-cache.md (default balanced checkpoint rows; the runtime identity needs a bound metallib), memory admission in hardware-support.md, the local package contract in model-registry-format.md, MTP intent and acceptance in the configuration and CLI references, and the suites, fixtures and opt-in live test in test.md. The effort vectors count is 475. Co-Authored-By: Claude <noreply@anthropic.com>
…e run The complete prefix cache's runtime identity includes the digest of the metallib MLX was pinned to before GPU work. darkbloom start binds it; the test process did not, so the slot reported runtime_identity_unavailable and the cache phase could never hit. The live test now binds the staged test metallib first and refuses the cache phase when the slot reports the cache disabled. Co-Authored-By: Claude <noreply@anthropic.com>
At 160 output tokens every turn ended inside its reasoning, so the history carried no answers and the model began copying the placeholder. The turns are now record lookups with 512 output tokens over a shorter document. Co-Authored-By: Claude <noreply@anthropic.com>
The served template differs from the publisher's in its date block and in one parenthesized call argument that minijinja needs; the docs and the changelog fragment named only the first. Co-Authored-By: Claude <noreply@anthropic.com>
A cache hit must not change the emitted tokens. On the real checkpoint, restores from the default `balanced` rows changed the tokens on 3 of 5 restored conversation turns; from native rows, on none. Muse Glimmer's complete checkpoints now default to native rows (`EngineV2KVQuantizationPolicy.resolveProviderCheckpoint`, used by the slot factory and `darkbloom benchmark`). The process switch, then the model's own per-model entry, still select a profile; the global setting does not apply, as for Nemotron 3.5 Super. Every other model type resolves exactly as before (a test compares both resolutions over the setting matrix). The live test records the slot's checkpoint precision and, with the switch unset, requires native rows. Co-Authored-By: Claude <noreply@anthropic.com>
Each scoped conversation request now settles the store's queued writes and records the files, bytes and write milliseconds it added, so a run shows what each checkpoint costs on disk. Co-Authored-By: Claude <noreply@anthropic.com>
…int stride Muse Glimmer's sliding window (2,048 tokens) is as long as the default solo stripe, and its window ring keeps no row behind a range end, so a complete checkpoint could land only where a range ended on a multiple of 2,048: a six-turn conversation of about 3,700 tokens reused 2,048 tokens per turn. The SDK captures paged historical checkpoints on a 1,024-token stride, so this type's solo stripe is now 1,024: every stride point ends a range. Cold and restored requests run on the same grid, so a restore stays exact by construction. The window ring (max of window plus speculative span and the largest chunk) is unchanged; `DARKBLOOM_CBV2_SOLO_PREFILL_STRIPE` still overrides it. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…after The SDK head carries the row-exact attention windows, rectangular-exact verification and the pinned quantized DFlash drafter for Muse Glimmer 30B. It contains both the previous pin 423a6149 and dev's pin 859f6415. Co-Authored-By: Claude <noreply@anthropic.com>
Every Muse Glimmer load now turns on the SDK's row-exact attention windows right after staging, so the tower has one numerics profile with or without a drafter. A tower that cannot fails the load. Complete checkpoints record the profile (museGlimmer.numericsProfile), and the slot builds no store if the tower reports another. The verified assistant funnel admits the two exact identities, with SpecDecLimits unchanged. The loader binds the artifact through the SDK's pinned quantized DFlash drafter, a second check on top of the store's digests, and other bytes fail closed. The drafter requires rectangular-exact verification on the exact tower. Depth is fixed at seven, and DARKBLOOM_MTP_MUSE_GLIMMER_DEPTH=adaptive selects the adaptive controller. The engine steps the model through MuseGlimmerCBv2Adapter, on which a request-stateful drafter can activate. Without a drafter it serves the same tokens as the generic adapter. Under exact acceptance the drafter's state is advisory, so it classifies as CompleteCheckpointAssistant.advisory. The historical target keeps its SSD checkpoints with the target-only layout. An advisory drafter on a recurrent target is still refused. MuseGlimmerPolicyTests.draftDepth now expects the decided default, fixed at seven, where it previously expected adaptive. Co-Authored-By: Claude <noreply@anthropic.com>
DARKBLOOM_MUSE_GLIMMER_DRAFTER loads a local drafter through the verified funnel. The test then requires the slot to report it active with rectangular-exact verification, and records its MTP status after load. A new drafter phase streams three prompts, greedy and sampled under fixed seeds, and records the engine's MTP counters for each request. DARKBLOOM_MUSE_GLIMMER_REFERENCE names an earlier run's receipts. Every case present in both runs must then have equal content, reasoning, finish reason and token count, so a drafter-off run and a drafter-on run check that the drafter changes no output. Co-Authored-By: Claude <noreply@anthropic.com>
…s policy MuseGlimmerModelPolicy.servedNumericsProfile is now the one place that names the SDK numerics profile the tower is served with. The load still requires the tower to report it once exact windows are on. The checkpoint fingerprint carries the tower's own report. The tests read both the plain and the exact profile from the SDK instead of repeating either string. An SDK pin that renames the profile is therefore one edit, and the drafter tests fail until that edit is made. The model registry reference gains the numerics and drafter rows. Co-Authored-By: Claude <noreply@anthropic.com>
The SDK head serves Muse Glimmer's decode and verify rows exactly at any row count. Prompt chunks keep MLX's arithmetic. Its numerics profile is now muse-glimmer-exact-windows-v3, and MuseGlimmerModelPolicy names it. The drafter verifies a round's columns as rows of one paged decode dispatch. It also requires exact acceptance: under typical acceptance the engine keeps it inactive and serves the target alone, which a new test checks. The loader now refuses symlinked or oversized index and JSON records, as it already refused such shards. The pin contains the previous pin 437f8b9f and dev's pin 859f6415. Co-Authored-By: Claude <noreply@anthropic.com>
… grid The SDK head cuts every Muse Glimmer prompt on a fixed 1,024-token grid (CBv2ModelCapabilities.prefillChunkAlignment): only at multiples of 1,024, at the prompt end or at a restore boundary, and each cell runs whole or waits. Neither load nor another request's drafter moves a prompt's bytes. The numerics profile is muse-glimmer-exact-windows-v4, and MuseGlimmerModelPolicy names it. The solo stripe no longer cuts these prompts. Its default now comes from the SDK grid and sizes the paged pool's prompt write to one cell. The pool size is computed in one place (pagedPrefillChunkTokens). A plain chunk or stripe setting that leaves the write below a cell, or off its multiples, now refuses the load with EngineV2ProductionError.prefillGridUnfit instead of reaching the engine's untyped check. A zero stripe is one example. The step budget needs no check, because a step always carries one cell. MuseGlimmerPrefillGridTests covers each knob, and shows that a step budget below one cell serves the same tokens. The pin is 5cbe636c plus a formatting-only commit, and contains 978b2de5. Co-Authored-By: Claude <noreply@anthropic.com>
dev pins mlx-swift-lm at f41a5f9a. That commit is an ancestor of this branch's pin 99c50f6c, so the gitlink keeps 99c50f6c. Every other file merged without conflict. dev's new commits change no EngineV2Factory, prefill chunk or stripe setting, checkpoint store, assistant funnel or model policy code. Its per-build SDK defaults list one Qwen build by exact id. Its new text-path hooks (the stray think-close prefix, the exit-thinking markers) are keyed by model types that do not include muse_glimmer. Co-Authored-By: Claude <noreply@anthropic.com>
…ite outcomes The live receipts counted dropped checkpoint writes but not why they were dropped. Each request now also records the donation outcomes settled during it (donated, disk_space_insufficient, ...), from the process-wide counters the store records to by default. The test is the process's only requester, so the difference between two snapshots names that request's writes. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolves one comment conflict in ToolChoiceEnforcementPolicy.swift: dev's reworded GLM note (JSONAnswerPolicy) is kept and the Muse Glimmer note follows it. No code lines conflicted. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Nov 14, 2026
Draft
…hed SDK base dev moved its mlx-swift-lm pin to #434 (c85e84cf) and changed tool-call parsing for GLM, Gemma and MiMo. Conflicts, both kept: - MultiModelBatchSchedulerEngine.swift, the DEBUG _testMakeEventStream parameter list: this branch's withholdReasoning and nativeGlimmerChannels, then dev's nativeMiMoChannels (the forwarding call had merged cleanly and already passes all three, in makeEventStream's declared order). - libs/mlx-swift-lm: 39e5dc5e, feat/muse-glimmer-native (#423) with #434 merged in, so the pin carries both dev's parsers and Muse Glimmer. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…ties StandaloneServer's config defaults its capabilities to none, so once the model declares a hardware requirement (apple_m5, mlx_nax, muse_glimmer_v1) the in-process live test could not load it on an M5. Detect them as `darkbloom start --local` does, with the staged metallib. Test-only. Co-Authored-By: Claude <noreply@anthropic.com>
…hed SDK base dev pinned mlx-swift-lm at main fe9b5282 (#434's merge, the same tree as c85e84cf) and says so in docs/architecture/inference.md, which merged cleanly. Only the libs/mlx-swift-lm gitlink conflicted: it now pins c1103b8c, feat/muse-glimmer-native (#423) with main fe9b5282 merged in (no file change), so the pin contains dev's. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
The splitter searched a tool channel's text from the start for the first complete invoke each time a piece could have completed a closing tag. A stray `</atem:invoke>` is never consumed, so a stream of them read the whole text again per tag: 10 000 tags took 12.7 s and 20 000 took 48 s. Each invoke found also copied the text after it, so a replayed history string with many invokes, read in one piece, copied quadratically too. The tool text now lives in `ToolBody`. A search that finds no complete invoke records where it stopped, and the next one resumes there, less the tag's length and one more character: appended text can complete a tag, or extend the last character (a combining mark, CR LF), only at the end. An opening tag whose boundary character ends the text is read again. Invokes found in one append leave the text together. The searches are the same Foundation calls from positions a search from the start passes, so the invokes, their order and the text left are byte-identical. Tests: a differential test against the previous search over 1 505 seeded tool texts (combining marks, ZWJ, CR LF, regional indicators, Indic and Hangul sequences, stray and partial tags), each split at 1, 2, 3, 5, 13 and 17 scalars and by fragment; and a work bound: 20 000 stray closes, 5 000 invokes plus 5 000 strays in one piece, and one open invoke over 20 000 pieces each cost at most 4 bytes of search or copy per input byte. Before: the bound failed (49 s). After: 0.8 s, and the fuzz suite's repeatedStrayCloses went from 121.6 s to 0.9 s (debug). Co-Authored-By: Claude <noreply@anthropic.com>
libs/mlx-swift-lm moves from c1103b8c to cc2be070, the same branch (feat/muse-glimmer-native, #423) with three commits on top: - 824db4cf keeps an ATEM value nested past 63 levels as text; - 31a7ccb2 keeps JSON text nested past 63 levels as text in ToolArgumentNormalization, which both ATEM readers call after typing a value; - cc2be070 formats the new test with swift-format 6.4.4. Without them, a Muse tool call whose parameter nests about 192 objects or 224 arrays deep (160 in a debug build) exhausts the 512 KiB cooperative stack when NativeToolStreamRouter encodes its arguments, and the provider stops with SIGBUS. libs/mlx and libs/mlx-swift are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins 62cfabd5, mlx-swift-lm #428 (speed) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins 3702459f, mlx-swift-lm #427 (vision) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins b7672434, mlx-swift-lm #429 (ATEM reference reader) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
The suite feeds seeded random and hostile model output, at every chunking, through: - the channel splitter; - the tool frame; - the SDK's ATEM reference reader and its strict parser; - the scheduler's forwarding body, under every tool choice. Each must hold up the way the inbound-depth (#2130), queue-budget (#2135) and TOML (#2138) fixes were tested. It must not crash, stall, buffer without bound, leak framing, raise invalidToolPayload or return a 500. A frame the model gets wrong is the model's error, a 422. deepNesting and the deep hostile frames need the nesting bounds of mlx-swift-lm #423 (824db4cf and 31a7ccb2, from d266d4e6 and 7f958c64) in the pin; this branch pins b7672434, which has them. Without them, a value nested a few hundred levels deep stops the test process with SIGBUS, as it would stop a provider. repeatedStrayCloses took about two minutes in a debug build while the splitter rescanned the tool body on every stray closing tag; with the linear splitter of #2149 (e2c60ca) it takes about a second. Test-only. Co-Authored-By: Claude <noreply@anthropic.com>
12 of 21 tasks
GumbiiDigital
added a commit
to GumbiiDigital/d-inference
that referenced
this pull request
Dec 3, 2026
…che (replay Layr-Labs#2149) Replays Layr-Labs#2149 onto dev (82175d9) and pins libs/mlx-swift-lm to d625d5bde2bd6f181227e858422f1d072d84c6cc (Layr-Labs/mlx-swift-lm#579, multimodal SDK baseline: Layr-Labs#423, Layr-Labs#427, Layr-Labs#429, Layr-Labs#430, Layr-Labs#432; Layr-Labs#428 omitted) so every commit in the stack compiles cleanly. Drops Layr-Labs#2149's MTPAcceptancePolicy.swift edit (superseded by Layr-Labs#2723 universal exact acceptance on dev), regenerates fixtures/prompt-contract/v1/reasoning_effort_vectors.json (475 -> 504 cases, inserting muse_glimmer at indices 380-408 via scripts/generate-reasoning-effort-vectors.py), and updates CachePromptParityTests and MuseGlimmerPolicyTests for dev parity.
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
Serves Muse Glimmer 30B (
model_type: muse_glimmer, NVIDIA's NVFP4 checkpoint at a pinned revision) as atext model on a paged CBv2 slot, for the exact identities of
MuseGlimmerModelPolicyonly, with its pinnedquantized drafter when that is installed. The change adds:
history, stop tokens, the served chat template and prompt goldens;
MuseGlimmerInstallation.stage), which turns on theSDK's row-exact attention windows and fails if the tower does not then report the policy's numerics
profile (
muse-glimmer-exact-windows-v4);setting off that grid refuses the load with a typed reason;
numerics profile;
through the SDK's pinned DFlash drafter. The engine verifies each round exactly, so drafter on serves
the same tokens as drafter off. Depth is fixed at seven;
DARKBLOOM_MTP_MUSE_GLIMMER_DEPTH=adaptiveselects the adaptive controller.
Vision is not served, and the model is not registered in the coordinator catalog.
Linked issue
None.
Test plan
This refresh (
be76a1b2c; round 258ae7e94bchanges only the SDK gitlink, to a commit with an identical tree, anddev's docs line). The merge reproduces the tree the M5 Ultra go/no-go tested on 2026-11-15: a local merge of this stack with the refreshed SDK equals the go/no-go's tree, except for the fixes in #2150 and #2152. Nothing at this exact head ran on an M5 here.be76a1b2c.MuseGlimmerLiveTestsbuilds its loopback server withProviderRuntimeCapabilityDetector.detectLive, asdarkbloom start --localdoes. Before, it used the configuration's default of no capabilities. A model with a hardware requirement refuses that default, so the live test could not start on an M5 (go/no-go). The hardware requirement itself is provider: Muse Glimmer launch fixes (tool calls, reference prompt, M5 Ultra gate, loop guard) and cancelled-row admission wait #2152's.apple_m5. The same change passed the go/no-go's live gates on the M5 (harness9bfa17ada).Earlier runs:
All on one M3 Ultra (256 GiB), macOS 27.2,
swift build --build-system native --build-tests, metallibfrom
scripts/stage-test-metallib.sh(SHA-2565b97893c…70ac),SDKROOTat the Command Line Tools 27.0SDK (this Mac's Xcode 27.2 SDK crashes Date comparisons on its beta OS). Runs are
swift test --build-system native --skip-build --no-parallel --filter <regex>with isolated daemon-statefiles. Head
7b75e0d99(after mergingdev6d61e2d08), SDK pin99c50f6c, debug build unless stated.failed. That includes the drafter suite (exact windows and their refusal, the profile in the
checkpoint identity, the funnel gate, loader admit/refuse, classification, adapter parity, engine
drafter on == off greedy and sampled, typical acceptance kept inactive) and the four prefill-grid tests:
0/ malformed /512/1536and chunk1500/3000each refuse withprefillGridUnfit;The live test and the real-tokenizer test skip without their environment.
MUSE_GLIMMER_NVFP4_DIRset to the pinned NVIDIAsnapshot; tokenizer files only):
MuseGlimmerPromptGoldenTests, 6 tests passed, 0 skipped.9B, Nemotron template, prefill geometry and the new suites): Swift Testing 818 tests in 90 suites, 0
failed. XCTest: 70 executed, 16 skipped, 8 failures, all in 7
MiMoV26ServingLoadTeststhat throwpayloadFixtureRequiredbecauseMIMO_V26_SERIAL_LOAD_FIXTURESis not set on this Mac. The same 8fail at every earlier head of this branch.
dev(6bc14de2c) for the suites this touches: Swift Testing 441 tests in55 suites, 0 failed, 1 skipped; XCTest 26 executed, 0 failed, 1 skipped.
Swift Testing tests passed and XCTest 43 executed, 0 failures, 3 skipped, at each.
MuseGlimmerLiveTests, opt-in, GPU lane held,ephemeral token, no coordinator). Each run's encrypted cache root is a new directory capped at 4 GiB, and
each receipt records its checkpoint writes' outcomes. The release test bundle does not build (existing
tests use DEBUG-only hooks).
http,drafter,speed,cache. Debug configuration compiled with-Xswiftc -O -Xcc -O3 -Xcxx -O3. Contended: another session's model kept the GPU at 100 %.prefix_cache_statusready, native checkpoint rows, 65.6 s. After load, MLXactive 20.83 GB and process footprint 21.24 GB.
http: answers incontent, reasoning inreasoning_content, no framing markers; a repeatidentical; a cut at 8 tokens ends
length. With a declared tool there is oneget_weather {"city":"Paris"}call, streamed and non-streamed, then an answer from its result. Asampled repeat of the 1,882-token copy prompt reused 1,024 tokens.
writes ran at about 1.2 MB/s, and a cold turn took 2,106 s, longer than the store's 1,800 s TTL
(its default and maximum). Turn 1's checkpoints therefore expired before turn 2, so I stopped the
run after 2 of its 13 cache requests. The paired drafter-on run never started its test, because
its package loading stalled on the same disk.
drafter,speed,cache. Debugbuild. The cache root is an APFS image in a RAM disk (owners on, 25 GiB free). Before each load the GPU
was 9 % (C) and 17–21 % (D) busy, with load average about 3. During the runs it was 87–100 %, mostly
from these runs.
Load 97.6 s and 97.1 s, same slot and status. After load, MLX active was 20.83 GB off and 22.79 GB on,
process footprint 21.49 and 23.51 GB, and MLX peak 23.51 GB in both. With the drafter: active, exact
acceptance,
rectangular_exactverification. The drafter artifact is 1.97 GB, 2.36 GB resident.Cache (run C): turn 1 is cold at 3,651 tokens. Turns 2–6 each reused 3,072 tokens, 82.9 / 81.8 /
80.5 / 79.0 / 77.8 % of 3,704 / 3,756 / 3,815 / 3,889 / 3,950. They took 4.7–11.4 s against
14.9–21.6 s cold.
Turns 2–6 ≥ 81 %: 80.4 %, FAIL by the letter.
Restored == cold: 6 of 6 turns (turn 1 cold under both scopes, turns 2–6 restored). Every
fresh-scope request reused 0.
Structural check: for every request, restored == floor(shared prefix / 1,024) × 1,024 (13 of 13
pass, by a local script that is not part of this PR). Each turn's prompt was rebuilt from the
conversation and the receipts' answers, then rendered with
prompt_golden.py's reference renderer,the served template and the pinned tokenizer. Every rendered token count matches its receipt. Shared
prefix means the tokens in common with turn 1's prompt, the only scope-A sequence with checkpoints.
Why 80.4 % and not 81 %: the reuse is the same 3,072 tokens per turn as at
cd3011ed3, which was81.0 % of that run's shorter turns (3,705–3,886). The history carries the model's own answers, and
these changed with the exact-window numerics, so turns 2–6 are longer. Below 4,096 tokens, 3,072
is all the 1,024-token grid restores. The SDK's 512-token capture stride is the lever that would
raise it, at the cost of twice the checkpoints and writes; it is set aside for now.
Each cold request wrote two checkpoints, 177.3 MB in 73.5–93.6 ms, both
donated. The store held1.50 GB at the end.
Run D's cache phase gives the same table: 3,072 restored per turn, 80.4 %, restored == cold on 6 of
6 turns, fresh scopes 0, and the structural check passing 13 of 13. Its writes took 74.1–82.7 ms.
Drafter on == drafter off: 23 of 23 shared cases had equal content, reasoning, finish reason and
token count. They cover three prompts, greedy and sampled (temperature 1.0, top_p 0.95, seed 99),
the four speed requests and the 13 cache-phase requests.
Acceptance at depth 7: 321 rounds, every one rectangular-exact. Of 2,224 proposed tokens, 880 were
accepted (2.74 per round), and 3.74 tokens were emitted per round. Accepted per round, greedy /
sampled:
Decode tok/s, off → on (debug build):
TTFT moves by at most 0.6 s. Short prompts take 0.73–0.86 s. The copy prompt takes 6.49 / 6.70 s
cold and 3.30 / 3.40 s with 1,024 tokens reused. The 5,476-token prompt takes 18.79 / 19.33 s (291 /
283 prompt tok/s). Footprint after that prefill is 30.39 GB off and 32.44 GB on.
its last token. The 1,882-token copy prompt closed at 813.5 s against 30.4 s, and the 5,476-token
prompt at 206.4 s against 42.3 s. On the RAM-disk volume the same requests closed 0.06–0.15 s after
their last token (runs C and D). The tokens are unaffected. This is the existing default, which this PR
does not change: a donor's terminal follows its complete-checkpoint publication (
EngineLoopV2.swift,finishAfterCompletePrefixPublication), unlessDARKBLOOM_PREFIX_CACHE_SSD_TERMINAL_BEFORE_PUBLICATIONis set, and that flag covers unseeded requests only.
81087591c, same SDK pin, run A's build settings and contention), a drafter offand on pair with the
cachephase in both: drafter on == off on all 23 shared cases, including the 13cache-phase requests (3,651–3,950 prompt tokens). The internal disk had 11–12 GiB free, below the
store's 20 GiB floor, so every checkpoint write there was refused.
cd3011ed3, SDK423a6149, before exact windows and the drafter), same conversation:with a 2,048-token solo stripe, the same turns reused 2,048 tokens (54 %). With
balancedrows, 3 of 5restores changed the tokens.
python3 -I scripts/muse-glimmer-qualification/prompt_golden.py --model-dir <snapshot> --published <Meta template> --check …/prompt-golden.json: current (run after741b37602, the last change to thetemplate, goldens or script).
python3 -I scripts/generate-reasoning-effort-vectors.py: 475 cases, file unchanged.python3 scripts/check-date-comparisons.py: no back-deployed Date comparisons in2,061 Swift files.
python3 scripts/changelog.py check: 1 valid fragment.scripts/docs-check.sh: 212files OK.
python3 scripts/docs-impact-check.py --base origin/dev: coverage OK.Not run, and why:
devbuild: that needs its own checkout, SDK and full rebuild. The touchedselection's
devbaseline is above, and the only XCTest failures at the head are the MiMo fixture testsexplained above.
run script does not switch.
turns use the coordinator's engine construction in-process.
httpphase with the drafter on: its sampled requests are unseeded, so a comparison would failfalsely.
What the tests do not establish: output quality beyond the checks above, cache reuse in an optimized
build, a release-build or uncontended speed or memory figure, that the platform sidecar renders the same
prompt, or behavior on other Macs.
Components touched
Protocol / interface changes
No WebSocket message, endpoint, config key or CLI flag changes. One new environment variable:
DARKBLOOM_MTP_MUSE_GLIMMER_DEPTH(fixed, the default, oradaptive; other values usefixedand log awarning). It is read only for the two Muse Glimmer identities, and the depth is part of the checkpoint
identity. The existing
DARKBLOOM_CBV2_PREFILL_CHUNKandDARKBLOOM_CBV2_SOLO_PREFILL_STRIPEnow refusethis model's load when the larger of the two is not a positive multiple of 1,024
(
EngineV2ProductionError.prefillGridUnfit), where they used to reach the engine's untyped check orsilently cut prompts off the grid. Other models are unaffected.
Two shared contracts with darkbloom-platform change, and the platform side is not updated by this PR:
fixtures/prompt-contract/v1/reasoning_effort_vectors.jsongains themuse_glimmerfamily (446 → 475cases; the 446 existing cases are byte-identical) and
muse_glimmerjoinsreasoning_model_types. Theplatform copies this file byte for byte and must add the family to its tables first or with it.
reasoning_strengthin the template context (with the thinking-offrule below), a Python-compatible
tojson, history normalization. The provider is the renderer ofrecord; the sidecar needs the same rules before a prompt contract for this model is used for cache
routing.
Fixtures/MuseGlimmer/prompt-golden.jsonis the test vector for that mirror.PromptContractIdentity's version strings are unchanged. Existing families render byte for byte asbefore; whether a new family's rules need a normalization version bump is the platform owner's call.
Documentation impact
docs/architecture/inference.md(Native Muse Glimmer 30B: exact windows on the prompt grid, batched exactverification, exact acceptance, the drafter and its depth; the stripe row; the reasoning-effort row, 475
vectors),
docs/architecture/prefix-cache.md(Muse Glimmer 30B: the 1,024-token grid, native rows, thenumerics fingerprint, advisory drafter state),
docs/architecture/hardware-support.md(memory admission),docs/reference/model-registry-format.md(local package, numerics and drafter rows),docs/reference/configuration.md(DARKBLOOM_MTP_MUSE_GLIMMER_DEPTH; the chunk, step and stripe rows namethe grid and its refusal),
docs/provider/cli-reference.md(MTP intent and exact acceptance),docs/developer/test.md(suites, fixtures, the live test withDRAFTER/REFERENCEand its drafterphase).
Changelog
changelog.d/<topic>.mdfragment and ranmake changelog-check.changelog.d/muse-glimmer-request-path.md.Notes for reviewers
Decisions taken here that a reviewer may want to overrule
high. A request thatswitches thinking off (
reasoning.enabled: false, elseenable_thinking: false) therefore rendersReasoning strength: low., and wins over an effort, as an explicit Boolean does for other families. Thelead's decision covers effort names only; this is an addition.
reasoning.exclude,include_reasoning: false,reasoning.enabled: false) isgenerated, counted and not sent, as for Flint. Such a request gets no logprob entries for it either.
tojson. Equality with the reference also needstojsonto write JSON as Python does. The writer theNemotron templates already use is extracted unchanged (
PythonJSONTemplateFilter) and bound to thismodel type alone. Measured: 11 of 42 cases (every one with tools) differed without it.
dev's newHFTemplateFiltersdoes not cover this type; switching to it would change the goldens and is not done.and llama.cpp render them, instead of a 400 that would make every later turn of that conversation
unservable. The template itself raises on a string.
missing required argument) fails the request:
toolChoiceViolation(422) when a call was forced,otherwise
generationFailed(500), the existing rule for Flint, GLM and MiMo. It never becomes answertext. A 500 for model noncompliance counts against provider health.
EngineV2KVQuantizationPolicy .resolveProviderCheckpoint), because a cache hit must not change the emitted tokens. On the six turns ofthe test plan (earlier head) with
balanced(k4v4) rows, the provider-wide default, only 2 of 5 restoredrequests matched their cold runs; the other 3 diverged after 15–395 characters into other wording of the
same answers (for example "0 mm" for "0 millimetres"). Native rows matched 5 of 5, at about three times
the disk (1.40 against 0.46 GiB for that run). The global setting does not apply to this type, as for
Nemotron 3.5 Super; its per-model entry or
DARKBLOOM_CBV2_CHECKPOINT_QUANTIZATIONstill selects aprofile.
prompt end or at a restore boundary, and each 1,024-token cell runs whole or waits
(
CBv2ModelCapabilities.prefillChunkAlignment). So neither the load nor another request's drafter moves aprompt's bytes. Complete checkpoints land on the same grid, so a restored request and its cold run take
the same cuts. The solo stripe no longer cuts these prompts. Its default now comes from the SDK grid
(
MuseGlimmerTextModel.defaultPrefillChunkAlignment) and sizes the paged pool's prompt write to one cell,computed in one place (
EngineV2Factory.pagedPrefillChunkTokens). Before this pin the type's solo stripewas set to 1,024 instead of 2,048 for the same reason, which raised reuse on the test plan's conversation
(earlier head) from 54 % to 81 %. A step budget below one cell needs no check, because a step always
carries one whole cell; a test shows such a budget serves the same tokens.
staging, with or without a drafter, so the tower has one numerics profile. Decode and verify rows are
exact at any row count, and prompt cells keep MLX's arithmetic on the fixed grid. A tower that does not
then report
MuseGlimmerModelPolicy.servedNumericsProfilefails the load(
MuseGlimmerServingLoadError.numericsProfile). Checkpoints record the tower's own report(
museGlimmer.numericsProfile), and the slot builds no store if it differs. The profile stringappears only in the policy file; the tests read the plain and exact profiles from the SDK, so a pin
that renames it is one edit.
SpecDecLimitsareunchanged. The loader binds the bytes through the SDK's pinned quantized DFlash drafter, a second check
on top of the store's digests, and anything else fails closed. Verification is rectangular-exact on the
exact tower. A round's columns are verified as rows of one paged decode dispatch, and one request
speculates per round (
Settings.verifying(target, maximumSpeculativeRows: 1), the shape the SDKmeasured). The drafter requires exact acceptance: under typical acceptance the engine keeps it inactive
(
drafter requires exact acceptance) and serves the target alone. Depth is fixed at seven by default,and
adaptiveis selectable. Under exact acceptance the drafter's state is advisory, so it classifiesas
CompleteCheckpointAssistant.advisory. The target keeps its SSD checkpoints with the target-onlylayout, and an advisory drafter on a recurrent target is still refused. The engine steps the model
through
MuseGlimmerCBv2Adapter, which without a drafter serves the same tokens as the generic adapter.Known differences from a reference server's prompt, all inherent to the generic path: mapping keys
render sorted (the Jinja bridge sorts them for every family); a float with an integral value loses its
.0; tool schemas pass the fleet's ingress schema normalization before the template sees them. Thecorpus pins the first, and avoids schemas the other two change.
Text-level framing. The engine hands the provider text, so marker-shaped text a model spells with
ordinary tokens is read as framing. vLLM, SGLang and llama.cpp parse the same text. A request's own
user or system text is not sanitized, as for every family.
Tool names. The provider refuses tool names outside
^[a-zA-Z0-9_-]{1,64}$, so a client cannot declarea namespaced
ns.fntool. Every tool is a bare name, the template lists"name.*"as its recipient, andthe model sometimes invokes
name.name; that doubled form is mapped back to the declared tool. Nothingelse is rewritten.
SDK pin and
dev. Since the 2026-11-15 refresh the pin isc1103b8c:99c50f6cplus merges of mlx-swift-lm#434c85e84cfand then of SDKmainfe9b5282(#434's merge at 10:53Z, the same tree asc85e84cf), which is the pin ofdevcc19fe003. Before that refresh the pin was99c50f6c(5cbe636cplus a formatting-only commit). It containsthe earlier pins
423a6149,437f8b9fand978b2de5, anddev's pins859f6415andf41a5f9a.f41a5f9ais the merge base, and99c50f6cis 53 commits past it.The branch merges
dev6d61e2d08(cc11a4108). The only conflict was thelibs/mlx-swift-lmgitlink,which keeps
99c50f6c; themlxandmlx-swiftpins are unchanged.dev's new commits change noEngineV2Factory, prefill chunk or stripe, checkpoint store, assistant funnelor model policy code. Its new hooks reach this type in three places, and none applies:
muse_glimmer.template context.
Not in this PR, or not done:
stride would raise it, at twice the checkpoints and writes. It is set aside, and the 1,024-token grid
stays.
come from an optimized debug build (run A) and a debug build (runs C and D). No release-build speed or
memory figure.
httpphase with the drafter on: not run, because its sampled requests are unseeded and wouldfail the reference comparison falsely. The drafter phase covers greedy and seeded sampling.
utilization), and runs C and D are debug builds. tok/s and TTFT only compare runs within a pair.
activation floors and load transients.
Owner placeholders: the catalog id
muse-glimmer-30b(one line inMuseGlimmerModelPolicy), displayname, price, hardware gate.
Before And After
Behavior
flowchart TB subgraph B["Before"] direction LR b1["scan: model_type muse_glimmer"] --> b2["not in the supported set:<br/>never advertised"] b3["if it were served"] --> b4["think-tag parser:<br/>frames leak into content"] b3 --> b5["JSON tool parser:<br/>ATEM calls lost"] b3 --> b6["published template:<br/>no prompt contract, no prefix cache"] end subgraph A["After"] direction LR a1["scan: exact id + muse_glimmer"] --> a2["verified install,<br/>paged slot or refuse"] a2 --> a3["to=self → reasoning_content<br/>to=user → content"] a2 --> a4["tool channel → tool_calls<br/>(ATEM, validated)"] a2 --> a5["served template + request date:<br/>prompt contract, SSD prefix cache on"] end B ~~~ ACode flow
flowchart TB subgraph B["Before"] direction LR q1["request"] --> q2["templateAdditionalContext:<br/>enable_thinking / reasoning_effort"] q2 --> q3["template (Swift-Jinja tojson)"] q4["engine text"] --> q5["NativeToolStreamRouter:<br/>think-tag splitter or none"] q5 --> q6["SDK StreamingReasoningParser"] end subgraph A["After (muse_glimmer only)"] direction LR l1["load"] --> l2["MuseGlimmerServingLoad →<br/>MuseGlimmerInstallation.stage"] l2 --> l2b["exact windows on,<br/>profile checked"] l2b -->|drafter installed| l2c["funnel gate → DFlash binding →<br/>MuseGlimmerCBv2Adapter"] r1["request"] --> r2["MuseGlimmerRequestPolicy:<br/>reasoning_strength"] r2 --> r3["MuseGlimmerTemplateFix: history<br/>template (Python-compatible tojson)"] r4["engine text"] --> r5["MuseGlimmerChannelSplitter"] r5 -->|reasoning, answer| r6[".parsed events"] r5 -->|"each atem:invoke"| r7["MuseGlimmerToolFrame →<br/>ATEM parser → validation"] end B ~~~ AOther model types take the Before paths unchanged.
Refactor Pass
One pass over the whole change after the request path was complete (commit
0173777cd). It closed foursplitter gaps: a
<|message|>inside a dropped message no longer opens another one; text outside anymessage is judged the same at every chunking; a word too long to be a recipient is not held back, so held
text and rescans stay bounded; stray closing markup on a tool channel is malformed with or without the
wrapper. It also stopped a declined-reasoning request from receiving its withheld reasoning's logprobs, and
removed an unused parameter and a needless
throws.741b37602made the served template compile in everyrenderer (a parenthesized namespace argument minijinja needs). After the
devmerge the splitter goesthrough
dev's new token-limit cut (finishText(cutAtLimit:)) rather than a parallel path.🤖 Generated with Claude Code