Phase 4 — The Expert-Slice Data Path (M1)

A weak device downloads a few 6 MB experts, not a 1.4 GB layer — and sharded compute matches monolithic to 3.6e-12.

Verified · real Qwen3.5-122B-A10B

An expert slice is a byte copy — no dequant

256→8
expert-dim slice
~6.1
MB / expert (Q4+Q6)
206 MB
2 layers × 16 experts download
200
HTTP, valid GGUF

MoE expert tensors stack all experts along the outermost ggml dimension, so the reader exposes (n_expert, rows, row_bytes) of raw quantized bytes. Expert *e* is a quant-block-aligned contiguous slab — the slice is literally data[a:b], with no dequantization and no re-packing.

write_expert_shard_gguf — the verified round trip.

sliced = tensor.data[a:b]              # outermost axis = expert
writer.add_tensor(name, sliced, raw_dtype=tensor.tensor_type)
# router (ffn_gate_inp) & shared expert stay on the backbone → excluded
GET /api/proxy/models/{m}/expert-shard?layers=0:2&experts=0:16  # node-token authed
A laser slicing one expert slab into a mini-GGUF beside a perfectly level balance scale
The numerical oracle

dispatch + combine == monolithic, exactly

With real 122B layer-0 experts (dequantized reference), splitting the experts into 4 shards, computing each separately and combining matches the monolithic MoE FFN: sharding is an exact regrouping of the same weighted sum, not an approximation.

3.6e-12
max|mono − sharded|
1.2e-07
relative error
True
allclose(1e-5)
28/256
experts touched
C++ worker, hardware-verified

linkcpp-expert-worker reproduces the oracle on ROCm

  • Pure ggml/gguf (no libllama): loads the slice into a GPU backend and runs mul_mat_id(up/gate) → swiglu → mul_mat_id(down).
  • ROCm build + run on an MI250: 122B layer-0, experts [0,8), 4 tokens.
  • Cosine 0.99995 vs the oracle, allclose(1e-3) = True, max|Δ| = 7.9e-7 — this residual is itself the first measured instance of cross-backend equivalence (ROCm vs numpy).
  • The same code path covers CUDA/Metal/Vulkan/CPU (mul_mat_id/swiglu are stock ggml; CUDA has a dedicated MoE kernel).

The hardest, riskiest piece — the on-device worker kernel — was verified here. What remained was backbone↔worker orchestration; the worker is a proven pure function consuming these slices.