<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Moe on lo0 — Tech Blog</title><link>https://blog.lo0.es/en/tags/moe/</link><description>Recent content in Moe on lo0 — Tech Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 09 Jun 2026 01:50:00 +0000</lastBuildDate><atom:link href="https://blog.lo0.es/en/tags/moe/index.xml" rel="self" type="application/rss+xml"/><item><title>Device-native architectures: fine-grained MoE and pre-attention router</title><link>https://blog.lo0.es/en/posts/device-native-architectures-fine-grained-moe-pre-attention-router/</link><pubDate>Tue, 09 Jun 2026 01:50:00 +0000</pubDate><guid>https://blog.lo0.es/en/posts/device-native-architectures-fine-grained-moe-pre-attention-router/</guid><description>&lt;blockquote>
&lt;p>This post belongs to the series on inference performance in small models. It is the architectural face of a problem we have already looked at from the compute-regime side (the SLM&amp;rsquo;s inverted roofline) and from the weight-loading side in &lt;a href="https://blog.lo0.es/en/posts/pantry-lift-from-disk-to-hbm-why-the-kitchen-opens-late/">From disk to HBM&lt;/a>. Here the question is different: what if, instead of adapting a large model to the device, we design the model &lt;em>for&lt;/em> the device from the first commit?&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>The default move to get an LLM onto a laptop, a phone or an edge box is to &lt;strong>take a dense model built for cloud and compress it&lt;/strong>: distillation, pruning, quantisation. It is a gesture of &lt;em>reduction&lt;/em>: you start from something big and take things away. SmallThinker (arXiv:2507.20984, SJTU IPADS + Zenergize AI) argues for the reverse gesture, &lt;em>designing from scratch&lt;/em>, and articulates it in three pieces. &lt;strong>First: fine-grained MoE&lt;/strong>, many small experts with very few activated per token, so that total parameters &lt;code>N&lt;/code> (the capacity) decouple from activated parameters &lt;code>A&lt;/code> (the compute cost per token). &lt;strong>Second: sparse FFN&lt;/strong>, ReLU-style activation sparsity inside each block, which adds a second level of sparsity on top of the first. &lt;strong>Third: a pre-attention router&lt;/strong> that predicts which experts will be needed &lt;em>before&lt;/em> running the attention block and launches the prefetch of those weights from SSD/flash in parallel with attention compute, hiding the storage latency, which is the real bottleneck when the model does not fit entirely in RAM. The authors report SmallThinker-4B-A0.6B and SmallThinker-21B-A3B exceeding ~20 tok/s on consumer CPUs with Q4_0, using ~1 GB and ~8 GB of RAM. The numbers are interesting and the direction is right; the evaluation methodology and the quality cost of activating so little deserve scepticism, and that is what the last part is for.&lt;/p>
&lt;h2 id="the-analogy-the-librarian-who-anticipates-your-request">The analogy: the librarian who anticipates your request&lt;/h2>
&lt;p>Picture a huge library with a small reading room. You are sitting in the room at a single desk: only a few books fit on it at a time (that is RAM). The bulk of the collection is in the back room, on long shelves that are slow to walk (that is the SSD/flash). And there is a librarian.&lt;/p>
&lt;p>The naive method: you read, you reach a point where you need a specific book, you request it, and then the librarian gets up, walks to the back room, looks for it and comes back. Meanwhile, you wait with the page open, making no progress. Every time you need a new book, you pay the full trip to the back room. The reading room spends most of its time waiting, not reading.&lt;/p>
&lt;p>The SmallThinker method: the librarian is clever and gets ahead of you. While you are still reading the chapter&amp;rsquo;s &lt;strong>table of contents&lt;/strong>, working out what it is about and connecting ideas, which in the model is the &lt;strong>attention&lt;/strong> block, they have already glanced over your shoulder, &lt;strong>predicted&lt;/strong> which three or four books you are going to ask for and gone to the back room to fetch them. By the time you finish the contents and formulate the request, the books are already on your desk. You have not waited: the trip to the back room happened &lt;em>in parallel&lt;/em> with your reading of the contents.&lt;/p>
&lt;p>The analogy holds on four details:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>The small desk is RAM&lt;/strong>; the slow back room is the &lt;strong>SSD/flash&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>The books are the MoE&amp;rsquo;s experts&lt;/strong>: only a few are on the desk at any moment.&lt;/li>
&lt;li>&lt;strong>Reading the contents is the attention block&lt;/strong>; requesting and using the books is the FFN/expert block.&lt;/li>
&lt;li>&lt;strong>The librarian who predicts and gets ahead is the pre-attention router&lt;/strong>: the prediction is made first, and the trip to fetch (the prefetch) overlaps with reading the contents (attention).&lt;/li>
&lt;/ul>
&lt;p>The quantitative question running through the whole post is: does the librarian get back in time? The wait is only hidden if the trip to the back room takes less than your reading of the contents. That is the condition &lt;code>t_{\text{attention}} \ge t_{\text{prefetch}}&lt;/code>, and we will do it with numbers.&lt;/p>
&lt;h2 id="compressing-a-dense-model-vs-designing-for-device">Compressing a dense model vs. designing for device&lt;/h2>
&lt;p>It is worth laying out the two approaches plainly, because they are not degrees of the same thing: they are different philosophies.&lt;/p>
&lt;p>&lt;strong>Approach A — compress a dense model built for cloud.&lt;/strong> You start from, say, a dense 7B–14B model trained to run on an RTX 4090 (24 GB, Ada Lovelace) or on a generic 4×H100 SXM cluster (320 GB, NVLink, native FP8). To fit it into a device you apply three levers, each with its own post: &lt;a href="https://blog.lo0.es/en/posts/knowledge-distillation-teaching-small-model-think-like-big-one/">distillation&lt;/a> (you train a small student that imitates the teacher), &lt;a href="https://blog.lo0.es/en/posts/llm-pruning-cutting-without-amputating/">pruning&lt;/a> (you remove weights or whole structures) and aggressive quantisation (you go down to 4 bits or fewer). The resulting model &lt;strong>is still dense&lt;/strong>: all its parameters are activated on every token. You have reduced the number of parameters, but the compute pattern is the cloud&amp;rsquo;s, only smaller.&lt;/p>
&lt;p>&lt;strong>Approach B — design for device from scratch.&lt;/strong> Here the device&amp;rsquo;s constraints enter the &lt;em>architecture&lt;/em>, not a later compression phase. The constraints are three and very concrete:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Weak compute.&lt;/strong> A laptop CPU or a mobile SoC does orders of magnitude fewer FLOPs than a datacenter GPU. This pushes you to minimise the &lt;strong>activated&lt;/strong> parameters per token, not the total ones.&lt;/li>
&lt;li>&lt;strong>Little RAM.&lt;/strong> Tens of GB do not fit. This pushes you to keep resident only what is essential and to &lt;em>stream&lt;/em> the rest.&lt;/li>
&lt;li>&lt;strong>Slow storage.&lt;/strong> The SSD or flash you are forced to stream from has far less bandwidth than a GPU&amp;rsquo;s HBM. This turns storage I/O into the bottleneck, and pushes you to &lt;em>hide&lt;/em> it.&lt;/li>
&lt;/ol>
&lt;p>SmallThinker is approach B taken to the detail: each of those three constraints has an architectural answer. Weak compute is attacked with fine-grained MoE + sparse FFN (minimise &lt;code>A&lt;/code>). Scarce RAM is attacked with streaming from SSD (resident ≈ &lt;code>A&lt;/code> + cache, not &lt;code>N&lt;/code>). Slow storage is attacked with the pre-attention router (hide the I/O behind attention). It is no accident that the three pieces fit together: each one solves a constraint, and together they reinforce each other.&lt;/p>
&lt;p>An important nuance, so as not to fall into the hype: approach B &lt;strong>is neither free nor universally superior&lt;/strong>. It requires training a new model (you do not reuse existing weights), and the quality ceiling of a model with a very small &lt;code>A&lt;/code> is intrinsically bounded, as we will see. The argument is not &amp;ldquo;B always wins&amp;rdquo;, but &amp;ldquo;for the device regime, B attacks the right bottlenecks, and A only attacks them in passing&amp;rdquo;.&lt;/p>
&lt;h2 id="two-levels-of-sparsity">Two levels of sparsity&lt;/h2>
&lt;p>The central capacity idea is old and well understood in &lt;a href="https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/">MoE&lt;/a>: separate &lt;strong>capacity&lt;/strong> from &lt;strong>compute cost&lt;/strong>. In a MoE, the model has &lt;code>N&lt;/code> total parameters spread across experts, but for each token only &lt;code>A&lt;/code> parameters are activated (those of the top-k experts the router picks). Compute cost per token scales with &lt;code>A&lt;/code>; knowledge capacity scales with &lt;code>N&lt;/code>. SmallThinker applies this idea at &lt;strong>two superimposed levels&lt;/strong>.&lt;/p>
&lt;p>&lt;strong>Level 1 — fine-grained MoE.&lt;/strong> &amp;ldquo;Fine-grained&amp;rdquo; means many small experts instead of few large ones, with very few activated per token. Instead of, say, 8 experts of which you activate 2, you have dozens of experts of which you activate a handful. With smaller experts, the same &lt;code>A&lt;/code> is spread across more possible combinations, which gives the router fine granularity and keeps &lt;code>A&lt;/code> very low relative to &lt;code>N&lt;/code>. The result is an aggressive &lt;code>N/A&lt;/code> ratio: a lot of capacity, very little compute per token.&lt;/p>
&lt;p>&lt;strong>Level 2 — sparse FFN (ReLU-style activation sparsity).&lt;/strong> This level is orthogonal and operates &lt;em>inside&lt;/em> each FFN. With a ReLU-style non-linearity, a large fraction of the intermediate layer&amp;rsquo;s neurons produce exactly zero for a given token. A neuron that comes out at zero contributes nothing to the output: its matrix-vector multiplication can be skipped. This is &lt;em>activation sparsity&lt;/em>: predictable token by token, and exploitable so as not to load or multiply the weight rows/columns corresponding to inactive neurons. It is the same phenomenon exploited by work such as Deja Vu or PowerInfer; SmallThinker builds it in from the factory by choosing activations that favour it.&lt;/p>
&lt;p>The combined effect, in one sentence: &lt;strong>large &lt;code>N&lt;/code> (capacity), tiny &lt;code>A&lt;/code> (compute cost per token ≈ proportional to &lt;code>A&lt;/code>)&lt;/strong>, and on top of that, inside that &lt;code>A&lt;/code>, a fraction of the multiplications is saved through activation sparsity. It is sparsity on top of sparsity.&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 780 300" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Classic MoE vs fine-grained MoE with sparse FFN">
&lt;defs>&lt;marker id="ar1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="195" y="22" text-anchor="middle" font-size="13" font-weight="600" fill="currentColor">Classic MoE (coarse-grained)&lt;/text>
&lt;text x="585" y="22" text-anchor="middle" font-size="13" font-weight="600" fill="currentColor">Fine-grained MoE + sparse FFN&lt;/text>
&lt;line x1="390" y1="35" x2="390" y2="285" stroke="currentColor" stroke-width="1" stroke-dasharray="4 3"/>
&lt;!-- classic: 8 large experts, 2 active -->
&lt;text x="40" y="50" font-size="11" fill="currentColor">8 large experts · activates 2&lt;/text>
&lt;rect x="40" y="60" width="64" height="40" fill="#1f5fa8" stroke="#13335c" stroke-width="1.4"/>
&lt;rect x="114" y="60" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;rect x="188" y="60" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;rect x="262" y="60" width="64" height="40" fill="#1f5fa8" stroke="#13335c" stroke-width="1.4"/>
&lt;rect x="40" y="106" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;rect x="114" y="106" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;rect x="188" y="106" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;rect x="262" y="106" width="64" height="40" fill="#cfd8e3" stroke="#7b8794" stroke-width="1.2"/>
&lt;text x="183" y="172" text-anchor="middle" font-size="11" fill="currentColor">large A per expert · coarse granularity&lt;/text>
&lt;!-- fine: many small experts, several active but low total A -->
&lt;text x="410" y="50" font-size="11" fill="currentColor">many small experts · activates few&lt;/text>
&lt;g>
&lt;rect x="410" y="60" width="28" height="22" fill="#2a7a40" stroke="#1a4d29" stroke-width="1.2"/>
&lt;rect x="444" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="478" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="512" y="60" width="28" height="22" fill="#2a7a40" stroke="#1a4d29" stroke-width="1.2"/>
&lt;rect x="546" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="580" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="614" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="648" y="60" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="410" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="444" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="478" y="88" width="28" height="22" fill="#2a7a40" stroke="#1a4d29" stroke-width="1.2"/>
&lt;rect x="512" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="546" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="580" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;rect x="614" y="88" width="28" height="22" fill="#2a7a40" stroke="#1a4d29" stroke-width="1.2"/>
&lt;rect x="648" y="88" width="28" height="22" fill="#cfe3d5" stroke="#7b948a" stroke-width="1"/>
&lt;/g>
&lt;text x="543" y="128" text-anchor="middle" font-size="11" fill="currentColor">low total A · fine granularity&lt;/text>
&lt;!-- sparse FFN inside -->
&lt;text x="410" y="158" font-size="11" font-weight="600" fill="currentColor">+ sparse FFN inside each active expert:&lt;/text>
&lt;g>
&lt;rect x="410" y="168" width="14" height="40" fill="#a48000"/>
&lt;rect x="428" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;rect x="446" y="168" width="14" height="40" fill="#a48000"/>
&lt;rect x="464" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;rect x="482" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;rect x="500" y="168" width="14" height="40" fill="#a48000"/>
&lt;rect x="518" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;rect x="536" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;rect x="554" y="168" width="14" height="40" fill="#a48000"/>
&lt;rect x="572" y="168" width="14" height="40" fill="#f1e7c2" stroke="#b8a96a" stroke-width="0.8"/>
&lt;/g>
&lt;text x="600" y="192" font-size="11" fill="currentColor">neurons at 0 (ReLU) →&lt;/text>
&lt;text x="600" y="206" font-size="11" fill="currentColor">skipped in the compute&lt;/text>
&lt;text x="40" y="245" font-size="11.5" font-weight="600" fill="currentColor">Capacity = N (all experts) · Cost/token ≈ A (activated) · and inside A, sparse FFN saves more&lt;/text>
&lt;text x="40" y="270" font-size="11" fill="currentColor">The trick: raise N without raising A. Fine granularity allows a far more aggressive N/A ratio.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;h2 id="the-pre-attention-router-predict-and-prefetch">The pre-attention router: predict and prefetch&lt;/h2>
&lt;p>Here is the paper&amp;rsquo;s specific piece, and the one that gives the post its name. The problem it solves is one of &lt;em>I/O scheduling&lt;/em>, not of quality.&lt;/p>
&lt;p>When the model does not fit entirely in RAM, the expert weights live in SSD/flash and are loaded on demand. The naive flow of a MoE layer is sequential: you run attention, then the router decides which experts are needed, then you &lt;strong>load those experts from SSD&lt;/strong> (waiting), then you run the FFN of those experts. The loading step is pure waiting: the CPU is blocked waiting for bytes from the SSD. In the device regime, where the SSD is slow, that waiting time dominates the decode step.&lt;/p>
&lt;p>The &lt;strong>pre-attention router&lt;/strong> breaks the sequentiality by inverting the order of the decision. The observation is that the router does not need &lt;em>this&lt;/em> same layer&amp;rsquo;s attention output to make a reasonable prediction of which experts will be needed: it can predict it from the state it already has &lt;em>before&lt;/em> running attention. So:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Before&lt;/strong> running the layer&amp;rsquo;s attention block, the router predicts the experts that will be needed.&lt;/li>
&lt;li>It launches the &lt;strong>prefetch&lt;/strong> of those experts from SSD/flash asynchronously.&lt;/li>
&lt;li>&lt;strong>In parallel&lt;/strong>, the CPU runs the attention block, which is pure compute and does not need the SSD.&lt;/li>
&lt;li>When attention finishes, the prefetched experts are (ideally) already in RAM, and the FFN proceeds without waiting.&lt;/li>
&lt;/ol>
&lt;p>Storage I/O has been &lt;strong>overlapped&lt;/strong> with attention compute. It is exactly the librarian who goes to the back room while you read the contents.&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 780 270" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Pre-attention router flow with overlapped prefetch">
&lt;defs>&lt;marker id="ar2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="20" y="22" font-size="12.5" font-weight="600" fill="currentColor">Naive (sequential): the load from SSD blocks&lt;/text>
&lt;rect x="20" y="32" width="110" height="34" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="75" y="53" text-anchor="middle" font-size="11" fill="#13335c">attention&lt;/text>
&lt;rect x="138" y="32" width="80" height="34" fill="#e6d0ff" stroke="#5a2db0" stroke-width="1.4"/>
&lt;text x="178" y="53" text-anchor="middle" font-size="11" fill="#3a1d70">router&lt;/text>
&lt;rect x="226" y="32" width="180" height="34" fill="#f6caca" stroke="#a52a2a" stroke-width="1.4"/>
&lt;text x="316" y="49" text-anchor="middle" font-size="11" fill="#6e1d1d">load experts from SSD&lt;/text>
&lt;text x="316" y="61" text-anchor="middle" font-size="10" fill="#6e1d1d">(blocking wait)&lt;/text>
&lt;rect x="414" y="32" width="110" height="34" fill="#cdebd0" stroke="#2a7a40" stroke-width="1.4"/>
&lt;text x="469" y="53" text-anchor="middle" font-size="11" fill="#1a4d29">expert FFN&lt;/text>
&lt;path d="M130,49 L138,49" stroke="#666" stroke-width="1.4" fill="none" marker-end="url(#ar2)"/>
&lt;path d="M218,49 L226,49" stroke="#666" stroke-width="1.4" fill="none" marker-end="url(#ar2)"/>
&lt;path d="M406,49 L414,49" stroke="#666" stroke-width="1.4" fill="none" marker-end="url(#ar2)"/>
&lt;text x="540" y="53" font-size="11" fill="currentColor">t_total = t_att + t_load + t_ffn&lt;/text>
&lt;line x1="20" y1="92" x2="760" y2="92" stroke="currentColor" stroke-width="0.8" stroke-dasharray="3 3"/>
&lt;text x="20" y="118" font-size="12.5" font-weight="600" fill="currentColor">Pre-attention router: the prefetch overlaps with attention&lt;/text>
&lt;text x="20" y="140" font-size="11" font-weight="600" fill="currentColor">compute thread (CPU)&lt;/text>
&lt;rect x="170" y="130" width="80" height="30" fill="#e6d0ff" stroke="#5a2db0" stroke-width="1.4"/>
&lt;text x="210" y="149" text-anchor="middle" font-size="10.5" fill="#3a1d70">router (pre)&lt;/text>
&lt;rect x="258" y="130" width="150" height="30" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="333" y="149" text-anchor="middle" font-size="11" fill="#13335c">attention (t_att)&lt;/text>
&lt;rect x="416" y="130" width="120" height="30" fill="#cdebd0" stroke="#2a7a40" stroke-width="1.4"/>
&lt;text x="476" y="149" text-anchor="middle" font-size="11" fill="#1a4d29">expert FFN&lt;/text>
&lt;text x="20" y="190" font-size="11" font-weight="600" fill="currentColor">I/O thread (SSD)&lt;/text>
&lt;rect x="258" y="180" width="130" height="30" fill="#ffe0a8" stroke="#a48000" stroke-width="1.4"/>
&lt;text x="323" y="199" text-anchor="middle" font-size="10.5" fill="#6b5400">prefetch experts (t_prefetch)&lt;/text>
&lt;path d="M250,145 C254,145 254,150 258,150" stroke="#5a2db0" stroke-width="1.2" fill="none"/>
&lt;path d="M250,150 L256,150 L256,195 L258,195" stroke="#a48000" stroke-width="1.2" fill="none" marker-end="url(#ar2)" stroke-dasharray="3 2"/>
&lt;line x1="258" y1="122" x2="258" y2="218" stroke="currentColor" stroke-width="0.7" stroke-dasharray="2 2"/>
&lt;line x1="408" y1="122" x2="408" y2="218" stroke="currentColor" stroke-width="0.7" stroke-dasharray="2 2"/>
&lt;text x="20" y="245" font-size="11.5" fill="currentColor">The prefetch is hidden if &lt;tspan font-weight="700">t_att ≥ t_prefetch&lt;/tspan>: by the time attention ends, the experts are in RAM.&lt;/text>
&lt;text x="20" y="262" font-size="11" fill="currentColor">If t_prefetch &amp;gt; t_att, a wait bubble (t_prefetch − t_att) appears before the FFN. That is the case to avoid.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>The &lt;strong>hiding condition&lt;/strong> is the inequality above: the prefetch is completely hidden if and only if&lt;/p>
$$t_{\text{attention}} \;\ge\; t_{\text{prefetch}}.$$
&lt;p>If attention takes longer than loading the experts, the load is free (it was already done). If the experts are too large or the SSD too slow, &lt;code>t_prefetch &amp;gt; t_att&lt;/code> and a wait bubble equal to &lt;code>t_prefetch − t_att&lt;/code> appears. That is why the design &lt;em>needs&lt;/em> &lt;code>A&lt;/code> to be small (small experts → fewer bytes to prefetch → low &lt;code>t_prefetch&lt;/code>) and the grain to be fine: the two things level 1 of sparsity does are not only about saving FLOPs, they are about making the prefetch fit underneath attention.&lt;/p>
&lt;h2 id="the-maths-that-matter">The maths that matter&lt;/h2>
&lt;h3 id="memory-footprint-resident-n-vs-a--cache">Memory footprint: resident N vs. A + cache&lt;/h3>
&lt;p>The parameter that decides whether the model fits is how much you have to keep &lt;strong>resident in RAM&lt;/strong> at once.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Everything in RAM.&lt;/strong> If you require all the experts to be loaded, the footprint is &lt;code>\approx N&lt;/code> (all parameters, multiplied by bytes/parameter according to the quantisation). For a 21B this is prohibitive on a device.&lt;/li>
&lt;li>&lt;strong>Streaming from SSD.&lt;/strong> If you only keep the active experts resident plus a cache of the recent/likely ones, the footprint drops to &lt;code>\approx A + \text{cache}&lt;/code>. The weights that are not in RAM live on SSD and get prefetched when needed. This is where the real saving is: the resident set scales with &lt;code>A&lt;/code>, not with &lt;code>N&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>The non-expert part of the model (embeddings, attention, router, layernorms) is always resident, but in a fine-grained MoE the bulk of &lt;code>N&lt;/code> is in the experts, so the approximation &lt;code>resident ≈ A + cache + dense_part&lt;/code> is a good one.&lt;/p>
&lt;h3 id="the-prefetch-calculation-with-numbers">The prefetch calculation, with numbers&lt;/h3>
&lt;p>Let us put numbers on the analogy. Suppose a consumer SSD at &lt;strong>5 GB/s&lt;/strong> of sequential read and a quantised expert of size &lt;code>X&lt;/code> MB. The time to load one expert is&lt;/p>
$$t_{\text{1 expert}} = \frac{X \text{ MB}}{5000 \text{ MB/s}} = \frac{X}{5000}\ \text{s} = \frac{X}{5}\ \text{ms}.$$
&lt;p>Let us make &lt;code>X&lt;/code> concrete. In SmallThinker-4B-A0.6B with Q4_0 (~0.5 byte/param effective counting block overhead), a small expert of, say, 4M parameters weighs &lt;code>\approx 4\text{M} \times 0.5 = 2&lt;/code> MB. Loading it costs &lt;code>t_{\text{1 expert}} = 2/5 = 0.4&lt;/code> ms.&lt;/p>
&lt;p>Now the scheduling question: if the layer&amp;rsquo;s attention block takes &lt;code>Y&lt;/code> ms, &lt;strong>how many experts can I prefetch while attention runs?&lt;/strong> The number is&lt;/p>
$$n_{\text{prefetch}} = \left\lfloor \frac{Y}{t_{\text{1 expert}}} \right\rfloor = \left\lfloor \frac{Y \cdot 5}{X} \right\rfloor.$$
&lt;p>With &lt;code>Y = 2&lt;/code> ms of attention and &lt;code>X = 2&lt;/code> MB per expert: &lt;code>n_{\text{prefetch}} = \lfloor 2 \times 5 / 2 \rfloor = 5&lt;/code> experts. That is, within that layer&amp;rsquo;s attention window the SSD manages to bring in 5 experts. If the layer&amp;rsquo;s top-k activates ≤ 5 experts, the prefetch hides them all and &lt;code>t_prefetch ≤ t_att&lt;/code>: zero load latency. If the layer needed 8 experts, you would bring 5 for free and pay the load of the remaining 3 as a bubble: &lt;code>(8-5) \times 0.4 = 1.2&lt;/code> ms of waiting per layer. Hence why the design wants fine grain with a small top-k: to fit underneath the attention window.&lt;/p>
&lt;p>Two critical observations about this calculation:&lt;/p>
&lt;ul>
&lt;li>The 5 GB/s is &lt;strong>idealised sequential read&lt;/strong>. The experts are scattered across the disk; random 4K reads on a consumer SSD are far slower. The effective bandwidth can be a fraction of the nominal one, which reduces &lt;code>n_{\text{prefetch}}&lt;/code>. Any methodology reporting tok/s ought to say whether it measures with experts pre-sorted on disk or with realistic access.&lt;/li>
&lt;li>The attention window &lt;code>Y&lt;/code> &lt;strong>shrinks with short context&lt;/strong> and at the start of generation. With short prompts, attention is cheap and may &lt;em>not&lt;/em> cover the prefetch; the advantage of the overlap grows with longer sequences. Another detail an honest benchmark should break down.&lt;/li>
&lt;/ul>
&lt;h3 id="weight-footprint-why-they-report-1-gb-for-a-4b">Weight footprint: why they report ~1 GB for a 4B&lt;/h3>
&lt;p>Let us do the 4B calculation in Q4_0. Quantisation to 4 bits ≈ 0.5 byte/param, plus a small overhead of per-block scales (Q4_0 adds one FP16 scale every 32 weights, ~0.56 effective byte/param). So:&lt;/p>
$$4\text{B} \times 0.5\ \text{B/param} \approx 2\ \text{GB}.$$
&lt;p>That is, &lt;strong>the full model in Q4_0 takes up ~2 GB on disk&lt;/strong>. But the authors report &lt;strong>~1 GB of RAM&lt;/strong>. A contradiction? No, and understanding why is understanding the design:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Not all experts are resident.&lt;/strong> Only the activated ones (&lt;code>A = 0.6B&lt;/code>) plus a cache fit in RAM; the rest lives on SSD and is streamed. &lt;code>0.6\text{B} \times 0.5 \approx 0.3&lt;/code> GB of active experts, plus the dense part (attention, embeddings, router) and a cache of hot experts.&lt;/li>
&lt;li>&lt;strong>Sparse FFN reduces the work and the useful resident set.&lt;/strong> The neurons that come out at zero do not need to be materialised for that token.&lt;/li>
&lt;/ul>
&lt;p>Adding up active experts + dense part + a reasonable cache, ~1 GB is plausible. But mind the nuance: ~1 GB is the &lt;strong>resident set in RAM&lt;/strong>, not the total footprint in storage, which is still ~2 GB on SSD. Conflating the two, reporting a bare &amp;ldquo;1 GB&amp;rdquo;, is misleading if the reader understands &amp;ldquo;the model takes up 1 GB&amp;rdquo;. It takes up 2 GB; it &lt;em>keeps&lt;/em> 1 GB in RAM. The distinction matters for a device with 2 GB of free storage: there it does not fit.&lt;/p>
&lt;p>Analogously, SmallThinker-21B-A3B: &lt;code>21\text{B} \times 0.5 \approx 10.5&lt;/code> GB on disk; &lt;code>3\text{B} \times 0.5 \approx 1.5&lt;/code> GB of active experts, and the ~8 GB of RAM reported includes active experts + a generous cache + the dense part. The large cache is what takes it from 1.5 to ~8 GB: you keep many hot experts resident so as not to hit the SSD constantly.&lt;/p>
&lt;h2 id="the-quality-cost-the-necessary-scepticism">The quality cost: the necessary scepticism&lt;/h2>
&lt;p>All the machinery above reduces the compute per token to &lt;code>\approx A&lt;/code>. But &lt;code>A = 0.6B&lt;/code> activated is &lt;strong>very&lt;/strong> little. This is where the enthusiasm needs a brake:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Bounded reasoning capacity.&lt;/strong> A model that activates 0.6B parameters per token has, per token, the compute power of a 0.6B model, not of a 4B one. The total capacity &lt;code>N=4B&lt;/code> helps to &lt;em>store&lt;/em> more knowledge (more specialised experts), but the &lt;em>processing&lt;/em> of each token is still limited by &lt;code>A&lt;/code>. For tasks requiring composition and intensive multi-step reasoning, this is a real ceiling, not a detail.&lt;/li>
&lt;li>&lt;strong>The router is a single point of failure for quality.&lt;/strong> If the fine-grained router picks the wrong experts, and with fine grain there are more decisions to take, quality drops without any speed metric reflecting it. The pre-attention router makes this worse: it predicts the experts &lt;em>before&lt;/em> seeing attention, with less information than a post-attention router. The authors ought to report how much quality is lost by predicting early (mismatch between the prefetched expert and the expert a post-attention router would have chosen).&lt;/li>
&lt;li>&lt;strong>The ~20 tok/s needs small print.&lt;/strong> On which CPU exactly? With what context and generation length (the advantage of the overlap depends on &lt;code>Y&lt;/code>)? Cold start included or steady state? Did the SSD have the experts pre-sorted sequentially? An &amp;ldquo;exceeds 20 tok/s&amp;rdquo; without those conditions is a marketing number, not a methodological one.&lt;/li>
&lt;li>&lt;strong>A fair comparison.&lt;/strong> The right question is not &amp;ldquo;is it fast?&amp;rdquo;, but &amp;ldquo;at equal quality on an independent benchmark, is it faster or smaller than an equivalent compressed dense model?&amp;rdquo;. That requires evals the reader can reproduce, not just tok/s on the authors&amp;rsquo; machine.&lt;/li>
&lt;/ul>
&lt;p>None of this invalidates the direction. Designing for device is, conceptually, the right approach: it attacks the real bottlenecks (compute, RAM, I/O) in the architecture instead of patching them afterwards. But &amp;ldquo;20 tok/s in ~1 GB&amp;rdquo; is a claim about &lt;em>efficiency&lt;/em>, and efficiency only means something anchored to a level of &lt;em>quality&lt;/em> measured honestly. Until that anchor is clear, the right amount of scepticism is high.&lt;/p>
&lt;h2 id="implications-for-on-premise-and-edge-inference">Implications for on-premise and edge inference&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>The SSD becomes part of the inference hierarchy.&lt;/strong> In cloud, the hierarchy is HBM → RAM. On device, the SSD/flash enters as one more level, and its bandwidth and random-access latency become first-order performance parameters. This connects with &lt;a href="https://blog.lo0.es/en/posts/pantry-lift-from-disk-to-hbm-why-the-kitchen-opens-late/">From disk to HBM&lt;/a>: cold start and weight streaming stop being just a startup problem and become part of the &lt;em>steady state&lt;/em>.&lt;/li>
&lt;li>&lt;strong>The heterogeneous edge box starts to make sense.&lt;/strong> In a &lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">mixed environments&lt;/a> pattern, a device-native model like SmallThinker runs on the NUC/edge with CPU and SSD, serving locally, while the heavy work stays on the central cluster. The pre-attention router is what makes a GPU-less edge box viable.&lt;/li>
&lt;li>&lt;strong>Capacity planning changes axes.&lt;/strong> As discussed in &lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">Inference capacity planning&lt;/a>, on device the resource to plan is not VRAM but the triad resident-RAM / SSD-bandwidth / CPU-FLOPs. A model with small &lt;code>A&lt;/code> and overlapped prefetch moves the bottleneck from &amp;ldquo;does it fit in RAM?&amp;rdquo; to &amp;ldquo;does the SSD feed the prefetch in time?&amp;rdquo;.&lt;/li>
&lt;/ul>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>SmallThinker is, above all, a change of question. Not &amp;ldquo;how do I shrink this cloud model so it fits on the device?&amp;rdquo; but &amp;ldquo;what would the model look like if I designed it for the device from the first parameter?&amp;rdquo;. The answer, fine-grained MoE to decouple &lt;code>N&lt;/code> from &lt;code>A&lt;/code>, sparse FFN to save inside &lt;code>A&lt;/code>, and a pre-attention router that hides storage I/O underneath attention, attacks the device&amp;rsquo;s three constraints (compute, RAM, I/O) in the architecture, not in a later compression phase. The key condition, &lt;code>t_att ≥ t_prefetch&lt;/code>, explains why the pieces fit: fine grain does not only save FLOPs, it makes the prefetch fit underneath attention. The reported numbers (~20 tok/s, ~1 GB / ~8 GB of RAM) are promising and the direction is solid; the cost of activating so little and the lack of methodological detail on quality call for caution. Designing for device is the right bet; measuring it honestly is the unfinished business.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/">MoE inference: the call centre with 256 specialists&lt;/a> — the conceptual basis of this post: how a router routes tokens to experts and why &lt;code>N&lt;/code> and &lt;code>A&lt;/code> decouple; read it first if MoE sounds distant.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/pantry-lift-from-disk-to-hbm-why-the-kitchen-opens-late/">From disk to HBM: cold start and model loading&lt;/a> — weight streaming from slow storage, which here stops being a startup problem and becomes steady state via prefetch.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/knowledge-distillation-teaching-small-model-think-like-big-one/">Knowledge distillation&lt;/a> — the canonical lever of the &amp;ldquo;compress a cloud dense model&amp;rdquo; approach, the exact counterpoint to the device-native one.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-pruning-cutting-without-amputating/">Pruning LLM models&lt;/a> — the other reduction lever; useful for comparing &amp;ldquo;take away from a big one&amp;rdquo; against &amp;ldquo;design small from scratch&amp;rdquo;.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">Mixed NVIDIA + Intel environments&lt;/a> — where a device-native model fits: the edge box with CPU and SSD that serves locally without a GPU.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">On-premise LLM inference capacity planning&lt;/a> — on device the axes to plan are resident RAM, SSD bandwidth and CPU FLOPs, not VRAM.&lt;/li>
&lt;li>&lt;strong>Inverted roofline in small models&lt;/strong> (sibling of this series, coming soon) — the SLM&amp;rsquo;s performance regime, which explains why a small &lt;code>A&lt;/code> keeps decode memory-bound and where the real ceiling is.&lt;/li>
&lt;li>&lt;strong>Self-speculative decoding with early-exit&lt;/strong> (sibling of this series, coming soon) — self-spec applied to on-device MoE: how to accelerate decode without an external draft when the model is already small.&lt;/li>
&lt;li>&lt;strong>Aggressive sub-4-bit and ternary quantisation&lt;/strong> (sibling of this series, coming soon) — Q4_0 and beyond on device: ternary and 2-bit to push the expert footprint on SSD down further.&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Equipo SmallThinker (SJTU IPADS + Zenergize AI). &lt;em>SmallThinker: A Family of Efficient Large Language Models Natively Trained for Local Deployment&lt;/em>. arXiv:2507.20984. &lt;a href="https://arxiv.org/abs/2507.20984">https://arxiv.org/abs/2507.20984&lt;/a>&lt;/li>
&lt;li>Repositorio oficial SmallThinker: &lt;a href="https://github.com/SJTU-IPADS/SmallThinker">https://github.com/SJTU-IPADS/SmallThinker&lt;/a>&lt;/li>
&lt;li>&lt;em>Self-Speculative Decoding for On-device MoE Acceleration&lt;/em>. ACM The Web Conference (WWW) 2026. doi:10.1145/3774904.3792218. &lt;a href="https://doi.org/10.1145/3774904.3792218">https://doi.org/10.1145/3774904.3792218&lt;/a>&lt;/li>
&lt;li>Liu, Z. et al. &lt;em>Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time&lt;/em>. ICML 2023. &lt;a href="https://arxiv.org/abs/2310.17157">https://arxiv.org/abs/2310.17157&lt;/a>&lt;/li>
&lt;li>Song, Y. et al. &lt;em>PowerInfer: Fast Large Language Model Serving with a Consumer-grade GPU&lt;/em> (sparse activation + hot/cold experts). SJTU IPADS, 2023. &lt;a href="https://arxiv.org/abs/2312.12456">https://arxiv.org/abs/2312.12456&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>MoE inference: the call centre with 256 specialists and 8 taking each call — fundamentals, expert parallel and the economics of DeepSeek-V3</title><link>https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/</link><pubDate>Sat, 30 May 2026 08:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/</guid><description>&lt;blockquote>
&lt;p>This post goes into an architectural decision in the Deploy stage of the &lt;a href="https://blog.lo0.es/en/posts/six-stage-llmops-pipeline-architecture-and-deep-dive/">six-stage LLMOps pipeline&lt;/a>. It complements those on &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a> (which does not change with MoE), &lt;a href="https://blog.lo0.es/en/posts/flashattention-librarian-io-awareness-async-blackwell-asymmetry/">FlashAttention&lt;/a> (still the attention kernel, also dense in every current MoE), &lt;a href="https://blog.lo0.es/en/posts/quantization-llm-inference-fp8-int4-gguf/">Quantization&lt;/a> (FP8/NVFP4 over expert weights is what lets DeepSeek-V3 fit into a modest cluster) and &lt;a href="https://blog.lo0.es/en/posts/speculative-decoding-fundamentals-maths-state-of-play/">Speculative decoding&lt;/a> (MTP in DeepSeek-V3 is native speculative decoding).&lt;/p>
&lt;/blockquote>
&lt;h2 id="you-are-here-deploy">You are here: DEPLOY&lt;/h2>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 90" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="you are here: Deploy">
&lt;style>.box{stroke:#444;stroke-width:1.4;rx:6}.active{fill:#7ad88f;stroke-width:3}.idle{fill:#f4f4f4}.lbl{font:600 12px sans-serif;fill:#222}.arr{stroke:#666;stroke-width:1.4;fill:none;marker-end:url(#moem)}.cyc{stroke:#888;stroke-width:1.2;fill:none;stroke-dasharray:4 2;marker-end:url(#moem)}&lt;/style>
&lt;defs>&lt;marker id="moem" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="390" y="20" text-anchor="middle" class="lbl">You are here: DEPLOY · compute sparsity without memory sparsity&lt;/text>
&lt;rect x="30" y="35" width="110" height="35" class="box idle"/>&lt;text x="85" y="58" text-anchor="middle" class="lbl">1 · Data&lt;/text>
&lt;rect x="155" y="35" width="110" height="35" class="box idle"/>&lt;text x="210" y="58" text-anchor="middle" class="lbl">2 · Tune&lt;/text>
&lt;rect x="280" y="35" width="110" height="35" class="box idle"/>&lt;text x="335" y="58" text-anchor="middle" class="lbl">3 · Eval&lt;/text>
&lt;rect x="405" y="35" width="110" height="35" class="box active"/>&lt;text x="460" y="58" text-anchor="middle" class="lbl">4 · Deploy&lt;/text>
&lt;rect x="530" y="35" width="110" height="35" class="box idle"/>&lt;text x="585" y="58" text-anchor="middle" class="lbl">5 · Observe&lt;/text>
&lt;rect x="655" y="35" width="110" height="35" class="box idle"/>&lt;text x="710" y="58" text-anchor="middle" class="lbl">6 · Retrain&lt;/text>
&lt;path class="arr" d="M140,52 L155,52"/>&lt;path class="arr" d="M265,52 L280,52"/>&lt;path class="arr" d="M390,52 L405,52"/>&lt;path class="arr" d="M515,52 L530,52"/>&lt;path class="arr" d="M640,52 L655,52"/>
&lt;path class="cyc" d="M710,72 L710,82 L85,82 L85,72"/>
&lt;/svg>
&lt;/div>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>A Mixture of Experts (MoE) replaces the transformer&amp;rsquo;s dense FFN layer with &lt;strong>N parallel experts plus a router&lt;/strong> that picks the &lt;code>k&lt;/code> experts relevant to each token. The operational consequence is that the model&amp;rsquo;s &lt;strong>total&lt;/strong> parameters (how many were trained and how many must be loaded into VRAM) decouple from the &lt;strong>active parameters per token&lt;/strong> (how many take part in each forward). DeepSeek-V3 has 671 B total but only 37 B active per token; Qwen3-235B-A22B is 235 B total and 22 B active; Mixtral 8x22B is 141 B and 39 B; Llama 4 Maverick is 400 B and 17 B. Compute per token falls to &lt;code>2·N_active&lt;/code> FLOPs, half that of a dense Llama-3-70B in DeepSeek-V3&amp;rsquo;s case, but memory stays proportional to &lt;code>N_total&lt;/code>: MoE &lt;em>sparsity&lt;/em> is &lt;strong>compute sparsity, not memory sparsity&lt;/strong>. Since each expert sees only &lt;code>batch·k/N&lt;/code> tokens per step, the memory-bound regime persists at a much higher batch than in dense. Serving DeepSeek-V3 671 B FP8 at low latency requires &lt;strong>expert parallel&lt;/strong> (EP) at scale, EP=32 in prefill and EP=144 in decode in DeepSeek&amp;rsquo;s production deployment, where the dominant bottleneck stops being HBM and becomes the &lt;strong>all-to-all of dispatch and combine&lt;/strong> between GPUs. As of May 2026, the pieces that make this viable are &lt;strong>DeepEP&lt;/strong> (FP8-native all-to-all CUDA kernels, intra-node NVLink plus inter-node RDMA), &lt;strong>EPLB&lt;/strong> (balancing by replicating &lt;em>hot&lt;/em> experts) and &lt;strong>Wide-EP&lt;/strong> on NVL72 (72 GPUs in one coherent NVLink domain). This post takes apart the mechanism, the maths (FLOPs/token, all-to-all bytes), the updated table of MoE models as of May 2026, the parallelisms (TP / EP / DP+EP / Wide-EP), the operational pitfalls (memory wall, cold experts, imbalance) and the real reproducible numbers on H100, B200 and GB200 NVL72.&lt;/p>
&lt;h2 id="the-analogy-the-call-centre-with-256-specialists">The analogy: the call centre with 256 specialists&lt;/h2>
&lt;p>A serious call centre handling complex technical queries runs on &lt;strong>specialists&lt;/strong>, not generalists. You have 256 operators on the payroll, each an expert in their sub-domain: employment law, mortgages, income tax, probate, and so on. But each incoming call only needs the attention of &lt;strong>eight&lt;/strong> specific specialists (top-8 routing): a client&amp;rsquo;s query about tax relief on a mortgage for an inherited second home involves the income tax person, the mortgage person, the capital gains person, and so on. The receptionist (the router) listens to the first second of the call, decides which eight specialists are relevant, conferences them in and combines their answers with weights.&lt;/p>
&lt;p>Three immediate consequences, identical to those of MoE in production:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>You pay 256 salaries&lt;/strong> (every expert is loaded in VRAM) but you only &lt;strong>spend the time of 8&lt;/strong> (only k experts take part in the forward of each token). Your payroll cost scales with &lt;code>N_total&lt;/code>; your cost per minute of call scales with &lt;code>N_active&lt;/code>.&lt;/li>
&lt;li>&lt;strong>If all the operators fit in one office&lt;/strong> (a single GPU), fine: paper just moves between desks. But &lt;strong>if they do not fit&lt;/strong>, you have to open branches: the conference call between operators in different branches goes over a telephone line between buildings (intra-node NVLink, inter-node InfiniBand) and that line &lt;strong>becomes the dominant bottleneck&lt;/strong> once dozens of branches are coordinating.&lt;/li>
&lt;li>&lt;strong>If one week every client asks about income tax&lt;/strong>, the three income tax operators saturate while the probate ones sit idle. You need &lt;strong>a system that replicates the hot operators&lt;/strong> across several branches to absorb peaks, and that &lt;strong>pairs hot with cold&lt;/strong> so that no branch goes idle.&lt;/li>
&lt;/ol>
&lt;p>The receptionist is the &lt;strong>router&lt;/strong>. The branches are the GPUs. The conference call between branches is the &lt;strong>all-to-all&lt;/strong> (dispatch plus combine). The system for replicating hot operators is &lt;strong>EPLB&lt;/strong>. The good telephone line is &lt;strong>DeepEP&lt;/strong>. And when someone designs a building where all 72 branches fit together with very fast internal cabling, that is &lt;strong>NVL72&lt;/strong>.&lt;/p>
&lt;h2 id="the-bare-mechanism">The bare mechanism&lt;/h2>
&lt;p>A classic MoE layer replaces the dense FFN (&lt;code>y = FFN(x) = down(act(up(x) · gate(x)))&lt;/code> in SwiGLU) with:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Router&lt;/strong>: a linear projection &lt;code>g(x) = W_router · x&lt;/code> produces &lt;code>N&lt;/code> scores. A softmax over those scores gives affinity probabilities.&lt;/li>
&lt;li>&lt;strong>Top-k selection&lt;/strong>: the &lt;code>k&lt;/code> experts with the highest score are chosen. Their &lt;code>softmax_topk&lt;/code> weights are normalised to sum to 1.&lt;/li>
&lt;li>&lt;strong>Parallel compute&lt;/strong>: each of the &lt;code>k&lt;/code> selected experts runs its own FFN over &lt;code>x&lt;/code>. The &lt;code>N - k&lt;/code> not selected sit idle for this token.&lt;/li>
&lt;li>&lt;strong>Weighted combination&lt;/strong>: the output is &lt;code>y = Σ_{i ∈ topk} w_i · Expert_i(x)&lt;/code>.&lt;/li>
&lt;/ol>
&lt;p>Variants the market consolidated in 2025-2026:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Shared experts&lt;/strong>: on top of the &lt;code>k&lt;/code> routed ones, there are &lt;code>s&lt;/code> experts that always run (1 or 2). They capture general knowledge every token needs. DeepSeek-V3 uses 1 shared + 8 routed; Mixtral uses 0 shared.&lt;/li>
&lt;li>&lt;strong>Fine-grained experts&lt;/strong>: more small experts instead of a few large ones (DeepSeek: 256 vs Mixtral: 8). This allows better specialisation because the top-k combination covers more sub-domains.&lt;/li>
&lt;li>&lt;strong>Auxiliary-loss-free routing&lt;/strong> (DeepSeek-V3): instead of adding a balancing loss during training, it dynamically adjusts a bias in the routing. It keeps balance without polluting the main loss.&lt;/li>
&lt;/ul>
&lt;p>Attention is still &lt;strong>dense&lt;/strong> in every current MoE model (Mixtral, DeepSeek, Qwen3-MoE, Llama 4, Kimi K2). Only the FFN is replaced. That is why FlashAttention v3/v4 is still used as-is; DeepSeek&amp;rsquo;s MLA is an optimisation orthogonal to MoE.&lt;/p>
&lt;h2 id="the-relevant-moe-models-in-may-2026">The relevant MoE models in May 2026&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Model&lt;/th>
&lt;th>Date&lt;/th>
&lt;th>Total&lt;/th>
&lt;th>Active&lt;/th>
&lt;th>Experts&lt;/th>
&lt;th>Top-k&lt;/th>
&lt;th>Shared&lt;/th>
&lt;th>Notes&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Mixtral 8x7B&lt;/td>
&lt;td>Dec 2023&lt;/td>
&lt;td>47 B&lt;/td>
&lt;td>13 B&lt;/td>
&lt;td>8&lt;/td>
&lt;td>2&lt;/td>
&lt;td>0&lt;/td>
&lt;td>The one that normalised MoE in open weights&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Mixtral 8x22B&lt;/td>
&lt;td>Apr 2024&lt;/td>
&lt;td>141 B&lt;/td>
&lt;td>39 B&lt;/td>
&lt;td>8&lt;/td>
&lt;td>2&lt;/td>
&lt;td>0&lt;/td>
&lt;td>—&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Grok-1 (open)&lt;/td>
&lt;td>Mar 2024&lt;/td>
&lt;td>314 B&lt;/td>
&lt;td>~86 B&lt;/td>
&lt;td>8&lt;/td>
&lt;td>2&lt;/td>
&lt;td>0&lt;/td>
&lt;td>Weights opened by xAI&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>DeepSeekMoE 16B&lt;/td>
&lt;td>Jan 2024&lt;/td>
&lt;td>16 B&lt;/td>
&lt;td>2.8 B&lt;/td>
&lt;td>64+2&lt;/td>
&lt;td>6&lt;/td>
&lt;td>2&lt;/td>
&lt;td>Introduces fine-grained + shared&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>DeepSeek-V2&lt;/td>
&lt;td>May 2024&lt;/td>
&lt;td>236 B&lt;/td>
&lt;td>21 B&lt;/td>
&lt;td>160+2&lt;/td>
&lt;td>6&lt;/td>
&lt;td>2&lt;/td>
&lt;td>+ MLA&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Snowflake Arctic&lt;/td>
&lt;td>Apr 2024&lt;/td>
&lt;td>480 B&lt;/td>
&lt;td>17 B&lt;/td>
&lt;td>128&lt;/td>
&lt;td>2&lt;/td>
&lt;td>10 B dense residual&lt;/td>
&lt;td>Dense-MoE hybrid&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Hunyuan-Large&lt;/td>
&lt;td>Nov 2024&lt;/td>
&lt;td>389 B&lt;/td>
&lt;td>52 B&lt;/td>
&lt;td>16+1&lt;/td>
&lt;td>1+shared&lt;/td>
&lt;td>1&lt;/td>
&lt;td>Cross-layer KV cache&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>DeepSeek-V3&lt;/strong>&lt;/td>
&lt;td>Dec 2024&lt;/td>
&lt;td>671 B&lt;/td>
&lt;td>37 B&lt;/td>
&lt;td>256+1&lt;/td>
&lt;td>8&lt;/td>
&lt;td>1&lt;/td>
&lt;td>MLA + MTP, aux-loss-free, FP8 training&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 4 Scout&lt;/td>
&lt;td>Apr 2025&lt;/td>
&lt;td>109 B&lt;/td>
&lt;td>17 B&lt;/td>
&lt;td>16&lt;/td>
&lt;td>1+shared&lt;/td>
&lt;td>1&lt;/td>
&lt;td>Designed for 1 H100 node&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 4 Maverick&lt;/td>
&lt;td>Apr 2025&lt;/td>
&lt;td>400 B&lt;/td>
&lt;td>17 B&lt;/td>
&lt;td>128&lt;/td>
&lt;td>1+shared&lt;/td>
&lt;td>1&lt;/td>
&lt;td>—&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Qwen3-235B-A22B&lt;/td>
&lt;td>Apr 2025&lt;/td>
&lt;td>235 B&lt;/td>
&lt;td>22 B&lt;/td>
&lt;td>128&lt;/td>
&lt;td>8&lt;/td>
&lt;td>0&lt;/td>
&lt;td>—&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Kimi K2 (Moonshot)&lt;/td>
&lt;td>2025&lt;/td>
&lt;td>1 T&lt;/td>
&lt;td>32 B&lt;/td>
&lt;td>384&lt;/td>
&lt;td>8&lt;/td>
&lt;td>(MLA)&lt;/td>
&lt;td>Trained with MuonClip&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>DeepSeek-V3.2-Exp&lt;/td>
&lt;td>Sep 2025&lt;/td>
&lt;td>671 B&lt;/td>
&lt;td>37 B&lt;/td>
&lt;td>256+1&lt;/td>
&lt;td>8&lt;/td>
&lt;td>1&lt;/td>
&lt;td>+ DeepSeek Sparse Attention&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Three operational observations:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>The active/total ratio falls with every generation&lt;/strong>: Mixtral 8x7B was 28 %, DeepSeek-V3 is 5.5 %, Llama 4 Maverick is 4.3 %. What the industry discovered is that &lt;strong>sparsity can be very aggressive without losing quality&lt;/strong>, provided &lt;code>N&lt;/code> is large enough and the routing is well learned. Fine specialisation is worth more than per-expert capacity.&lt;/li>
&lt;li>&lt;strong>The flagships of the large providers (OpenAI, Anthropic, Google) are almost certainly MoE&lt;/strong>, but the architectures are not published. The only semi-credible leak (Hotz, Jul 2023) claimed GPT-4 was an 8×~220 B MoE; no official confirmation.&lt;/li>
&lt;li>&lt;strong>DeepSeek-V3 marks the inflection point&lt;/strong>: open weights, frontier-class, MoE with aggressive sparsity and compatible with FP8 quantisation. It is the model that forced the ecosystem (vLLM, SGLang, TensorRT-LLM) to optimise wide-EP in 2025.&lt;/li>
&lt;/ol>
&lt;h2 id="the-maths-that-matters">The maths that matters&lt;/h2>
&lt;p>Three numbers drive the whole architectural decision with MoE.&lt;/p>
&lt;p>&lt;strong>Compute per token.&lt;/strong> A dense transformer spends roughly &lt;code>2N&lt;/code> FLOPs per token in the forward pass (with &lt;code>N&lt;/code> = total parameters). A MoE spends &lt;code>2·N_active&lt;/code> FLOPs per token (the &lt;code>N_total - N_active&lt;/code> experts do not take part). For DeepSeek-V3: 2 × 37 B = &lt;strong>74 GFLOPs/token&lt;/strong>. For dense Llama-3-70B: 2 × 70 B = &lt;strong>140 GFLOPs/token&lt;/strong>. &lt;strong>DeepSeek does half the compute per token&lt;/strong> of Llama-3-70B while offering capacity equivalent to a model almost 10 × larger.&lt;/p>
&lt;p>&lt;strong>Total memory.&lt;/strong> But &lt;strong>all&lt;/strong> the experts must be loaded in VRAM at some point in the forward pass. The sparsity is in compute, not memory. Weight memory:&lt;/p>
$$\text{Memory}_{\text{weights}} \approx N_{\text{total}} \cdot \text{bytes per param}$$
&lt;p>For DeepSeek-V3 FP8 (1 byte): 685 GB. It does not fit in 8×H100 SXM (640 GB). You need either extra quantisation or 16+ GPUs. For Mixtral 8x22B FP8: 141 GB, comfortably inside 2×H100. For Qwen3-235B-A22B FP8: 235 GB, fits in 4×H100.&lt;/p>
&lt;p>&lt;strong>All-to-all bytes per MoE layer.&lt;/strong> When experts are spread across GPUs (EP), each token has to travel to the GPUs where its &lt;code>k&lt;/code> experts live. The volume per MoE layer is roughly:&lt;/p>
$$\text{bytes a2a/layer} \approx 2 \cdot \text{batch} \cdot \text{seq len} \cdot d_{\text{model}} \cdot k \cdot \text{bytes}$$
&lt;p>(the factor 2 is dispatch plus combine). For DeepSeek-V3 with &lt;code>d_model = 7168&lt;/code>, &lt;code>k = 8&lt;/code>, &lt;code>batch = 4096&lt;/code>, FP8 (1 byte): each MoE layer moves ~470 MB; multiplied by 61 MoE layers in DeepSeek-V3, the complete step adds &lt;strong>~29 GB of inter-GPU traffic&lt;/strong> in MoE comms alone. That is of the order of a GPU&amp;rsquo;s HBM bandwidth in a single step. This is why bandwidth and NVLink/InfiniBand topology determine how large EP can be before comms saturate.&lt;/p>
&lt;p>&lt;strong>Persistent memory-bound regime.&lt;/strong> Here is the least intuitive consequence. In dense, raising the batch moves the operation from memory-bound to compute-bound: with enough tokens per batch, the weights are amortised over more operations. In MoE, each expert sees only &lt;code>batch · k / N&lt;/code> tokens. For Qwen3-235B (k=8, N=128) with batch=128, each expert processes &lt;strong>8 tokens per step&lt;/strong>. To reach the compute-bound regime of the tensor cores (arithmetic intensity ~100-200 FLOPs/byte) you need batches in the &lt;strong>thousands&lt;/strong>, around 1,600 according to recent estimates for Qwen3 (Memory-Bound MoE Serving, arXiv:2512.09277). The operational consequence: &lt;strong>MoE scales throughput with batch more linearly than dense&lt;/strong>, but it also needs far larger batches to get close to its compute ceiling.&lt;/p>
&lt;h2 id="expert-parallel-and-the-all-to-all-bottleneck">Expert parallel and the all-to-all bottleneck&lt;/h2>
&lt;p>There are three main ways to parallelise a MoE across GPUs:&lt;/p>
&lt;p>&lt;strong>Tensor Parallel (TP, Megatron-style).&lt;/strong> Splits each weight matrix across GPUs by width or height. Every GPU processes all tokens and all layers. Comms per layer: 2 all-reduces. It works well for dense; for MoE it leaves the routing sparsity unexploited (each GPU holds fragments of every expert).&lt;/p>
&lt;p>&lt;strong>Expert Parallel (EP).&lt;/strong> Splits &lt;strong>whole experts&lt;/strong> across GPUs: 256 experts / 32 GPUs = 8 experts per GPU. Each token, after routing, travels to the GPUs where its top-k &lt;code>k&lt;/code> experts live. Comms per MoE layer: an &lt;strong>all-to-all dispatch&lt;/strong> (tokens towards experts) plus an &lt;strong>all-to-all combine&lt;/strong> (outputs back). The cost grows with EP size and becomes the bottleneck when EP &amp;gt; 8.&lt;/p>
&lt;p>&lt;strong>DP + EP / Wide-EP.&lt;/strong> Replicates the model across DP groups; inside each group, EP shards the experts. &lt;strong>Wide-EP&lt;/strong> takes EP to the full dimension of a rack (NVL72, 72 GPUs in a coherent NVLink domain). Each expert receives more tokens per step, so arithmetic intensity in each expert&amp;rsquo;s GEMMs improves and per-GPU throughput rises. vLLM reports &lt;strong>1.8× throughput per GPU with wide-EP&lt;/strong> against smaller setups on DeepSeek-V3 (vLLM blog, Dec 2025).&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 780 380" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Expert Parallel with all-to-all dispatch and combine">
&lt;style>
.gpu{fill:#eaf3ff;stroke:#1f5fa8;stroke-width:1.4;rx:8}
.exp{fill:#fff4d6;stroke:#a48000;stroke-width:1.2;rx:4}
.tok{fill:#cdebd0;stroke:#2a7a40;stroke-width:1.2;rx:4}
.router{fill:#e6d0ff;stroke:#5a2db0;stroke-width:1.4;rx:6}
.lbl{font:600 12px sans-serif;fill:#222}
.sub{font:400 10px sans-serif;fill:#555}
.disp{stroke:#cc6622;stroke-width:1.5;fill:none;marker-end:url(#mma)}
.comb{stroke:#226699;stroke-width:1.5;fill:none;stroke-dasharray:4 2;marker-end:url(#mma)}
&lt;/style>
&lt;defs>&lt;marker id="mma" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#444"/>&lt;/marker>&lt;/defs>
&lt;text x="20" y="22" class="lbl">MoE layer with Expert Parallel: EP=4 (4 GPUs, 8 experts/GPU)&lt;/text>
&lt;rect x="20" y="40" width="170" height="60" class="router"/>
&lt;text x="105" y="62" text-anchor="middle" class="lbl">Router (W_router)&lt;/text>
&lt;text x="105" y="78" text-anchor="middle" class="sub">softmax → top-k=2&lt;/text>
&lt;text x="105" y="92" text-anchor="middle" class="sub">per token&lt;/text>
&lt;rect x="20" y="115" width="80" height="35" class="tok"/>&lt;text x="60" y="138" text-anchor="middle" class="lbl">tokens&lt;/text>
&lt;text x="220" y="60" class="sub">all-to-all dispatch (FP8)&lt;/text>
&lt;path class="disp" d="M195,75 L300,160"/>
&lt;path class="disp" d="M195,80 L450,160"/>
&lt;path class="disp" d="M195,85 L600,160"/>
&lt;path class="disp" d="M195,90 L720,160"/>
&lt;rect x="240" y="160" width="120" height="120" class="gpu"/>
&lt;text x="300" y="178" text-anchor="middle" class="lbl">GPU 0&lt;/text>
&lt;rect x="252" y="190" width="42" height="20" class="exp"/>&lt;text x="273" y="204" text-anchor="middle" class="sub">E0&lt;/text>
&lt;rect x="296" y="190" width="42" height="20" class="exp"/>&lt;text x="317" y="204" text-anchor="middle" class="sub">E1&lt;/text>
&lt;rect x="252" y="215" width="42" height="20" class="exp"/>&lt;text x="273" y="229" text-anchor="middle" class="sub">E2&lt;/text>
&lt;rect x="296" y="215" width="42" height="20" class="exp"/>&lt;text x="317" y="229" text-anchor="middle" class="sub">E3&lt;/text>
&lt;text x="300" y="255" text-anchor="middle" class="sub">experts 0-7&lt;/text>
&lt;text x="300" y="270" text-anchor="middle" class="sub">(8 experts)&lt;/text>
&lt;rect x="390" y="160" width="120" height="120" class="gpu"/>
&lt;text x="450" y="178" text-anchor="middle" class="lbl">GPU 1&lt;/text>
&lt;rect x="402" y="190" width="42" height="20" class="exp"/>&lt;text x="423" y="204" text-anchor="middle" class="sub">E8&lt;/text>
&lt;rect x="446" y="190" width="42" height="20" class="exp"/>&lt;text x="467" y="204" text-anchor="middle" class="sub">E9&lt;/text>
&lt;text x="450" y="255" text-anchor="middle" class="sub">experts 8-15&lt;/text>
&lt;rect x="540" y="160" width="120" height="120" class="gpu"/>
&lt;text x="600" y="178" text-anchor="middle" class="lbl">GPU 2&lt;/text>
&lt;rect x="552" y="190" width="42" height="20" class="exp"/>&lt;text x="573" y="204" text-anchor="middle" class="sub">E16&lt;/text>
&lt;rect x="596" y="190" width="42" height="20" class="exp"/>&lt;text x="617" y="204" text-anchor="middle" class="sub">E17&lt;/text>
&lt;text x="600" y="255" text-anchor="middle" class="sub">experts 16-23&lt;/text>
&lt;rect x="660" y="160" width="100" height="120" class="gpu"/>
&lt;text x="710" y="178" text-anchor="middle" class="lbl">GPU 3&lt;/text>
&lt;rect x="668" y="190" width="42" height="20" class="exp"/>&lt;text x="689" y="204" text-anchor="middle" class="sub">E24&lt;/text>
&lt;rect x="712" y="190" width="42" height="20" class="exp"/>&lt;text x="733" y="204" text-anchor="middle" class="sub">E25&lt;/text>
&lt;text x="710" y="255" text-anchor="middle" class="sub">experts 24-31&lt;/text>
&lt;text x="220" y="310" class="sub">all-to-all combine (weighted sum returns to the origin)&lt;/text>
&lt;path class="comb" d="M300,280 L195,330"/>
&lt;path class="comb" d="M450,280 L195,330"/>
&lt;path class="comb" d="M600,280 L195,330"/>
&lt;path class="comb" d="M710,280 L195,330"/>
&lt;rect x="100" y="325" width="200" height="35" class="tok"/>
&lt;text x="200" y="346" text-anchor="middle" class="lbl">y = Σ w_i · Expert_i(x)&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>Quick decision table:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Case&lt;/th>
&lt;th>Recommendation&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Small MoE that fits in 1 node (Mixtral 8x7B, Llama 4 Scout)&lt;/td>
&lt;td>TP only or EP=2 intra-node&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Medium MoE (Mixtral 8x22B, Qwen3-235B) on 1-2 H100 nodes&lt;/td>
&lt;td>EP=8 intra-node, optionally TP=2&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Large MoE (DeepSeek-V3) on a multi-node cluster&lt;/td>
&lt;td>TP × EP cross-node (e.g. TP=4 × EP=8 on 32 GPUs)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Large MoE with NVL72 available&lt;/td>
&lt;td>Wide-EP=72 (decode), EP=32 (prefill)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>DeepSeek&amp;rsquo;s production deployment combines &lt;strong>Prefill EP=32&lt;/strong> (4 nodes × 8 GPUs) with &lt;strong>Decode EP=144&lt;/strong> (18 nodes × 8 GPUs). The prefill/decode split fits conceptually with &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">Disaggregated serving&lt;/a>: prefill is compute-bound and benefits from moderate EP; decode is memory-bound and benefits from Wide-EP, which raises the tokens per expert per step.&lt;/p>
&lt;h2 id="deepep-eplb-and-wide-ep-the-pieces-that-unblocked-2025">DeepEP, EPLB and Wide-EP: the pieces that unblocked 2025&lt;/h2>
&lt;p>&lt;strong>DeepEP&lt;/strong> (DeepSeek, opened in February 2025) is a library of all-to-all CUDA kernels optimised specifically for MoE EP. Four important properties:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Native FP8 dispatch&lt;/strong>: tokens travel in FP8, halving the bandwidth consumed.&lt;/li>
&lt;li>&lt;strong>Mixing intra-node NVLink with inter-node RDMA&lt;/strong>: the kernel picks the optimal route according to topology.&lt;/li>
&lt;li>&lt;strong>CPU bypass&lt;/strong>: the GPU→GPU dispatch goes over RDMA without touching the host.&lt;/li>
&lt;li>&lt;strong>Aligned with DeepSeek-V3&amp;rsquo;s group-limited gating&lt;/strong>: the routing prefers experts in the same node group where possible, minimising inter-node traffic.&lt;/li>
&lt;/ul>
&lt;p>In 2025 Tencent contributed optimisations that added +30 % on the normal kernels. There is a ROCm port for AMD.&lt;/p>
&lt;p>&lt;strong>EPLB (Expert Parallelism Load Balancer)&lt;/strong> solves the runtime imbalance problem: even when the model is well balanced in global distribution, &lt;strong>a specific batch can heavily activate certain experts&lt;/strong> (prompts in a single language, a single domain). EPLB &lt;strong>replicates the hot experts&lt;/strong> across several GPUs (redundant experts) and packs them heuristically with cold experts to minimise load variance. It has two modes: hierarchical (for prefill with medium EP) and global (for decode with Wide-EP). It is integrated into SGLang and vLLM.&lt;/p>
&lt;p>&lt;strong>Wide-EP on NVL72&lt;/strong> is the peak setup of 2026: 72 Blackwell GPUs in a coherent NVLink domain (1.8 TB/s bidirectional per GPU, intra-rack). Each expert receives many more tokens per step, so arithmetic intensity improves and so does throughput per GPU. Combined with NVFP4 over expert weights and FP8 over attention, SGLang reported on GB200 NVL72 &lt;strong>26,156 tok/s/GPU in prefill and 13,386 tok/s/GPU in decode&lt;/strong> for DeepSeek-V3 (LMSYS, Sep 2025), a &lt;strong>3.8× prefill and 4.8× decode versus H100&lt;/strong>.&lt;/p>
&lt;h2 id="operational-pitfalls">Operational pitfalls&lt;/h2>
&lt;p>&lt;strong>HBM fragmentation from expert weights.&lt;/strong> With EP=8 in 1 node, each GPU holds N/8 experts, each a tuple of matrices (&lt;code>gate&lt;/code>, &lt;code>up&lt;/code>, &lt;code>down&lt;/code>). If N=256, that is 32 FFNs per GPU. The allocator can fragment; in some cases you need a more conservative &lt;code>--gpu-memory-utilization&lt;/code> than usual.&lt;/p>
&lt;p>&lt;strong>Cold experts.&lt;/strong> In real distributions some experts are activated by &amp;lt;1 % of tokens. EPLB compensates by replicating hot ones, but the cold ones sit occupying HBM without taking part, &amp;ldquo;dead&amp;rdquo; memory. When real demand diverges a lot from the training distribution, this shows.&lt;/p>
&lt;p>&lt;strong>Continuous batching.&lt;/strong> It works with MoE, but the effective batch size per expert is &lt;code>batch_total · k / N&lt;/code>. With large N and a moderate batch, each expert sees very few tokens per step. You need a &lt;code>batch_total&lt;/code> far larger than in dense to match per-GPU throughput.&lt;/p>
&lt;p>&lt;strong>Speculative decoding + MoE.&lt;/strong> They interact &lt;strong>well&lt;/strong>. MoE sparsity keeps the memory-bound regime at high batch, which is exactly the regime where speculative decoding wins most. DeepSeek-V3 integrates &lt;strong>MTP&lt;/strong> (Multi-Token Prediction), speculative decoding native to the model, with no external draft, with acceptance around 85-90 % on the second token (see &lt;a href="https://blog.lo0.es/en/posts/speculative-decoding-fundamentals-maths-state-of-play/">Speculative decoding&lt;/a> for the mechanism).&lt;/p>
&lt;p>&lt;strong>MLA and FlashMLA are not MoE.&lt;/strong> DeepSeek-V3 combines MoE with &lt;strong>Multi-head Latent Attention&lt;/strong> (MLA), an attention variant that reduces the KV cache ~10× against standard MHA. MLA and MoE are orthogonal: MLA optimises attention, MoE optimises the FFN. For serving DeepSeek you use the specific &lt;strong>FlashMLA&lt;/strong> kernel (not FA3 directly).&lt;/p>
&lt;p>&lt;strong>DSA (DeepSeek Sparse Attention)&lt;/strong> in DeepSeek-V3.2-Exp (Sep 2025) introduces sparsity in attention too. The first time at the frontier that sparsity is applied in both attention and FFN.&lt;/p>
&lt;h2 id="implications-for-on-premise-hardware">Implications for on-premise hardware&lt;/h2>
&lt;p>&lt;strong>On an RTX 4090 (24 GB).&lt;/strong> Large MoEs are out of reach. What does fit: Mixtral 8x7B AWQ-INT4 (~24 GB of weights, no headroom for KV cache, so it really requires TP=2 across two 4090s); DeepSeekMoE 16B BF16 (~33 GB, does not fit whole; INT4 ~8 GB, fits with room to spare). The interesting case is &lt;strong>llama.cpp with &lt;code>--n-cpu-moe&lt;/code>&lt;/strong>: expert weights offloaded to RAM (CPU), attention and shared experts on the GPU. It lets you run DeepSeek-V3 IQ4 (~400 GB) on a workstation with 1-2 GPUs plus 512 GB of RAM at modest throughput, but it opens the door to a low-budget setup.&lt;/p>
&lt;p>&lt;strong>On a generic 4×H100 SXM cluster (320 GB, NVLink, native FP8).&lt;/strong> These fit comfortably:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Mixtral 8x22B FP8&lt;/strong> (~141 GB) with TP=2 or EP=4. Low latency, excellent throughput.&lt;/li>
&lt;li>&lt;strong>Qwen3-235B-A22B FP8&lt;/strong> (~235 GB) with TP=4 or EP=4. Plenty of room.&lt;/li>
&lt;li>&lt;strong>Llama 4 Scout 109B FP8&lt;/strong> (~110 GB) with TP=2 or TP=4. Designed by Meta to serve well on one H100 node.&lt;/li>
&lt;/ul>
&lt;p>What does &lt;strong>not&lt;/strong> fit in 4×H100: DeepSeek-V3 FP8 (~685 GB) without aggressive quantisation. Options: (1) scale to 8-16 H100; (2) use AWQ INT4 over routed experts plus FP16 over activated ones (~400 GB), which fits in 8×H100; (3) wait for Blackwell or use AMD MI300X (192 GB/GPU, so DeepSeek-V3 FP8 on 4×MI300X).&lt;/p>
&lt;p>The rule of thumb as of May 2026: &lt;strong>one 4×H100 node comfortably serves MoEs up to ~200 B total in FP8; for DeepSeek-V3 you have to scale to 2 nodes or wait for B200 NVL72&lt;/strong> (where the whole model fits with room for enormous batches).&lt;/p>
&lt;h2 id="what-we-have-not-covered">What we have not covered&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>MLA and FlashMLA in detail&lt;/strong>: DeepSeek&amp;rsquo;s KV cache optimisation, orthogonal to MoE.&lt;/li>
&lt;li>&lt;strong>DeepSeek Sparse Attention (DSA)&lt;/strong> introduced in V3.2-Exp: the first production implementation of attention sparsity for frontier models.&lt;/li>
&lt;li>&lt;strong>MoE during training&lt;/strong>: load balancing losses, drop policies, auxiliary terms vs aux-loss-free, Kimi K2&amp;rsquo;s MuonClip.&lt;/li>
&lt;li>&lt;strong>MoE + LoRA&lt;/strong>: how adapter fine-tuning is done on a MoE, and what happens to the routing.&lt;/li>
&lt;li>&lt;strong>LLM-d&lt;/strong> and other open-source platforms that materialise Wide-EP on Kubernetes.&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache: working memory&lt;/a> — structurally the KV cache is the same as in dense (attention is dense in every current MoE); MLA is the specific optimisation DeepSeek adds on top.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention deep dive&lt;/a> — handling the KV cache in physical blocks stays identical under MoE; only the FFN changes.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/flashattention-librarian-io-awareness-async-blackwell-asymmetry/">FlashAttention v1/v2/v3/v4&lt;/a> — the attention kernel is reused as-is; FlashMLA is the variant specific to DeepSeek&amp;rsquo;s MLA, adding a latent compression step to the FA pattern.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/quantization-llm-inference-fp8-int4-gguf/">Quantization for LLM inference&lt;/a> — FP8/NVFP4 over expert weights is what makes DeepSeek-V3 fit into a modest cluster and what lets NVL72 reach its peak numbers.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/speculative-decoding-fundamentals-maths-state-of-play/">Speculative decoding&lt;/a> — MTP in DeepSeek-V3 is native speculative decoding; MoE&amp;rsquo;s persistent memory-bound regime means speculative wins more in MoE than in dense at medium batch.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">Disaggregated serving: prefill and decode&lt;/a> — DeepSeek&amp;rsquo;s real deployment separates prefill (EP=32) and decode (EP=144) pools; disaggregation is a prerequisite for Wide-EP.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/continuous-batching-orca-vllm-chunked-prefill-goodput/">Continuous batching&lt;/a> — the other side of the coin. MoE needs far larger batches than dense for the same per-GPU throughput because each expert sees &lt;code>batch · k / N&lt;/code> tokens per step; the iterative scheduler is what makes it viable at scale.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/six-stage-llmops-pipeline-architecture-and-deep-dive/">The six-stage LLMOps pipeline&lt;/a> — the master map where Deploy is stage 4.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">Capacity planning for on-premise LLM inference&lt;/a> — MoE sizing differs from dense: the &amp;ldquo;MoE case&amp;rdquo; section there quantifies the VRAM cost dominated by total weights and the TPOT dominated by active weights per token.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/device-native-architectures-fine-grained-moe-pre-attention-router/">Device-native architectures: fine-grained MoE and pre-attention router&lt;/a> — MoE taken to the fine-grained extreme and designed from scratch for device: the pre-attention router prefetches experts from SSD in parallel with attention, hiding the storage I/O.&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Shazeer, N. et al. &lt;em>Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer&lt;/em>. ICLR 2017. &lt;a href="https://arxiv.org/abs/1701.06538">https://arxiv.org/abs/1701.06538&lt;/a>&lt;/li>
&lt;li>Lepikhin, D. et al. &lt;em>GShard: Scaling Giant Models with Conditional Computation&lt;/em>. ICLR 2021. &lt;a href="https://arxiv.org/abs/2006.16668">https://arxiv.org/abs/2006.16668&lt;/a>&lt;/li>
&lt;li>Fedus, W., Zoph, B., Shazeer, N. &lt;em>Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity&lt;/em>. JMLR 2022. &lt;a href="https://arxiv.org/abs/2101.03961">https://arxiv.org/abs/2101.03961&lt;/a>&lt;/li>
&lt;li>Gale, T., Narayanan, D., Young, C., Zaharia, M. &lt;em>MegaBlocks: Efficient Sparse Training with Mixture-of-Experts&lt;/em>. MLSys 2023. &lt;a href="https://arxiv.org/abs/2211.15841">https://arxiv.org/abs/2211.15841&lt;/a>&lt;/li>
&lt;li>Mistral AI. &lt;em>Mixtral of Experts&lt;/em>. 2024. &lt;a href="https://arxiv.org/abs/2401.04088">https://arxiv.org/abs/2401.04088&lt;/a>&lt;/li>
&lt;li>DeepSeek-AI. &lt;em>DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models&lt;/em>. 2024. &lt;a href="https://arxiv.org/abs/2401.06066">https://arxiv.org/abs/2401.06066&lt;/a>&lt;/li>
&lt;li>DeepSeek-AI. &lt;em>DeepSeek-V2&lt;/em>. 2024. &lt;a href="https://arxiv.org/abs/2405.04434">https://arxiv.org/abs/2405.04434&lt;/a>&lt;/li>
&lt;li>DeepSeek-AI. &lt;em>DeepSeek-V3 Technical Report&lt;/em>. 2024. &lt;a href="https://arxiv.org/abs/2412.19437">https://arxiv.org/abs/2412.19437&lt;/a>&lt;/li>
&lt;li>Tencent. &lt;em>Hunyuan-Large&lt;/em>. 2024. &lt;a href="https://arxiv.org/abs/2411.02265">https://arxiv.org/abs/2411.02265&lt;/a>&lt;/li>
&lt;li>DeepEP repo: &lt;a href="https://github.com/deepseek-ai/DeepEP">https://github.com/deepseek-ai/DeepEP&lt;/a>&lt;/li>
&lt;li>EPLB repo: &lt;a href="https://github.com/deepseek-ai/EPLB">https://github.com/deepseek-ai/EPLB&lt;/a>&lt;/li>
&lt;li>DeepSeek open-infra-index, &lt;em>V3/R1 Inference System Overview&lt;/em>: &lt;a href="https://github.com/deepseek-ai/open-infra-index">https://github.com/deepseek-ai/open-infra-index&lt;/a>&lt;/li>
&lt;li>vLLM blog, &lt;em>Large-Scale Serving DeepSeek&lt;/em> (Dec 2025): &lt;a href="https://blog.vllm.ai/2025/12/17/large-scale-serving.html">https://blog.vllm.ai/2025/12/17/large-scale-serving.html&lt;/a>&lt;/li>
&lt;li>vLLM blog, &lt;em>WideEP en GB200&lt;/em> (Feb 2026): &lt;a href="https://blog.vllm.ai/2026/02/03/dsr1-gb200-part1.html">https://blog.vllm.ai/2026/02/03/dsr1-gb200-part1.html&lt;/a>&lt;/li>
&lt;li>LMSYS blog, &lt;em>DeepSeek 96 H100 PD+EP&lt;/em> (May 2025): &lt;a href="https://www.lmsys.org/blog/2025-05-05-large-scale-ep/">https://www.lmsys.org/blog/2025-05-05-large-scale-ep/&lt;/a>&lt;/li>
&lt;li>LMSYS blog, &lt;em>DeepSeek GB200 NVL72 part II&lt;/em> (Sep 2025): &lt;a href="https://www.lmsys.org/blog/2025-09-25-gb200-part-2/">https://www.lmsys.org/blog/2025-09-25-gb200-part-2/&lt;/a>&lt;/li>
&lt;li>NVIDIA Dynamo + GB200 NVL72 for MoE: &lt;a href="https://developer.nvidia.com/blog/how-nvidia-gb200-nvl72-and-nvidia-dynamo-boost-inference-performance-for-moe-models/">https://developer.nvidia.com/blog/how-nvidia-gb200-nvl72-and-nvidia-dynamo-boost-inference-performance-for-moe-models/&lt;/a>&lt;/li>
&lt;li>Tensor Economics, &lt;em>MoE Inference Economics from First Principles&lt;/em>: &lt;a href="https://www.tensoreconomics.com/p/moe-inference-economics-from-first">https://www.tensoreconomics.com/p/moe-inference-economics-from-first&lt;/a>&lt;/li>
&lt;li>Cohere, &lt;em>Why MoE models get more from speculative decoding&lt;/em>: &lt;a href="https://cohere.com/blog/mixture-of-experts-models-get-more-from-speculative-decoding">https://cohere.com/blog/mixture-of-experts-models-get-more-from-speculative-decoding&lt;/a>&lt;/li>
&lt;/ul></description></item></channel></rss>