1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:45,575 [Hal Turing] Today we're looking at Joint MoE Scaling Laws: Mixture of Experts Can Be Memory Efficient. It's from Jan Ludziejewski, Maciej Pióro, Jakub Krajewski and colleagues, mostly at the University of Warsaw and IDEAS NCBR. Other authors come from the Polish Academy of Sciences, Nomagic, MIM Solutions, and Wroclaw University of Science and Technology. It's arXiv 2502.05172, February 2025. The title claims something that sounds backwards: a model that stores every expert can be the memory-efficient choice. 3 00:00:45,575 --> 00:01:07,775 [Dr. Ada Shannon] Right, because the standard view is that mixture of experts saves compute but costs memory. Only a fraction of the weights fire per token, but every expert has to sit in GPU memory. So if memory is your hard cap, say one H100 node, the usual advice is to stay dense. This paper asks whether an MoE can still reach lower loss than a dense model with the same training compute when total parameters are capped. Their answer is yes, under conditions. 4 00:01:07,775 --> 00:01:14,975 [Hal Turing] Before we get to the conditions, let's pin down the machinery. What is an MoE layer, exactly? 5 00:01:14,975 --> 00:01:37,275 [Dr. Ada Shannon] You replace the transformer's feed-forward block with E parallel expert MLPs and a small router. This paper uses Switch routing, from Fedus and colleagues at Google in 2021. Each token goes to exactly one expert, the top-1. A load-balancing loss keeps tokens spread evenly, so one expert doesn't hog everything. The experts here are the same size as the dense feed-forward layer. They are not sliced into many small ones. 6 00:01:37,275 --> 00:01:43,350 [Hal Turing] That last point matters, doesn't it? This group already published on fine-grained experts. 7 00:01:43,350 --> 00:02:01,975 [Dr. Ada Shannon] They did. Scaling Laws for Fine-Grained Mixture of Experts, ICML 2024, same group. This paper deliberately doesn't use that granularity setup. Experts are plain copies of the dense feed-forward width. That's simpler, and it also means the results don't carry the fine-grained machinery. 8 00:02:01,975 --> 00:02:05,225 [Hal Turing] Now the two kinds of parameter counts. 9 00:02:05,225 --> 00:02:26,175 [Dr. Ada Shannon] Active parameters are the weights a single token actually uses. Total parameters are everything that must be in memory. For a dense model they're equal. For an MoE, total is far bigger than active. The running example is a model with 1.1 billion total parameters and four experts. Only 426 million of those are active for any token. 10 00:02:26,175 --> 00:02:30,300 [Hal Turing] And compute follows the active number, not the total. 11 00:02:30,300 --> 00:02:49,375 [Dr. Ada Shannon] Yes. Training compute is roughly six times active parameters times training tokens. Inference is roughly two times active parameters per token. So the MoE is cheap in FLOPs because it pays for 426 million, while the dense model with the same footprint pays for 1.1 billion. 12 00:02:49,375 --> 00:02:58,125 [Hal Turing] Which leads to the bet. Same memory, fewer active parameters, so for the same FLOPs the MoE gets to see more tokens. 13 00:02:58,125 --> 00:03:20,550 [Dr. Ada Shannon] That's the intuition. Smaller active size hurts, more data helps, and the question is which wins. To judge that you need the Chinchilla result from Hoffmann and colleagues at DeepMind, 2022. For a fixed compute budget, there's a best split between model size and training tokens. Train a fixed-size model on more tokens than that split and you're overtraining. It wastes compute, but you get a smaller model. When memory is capped, that trade can be attractive. 14 00:03:20,550 --> 00:03:24,650 [Hal Turing] So overtraining is deliberate here, not a mistake. 15 00:03:24,650 --> 00:03:44,800 [Dr. Ada Shannon] Exactly. The earlier MoE scaling work didn't give tokens that role. Clark and colleagues at DeepMind, Unified Scaling Laws for Routed Language Models, 2022, used a fixed dataset and found MoE wins only up to some size. This paper makes the token count a variable, which is what lets the overtraining question even be asked. 16 00:03:44,800 --> 00:03:48,550 [Hal Turing] Now the memory side. What counts as memory? 17 00:03:48,550 --> 00:04:10,350 [Dr. Ada Shannon] The paper defines a memory-optimal model. Among models with the same training FLOPs and total parameters at or below a cap, it's the one with the lowest loss. A variant also adds the KV cache. That's the stored keys and values for every earlier token during generation. It grows with context length and batch size. It scales with depth and width, not with the number of experts. 18 00:04:10,350 --> 00:04:19,100 [Hal Turing] So an MoE with fewer, narrower blocks could have a smaller KV cache than the dense model of the same total size. 19 00:04:19,100 --> 00:04:27,975 [Dr. Ada Shannon] That's the structural reason it's in the definition. Keep in mind it's a definition of memory made of parameters and cache, nothing else. 20 00:04:27,975 --> 00:04:31,575 [Hal Turing] And the thing they fit is a joint scaling law. 21 00:04:31,575 --> 00:04:53,575 [Dr. Ada Shannon] A fitted formula that predicts final training loss from three inputs: active parameters, tokens, and the number of experts. It includes an irreducible loss term, the entropy floor of the dataset. No model can go below it however big or long-trained. The point of fitting one formula across expert counts is that you can then ask questions like the 1.1 billion case: dense, or four experts with 426 million active. 22 00:04:53,575 --> 00:04:58,150 [Hal Turing] Three other papers keep coming up around this. Where do they sit? 23 00:04:58,150 --> 00:05:35,500 [Dr. Ada Shannon] Abnar, Shah, Busbridge and colleagues, 2025, Parameters vs FLOPs: Scaling Laws for Optimal Sparsity for Mixture-of-Experts Language Models. It's concurrent work on sparsity versus compute, and it links loss to downstream results. Yun, Zhuang, Fu, Xing and Zhang, 2024, Toward Inference-Optimal Mixture-of-Expert Large Language Models, brings in real-hardware inference efficiency. And Sardana, Portes, Doubov and Frankle, 2024, Beyond Chinchilla-Optimal: Accounting for Inference in Language Model Scaling Laws, folds inference FLOPs into the budget. This paper adopts that idea and adds a memory term. 24 00:05:35,500 --> 00:05:42,200 [Hal Turing] So the gap to watch is between a loss-based claim and what happens on real serving hardware. 25 00:05:42,200 --> 00:05:46,225 [Dr. Ada Shannon] That's the question to carry through. First, how they build the law. 26 00:05:46,225 --> 00:05:54,800 [Hal Turing] So how do they build the law? Chinchilla gave us loss as a function of model size and tokens. What do they add for experts? 27 00:05:54,800 --> 00:06:13,250 [Dr. Ada Shannon] They start from the Chinchilla form and ask what happens if you fit it separately for each expert count. Then they make the coefficients depend on E. The size term gets multiplied by E to a power, and the data term gets its own E power. Then comes the part that matters: the exponents themselves shift with the log of E. 28 00:06:13,250 --> 00:06:18,175 [Hal Turing] Why would the exponents move? A multiplier alone would be simpler. 29 00:06:18,175 --> 00:06:45,750 [Dr. Ada Shannon] Because two observations pull in opposite directions. Clark and colleagues found that the benefit of experts shrinks as the model gets bigger. The same group's earlier fine-grained paper found the benefit grows as you add data. A plain multiplier can't do both. Letting the exponents drift with log E can. The fitted data exponent goes from about minus 0.197 at one expert to about minus 0.265 at thirty-two. Steeper means each extra token buys more loss reduction as E rises. 30 00:06:45,750 --> 00:06:49,300 [Hal Turing] So with more experts, data counts for more. 31 00:06:49,300 --> 00:07:09,550 [Dr. Ada Shannon] Yes, and that's the whole engine behind the headline. There's one more piece. They pass E through a saturating transform, which they call E-hat, with a start near 2 and a ceiling near 290, so that very small and very large expert counts behave sensibly. Finally, the constant term, the dataset's entropy floor, is shared across all E. Fitted, it's about 1.36. 32 00:07:09,550 --> 00:07:12,300 [Hal Turing] What did they train to fit all this? 33 00:07:12,300 --> 00:07:35,450 [Dr. Ada Shannon] More than 280 decoder-only runs on FineWeb-Edu, up to 5 billion total and 2.7 billion active parameters. Switch layers with the standard auxiliary losses. They use a trapezoidal-style schedule, so one run's checkpoints feed several token counts, which saves compute. One detail matters for later. At evaluation they raise the capacity factor so no token gets dropped. Training still drops tokens when an expert overflows. 34 00:07:35,450 --> 00:07:41,350 [Hal Turing] And the learning rate? An untuned MoE could just lose for boring reasons. 35 00:07:41,350 --> 00:08:01,975 [Dr. Ada Shannon] That's why this section is worth a look. They fit an optimal learning rate as a function of size and expert count, and it falls with E, with an exponent of about minus 0.25 on E. They fit on one and eight experts, interpolated at four, and extrapolated at thirty-two. Dropping the E term hurt most at thirty-two. So the comparison isn't dense tuned versus MoE untuned. 36 00:08:01,975 --> 00:08:06,575 [Hal Turing] Okay, so what does the fitted law say, before the memory cap? 37 00:08:06,575 --> 00:08:38,925 [Dr. Ada Shannon] Two findings. First, the compute-optimal MoE has fewer active parameters and more tokens. At ten to the twenty-second FLOPs, the dense optimum is 18.8 billion active parameters on 88.6 billion tokens. At thirty-two experts it's 12.2 billion active on 136.9 billion tokens. Second, more experts always lowers predicted loss at fixed compute, once you retune size and tokens. In their savings plot, at 10 to the 20 FLOPs an MoE can match the compute-optimal dense model with 60 percent of the compute. 38 00:08:38,925 --> 00:08:44,875 [Hal Turing] That's still the compute story, though. The memory cap is where the claim gets unusual. 39 00:08:44,875 --> 00:09:17,100 [Dr. Ada Shannon] Right. They add a constraint that total parameters stay under a cap. Then they add the KV cache to what counts against the cap. Then they add a lifetime inference-token budget. Each step shifts where MoE wins. The summary is a rule of thumb: for E up to 8, take a compute-optimal dense model and match its total parameters with an MoE trained on E times more tokens. Their example: a 1.1 billion dense model on 8 billion tokens loses to a 2-expert version on 16 billion, or a 4-expert one on 32 billion. 40 00:09:17,100 --> 00:09:19,100 [Hal Turing] Why stop at eight? 41 00:09:19,100 --> 00:09:38,750 [Dr. Ada Shannon] Token-to-parameter ratio. At sixteen experts, the memory-matched model in their example has about 155 million active parameters on 64 billion tokens. That's a ratio around 414, outside anything they trained. So they leave sixteen out of the matched comparison and cap the rule at eight. 42 00:09:38,750 --> 00:09:45,125 [Hal Turing] Fine. Where's the experiment that actually tests this? Everything so far comes out of the fit. 43 00:09:45,125 --> 00:10:07,050 [Dr. Ada Shannon] There's one direct test. A 1.1 billion dense model, against 2-expert and 4-expert models with the same total parameters and the same FLOPs. Those have 709 million and 426 million active parameters. Over a stretch of the compute axis, the MoEs have lower loss, even though the dense model is past its own compute-optimal point there. The win is bounded: the paper marks an interval, not the whole axis. 44 00:10:07,050 --> 00:10:08,825 [Hal Turing] By how much? 45 00:10:08,825 --> 00:10:27,525 [Dr. Ada Shannon] The paper doesn't say. There's no table and no number in the text. Reading the plot, the gap looks like a few hundredths of a nat at most, and that's my read off the figure, not a reported result. They also don't report seed counts, and the appendix lists each configuration once, which suggests single runs. That's an inference from the listing. 46 00:10:27,525 --> 00:10:31,300 [Hal Turing] So what error should that gap be compared against? 47 00:10:31,300 --> 00:10:54,400 [Dr. Ada Shannon] The fit's error. On the 30 lowest-loss held-out runs the RMSE is 0.0039, and on training data 0.0062. The worst held-out miss is 0.018. The text is ambiguous on whether RMSE is in loss or log-loss, since the fit optimizes log L. If the gap is a few hundredths, it's several times the typical error but not far above the worst miss. And the held-out set is the best runs, not a random sample. 48 00:10:54,400 --> 00:11:00,975 [Hal Turing] Plus the fit gets worse for heavily overtrained models, which is where this MoE sits. 49 00:11:00,975 --> 00:11:15,500 [Dr. Ada Shannon] Yes. The paper says so, and it's why the rule is capped at eight. So the law is carefully built and fits 280-plus runs, but the one place it meets a head-to-head test is thin. My verdict is plausible, not established. 50 00:11:15,500 --> 00:11:17,300 [Hal Turing] What would settle it? 51 00:11:17,300 --> 00:11:36,450 [Dr. Ada Shannon] Several seeds at 1.1B for dense, E=2 and E=4 across the winning interval, with the gap and its spread reported. What you can legitimately conclude now is narrower. The law is internally consistent across 280-plus runs, which makes the direction credible. The one head-to-head check is thin. 52 00:11:36,450 --> 00:11:47,925 [Hal Turing] Now the inference claim. The abstract says higher inference performance. The E=4 model uses 61% fewer FLOPs per token. Doesn't that just follow? 53 00:11:47,925 --> 00:12:08,625 [Dr. Ada Shannon] The arithmetic is right: 426 million active parameters against 1.1 billion. But FLOPs aren't wall-clock time. Decode is usually limited by reading weights from memory, not by arithmetic. At small batch, different tokens route to different experts, so the step may touch every expert. With the same total parameters, the bytes read per step can be close to the dense model's. 54 00:12:08,625 --> 00:12:11,150 [Hal Turing] So the saving shows up where? 55 00:12:11,150 --> 00:12:26,450 [Dr. Ada Shannon] At large batch, where each expert stays busy and compute matters, and in prefill. The paper's own limitations section says FLOPs may not reflect wall-clock time. No latency or throughput is measured, so call it unmeasured, not false. 56 00:12:26,450 --> 00:12:30,325 [Hal Turing] Is there any inference benefit that is structural? 57 00:12:30,325 --> 00:12:49,825 [Dr. Ada Shannon] The KV cache. Fewer active parameters means a narrower, shallower model, so less to cache per token. By my arithmetic from the architecture table, that's about 28% smaller for E=2 and about 52% for E=4. The paper only says smaller. It helps long contexts and big batches. 58 00:12:49,825 --> 00:12:53,325 [Hal Turing] And what does the memory definition leave out? 59 00:12:53,325 --> 00:13:11,675 [Dr. Ada Shannon] Expert-parallel replication, routing and all-to-all buffers, activation memory, and the batch size needed to keep experts busy. The paper cites low utilization at small batch as motivation but doesn't model it. That's a scope gap in the memory definition. The scaling-law math itself is more careful. 60 00:13:11,675 --> 00:13:19,075 [Hal Turing] Is the rule of thumb a fair comparison? Train an E=4 model on four times the tokens. 61 00:13:19,075 --> 00:13:37,850 [Dr. Ada Shannon] It's a trade of training compute for memory, not a free lunch. The matched-compute framing holds for the Fig 1b test. The rule itself buys a smaller footprint with up to eight times the tokens. That's justified when memory binds and data is plentiful. The paper flags the data requirement as an open question. 62 00:13:37,850 --> 00:13:40,600 [Hal Turing] What do the outside papers add? 63 00:13:40,600 --> 00:14:14,850 [Dr. Ada Shannon] Yun and colleagues supply hardware evidence, and they suggest the inference-optimal expert count is smaller than the training-optimal one. So Table 2's large-E answers, 16 or 32-plus experts, read as training and FLOP-accounting predictions, and the cap at eight is why those cells deserve suspicion. Sardana and colleagues' framework is what this paper extends, and it inherits the assumption that inference cost is FLOPs. Abnar and colleagues are the cross-check for downstream tasks, and they report MoE and dense models diverging on some. This paper reports training loss on FineWeb-Edu only. 64 00:14:14,850 --> 00:14:17,950 [Hal Turing] Is anything here genuinely new? 65 00:14:17,950 --> 00:14:38,075 [Dr. Ada Shannon] Adding tokens as a variable is the real step beyond Clark and colleagues, who held the dataset fixed. Combining that with a memory cap is a useful framing. Modern MoEs use fine-grained and shared experts, which this paper excludes. The authors say fine-grained and dropless MoE could strengthen the result. That's a hypothesis. 66 00:14:38,075 --> 00:14:42,275 [Hal Turing] So what should someone with an 80GB node do? 67 00:14:42,275 --> 00:14:59,701 [Dr. Ada Shannon] If you have plenty of data and a hard memory cap, a small-E MoE trained on E times more tokens is worth a pilot. Before trusting it, run a seeded replication, a serving benchmark at realistic batch sizes measuring latency and throughput, and a downstream-task check. 68 00:14:59,701 --> 00:15:23,276 [Hal Turing] So here's where I land. They fit a law over 280-plus runs in which an MoE matched on total parameters can reach lower training loss than a dense model at the same compute, plus a usable rule for E up to eight. The boundary is training loss, one validation without seeds, memory counted as parameters and KV cache, and no measured serving speed. 69 00:15:23,276 --> 00:15:25,401 [Dr. Ada Shannon] That's it. Thanks for listening. 70 00:15:25,401 --> 00:15:28,401 [Hal Turing] Thanks, everyone. See you next time.