Pipeline-parallel inference across an attested Apple Silicon cluster (+ Gemma 4) - #473
Draft
crypt0fairy wants to merge 2 commits into
Draft
Pipeline-parallel inference across an attested Apple Silicon cluster (+ Gemma 4)#473crypt0fairy wants to merge 2 commits into
crypt0fairy wants to merge 2 commits into
Conversation
|
@crypt0fairy is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
…ster
Adds multi-device clustering so a co-located, individually-attested Apple
Silicon cluster serves one logical provider, splitting a model layer-wise
across nodes over an encrypted MLX ring — without breaking Darkbloom's
operator-blind guarantee.
Core (provider-swift/Sources/ProviderCore/Cluster/):
- Trust: ClusterRoster (coordinator-signed membership, min-member trust),
ClusterHandshake (SIGMA pairwise mutual auth over the roster),
ClusterLinkCrypto (HKDF directional keys + per-token ChaCha20-Poly1305,
AAD-bound to cluster/request/layer/seq).
- Planning: LayerPartition (memory-weighted largest-remainder split),
ClusterPlan (topology from [cluster] config).
- Transport: MLXDistributed (Swift binding over mlx-c distributed collectives),
MLXRingEnvironment, ActivationCodec (tensor<->sealed bytes).
- Decode: ClusterPipeline (the verified lockstep ring loop), ClusterServer
(control-round request broadcast), DistributedInferenceEngine, the
PipelineModelShard seam + the GPT-OSS shard adapter.
- Continuous batching: ClusterBatch{Scheduler,Server,Pipeline,Control}
(~2.5x aggregate throughput, validated cross-Mac).
- Robustness: peer control-loop backs off and exits on a dead ring instead of
busy-spinning (fixes an orphaned peer pegging a CPU core for hours).
Coordinator (Go): per-member cluster attestation relay + verify
(cluster trust = min member), cluster-provider registers as one mlx-swift
provider, dev local-cluster switches.
Executables: cluster-run, cluster-provider (+ --peer), and bench/smoke
harnesses (solo-bench, comms-bench, batch-*).
Docs: clustering.md, cluster-node-handshake.md, cluster-benchmark.md,
cluster-tensor-expert-parallel.md (incl. pipeline/TP/RDMA diagrams),
cluster-perf-backlog.md, jaccl-rdma-readiness.md.
Cluster model support: GPT-OSS (Gemma 4 added in the following commit).
Submodules point at the ring-enabled mlx-swift + pipeline-shard
mlx-swift-lm fork branches.
Wires the Gemma 4 pipeline shard (mlx-swift-lm) into the cluster so a Gemma 4 text model runs across the ring through the same engine/transport/crypto path as GPT-OSS. - Gemma4ShardAdapter: bridges Gemma4PipelineShard to PipelineModelShard. - Dispatch: ClusterHeadBringup + cluster-run select the gemma4 shard by model_type; configInt now reads text-tower dims from the nested `text_config` (Gemma 4's multimodal config layout) with a top-level fallback. - gemma4-shard-smoke: synthetic monolithic-vs-shard correctness oracle (0.000000 logit diff; covers MoE experts, k_eq_v full-attention, tied embeddings, final-logit softcap). Validated end-to-end: gemma-4-26B-A4B-it-qat-4bit sharded across two Macs over Thunderbolt (18/12 layer split, encrypted ring, coherent generation).
crypt0fairy
force-pushed
the
feat/cluster-pipeline-parallelism
branch
from
June 26, 2026 19:21
20ef807 to
900a1db
Compare
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
Adds multi-device clustering so a co-located, individually-attested Apple
Silicon cluster serves as one logical provider, splitting a model layer-wise
across nodes over an encrypted MLX ring — without breaking Darkbloom's
operator-blind guarantee. This unlocks models too large for any single Mac
(e.g. Gemma-4-26B, GPT-OSS-120B) by pooling the cluster's combined unified memory.
Two commits:
Depends on the fork submodules: Layr-Labs/mlx#2 (ring backend), Layr-Labs/mlx-swift#8
(enable ring), Layr-Labs/mlx-swift-lm#53 (GPT-OSS/Gemma-4 pipeline shards).
Architecture
(the coordinator's
Provider == one socketmodel is preserved). Peers join onlythe ring and loop in lockstep via a per-request control-round
all_gather.per-token ChaCha20-Poly1305, AAD-bound to cluster/request/layer/seq. A tap on
the wire sees only ciphertext, with forward secrecy.
Core modules (
provider-swift/Sources/ProviderCore/Cluster/):ClusterRoster,ClusterHandshake,ClusterLinkCrypto,LayerPartition,ClusterPlan,MLXDistributed,ActivationCodec,ClusterPipeline,ClusterServer,DistributedInferenceEngine,PipelineModelShard+ GPT-OSS/Gemma-4 adapters,and the
ClusterBatch*continuous-batching path.Trust & Attestation
The privacy guarantee rests on decrypting only inside attested hardware. The cluster
extends single-node attestation to every node:
the coordinator verifies each and sets cluster trust = min(member trust).
ClusterRoster; nodes verify it before forming pairwiseClusterHandshakelinks (so they only ring with coordinator-authorized peers).Honest gaps (not yet closed — flagged for review):
DARKBLOOM_CLUSTER_ATTEST=1), off bydefault; with it off the coordinator attests the head and peers are trusted
transitively.
self_signed(no per-peer MDM/MDA over their own link).roster issuance) is the proposed path to close these without disturbing the
one-provider-per-socket serving model.
Performance (measured, batch=1, Thunderbolt)
Clustering's value is fitting models that don't fit one node, not speeding up
ones that do (pipeline runs GPUs sequentially at batch=1 — see
docs/cluster-benchmark.md). Continuous batching recovers ~2.5× aggregatethroughput. TP/EP analysis + the TP comms floor are documented in
docs/architecture/cluster-tensor-expert-parallel.md.Validation
ClusterCryptoTests(roster, handshake, link cipher, split).GPT-OSS and Gemma 4.
across two Macs over Thunderbolt (encrypted ring, coherent generation, ~28 tok/s).
Robustness
An orphaned peer used to busy-spin its control loop on a dead ring (pegging a CPU
core indefinitely); it now backs off exponentially and exits.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.