Batched resident MoE experts on Apple Silicon: a flat parallel expert pass, ~1.6x decode, parity bit-identical (single-run)
Ran Tao (Octoryn Research)
摘要
On a text-diffusion Gemma MoE (26B-A4B-class, 128 experts, top-8 routing) forward on a 20-core-class Apple Silicon machine, the per-(token,expert) expert FFN — where each tiny M=1 GEMV spawned its own narrow parallel launch, starving the cores — was restructured into one flat parallel pass per layer over a job list of F16-resident experts. On one short-canvas, 4-step decode run, decode wall fell ~1.6x with higher CPU utilization, while decode token ids stayed bit-identical and the forward argmax was unchanged. Single run, no variance, CPU-bound; not a throughput claim.
本 Research Object 以其原始语言(英文)发表。
1. Contribution
Claimed. A single engineering change to a text-diffusion Gemma MoE (26B-A4B-class) forward on Apple Silicon that collapses the nested per-(token,expert) expert FFN path into one flat parallel pass per layer, plus the measured effect of that change on a single decode run:
- The prior path looped over tokens, then over the top-8 routed experts, and each tiny M=1 expert GEMV spawned its own narrow parallel launch. Between those launches the CPU cores were starved.
- The new path builds an immutable
(token, expert, weight)job list for the whole layer, pre-fetches the F16-resident expert slices sequentially (read-only afterwards), then runs one flat parallel pass over all jobs (gate/up projection → gated activation → weighted down projection per job). - On one decode run (small canvas, 4 steps) this cut decode wall by ~1.6x, with CPU utilization rising toward core saturation, while producing bit-identical decode token ids and an unchanged forward argmax.
NOT claimed. This is not a benchmark report and not a throughput claim about autoregressive MoE serving. It does not claim multi-run statistics, a tokens-per-second figure, GPU expert-kernel batching, KV-cache reuse, any improvement to decode answer quality, or applicability to an autoregressive MoE serving path. It is a single-machine, single-run result. It is distinct from per-request-stream KV-isolation and batched-concurrent serving work — those parallelize across request streams; this parallelizes the expert FFN inside one single-stream decode.
2. Methods
| Item | Value |
|---|---|
| Model | Text-diffusion Gemma MoE, 26B-A4B-class, 128 experts, top-8 routing, 4-bit quantized |
| Engine path | Hand-written forward; dense linears via a hand-written GPU GEMM; the expert FFN GEMV is hand-written F16 CPU code under a multicore parallel dispatch (the batched pass is CPU-multicore, not a GPU kernel) |
| Hardware | Apple Silicon, 20-core CPU class; exact chip not re-stated for the speedup change |
| Build / toolchain | Not recorded in source (no build flags or compiler version recorded) |
| Oracle / parity baseline | The prior scalar/nested expert path in the same binary; forward also parity-verified vs a reference implementation elsewhere (forward cosine ≈ 0.99999995) |
| Precision | F16 expert weights (resident in an expert cache), F32 accumulation; the same F16 math and per-token top-k summation order are preserved |
| Decode config | Small canvas, 4 steps (the measured run); the cumulative figure is per-step on the same small canvas |
| Implementation note | Hand-written F16 GEMV, no BLAS |
3. Results
All numbers are as reported in the engineering record. Single run; no variance recorded.
| Metric | Before | After | Factor |
|---|---|---|---|
| Decode wall (small canvas, 4 steps) | baseline | reduced | ~1.6x |
| CPU utilization | lower | higher | cores closer to saturated |
| Cumulative this session (per step) | baseline | reduced | ~3x |
- The ~3x cumulative figure is not attributable to this change alone — the record states it is the batched-experts change combined with a prior output-projection batching (folding W separate M=1 calls into one M=W GEMM). This change's own contribution is the ~1.6x.
- Parity: decode produces the same canvas token ids as the scalar path (decoding to a short natural-language continuation); the forward argmax is unchanged. Reported as bit-identical by construction (same F16 weights, same per-token top-k summation order).
4. Ablations / negative controls
No formal ablation or negative control accompanies this change. The implicit comparison is the prior scalar/nested path in the same binary (the "before" column). Bit-identical output is the correctness anchor; no separate parity harness run is recorded specifically for this change beyond the canvas-id and argmax checks above.
5. Threats to validity / limitations
- Single run, no variance. One small-canvas/4-step decode; no repeats, no confidence interval, no warm/cold distinction recorded. Hence the evidence level is experimental, not reproduced.
- No tokens-per-second and no throughput claim. The numbers are wall-clock for one configuration; nothing about aggregate or batched serving throughput is implied.
- CPU-bound expert pass. The speedup comes from saturating CPU cores, not from a GPU expert kernel. Gains are tied to this 20-core-class machine and will differ on other chips; CPU utilization did not reach the full core ceiling, so headroom and scaling are unquantified.
- Configuration sensitivity. Measured only at small canvas, 4 steps. Larger canvases, more steps, and longer prompts are not measured; the job-list count (and thus parallel efficiency) scales with n_tokens × top-8, which was small here.
- Quality is unchanged, not improved. A downstream regression suite on the same decoder reports a partial verdict — answer-hit roughly 27% versus a sampled-denoiser oracle near 96%, a structural argmax-denoiser limitation. Bit-identical means this speedup neither causes nor fixes that gap; it does not make the decoder production-ready.
- Hardware/build under-specified. Exact chip, OS, compiler/toolchain version, and build flags are not recorded.
6. Reproducibility
- Scope: a localized perf change to the expert FFN path of the diffusion-Gemma forward, plus a documentation record. Single-author engineering record dated 2026-06-15.
- Model: text-diffusion Gemma MoE, 26B-A4B-class, 4-bit quantized.
- How to reproduce (from sources): run the diffusion-Gemma decode at small canvas, 4 steps on the same Apple Silicon machine, before vs after the change, comparing decode wall, CPU%, decode canvas token ids, and forward argmax.
- Not recorded in source: exact CLI invocation/flags, seed, prompt for the timing run, environment (OS/compiler version), and any multi-run timing distribution.
声明边界
作者对范围的明确界定——本工作证明了什么、未证明什么——沿用自 Octoryn Research 的发表模型。
证明
- On one short-canvas, 4-step decode run, the flat parallel expert pass cut decode wall ~1.6x and raised CPU utilization toward core saturation.
- The change is output-preserving: decode token ids were bit-identical to the prior scalar/nested path and the forward argmax was unchanged.
- The expert FFN can be restructured from nested per-(token,expert) launches into a single job-list parallel pass without changing the F16 math or the top-k summation order.
未证明
- Any multi-run or reproduced statistic, variance, or confidence interval (single run only).
- A tokens-per-second figure or any aggregate or batched serving throughput improvement.
- That the larger cumulative session speedup is from this change alone (it includes prior output-projection batching).
- Any improvement to decode answer quality (the downstream suite remains partial relative to a sampled-denoiser oracle).
- GPU expert-kernel batching, KV-cache reuse, or applicability to an autoregressive MoE serving path.
适用于
- A text-diffusion Gemma MoE (26B-A4B-class) quantized decode on a 20-core-class Apple Silicon machine.
- Expert weights already resident in F16 so the parallel pass is read-only.
- Decode at small canvas with top-8 routing, where many small expert jobs exist per layer.
不适用于
- Other chips or core counts, or GPU-resident expert kernels (this is CPU-multicore F16 GEMV).
- Autoregressive MoE serving or cross-request-stream batching (distinct objects).
- Configurations not measured (larger canvas or step counts, longer prompts) or claims about decode correctness or production readiness.
作者
- Ran Tao — 调查研究, 写作
引用本文
引用格式
Tao, R., Octoryn Research. (2026). Batched resident MoE experts on Apple Silicon: a flat parallel expert pass, ~1.6x decode, parity bit-identical (single-run) (TR-2026-0047). Octopus Research Institute.
BibTeX
@techreport{oritr20260047,
title = {Batched resident MoE experts on Apple Silicon: a flat parallel expert pass, ~1.6x decode, parity bit-identical (single-run)},
author = {Tao, Ran and {Octoryn Research}},
institution = {Octopus Research Institute},
year = {2026},
note = {Permanent ID TR-2026-0047. Not peer reviewed.}
}披露
- 资助
- 硬件与基础设施由 Octoryn / Octopus Core Pty Ltd 提供。
- 利益冲突
- Octoryn 提供商业推理与治理工具;相关发现独立报告。
