Repository navigation
glm53: the full GLM-5.3 on several Macs - #557
Closed
chadhurley25075-png wants to merge 1 commit into
Closed
chadhurley25075-png wants to merge 1 commit into
chadhurley25075-png wants to merge 1 commit into
Conversation
A new family, tf-glm53, for the full GLM-5.3 (GlmMoeDsaForCausalLM: 78 layers, 256 routed experts top-8, DSA sparse attention with index_topk 2048, the layer-78 MTP head). Each rank holds a share of every layer's heads, expert rows and vocabulary; fp32 partials are exchanged over MCDMA inside the command buffer and summed in slot order, so N Macs give the bits one Mac gives with N canonical slices. - fp32 activations end to end (the checkpoint's F16 scales promote mlx-lm's matmuls to fp32, so that is the reference); MLX-arithmetic 6/8-bit row kernels, simdgroup tiles for prompt blocks, split-K short matvecs; fp16 KV option. - The DSA indexer at fp32 over BF16 weights, scores with the query staged once a span of keys (G53_IDX=3: two rows a threadgroup), radix top-k over many threadgroups for decode-sized blocks; sparse latent attention (G53_ATTN4H, G53_JOINB). - MTP self-speculative decode from the layer-78 head with verify blocks on the row path, and copy drafts (G53_COPY), both verified by the trunk: the same tokens. - N-rank exchange: per-peer send threads, a stall diagnostic (G53_STALL_S) and fenced pieces for large partials (G53_XCHUNK; MCDMA Endpoint.flushPeer), because the Thunderbolt link dropped an overflowing partial without an error. - Exact speed switches: concurrent encoder (G53_CONC), the wait inside the sum launch (G53_FWAIT), shared weight reads for bf16 row matvecs (G53_GROWS), key-split decode indexer (G53_KSPLIT), own-row prompt indexer (G53_OWN_FRONT), KV residency and touch after a snapshot load (G53_KV_RESIDENT, G53_TOUCH). - Layer-split latent cache (G53_LSPLIT, _OWNER, _FROM): past a chosen position each layer's latent cache and attention live on one rank, so a 512 GB owner beside three 256 GB Macs takes the cap from about 2.0M to 3.1M positions with the same replies. - Serve mode (JSON lines over TCP, cancel/stop_at, KV snapshots), oracle mode against an mlx-lm dump, tf-glm53-ixbench, and tools: the MLA absorb pack, the MTP head converters, a synthetic checkpoint. The copy index's unit tests join zig build test. Every switch is off by default and leaves replies character-identical when on. Measured on four M3 Ultra Mac Studios (256/512/256/256 GB) over Thunderbolt 5; not measured on M5. Built on Ash Hart's TensorFold and MCDMA (kernel conventions, the exchange, the copy rounds' acceptance rule). The own-row prompt indexer follows MiaAI-Lab's prompt sequence-parallel select and drowzeys' TF_GLM53_SP_SELECT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thank you, @chadhurley25075-png. Running the full GLM-5.3 across four Macs with replies identical whatever switches are on is a big piece of work, and the layer-split latent cache is a neat way past one Mac's memory. We can't land it in this form, and the reasons are about how it fits the engine, not the results:
We also don't have four Macs with that much memory to gate it on. If you'd like to take it forward, a smaller first step would help: GLM-5.3's indexer and sparse latent attention as a family on the lane host, checked on one Mac with a layer subset. We'd be glad to review that. |
This was referenced Oct 10, 2026
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.
glm53: the full GLM-5.3 on several Macs
This adds a
glm53family: the full GLM-5.3 (GlmMoeDsaForCausalLM, 78 layers, 256 routed experts top-8, DSA sparseattention with
index_topk2048, the layer-78 MTP head), served across four M3 Ultra Mac Studios (256/512/256/256 GB) overThunderbolt 5 with MCDMA. It sits next to the GLM-5.3-Flash
glmfamily and is built the TensorFold way: fp32 partialsexchanged inside the command buffer and summed in slot order, so N Macs give exactly the bits one Mac gives with N slices.
Why four Macs (you need far less)
We run it on four Studios on purpose: we want to fill it with millions of tokens of context and keep room to run the rest
of your stack (MCDMA, Drift and friends) right beside it. The model itself needs much less. The 6-bit weights are about
670 GB, so two 512 GB Macs hold them with room left for a long context, and the family takes any number of ranks
(
"ranks": N). We've only measured the four-Mac setup, so the numbers below are for that.Measured (4× M3 Ultra, 6-bit experts, BF16 indexer, MTP head)
The first two rows were re-measured on this branch's binary, A/B against the build we serve: same speeds, same reply hashes on
all six long-conversation turns. The others were measured on that served build. Full table and setup in
docs/recipes/glm-5.3.md.What's in it
partials (
G53_XCHUNK) — without them the Thunderbolt link dropped an overflowing partial silently.indexer runs at fp32 over BF16 weights, scores two rows a threadgroup, and can split keys across ranks (
G53_KSPLIT) orrows across ranks for prompts (
G53_OWN_FRONT) — always the same picks. Keep the indexer BF16: on GLM-5.2 every 4–8-bitindexer quant we tried lost long context at ~3,000–4,700 tokens; BF16 held.
G53_LSPLIT): past a chosen position, each layer's latent cache and attention live on one rank,taking a 512 GB + 3×256 GB set from ~2.0M to 3.1M positions with the same replies.
tf-glm53-ixbench, a synthetic checkpointfor tests, and the MLA-pack / MTP-head converters. Every switch is off by default.
Limits
Measured on M3 Ultra only — not measured on M5. Needs ~670 GB of weights across four Macs. Past the split point decode is
~27–30 tok/s near 1M positions. Long-prompt Thunderbolt stalls are detected and reported; the root fix (flow control or
reconnect in MCDMA's Thunderbolt link) belongs in MCDMA.
Thanks
Ash, thank you. None of this exists without TensorFold and MCDMA — the kernel conventions, the exchange, the native engine
and, most of all, the exactness discipline are yours, and they made this the most enjoyable engine we've ever built on. The
"every switch must give the same bits" rule you hold everything to is what let us take the full GLM-5.3 to a million-token
needle without ever wondering whether an answer had drifted. This is offered as a gift to your project: take all of it, part
of it, or none of it, and if you'd rather it land as smaller PRs or live as a separate family, we're glad to reshape it.
The own-row prompt indexer follows MiaAI-Lab's prompt sequence-parallel select and drowzeys'
TF_GLM53_SP_SELECT— thank youto both.
🤖 Generated with Claude Code