Build1 distinct publisher3 min readUpdated
A CUDA and ROCm tutorial ends on the unglamorous half of Mixture of Experts: two all-to-all collectives per layer, optimizer state pushed onto PCIe, and launch overhead you have to design away.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
The final installment of a five-part CUDA and ROCm tutorial series on dev.to spends its length on four mechanisms rather than one architecture: Mixture of Experts routing with all-to-all expert parallelism, a ZeRO-Offload path that spills optimizer state to system RAM, CUDA/HIP graphs to eliminate kernel launch overhead, and an inference server with KV caching and PagedAttention [1]. The author's framing is the useful part: training is only half the battle, serving is the other half, and the prerequisites are Parts 1 through 4 plus a multi-GPU box, four cards or more [2].
Start with the arithmetic that forces the design. A dense 1.5 trillion parameter model would need 3TB of VRAM for weights alone [4], which works out to two bytes per parameter, so that figure already assumes half precision and gets no rescue from further quantisation of the same kind [9]. MoE answers this by holding hundreds of expert feed-forward networks and activating two of them per token [5], with the output a softmax-weighted sum over the top-k experts, k usually 2 [6]. The author notes that in 2024 and 2025 the major models, naming Grok, Mixtral and Gemini, use this to reach trillions of parameters without a matching compute bill [3].
What that buys in FLOPs it spends on the network. Dense models used All-Reduce; MoE needs All-to-All, because different GPUs own different experts and every token has to travel to whichever rank holds the expert it was routed to [10]. The listing is three steps: an NCCL/RCCL grouped send and receive built from per-rank send and receive counts, a local expert kernel over whatever arrived, then a second all-to-all to return the processed tokens to their origin GPUs [11]. That is two collectives per MoE layer per forward pass, and both are shaped by routing decisions that are not known until the router runs [12]. The author asserts this scales to thousands of experts across a cluster with minimal communication overhead [13]; that claim is unquantified in the text and is exactly the number an operator should measure rather than accept.
The router kernel itself is honest about being illustrative. It tracks the top two scores in a manual reduction and applies softmax to only those two, which is the right sparse move [7]. But it runs one thread per token and loops over every expert and every hidden dimension to get the logits [8], so routing cost per token scales with the full expert count regardless of k [c8a].
The offload section targets the other wall. At 70B parameters, ZeRO-3 may not fit in 40GB of VRAM, so momentum, variance and sometimes gradients go to host DDR [14], allocated as pinned memory [16], with gradients copied out asynchronously during the backward pass, the AdamW update computed on a CPU thread, and FP32 weights copied back just in time for the next forward [15]. If those two moment buffers are FP32, as the FP32 master weights imply, they are roughly 560GB on their own, about fourteen times a 40GB card [17]. The throughput ceiling of that scheme is PCIe, not the GPU.
Watch the two items the supplied text promises but breaks off before delivering: the graph capture and the paged KV cache both appear only in the agenda, with the article cutting off mid-listing inside the offload code [18]. Those are the pieces that decide decode latency, and a tutorial that stops before them has described the problem, not the fix.
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
Part 5 (final part) of the dev.to series "Advanced GPU Optimization: How to tech an LLM with CUDA and ROCm?" states its agenda as: implementing MoE routing and expert parallelism using all-to-all communication, building a ZeRO-Offload mechanism to spill optimizer states to system RAM, harnessing CUDA/HIP graphs to eliminate kernel launch overhead, and building an optimized inference server with KV caching and PagedAttention.
The article lists prerequisites as Parts 1-4, a multi-GPU setup (4+ ideal), and "a realization that training is only half the battle - serving is the other half".
A dense 1.5 trillion parameter model would require 3TB of VRAM just for weights.
MoE solves the VRAM problem by having hundreds of "expert" FFNs but activating only 2 of them per token.
The stated MoE math is y = sum over top-k experts of Softmax(Router(x))_i * Expert_i(x), with k usually 2.
The router kernel computes logits per token, tracks the top-2 scores via a manual reduction over experts, writes the two expert indices and weights, and applies softmax only to the top-2 scores (described as sparse softmax).
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Illustrative code only, no measurement
A single self-published tutorial supplies readable kernel and collective listings, which is real technical detail, but there is no benchmark, profile, hardware description, convergence check or external citation for any performance claim. The strongest claims in the cluster are structural readings of the author's own code rather than validated results, and the delivered text is incomplete.
No adoption signal in cluster
The cluster contains no release, deployment, usage disclosure, benchmark result or downstream reference. The article's assertion that Grok, Mixtral and Gemini use MoE is an uncited framing statement, not an observed adoption event, and no repository, star count, dependency or user of this tutorial's code is shown.
Confident conclusions outrun the shown work
Overstatement is moderate and specific rather than pervasive. The technical exposition is honest in shape, but the summary claims - scaling to thousands of experts with minimal communication overhead, and offload cost becoming nearly invisible - are asserted while the same text shows two routing-dependent collectives per layer, a gating kernel whose cost does not shrink with k, and hundreds of gigabytes of optimizer state moving over PCIe. The piece also promises a PagedAttention inference server it never delivers.
Series completion and developer audience building
The observable incentive is modest and non-commercial on its face: an individually authored five-part tutorial series on a developer content platform, framed as the finale with heavy reader address, which rewards breadth and confident closure over caveats. No vendor sponsorship, product, employer affiliation or commercial offer appears in the text, and both CUDA and ROCm paths are covered rather than one being promoted, so there is no visible platform bias to score higher.
High on what the text says, low on whether it holds
Confidence is high for descriptive claims because the artifact itself is the source and its code is quoted in full, and the derived arithmetic (2 bytes per parameter, ~560GB optimizer state, O(num_experts * D) gating) follows directly from the article's own numbers. Confidence is low for anything about real-world performance, adoption or industry structure, where the cluster offers one uncorroborated, partially truncated voice.
build
Under 30% citation overlap between engines makes pooled AI visibility scores unbuyable1 distinct publisher
build
Count invalid JSON as a failed classification, and model choice becomes a reliability problem1 distinct publisher
build
Wiring, not headcount: same agent task swung from 70% worse to 81% better on topology alone1 distinct publisher
product
A school agenda shipped with "Vitoiis" and a planet named Marc, and no one read it first1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 21, 2026