You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Status: RESEARCHED spec — ready for ticket-cutting. The seven open questions are now answered (a second-round research pass on 2026-08-14 independently re-derived every load-bearing claim against the local clone). Corrections to the first draft are folded in inline; see "Corrections vs. first draft" at the bottom. This is a spec (PRD), not a directly implementable ticket.
Problem Statement
The operator runs frontier MoE models (GLM-5.2, DeepSeek-V4-Flash, eventually Kimi K3) via colibri, a pure-C engine that streams routed experts from disk and maps better than llama.cpp to the fleet's tiered hardware (a fast box for attention + Optane/NVMe/disk for experts). colibri's distributed expert workers feature (upstream PR JustVugg#551) would let the fleet fan routed-expert compute across machines — a coordinator holding attention/routing/KV, workers computing the routed expert FFNs — instead of one box streaming every expert from its own disk.
That feature is stalled and unshippable today, for three compounding reasons:
The maintainer refuses to merge feat: add distributed expert workers JustVugg/colibri#551 because its worker re-implements the expert FFN (expert_gate_up → siluf → e8_rot_rows → matmul_qt) as a parallel copy of moe(), with no token-exact worker-vs-local parity test, so it could "silently drift from the real kernel."
Research confirmed the fear is real: the worker copy is missing the fmt=6 (E8/IQ3) input pre-rotation that moe() applies before gate/up, so it produces wrong numbers for E8/IQ3-quantized experts — a bug present even against feat: add distributed expert workers JustVugg/colibri#551's own base, not introduced by drift.
The PR is 762 commits behind dev (based on e4b5bf3d, GitHub mergeable: CONFLICTING), and the author has not followed up on the maintainer's request.
Solution
Rebase JustVugg#551 onto current dev (research shows this is near-trivial), fix the missing fmt=6 input rotation in cluster_worker_run, and add the two-layer token-exact parity gate (mirroring the JustVugg#550 template) that proves worker output equals local moe() output. Land it upstream (primary path); maintain a fork (explicit fallback). The deliverable is therefore "fix a latent correctness bug in a stalled PR + ship the test that would have caught it" — a stronger contribution than a bare unblock. Note the realistic upstream outcome is "removes the correctness blocker; PR kept open and positioned first-of-the-trio for when the maintainer's breadth phase opens" (see "Institutional context" below — the maintainer deferred JustVugg#550 on priority even though it ships the gate).
The "discussion" on JustVugg#551 is thin: the PR body plus exactly one comment (the maintainer's blocker). There are no reviews and no inline review comments on JustVugg#551. The real history lives on the parent PR JustVugg#380 and on the template JustVugg#550.
Two blockers, not one. The maintainer's feat: add distributed expert workers JustVugg/colibri#551 comment is two-part: (1) Priority (breadth = multi-machine vs current focus on depth/single-box) and (2) Correctness (no token-exact gate). Only (2) is fixable by us. And (1) is structural: the maintainer gave feat: add dense MLP activation sharding JustVugg/colibri#550 the exact same deferral even though feat: add dense MLP activation sharding JustVugg/colibri#550 ships the gate ("This is the strongest of your three … but same honest note … breadth … deferring rather than merging today … Kept open"). So an upstream merge is not guaranteed on correctness alone — our success criterion is removing the correctness blocker, with the fork as the fallback for actually running it now.
The canonical gate, verbatim (from feat: add dense MLP activation sharding JustVugg/colibri#550's body + review):feat: add dense MLP activation sharding JustVugg/colibri#550's test_dense_sharding.py "starts a worker and compares the exact TF=1 oracle mismatch signature between local CPU execution and delegated dense execution. It skips cleanly when the gitignored glm_tiny fixture is unavailable." The maintainer calls this "a real token-exact baseline-vs-delegated gate — exactly the discipline the others need." Our gate should mirror this including the skip-cleanly-when-fixture-missing behavior (so CI doesn't hard-fail on a gitignored fixture).
CLI surface (from feat: add distributed expert workers JustVugg/colibri#551's body):coli cluster coordinator (registration/heartbeat/topology), coli cluster worker, and coordinator discovery for coli serve; enabled by CLUSTER_WORKERS / --cluster-coordinator. The PR body also states "Native C tests and make colibri pass on macOS" and that the single-machine path is unchanged unless enabled.
Maintainer merge patterns (from a PR-postmortem pass, 2026-08-14)
A review of the maintainer's merged vs. rejected/deferred PRs shows a consistent, predictable bar. Rules relevant to this work:
Correctness gates are non-negotiable for the kernel. CONTRIBUTING.md: every PR is reviewed for "a clean build (0 warnings), the oracle (~30-32/32 TF + 20/20 greedy), and its own targeted validation." The gate must be a differential oracle (worker output == local moe()), not registry/protocol unit tests — that exact sentence is what feat: add distributed expert workers JustVugg/colibri#551 failed on.
Never re-implement a core kernel; reuse it. "Two implementations of the same thing can't both land." He merges on trust only via reuse or a token-exact gate. This is why the fix extracts a shared helper rather than patching the worker's parallel copy.
Gate at real dimensions, not toy. "A check that cannot fail is worse than no check" — the false-green-at-toy-dims failure (cuda: batch ragged attention across independent streams JustVugg/colibri#365) is a named house norm. glm_tiny (8 routed experts, top-2) is real; the gate must fail pre-fix and pass post-fix.
One concern per PR; rebase onto dev (never main); CI green, 0 warnings. First-time-contributor CI may sit in action_required — ask the maintainer to approve the workflow run.
PR body follows the house template (Summary / Validation / Compatibility) plus a "Correctness gate" section stating byte-for-byte worker-vs-local equality, the oracle run twice (union ON and OFF), and "default path unchanged unless CLUSTER_WORKERS set."
User Stories
As a fleet operator, I want to distribute routed-expert FFN computation across multiple machines, so that a frontier MoE model runs faster than it does streaming every expert from one box's disk.
As a fleet operator, I want the coordinator to keep attention, routing, KV cache, and the dense layers local, so that the fast box (eli-itx with its RTX 3080) serves attention at full GPU speed while workers absorb the bulk expert compute.
As a fleet operator, I want workers to serve routed experts from wherever the expert weights live (Optane / NVMe / RAM), so that the R740's 1.5 TB of Optane becomes a ~74 GB/s expert store instead of a ~7 GB/s NVMe one.
As a fleet operator, I want the distributed path env-gated off by default, so that single-machine inference is byte-for-byte unchanged unless I explicitly enable the cluster.
As a fleet operator, I want a token-exact guarantee that the worker path produces identical output to local inference, so that I can trust distributed runs not to silently corrupt results.
As a contributor, I want the parity test to catch the missing fmt=6 input rotation, so that the E8/IQ3 correctness bug is fixed and demonstrated rather than merely asserted.
As an upstream maintainer, I want a worker-vs-local token-exact gate in CI, so that I can merge a re-implemented core kernel on trust rather than hope.
As a fleet operator, I want the transport layer to be an interface (TCP today), so that faster transports (2.5GbE, USB, etc.) can slot in later without a rewrite.
As a fleet operator, I want to measure distributed vs single-box throughput by controlling which experts/layers live where, so that I can determine whether distribution is "worth it" without a full tuning effort.
As a contributor, I want the E8/IQ3 (fmt=6) and int4 (fmt=4) quantized expert paths both covered, so that the gate exercises the formats the worker actually handles.
As a fleet operator, I want the shared expert to stay on the coordinator, so that the parity assertion scopes only to the routed experts and does not compare mixed contributions.
As a contributor, I want the COLIEX01 wire framing reused as the shared data-plane contract, so that the native worker path and any future browser/WebGPU path share one auditable protocol.
As a fleet operator, I want the MVP to run eli-itx as coordinator with the BC-250s as workers, so that the feature is validated on hardware I already own before the R740 exists.
As a contributor, I want a byte-level C wire-protocol test using synthetic tensors, so that the framing is proven correct without needing a model.
As a fleet operator, I want a tiny deterministic oracle model as the test fixture, so that the token-exact gate runs in seconds and is reproducible in CI without 744 GB of weights.
Implementation Decisions
Rebase, don't re-implement. A test merge of pr551 onto upstream/dev produced exactly one conflicted file: c/coli (two hunks), and the auto-merged c/colibri.c compiles clean (gcc -fsyntax-only → exit 0). Commit distance is exactly 762 (e4b5bf3d..upstream/dev). Note on the why (corrected from first draft): the "easy" outcome is real but not because the FFN primitives are byte-identical. expert_gate_up and silufare byte-identical; e8_rot_rows is also byte-identical but lives in c/quant.h, not c/colibri.c. matmul_qt is byte-identical only because it is a one-line shim calling matmul_qt_ex; the real primitive matmul_qt_ex has diverged between pr551 and dev (dev adds an w->fmt==8 fp8 passthrough, CUDA S-threshold retry vs pr551's permanent disable, a Metal g_moe_exact gate, and a gs argument to coli_metal_gemm/coli_cuda_matmul). There are no "benign shim renames": st_init and st_init_multi both exist in both branches (c/st.h); only the call site changed (dev passes COLI_MODEL_DIRS via st_init_multi). The merge is clean because the intervening 762 commits went textually around the expert-FFN core without overlapping the worker's added lines — not because nothing changed underneath. The worker's FFN call sequence must still be reconciled with the rebased matmul_qt_ex (see resolved Q1/Q3).
Fix the fmt=6 input pre-rotation by eliminating the parallel copy, not patching it.moe() rotates the gate/up input for fmt=6 experts (via the E8_XE macro) before expert_gate_up, then rotates the intermediate before the down matmul — two rotations total. cluster_worker_run does only the second, feeding raw x to expert_gate_up. The maintainer's objection is that the worker re-implements the four-step FFN (expert_gate_up → siluf → e8_rot_rows → matmul_qt) as a parallel copy of moe()'s inner compute — which is exactly why it drifted. So: extract that four-step sequence into ONE shared helper (consistent with the existing coli_cuda_expert_mlp naming on the GPU side) called by both moe()'s CPU path and the worker, and fix the worker to apply the shared E8_XE input rotation before it. This reduces duplication in upstream's own code (the sequence is already inlined ~6× inside moe()), keeps the per-layer rotation caching that fmt=5: a deployable E8-lattice grouped container — int3 that beats shipped int4 quality at 25% fewer bytes (design + plan) JustVugg/colibri#452 protects, and makes the drift structurally impossible — directly answering the maintainer's "re-implemented core kernel" concern rather than fixing one symptom.
Prefactor first (ticket Extract a shared routed-expert FFN helper (pure refactor, byte-identical) #9). The shared-helper extraction is a pure refactor of moe()'s six inlined FFN copies — byte-identical, one file, no new knobs — and is split into its own ticket, done first, and submitted upstream as a standalone PR. Rationale: it removes the maintainer's "re-implemented core kernel" objection at the root, shrinks the feat: add distributed expert workers JustVugg/colibri#551 diff, and is the highest-odds-of-merge slice (depth cleanup, not breadth feature). Two of the six copies apply the fmt=6 down-rotation and four don't (Vulkan/CUDA/CPU fallback paths) — the extraction settles which is canonical.
Coordinator/worker split (as feat: add distributed expert workers JustVugg/colibri#551 already designs): coordinator = attention, routing, KV, dense, shared expert; worker = routed expert FFN only. The worker never routes on its own — it receives pre-routed batches. Correction: the wire carries (expert_id, nr, raw input rows) only; the routing weights never cross the wire — the coordinator applies them locally to the worker's returned rows. So the split is: worker computes the unweighted per-expert FFN; the coordinator owns the weights (and thus any weighting divergence is impossible by construction).
Transport = an interface. TCP data plane + cluster.py HTTP registry for discovery. Future transports are out of scope but not foreclosed — the worker registry and wire framing already abstract the transport.
Env-gated off (CLUSTER_WORKERS / --cluster-coordinator; CLI: coli cluster coordinator / coli cluster worker, coordinator discovery via coli serve); the single-machine path is untouched unless enabled.
Python token-exact test (pattern: feat: add dense MLP activation sharding JustVugg/colibri#550's c/tests/test_dense_sharding.py) — the glm_tiny oracle, teacher-forcing prefill mode (deterministic: TEMP=0, DRAFT=0), run twice (local vs delegated), asserting identical token signatures. Correction:feat: add dense MLP activation sharding JustVugg/colibri#550's test asserts baseline ≡ delegated equality of the mismatch lines (it does not assert zero mismatches). Our gate must be stronger to satisfy the maintainer's "token-exact worker-vs-local" bar: assert both that the two runs are identical and that there are zero [ORACLE] mismatch lines.
Fixture:glm_tiny (generated by c/tools/make_glm_oracle.py) already routes (8 routed experts, top-2, 1 shared), so it exercises the routed-expert path. Correction: the default oracle emits float32 expert weights (the "bf16" docstring is stale; no dtype cast in code), which expert_load reads natively via its runtime-quantization fallback — so the default oracle runs without conversion, but a fmt=6 (or fmt=4) conversion is required to actually catch the bug (a pure-f32 fixture never exercises the fmt=6 rotation). Produce fmt=6 expert weights via c/tools/iq3_pack.py (fmt=6 only) or c/tools/convert_fp8_to_int4.py's e8 path (emits fmt=4/5/6). The --fp8 oracle is not directly readable as-is (it writes <name>_scale_inv while the engine expects <name>.qs block scales).
Assertion scopes to routed experts only (the shared expert stays on the coordinator).
Determinism/pinning (new, from resolved Q4–Q6): the gate must pin worker and coordinator to identical numeric paths — same ARCH build flag, CPU-only backends, and a fixed numeric-env block (see resolved questions below). Routing itself is already lossless/deterministic (ids from uniq[], weights coordinator-side, inputs raw memcpy).
Resolved Questions (answers from the 2026-08-14 research pass)
Format coverage for the gate. The input pre-rotation exists only for fmt==6 — fmt=4 (int4) and fmt=8 (fp8) have no activation transform anywhere. Therefore fmt=6 is mandatory (it is the only rotation-bearing format and the only one that exercises the bug). Add fmt=4 as a control arm: it exercises the worker's expert_gate_up fmt=4 pair-fusion path with no rotation, so a fmt=4-pass/fmt=6-fail result isolates the divergence to the rotation itself (not the socket protocol or the FFN math). Defer fmt=8 (see Q3).
Routing capture mechanism. Confirmed lossless and deterministic, end-to-end. Routing/top-k runs only in the coordinator's moe() (pr551:c/colibri.c:2896), which fills idxs[]/ws[]/keff[] and a distinct-expert uniq[]. cluster_moe_batch shards uniq[] across workers by (eid+layer)%g_cluster_n; cluster_item copies raw input rows via memcpy; the wire carries (eid, nr, inputs) and the coordinator applies ws[] to returned rows locally. Top-k tie-breaking is deterministic (strict > over ascending expert id) and irrelevant to parity (the worker never re-routes). No float weights are serialized, so there is no lossy round-trip. The gate's pass/fail is attributable solely to the worker's expert-FFN arithmetic.
Arch-flag parity. Real. matmul_e8's AVX2 arm uses two interleaved accumulators + tree reduction vs the scalar single-accumulator path, and the selector is a compile-time #ifdef __AVX2__ with no runtime dispatch or env override (g_no_fused_pair/g_idot/g_i4s do not control matmul_e8). Build worker and coordinator with the same ARCH; recommend ARCH=x86-64-v3 (portable AVX2) over native.
CPU vs GPU parity. Real risk. The worker is always CPU (it returns from main() at pr551:c/colibri.c:6663 before CUDA/Metal/Vulkan init). The coordinator can serve routed experts on GPU (Vulkan coli_vk_expert_group_issue, Metal skip-CPU, CUDA coli_cuda_expert_mlp). Force CPU: build the pure-C binary and pin COLI_CUDA=0 COLI_METAL=0 COLI_VULKAN=0 as defense-in-depth (the init blocks are env-gated).
Env parity. Confirmed, and broader than first flagged. FP-affecting env vars that must be pinned identically on both sides (minimum set): IDOT=0 I4S=1 COLI_NO_FUSED_PAIR=1 SPEC_PIN=0 XEXP=0 I4_ACC512=0 I3_AVX512=0 DRAFT=0 (plus the three GPU vars from Q5). IDOT=0 forces the exact-f32 int4/int8 kernels and sidesteps the g_i4s/spec_pinned gate; COLI_NO_FUSED_PAIR=1 makes the worker's and coordinator's gate+up paths structurally identical. The worker does honor these (all reads precede its early-return).
Worker init. The hand-rolled load_cfg + st_init + ebits/dbits is sufficient for the expert-FFN path — expert_load_impl consumes only m->c, m->ebits, m->S, and the passed ESlot (worker uses demand=0, so disk-class counters are skipped). One change required: swap st_init → st_init_multi(COLI_MODEL_DIRS) so a worker matches a sharded coordinator's tensor namespace. Do not port the rest of model_init (tokenizer/KVCache/router/embed/MTP) — dead weight for an expert-only worker.
Maintainer's blocker (comment on feat: add distributed expert workers JustVugg/colibri#551, 2026-07-23, verbatim core): "Two blockers … (1) Priority … (2) Correctness, and this is the real one:cluster_worker_run reimplements the expert FFN (expert_gate_up → siluf → e8_rot_rows → matmul_qt) as a parallel copy of moe()'s inner compute, but test_cluster.py only exercises the Python HTTP registry — nothing proves the worker's output matches local moe(). A parallel expert path with no token-exact worker-vs-local gate can silently drift from the real kernel. Compare your own feat: add dense MLP activation sharding JustVugg/colibri#550, which does ship that gate. … I won't merge a re-implemented core kernel on trust."
Bug location: pr551:c/colibri.c:1833–1837 (worker FFN, missing input rotation) vs dev:c/colibri.c:4278–4279 (E8_XE macro, applied at 4787) + 4802 (canonical two-rotation sequence).
Corrections vs. first draft (what the re-check changed)
Removed the claim that the four FFN primitives are "byte-identical between pr551 and dev" and that the only churn is "benign renames (matmul_qt→matmul_qt_ex, st_init→st_init_multi)". Reality: e8_rot_rows is in quant.h; matmul_qt is byte-identical only as a 1-line shim while matmul_qt_ex diverged (fp8/CUDA/Metal); st_init/st_init_multi both pre-exist in both branches (only the call site changed).
Corrected c/coli hunk 2 from "an argparse add" to "pr551's full cluster subparser block".
Corrected the fixture claim: default oracle is f32, not bf16; expert_load reads f32 (and fp8) natively, so a conversion is required only to catch the fmt=6 bug (fmt=6/fmt=4 expert weights), not to run at all.
Corrected the coordinator/worker split: routing weights do not cross the wire (coordinator applies them locally).
Changed mergeable: false → mergeable: CONFLICTING (GitHub's actual field value).
Replaced the seven "Open questions" with resolved answers (see above).
Local clone (upstream, for reading + rebasing):/home/eli/dev/_reference-docs-and-repos/colibri — branches pr550 and pr551 already fetched; upstream/dev is current (0f335e5). No persistent merge result exists — the test merge ran in an ephemeral worktree that was removed. The picking-up agent should redo the rebase in a fresh branch. The clone is codegraph-indexed (.codegraph/ at the root) — implementers should run codegraph explore (or the codegraph MCP tool) before grep/read.
Problem Statement
The operator runs frontier MoE models (GLM-5.2, DeepSeek-V4-Flash, eventually Kimi K3) via colibri, a pure-C engine that streams routed experts from disk and maps better than llama.cpp to the fleet's tiered hardware (a fast box for attention + Optane/NVMe/disk for experts). colibri's distributed expert workers feature (upstream PR JustVugg#551) would let the fleet fan routed-expert compute across machines — a coordinator holding attention/routing/KV, workers computing the routed expert FFNs — instead of one box streaming every expert from its own disk.
That feature is stalled and unshippable today, for three compounding reasons:
expert_gate_up → siluf → e8_rot_rows → matmul_qt) as a parallel copy ofmoe(), with no token-exact worker-vs-local parity test, so it could "silently drift from the real kernel."moe()applies before gate/up, so it produces wrong numbers for E8/IQ3-quantized experts — a bug present even against feat: add distributed expert workers JustVugg/colibri#551's own base, not introduced by drift.dev(based one4b5bf3d, GitHubmergeable: CONFLICTING), and the author has not followed up on the maintainer's request.Solution
Rebase JustVugg#551 onto current
dev(research shows this is near-trivial), fix the missing fmt=6 input rotation incluster_worker_run, and add the two-layer token-exact parity gate (mirroring the JustVugg#550 template) that proves worker output equals localmoe()output. Land it upstream (primary path); maintain a fork (explicit fallback). The deliverable is therefore "fix a latent correctness bug in a stalled PR + ship the test that would have caught it" — a stronger contribution than a bare unblock. Note the realistic upstream outcome is "removes the correctness blocker; PR kept open and positioned first-of-the-trio for when the maintainer's breadth phase opens" (see "Institutional context" below — the maintainer deferred JustVugg#550 on priority even though it ships the gate).Institutional context — why JustVugg#551 was actually shelved (full discussion, read 2026-08-14)
The "discussion" on JustVugg#551 is thin: the PR body plus exactly one comment (the maintainer's blocker). There are no reviews and no inline review comments on JustVugg#551. The real history lives on the parent PR JustVugg#380 and on the template JustVugg#550.
c/glm.c— which refactor: split glm.c → colibri.c + 4 header modules (−18%) JustVugg/colibri#391 had just renamed toc/colibri.c. The maintainer repeatedly asked for a split ("It bundles three big features … it would land much more easily as three separate PRs"), the author split into feat: add dense MLP activation sharding JustVugg/colibri#550/feat: add distributed expert workers JustVugg/colibri#551/feat: add WebGPU expert workers JustVugg/colibri#552, and feat: add local-cluster MoE, dense sharding, and WebGPU workers JustVugg/colibri#380 was closed superseded on 2026-07-23. While reviewing feat: add local-cluster MoE, dense sharding, and WebGPU workers JustVugg/colibri#380 the maintainer flagged two design questions the cluster piece must address that are not in feat: add distributed expert workers JustVugg/colibri#551's own thread:cap_for_ram/--ram); a worker holds its own resident expert set, so distribution must not double-count or silently blow the budget. Out of scope for the correctness gate, but flagged as a follow-up (see Out of Scope).COLI_CUDA_ROUTER=1, introducing the pre-routed routing-consumption path (g_pre_idx, lifted out of theCOLI_METALfence). The cluster worker consumes pre-routed expert ids the same way — reconcile the two paths during the rebase.test_dense_sharding.py"starts a worker and compares the exactTF=1oracle mismatch signature between local CPU execution and delegated dense execution. It skips cleanly when the gitignoredglm_tinyfixture is unavailable." The maintainer calls this "a real token-exact baseline-vs-delegated gate — exactly the discipline the others need." Our gate should mirror this including the skip-cleanly-when-fixture-missing behavior (so CI doesn't hard-fail on a gitignored fixture).coli cluster coordinator(registration/heartbeat/topology),coli cluster worker, and coordinator discovery forcoli serve; enabled byCLUSTER_WORKERS/--cluster-coordinator. The PR body also states "Native C tests andmake colibripass on macOS" and that the single-machine path is unchanged unless enabled.enhancement(feat: add dense MLP activation sharding JustVugg/colibri#550 alsoperformance). Our PR should match.Maintainer merge patterns (from a PR-postmortem pass, 2026-08-14)
A review of the maintainer's merged vs. rejected/deferred PRs shows a consistent, predictable bar. Rules relevant to this work:
moe()), not registry/protocol unit tests — that exact sentence is what feat: add distributed expert workers JustVugg/colibri#551 failed on.glm_tiny(8 routed experts, top-2) is real; the gate must fail pre-fix and pass post-fix.dev(nevermain); CI green, 0 warnings. First-time-contributor CI may sit inaction_required— ask the maintainer to approve the workflow run.CLUSTER_WORKERSset."User Stories
Implementation Decisions
pr551ontoupstream/devproduced exactly one conflicted file:c/coli(two hunks), and the auto-mergedc/colibri.ccompiles clean (gcc -fsyntax-only→ exit 0). Commit distance is exactly 762 (e4b5bf3d..upstream/dev). Note on the why (corrected from first draft): the "easy" outcome is real but not because the FFN primitives are byte-identical.expert_gate_upandsilufare byte-identical;e8_rot_rowsis also byte-identical but lives inc/quant.h, notc/colibri.c.matmul_qtis byte-identical only because it is a one-line shim callingmatmul_qt_ex; the real primitivematmul_qt_exhas diverged betweenpr551anddev(dev adds anw->fmt==8fp8 passthrough, CUDA S-threshold retry vs pr551's permanent disable, a Metalg_moe_exactgate, and agsargument tocoli_metal_gemm/coli_cuda_matmul). There are no "benign shim renames":st_initandst_init_multiboth exist in both branches (c/st.h); only the call site changed (dev passesCOLI_MODEL_DIRSviast_init_multi). The merge is clean because the intervening 762 commits went textually around the expert-FFN core without overlapping the worker's added lines — not because nothing changed underneath. The worker's FFN call sequence must still be reconciled with the rebasedmatmul_qt_ex(see resolved Q1/Q3).moe()rotates the gate/up input for fmt=6 experts (via theE8_XEmacro) beforeexpert_gate_up, then rotates the intermediate before the down matmul — two rotations total.cluster_worker_rundoes only the second, feeding rawxtoexpert_gate_up. The maintainer's objection is that the worker re-implements the four-step FFN (expert_gate_up → siluf → e8_rot_rows → matmul_qt) as a parallel copy ofmoe()'s inner compute — which is exactly why it drifted. So: extract that four-step sequence into ONE shared helper (consistent with the existingcoli_cuda_expert_mlpnaming on the GPU side) called by bothmoe()'s CPU path and the worker, and fix the worker to apply the sharedE8_XEinput rotation before it. This reduces duplication in upstream's own code (the sequence is already inlined ~6× insidemoe()), keeps the per-layer rotation caching that fmt=5: a deployable E8-lattice grouped container — int3 that beats shipped int4 quality at 25% fewer bytes (design + plan) JustVugg/colibri#452 protects, and makes the drift structurally impossible — directly answering the maintainer's "re-implemented core kernel" concern rather than fixing one symptom.moe()'s six inlined FFN copies — byte-identical, one file, no new knobs — and is split into its own ticket, done first, and submitted upstream as a standalone PR. Rationale: it removes the maintainer's "re-implemented core kernel" objection at the root, shrinks the feat: add distributed expert workers JustVugg/colibri#551 diff, and is the highest-odds-of-merge slice (depth cleanup, not breadth feature). Two of the six copies apply the fmt=6 down-rotation and four don't (Vulkan/CUDA/CPU fallback paths) — the extraction settles which is canonical.(expert_id, nr, raw input rows)only; the routing weights never cross the wire — the coordinator applies them locally to the worker's returned rows. So the split is: worker computes the unweighted per-expert FFN; the coordinator owns the weights (and thus any weighting divergence is impossible by construction).COLI_CLUSTER_MAGIC "COLIEX01",pr551:c/colibri.c:1686), which originated in feat: add distributed expert workers JustVugg/colibri#551 (PR feat: add WebGPU expert workers JustVugg/colibri#552, which copied it, was closed without merging — so there is no overlap indev). Reuse it as-is.cluster.pyHTTP registry for discovery. Future transports are out of scope but not foreclosed — the worker registry and wire framing already abstract the transport.CLUSTER_WORKERS/--cluster-coordinator; CLI:coli cluster coordinator/coli cluster worker, coordinator discovery viacoli serve); the single-machine path is untouched unless enabled.Testing Decisions
c/tests/test_dense_protocol.c) —#include "../colibri.c", asocketpair, synthetic floats, assert byte-exact framing. No model.c/tests/test_dense_sharding.py) — theglm_tinyoracle, teacher-forcing prefill mode (deterministic:TEMP=0,DRAFT=0), run twice (local vs delegated), asserting identical token signatures. Correction: feat: add dense MLP activation sharding JustVugg/colibri#550's test asserts baseline ≡ delegated equality of the mismatch lines (it does not assert zero mismatches). Our gate must be stronger to satisfy the maintainer's "token-exact worker-vs-local" bar: assert both that the two runs are identical and that there are zero[ORACLE]mismatch lines.glm_tiny(generated byc/tools/make_glm_oracle.py) already routes (8 routed experts, top-2, 1 shared), so it exercises the routed-expert path. Correction: the default oracle emits float32 expert weights (the "bf16" docstring is stale; no dtype cast in code), whichexpert_loadreads natively via its runtime-quantization fallback — so the default oracle runs without conversion, but a fmt=6 (or fmt=4) conversion is required to actually catch the bug (a pure-f32 fixture never exercises the fmt=6 rotation). Produce fmt=6 expert weights viac/tools/iq3_pack.py(fmt=6 only) orc/tools/convert_fp8_to_int4.py's e8 path (emits fmt=4/5/6). The--fp8oracle is not directly readable as-is (it writes<name>_scale_invwhile the engine expects<name>.qsblock scales).ARCHbuild flag, CPU-only backends, and a fixed numeric-env block (see resolved questions below). Routing itself is already lossless/deterministic (ids fromuniq[], weights coordinator-side, inputs rawmemcpy).c/tests/test_dense_protocol.c+c/tests/test_dense_sharding.py; feat: add distributed expert workers JustVugg/colibri#551's existingc/tests/test_cluster.py(HTTP registry only — this is the gap being closed).Out of Scope
Resolved Questions (answers from the 2026-08-14 research pass)
fmt==6— fmt=4 (int4) and fmt=8 (fp8) have no activation transform anywhere. Therefore fmt=6 is mandatory (it is the only rotation-bearing format and the only one that exercises the bug). Add fmt=4 as a control arm: it exercises the worker'sexpert_gate_upfmt=4 pair-fusion path with no rotation, so a fmt=4-pass/fmt=6-fail result isolates the divergence to the rotation itself (not the socket protocol or the FFN math). Defer fmt=8 (see Q3).moe()(pr551:c/colibri.c:2896), which fillsidxs[]/ws[]/keff[]and a distinct-expertuniq[].cluster_moe_batchshardsuniq[]across workers by(eid+layer)%g_cluster_n;cluster_itemcopies raw input rows viamemcpy; the wire carries(eid, nr, inputs)and the coordinator appliesws[]to returned rows locally. Top-k tie-breaking is deterministic (strict>over ascending expert id) and irrelevant to parity (the worker never re-routes). No float weights are serialized, so there is no lossy round-trip. The gate's pass/fail is attributable solely to the worker's expert-FFN arithmetic.e4b5bf3dhas zero fp8 references; it landed later upstream, renumbered 100→7→8 across Feature request: fp8-e4m3-b128 passthrough weight format — zero loss at int8 cost (repack, not requantize) JustVugg/colibri#524/Vulkan: fmt=7 MXFP4 decode + Kimi K3 GPU tier (follow-up to #418) JustVugg/colibri#705). The worker has no fmt=8 path, andqt_resolve_fmt(pr551) misclassifies an fp8 tensor as int8 and then fails the scale-count check with a hardexit(1)— fail-hard, not silent corruption. Out of scope for pass 1; no guard strictly needed (nothing silently wrong). Optionally add a cheap protocol-version/format rejection so a future fp8 snapshot fails cleanly.matmul_e8's AVX2 arm uses two interleaved accumulators + tree reduction vs the scalar single-accumulator path, and the selector is a compile-time#ifdef __AVX2__with no runtime dispatch or env override (g_no_fused_pair/g_idot/g_i4sdo not controlmatmul_e8). Build worker and coordinator with the sameARCH; recommendARCH=x86-64-v3(portable AVX2) overnative.main()atpr551:c/colibri.c:6663before CUDA/Metal/Vulkan init). The coordinator can serve routed experts on GPU (Vulkancoli_vk_expert_group_issue, Metal skip-CPU, CUDAcoli_cuda_expert_mlp). Force CPU: build the pure-C binary and pinCOLI_CUDA=0 COLI_METAL=0 COLI_VULKAN=0as defense-in-depth (the init blocks are env-gated).IDOT=0 I4S=1 COLI_NO_FUSED_PAIR=1 SPEC_PIN=0 XEXP=0 I4_ACC512=0 I3_AVX512=0 DRAFT=0(plus the three GPU vars from Q5).IDOT=0forces the exact-f32 int4/int8 kernels and sidesteps theg_i4s/spec_pinnedgate;COLI_NO_FUSED_PAIR=1makes the worker's and coordinator's gate+up paths structurally identical. The worker does honor these (all reads precede its early-return).load_cfg+st_init+ebits/dbitsis sufficient for the expert-FFN path —expert_load_implconsumes onlym->c,m->ebits,m->S, and the passedESlot(worker usesdemand=0, so disk-class counters are skipped). One change required: swapst_init→st_init_multi(COLI_MODEL_DIRS)so a worker matches a sharded coordinator's tensor namespace. Do not port the rest ofmodel_init(tokenizer/KVCache/router/embed/MTP) — dead weight for an expert-only worker.References & provenance
cluster-upstream, head sha0af26a3, basedev@e4b5bf3d,mergeable: CONFLICTING, 1 commit.cluster_worker_runreimplements the expert FFN (expert_gate_up→siluf→e8_rot_rows→matmul_qt) as a parallel copy ofmoe()'s inner compute, buttest_cluster.pyonly exercises the Python HTTP registry — nothing proves the worker's output matches localmoe(). A parallel expert path with no token-exact worker-vs-local gate can silently drift from the real kernel. Compare your own feat: add dense MLP activation sharding JustVugg/colibri#550, which does ship that gate. … I won't merge a re-implemented core kernel on trust."c/tests/test_dense_protocol.c(C wire test) +c/tests/test_dense_sharding.py(token-exact test). Note: feat: add dense MLP activation sharding JustVugg/colibri#550 asserts baseline≡delegated equality of mismatch lines, not zero mismatches — our gate is intentionally stronger.dev.c/tools/make_glm_oracle.py(glm_tiny: 8 routed experts, top-2, 1 shared; default f32 weights).pr551:c/colibri.c:1833–1837(worker FFN, missing input rotation) vsdev:c/colibri.c:4278–4279(E8_XEmacro, applied at 4787) +4802(canonical two-rotation sequence).Corrections vs. first draft (what the re-check changed)
matmul_qt→matmul_qt_ex,st_init→st_init_multi)". Reality:e8_rot_rowsis inquant.h;matmul_qtis byte-identical only as a 1-line shim whilematmul_qt_exdiverged (fp8/CUDA/Metal);st_init/st_init_multiboth pre-exist in both branches (only the call site changed).c/colihunk 2 from "an argparse add" to "pr551's fullclustersubparser block".[ORACLE]mismatch lines". Our gate asserts both.expert_loadreads f32 (and fp8) natively, so a conversion is required only to catch the fmt=6 bug (fmt=6/fmt=4 expert weights), not to run at all.mergeable: false→mergeable: CONFLICTING(GitHub's actual field value).Local artifacts (for the agent picking this up)
/home/eli/dev/_reference-docs-and-repos/colibri— branchespr550andpr551already fetched;upstream/devis current (0f335e5). No persistent merge result exists — the test merge ran in an ephemeral worktree that was removed. The picking-up agent should redo the rebase in a fresh branch. The clone is codegraph-indexed (.codegraph/at the root) — implementers should runcodegraph explore(or the codegraph MCP tool) before grep/read.