Repository navigation
Muse Glimmer 30B: native NVFP4 tower, exact verify windows and the DFlash drafter - #423
Draft
jonathan308 wants to merge 56 commits into
Draft
jonathan308 wants to merge 56 commits into
jonathan308 wants to merge 56 commits into
Conversation
A sibling of ModelOptProjectionLayout for the W4A16 form (U8 codes, E4M3 block scales, F32 weight_scale_2, no input_scale) and a public linear over MLX's nvfp4 quantized matmul with weight_scale_2 applied verbatim in FP32. Kernel tests decode a random matrix on the host from the producer's formula and compare products; a 16-code row pins the nibble order and code table. Co-Authored-By: Claude <noreply@anthropic.com>
A fork-only text decoder under MLXLLM/Models/MuseGlimmer. It runs the MLXVLM tower's operations in the same order and dtypes: centered RMS norms with two eps values, parameterless embed and QK norms, the FP32 query scale before RoPE, RoPE on sliding layers only, the sigmoid gate from the layer input, SwiGLU, a plain final norm, then output_multiplier and the tanh softcap. Projection slots hold any UnaryLayer so ModelOpt layers can install there; the attention has a CBv2 branch and the trunk can capture layer outputs. On a tiny random model the logits equal the MLXVLM class bit for bit in BF16 and FP32, uncached and through chunked prefill plus 24 greedy steps past an 8-token window. The upstream file is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
Layer kinds (sliding window or full, no sharing, no sinks), newCacheV2, the prompt-output seam, decode command-buffer limits, historical attention checkpoints with a K/V dtype table, and capabilities: paged KV supported and required in its native segmented form, packed prefill off. CBv2ModelCapabilities gains requiresPagedKV, default off. requiresNativePagedKV only constrains which paged pool a model accepts; a contiguous backend still passes it. With the new flag EngineV2.backendCapabilityViolation refuses any backend that is not paged. No existing model sets it. Tests drive a tiny tower with the production attention geometry through EngineV2 on PagedKVBackend: greedy tokens and logits against the eager caches past the window, two concurrent requests against their solo runs, a complete checkpoint exported and restored into a new model, and the backend refusals. Co-Authored-By: Claude <noreply@anthropic.com>
ModelOptIndexedCheckpoint binds a hashed index to hash-verified shards with no model-specific inventory. MuseGlimmerInstallation classifies every tensor from header metadata: BF16 projections stay dense, F8_E4M3 with weight_scale and input_scale become calibrated FP8 with saturating activation overflow, U8 with weight_scale and weight_scale_2 become weight-only NVFP4. Coverage is checked both ways before and after loading; missing, extra and misshapen tensors throw typed errors. Vision tensors are verified and listed in the receipt but not loaded. hf_quant_config.json is cross-checked, never used to load. The pin holds the index and shard SHA-256 of revision 47818374. Tests stage a synthetic three-format sharded checkpoint and cover the refusals. Co-Authored-By: Claude <noreply@anthropic.com>
A hidden-returning forward that also returns the residual stream after the configured layers (default 1, 13, 25, 37, 49), a prompt variant that projects logits for the last row only, raw token embeddings, the head, and MuseGlimmerCBv2Adapter. The generic adapter is always a recurrent MTP model, which the round driver refuses for a request-stateful drafter on a target without recurrent state; the dedicated adapter is not, and reports supportsRequestStatefulMTP. No shared engine file changes. Co-Authored-By: Claude <noreply@anthropic.com>
MuseGlimmerRealArtifactTests stage the pinned NVIDIA checkpoint when MUSE_GLIMMER_NVFP4_DIR is set and, with MUSE_GLIMMER_ORACLE_DIR, compare against the independent float32 oracle fixtures: per-layer residual samples at the last position, the drafter layers' last four rows, the final hidden, top-50 logits, and greedy continuations through EngineV2 on the paged backend, including a 2,321-token prompt across the window. A small reader loads the fixtures' uncompressed npz files. MUSE_GLIMMER_BENCH adds a decode and prefill timing. CI skips all of them. Co-Authored-By: Claude <noreply@anthropic.com>
…ifact writer The block drafter of meta-models/Muse-Glimmer-30B-assistant as a fork-only module under MLXLLM/Models/MuseGlimmer/DFlash: - configuration decode with typed refusals, and the pinned published values; - the five pre-norm layers, the context projection and one block forward (block queries attend each other in both directions and the cached keys and values of committed target positions); - a request-owned context ring of at most sliding_window positions keyed by absolute position, allocated once; a block's own keys and values never enter it; - a strict loader: pinned SHA-256 for config.json and model.safetensors, exact tensor inventory, each projection's format read from the verified header; - in-memory affine quantization and a deterministic artifact writer with a SHA-256 manifest. Tests use tiny random models against a reference that recomputes a block from every context row with plain products, an explicit mask and its own RoPE. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…s do `ToolCallPolicy.onyxParsing = .referenceParity` selects a second reading of Muse Glimmer output, next to upstream's strict one, which stays the default: - one call for each complete invoke of a tool frame, in order - a doubled tool name `X.X` is the declared tool `X` - values typed by the tool schema: a string keeps its bytes, other values decode as JSON; a value that does not fit goes to the validation policy - a call cut off by the token limit: complete invokes are kept, a cut-off invoke is never a call - a frame left open before a bare `to=...<|message|>` header ends there - output without a frame is content; a cut-off reasoning frame keeps its text A tool that was not declared is still rejected. Marker-shaped text cannot open a frame in the token decoder. `OnyxTokenStreamDecoder` and `OnyxTextStreamDecoder` are the public decoders for a host. `ToolCallFormat.infer(from: "muse_glimmer")` is `.atem`. Tests port the vLLM Muse Glimmer parser cases and its schema value table. Co-Authored-By: Claude <noreply@anthropic.com>
- `ReasoningParserFormat.onyx` splits text with visible Onyx markers into reasoning (`to=self`) and content, collected and streamed. Tool frames are never content. - `MLXModelContainerEngine` reads the Onyx frames of an `.atem` model from the token ids and reports reasoning and content as `.parsed`, with the reference reading of tool calls. `Generation` has no reasoning event, so the text path would drop the reasoning. - The server selects `onyx` for a loaded `.atem` model when no reasoning parser was requested (`ReasoningParserFormat.inferred`). - `ServerToolParser` accepts `atem`, `onyx` and `muse_glimmer`. `<|eot|>` and `<|end_of_text|>` end generation; `<|eom|>` does not. A response cut off inside reasoning returns the partial reasoning, empty content and `length`. Co-Authored-By: Claude <noreply@anthropic.com>
The text model declared CBv2MTPForwardable with capture layers so the generic adapter could report them. Nothing uses a frozen-KV drafter with this model and no test covered it; the request-stateful path goes through MuseGlimmerCBv2Adapter. forwardWithMTPHidden and prefillWithMTPHidden stay. Co-Authored-By: Claude <noreply@anthropic.com>
Environment-gated tests on the published drafter and the two target tensors it borrows (embed_tokens, the weight-only NVFP4 lm_head), read from pinned shards: - the first block of the independent oracle's P1 fixture, in float32 and in the checkpoint's BF16, against the oracle's drafts and top-five head values; - every round of oracle traces that carry the target's five-layer context for each committed position; - measurements, written as JSON: quantized drafters against the dense one, drafts with only the last N context rows, and the quantized artifact conversion with a reload check. All are skipped unless MUSE_GLIMMER_NVFP4_DIR and MUSE_GLIMMER_ASSISTANT_DIR are set. Co-Authored-By: Claude <noreply@anthropic.com>
MuseGlimmerDFlashDrafter binds the block drafter to one target through the MuseGlimmerDFlashTarget protocol (raw embeddings, bare head, context width). Each request owns its context ring. Observed target rows and a round's accepted rows are committed as they arrive; the first draft step of a round runs one block forward and keeps up to seven proposals, later steps return them. Target-prefix acceptance is on, so sampled rows speculate and the emitted tokens stay the target's own. The ring is a fixed per-request charge through the bounded allocation contract; one block forward is charged once per engine. Engine tests run the real CBv2 engine on the paged backend over a tiny random target, with serial and rectangular verification: greedy and sampled output equal the engine without a drafter for the drafter's own proposals, for proposals that are always right and for a wrong proposal at each position; every depth; cancellation while a round is built; two concurrent rows; a request with image spans. Co-Authored-By: Claude <noreply@anthropic.com>
…ling reference - fork.yaml: a section for the reference reading of Onyx frames and ATEM calls, with its files and tests. - skills tool-calling reference: `onyxParsing` and the two host decoders. - mlx-server help lists the `atem` tool parser and the `onyx` reasoning parser. - Whitespace around the first `to=...` header of a response is framing. Co-Authored-By: Claude <noreply@anthropic.com>
…generic paged path A request-stateful drafter may declare its request state advisory (CBv2MTPAdvisoryHistoryDrafter): the state is rebuilt from the target rows the engine hands over and, with exact acceptance, no emitted token depends on it. For such a drafter the generic paged branch builds its complete checkpoint codec and adopts checkpoints with no assistant state, exactly as for an engine without a drafter. A request that adopts a checkpoint gets a new request state, and each observation carries the absolute target position of its first row, so the drafter starts at the restored boundary. Every existing drafter is unchanged: without the conformance, or with typical acceptance, checkpointsRequireAssistantHistory equals tracksPersistentHistory and the position is not passed. The contiguous, native paged, recurrent and hybrid branches are not touched. Co-Authored-By: Claude <noreply@anthropic.com>
The drafter declares its context advisory and takes the absolute position of each observation: rows it already holds are skipped and a gap restarts the context, so a restored request's drafter starts at the restored boundary with the right RoPE positions. A target row or round call the drafter cannot serve no longer stops the engine thread: the step returns a well-formed proposal and the request ends with an error at the fence. Tests: a restored request's tokens equal a cold request's with the drafter on (greedy and sampled, serial and rectangular verification, both checkpoint boundaries, donors with and without a drafter) and speculation resumes after the restore; checkpoints saved with the drafter hold the same bytes as without; drafters that are not advisory keep their refusal; misshapen target rows end the request, not the engine. Adds block, head and commit timings to the real-weight study and applies swift-format to the DFlash files. Co-Authored-By: Claude <noreply@anthropic.com>
…test with the published tokenizer - `ATEMReferenceScanner` matches tags scalar by scalar with a literal search, so a value that starts or ends with a combining mark keeps it. - The search for a parameter stops at the invoke's close: a frame of many invokes is read in one pass. - More decoder tests: bare headers at the start of a body and after a tool frame, a frame without a recipient, a stray `<|message|>`, stop strings (answer only), and protocol errors that hold no model output. - `MuseGlimmerOnyxTokenizerLiveTests` runs the token decoder with the published tokenizer when `MUSE_GLIMMER_NVFP4_DIR` is set. It reads no weights. Co-Authored-By: Claude <noreply@anthropic.com>
One order of fused multiply-adds defines every output element, so a row has the same bytes at every row count and position. A simdgroup-matrix kernel reads each weight once for up to 16 rows; a scalar kernel runs the same order for one row on the GPU family where the two were measured equal. Kernel tests compare raw bytes against one-row products and a host loop in the documented order. An opt-in suite times the weight-only NVFP4, FP8 and BF16 projections of a dense 30B decoder at their real shapes. Co-Authored-By: Claude <noreply@anthropic.com>
The pull request check formats every Swift file a change touches and fails when the formatter changes it. Two older lines of this file were not formatted. Co-Authored-By: Claude <noreply@anthropic.com>
museGlimmer30BQuantized pins the conversion of the published BF16 drafter that writeArtifact produces for museGlimmer30BQuantizedPlan: MLX affine, group 64, MLP projections at 5 bits, attention projections and encoder.fc at 8 bits; 1,968,222,936 bytes, under the 2 GiB assistant bound. The conversion is deterministic, so the hashes follow from the pinned source. The real-weight test loads the artifact through the strict loader, compares every tensor with an in-memory conversion and drafts the oracle's first block. Co-Authored-By: Claude <noreply@anthropic.com>
…e-step benchmark The scalar kernel was measured slower than the matrix kernel for one row of a 202,048-output head. The benchmark suite gains one evaluation of all projections of a decode step and the FP8 row-exact path with its activation cast as a separate pass. Co-Authored-By: Claude <noreply@anthropic.com>
A real-weight study, skipped without the checkpoints: blocks of 12 and 8 positions against the trained 16, by accepted drafts and wall time. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Freshness merge before integration. No MLX pin change (Package.swift and Package.resolved unchanged; mlx-swift c633d221). Co-Authored-By: Claude <noreply@anthropic.com>
The DFlash block drafter, its strict loader and pinned quantized artifact, and the additive advisory-history seam for complete checkpoints. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
MuseGlimmerTextModel conforms to MuseGlimmerDFlashTarget (raw embeddings, bare head, tapped hidden width). Tests run the drafter through the engine over the native tower and its CBv2 adapter on the paged backend: greedy and sampled output equal the target alone, and a restored request equals a cold one. Co-Authored-By: Claude <noreply@anthropic.com>
…native Onyx frames and ATEM tool calls with an opt-in reference reading (ToolCallPolicy.onyxParsing defaults to .strict). No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
ModelOptRowExact.Schedule lays out the one-row and row-exact FP8 products: the activation cast as its own pass, and two output rows per thread in one simdgroup. Both give the same bytes as the standard layout. ModelOptCalibratedLinear.rowExactSchedule defaults to .standard, so existing models keep their dispatches. Co-Authored-By: Claude <noreply@anthropic.com>
setRowExactWindows(true) makes every call of 1 to 64 rows give each row the bytes of a one-row call: weight-only NVFP4 through the row-exact NVFP4 product (one-row steps included), FP8 through the row-exact products on the window schedule, BF16 through ModelOptRowExact.matmul past one row, all in pieces of 16 rows, and the block norms below MLX's 32-row reduction switch. A projection without such a product is refused up front. Off by default; calls above 64 rows keep MLX's kernels either way. Tests: windows of 1 to 8 tokens on paged caches equal the one-row steps in logits and K/V across the sliding edge and after the ring wraps (BF16 and float32, dense and mixed formats), 2 to 64 rows of several sequences, block norms at the production width, unchanged BF16/FP8 decode and prefill bytes, and the refusal. Co-Authored-By: Claude <noreply@anthropic.com>
With exact windows on, calls of more than 64 rows (a decode step of more than 64 requests, a prompt chunk) left the projections and norms to MLX's kernels while numericsProfile still claimed exact. Every call now runs in the existing 16-row pieces (norms from 32 rows), so no row count degrades. Prompt chunks read each projection's weights once per piece and prefill is slower with exact windows on. numericsProfile becomes muse-glimmer-exact-windows-v2: prefill bytes differ from v1, so checkpoints of the two must not mix. A host that pins v1 fails closed until it moves to v2. decodeAndPrefillBytesDoNotMoveForBF16AndFP8 asserted that a 99-row prefill keeps MLX's bytes with the switch on, which pinned the removed fallback. It becomes decodeBytesDoNotMoveForBF16AndFP8: both towers prefill with the switch off and the exact tower decodes with it on, so one-row BF16 and FP8 steps from the same cache still keep their bytes. New tests cover 65-row steps, 9 and 16 requests of width 8, and every projection at 65, 99 and 200 rows against one-row calls. Co-Authored-By: Claude <noreply@anthropic.com>
The drafter checked only the width of the target's hidden rows, so a target that tapped other layers of the same count bound and drafted from the wrong residual streams. MuseGlimmerDFlashTarget now names its tapped layers and the drafter requires them to equal the artifact's target_layer_ids (1, 13, 25, 37 and 49 for the published drafter). Fixture tests refuse a drafter configuration and a tower with other taps of the same width. Co-Authored-By: Claude <noreply@anthropic.com>
Typical acceptance can keep a draft the target did not choose, and the DFlash drafter's advisory history then loses its observation positions (decision D6 is exact acceptance only). CBv2MTPDrafter gains requiresExactAcceptance (default false, so every other drafter is unchanged). When it is true and the configuration asks for any other rule, CBv2MTPRoundDriver.build returns no driver and EngineV2 reports "drafter requires exact acceptance"; requests run target-only. MuseGlimmerDFlashDrafter returns true. The checkpoint switch test now expects the refusal from the driver and the engine, and still checks the typical-acceptance switches on a scripted advisory drafter that waives it. Co-Authored-By: Claude <noreply@anthropic.com>
Shards open without following symlinks and with their sizes checked, but the index, config.json and hf_quant_config.json were read with Data(contentsOf:): a symlink was followed and any size was read. A present hf_quant_config.json that could not be read was treated as absent (try?), which skipped its cross-check. ModelOptIndexedCheckpoint.readRegularFile reads a small checkpoint file only when it is a regular file and not a symlink, opens it O_NOFOLLOW, and checks its size with fstat before reading (index 64 MiB, the same bound the index parser applies; JSON records 4 MiB). Any failure throws Failure.unsafeFile. stage(directory:) refuses a quantization record that is present (any directory entry, a dangling symlink included) but cannot be read. Pins and hashing are unchanged: these only add refusals. Tests cover a symlinked index through both entries, a symlinked and an oversized config.json, and an hf_quant_config.json that is a directory, a dangling symlink or unreadable. Co-Authored-By: Claude <noreply@anthropic.com>
The weight-only NVFP4 product is computed before weight_scale_2 is applied, and that unscaled product can leave the FP16 range. The installer accepted an F16 dense dtype, so an FP16-staged tower with NVFP4 projections could produce inf. plan() now refuses FP16 activations whenever any projection is NVFP4 (Failure.dtype). The pinned artifact is BF16, so the pinned path does not change; a tower without NVFP4 projections still plans in FP16. Co-Authored-By: Claude <noreply@anthropic.com>
MLXModelContainerEngine forced reference-parity parsing for every .atem model, while the library default and fork.yaml say the strict reading stays the default. The engine now takes onyxParsing (default .strict), and the CLI selects the reference reading only with --onyx-parsing reference-parity or MLX_SERVER_ONYX_PARSING. An unknown value is an error. Tests: a one-invoke frame calls under the default; a frame with two invokes gives no call by default or with .strict and two calls with .referenceParity; the handler emits nothing for a rejected call or a protocol error and keeps reading; CLI defaults, option, environment and errors. Under the strict reading a user frame that ends at <|end_of_text|> keeps the marker as text (the upstream adapter closes frames only at <|eom|> or <|eot|>); the end-of-text test runs both readings and records that as a known issue instead of pinning it. Co-Authored-By: Claude <noreply@anthropic.com>
MuseGlimmerOnyxTokenizerLiveTests sat at the top of the test target without a type tag. It runs the token decoder with the published tokenizer files, so it moves to Integration/MuseGlimmer/ and is tagged .integration like the other Muse Glimmer suites. It stays skipped unless MUSE_GLIMMER_NVFP4_DIR is set. fork.yaml drops the old glob; the Muse Glimmer section's Integration glob now covers the file. Co-Authored-By: Claude <noreply@anthropic.com>
Decode and verify rows stay exact at any row count and any number of requests, in pieces of 16 rows. Prompt chunks, through cbv2Prefill and prefillWithMTPHidden, now keep MLX's arithmetic with exact windows on: the bytes of the plain tower, so prefill keeps MLX's matrix kernels and the drafter on and off prefill alike. The engine never runs a prompt chunk in a forward with decode or verify rows: packed prefill is off for this model, and a one-token final prompt chunk is scheduled as a decode row. Prompt bytes change relative to v2, so numericsProfile is now muse-glimmer-exact-windows-v3. Tests: prompt chunks of 1 to 200 rows equal the plain tower through both entry points; a request's decode and verify rows keep their bytes while another request's prompt is prefilled beside them; the real-model window test prefills through the prompt entry point. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
A model whose prompt bytes depend on where a prompt is cut can declare `CBv2ModelCapabilities.prefillChunkAlignment`. The scheduler then cuts a text prompt only at multiples of it, at the prompt end and at a boundary a prefix restore requires, and runs each cell whole or not at all: a cell that does not fit the step budget or the mixed-step quota waits and takes the first claim on the next step (the multimodal block guard, exempt from the quota). The solo stripe, the plain chunk and demanded checkpoint ranges do not apply to such a row, and a step always holds one cell. Fairness: grid schedulers plan decode rows before prompt rows (after the claim row; the running order is restored), and a claim step arms no further claim, so a decode row waits at most one step for a cell and a deferred cell runs within two steps. The engine refuses a paged pool whose maxPrefillChunk cannot hold a cell. The first-token projection plans the same cells and returns unbounded where a cell would wait or a claim is pending. Nil keeps every other model's scheduling unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
The tower declares prefillChunkAlignment 1024 (the solo stripe and the checkpoint stride), so load, other requests and the drafter no longer move a prompt's cuts or bytes. The numerics profile moves to muse-glimmer-exact-windows-v4, since v3 checkpoints made under load may hold off-grid prompt bytes. Tests: a request's prompt K/V bytes and output are the same alone, beside another request's decode, and beside it with the drafter on (bf16, float32), and a restore under load equals the cold run. Test engines with small pools lower the grid to their chunk. Co-Authored-By: Claude <noreply@anthropic.com>
Runs the lint job's command (`swift format format --configuration .swift-format` on the Swift files this branch adds or changes against main). Layout only: line breaks and the indentation of conditional imports in seven files. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Nov 14, 2026
Draft
A parameter value is the model's text, and a client's prompt can steer it. JSONSerialization reads 512 levels, and decoding the result, encoding it, comparing, hashing and releasing it each recurse once per level on a cooperative thread's 512 KiB stack. A provider encodes every call's arguments before it sends them (JSONEncoder.openAIServer), so a call whose value nested a few hundred levels deep killed the process with SIGBUS before any error could be returned. Measured on a cooperative thread, this file's decoding and the encoder compiled -O -wmo: encoding exhausted the stack at 192 levels of objects (224 of arrays), and decoding, comparing, hashing and releasing at 512 levels of objects. A debug build failed from 160. The reader now counts a value's nesting without recursion before it decodes it. Past 63 levels the value stays text, as a value JSONSerialization cannot read already does. A call's arguments object adds one level, so its arguments nest at most 64 deep, the limit d-inference holds a request body and a replayed call to. Co-Authored-By: Claude <noreply@anthropic.com>
Both ATEM readers type each value and then normalize the call by its schema. For a parameter the schema types as an array or an object, normalization reads the text as JSON again, and JSONSerialization reads 512 levels. So a value that the ATEM reader had kept as text, because it nested too deep, was decoded whole once more. A d-inference provider then exhausted a cooperative thread's 512 KiB stack while it encoded the call, and stopped with SIGBUS. The strict ATEM parser types its values through the same step. The nesting count moves to ToolArgumentNormalization, and normalization now keeps text nested past maximumValueDepth (63) as written. A Python literal past 32 levels already stays text in the same way. Every caller of this step gets the bound. Those callers are ToolCallProcessor and the ATEM, Onyx, Harmony, Gemma, MiniMax, Qwen XML and Pythonic readers. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
#423 now keeps an ATEM value nested past 63 levels as text (824db4c) and bounds JSON text the same way in the shared ToolArgumentNormalization (31a7ccb), so no Muse tool call can nest deep enough to exhaust a 512 KiB cooperative stack when it is encoded. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
#423 now keeps an ATEM value nested past 63 levels as text (824db4c) and bounds JSON text the same way in the shared ToolArgumentNormalization (31a7ccb), so no Muse tool call can nest deep enough to exhaust a 512 KiB cooperative stack when it is encoded. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
#423 now keeps an ATEM value nested past 63 levels as text (824db4c) and bounds JSON text the same way in the shared ToolArgumentNormalization (31a7ccb), so no Muse tool call can nest deep enough to exhaust a 512 KiB cooperative stack when it is encoded. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
#423 now keeps an ATEM value nested past 63 levels as text (824db4c) and bounds JSON text the same way in the shared ToolArgumentNormalization (31a7ccb), so no Muse tool call can nest deep enough to exhaust a 512 KiB cooperative stack when it is encoded. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 18, 2026
#423 now keeps an ATEM value nested past 63 levels as text (824db4c) and bounds JSON text the same way in the shared ToolArgumentNormalization (31a7ccb), so no Muse tool call can nest deep enough to exhaust a 512 KiB cooperative stack when it is encoded. No conflicts. Co-Authored-By: Claude <noreply@anthropic.com>
3 of 5 tasks
5 tasks done
This branch has not been 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.
Draft. Muse Glimmer 30B (Meta, Apache-2.0) served from NVIDIA's native NVFP4 checkpoint, with the DFlash drafter and exact speculative verification. Branch
feat/muse-glimmer-nativeonmain0ed99d07; 51 commits, all signed. The provider side (Layr-Labs/d-inference,feat/muse-glimmer-30b) will re-pin to this branch's final head; that PR follows.Proposed changes
Model and artifact. A fork-only native text tower under
Libraries/MLXLLM/Models/MuseGlimmer/fornvidia/Muse-Glimmer-30B-NVFP4@47818374517751c48c55cde2621594926b1888b6. The checkpoint is ModelOpt mixed precision, used as stored:The architecture: 52 layers in a [sliding 2,048 ×3, full] ×13 pattern, RoPE on the sliding layers only, a sigmoid attention gate, centered RMS norms, and an output multiplier followed by a tanh softcap. Upstream's
MLXVLM/Models/MuseGlimmer.swiftis untouched. Vision tensors are hash-verified and not loaded (text first).Strict pinned loading.
MuseGlimmerCheckpointPinpins the index and the three shard SHA-256s.hf_quant_config.jsonis only cross-checked; an unreadable one refuses.The new generic pieces are
ModelOptWeightOnlyNVFP4Layout/LinearandModelOptIndexedCheckpoint.Backend. Paged KV only (
requiresPagedKV); a contiguous or unsupported backend is refused, never degraded. Prefix reuse uses complete historical-attention checkpoints.Exact verify windows. MLX's
.nvfp4product uses different sum orders for 1, 2–5 and 6–16 rows, so a verify window could differ from the decode steps it replaces.setRowExactWindows(true), decode and verify rows are exact at any row count, in 16-row pieces. Prompt chunks keep MLX arithmetic, which is why prefill speed is unchanged.muse-glimmer-exact-windows-v4; the provider puts it in the checkpoint numerics fingerprint.Batched exact verify attention. An opt-in paged path writes every column's K/V first, then runs one decode dispatch per layer for all (row, column) pairs, on sliding and full layers. Previously it took one dispatch per column per layer. It is default-off and requested by the Muse drafter.
DFlash drafter (
MuseGlimmer/DFlash/):museGlimmer30BQuantized, 1.833 GiB, MLP 5-bit with attention andencoder.fc8-bit, under the 2 GiB assistant cap) and a converter;CBv2MTPAdvisoryHistoryDrafter;.typicalacceptance.ATEM / Onyx parsing. Adds
ToolCallFormat.atem,ReasoningParserFormat.onyxandOnyxTokenStreamDecoder.mlx-serverreads Onyx tool frames strictly by default; reference parity is opt-in (--onyx-parsing reference-parity).Shared code touched. Every shared change is additive and defaults to off:
RecurrentStateV2.requiresPagedKVand three lines inEngineV2.backendCapabilityViolation;ModelOptRowExact.Schedule(default.standard);requiresExactAcceptance(default false);CBv2ModelCapabilities.prefillChunkAlignment(default nil) inSchedulerV2and the first-token deadline projection. With an alignment set, decode rows are planned before prompt rows, so a decode row waits at most one step for a cell, and the engine refuses a paged pool whosemaxPrefillChunkcannot hold a cell.Tests check that the defaults are unchanged.
Validation
Run on an M3 Ultra with the native build system. Real-weight suites are env-gated (
MUSE_GLIMMER_NVFP4_DIR,MUSE_GLIMMER_ASSISTANT_DIR,MUSE_GLIMMER_ORACLE_DIR).flintMoEFusedCombineMatchesOriginalBytes, which fails the same way on main.scripts/check_forkdiff.py: 2,149 of 2,149 files described.omlxdoes not appear in the diff.Measured on the M3 Ultra, release bench through
EngineV2on paged KV, 256 new tokens. The machine had other sessions' builds running (load average 7–18).On an M5 Ultra at
99c50f6c(same harness, warm process, two repetitions, quiet GPU checked before each section; one section was discarded for another session's CPU load):Not done / known
<|end_of_text|>leaves the marker in the content. This comes from the upstreamOnyxStreamAdapterand is recorded withwithKnownIssue. Reference parity handles it..rectangularExacton a real-sized target (needs a new engine fixture). The process-globalscalarRowsis still shared between suites.Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes (not--all-files, since main is not formatted; the lint job's swift-format 6.4.4 command was run on every Swift file this branch changes, at99c50f6c)docs/muse-glimmer.md,fork.yaml, tool-calling docs)AI usage
accurately describes the code changes.
🤖 Generated with Claude Code