Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

Mechanical Dreams

Mechanical Dreams artwork

Pretraining Mixture of Experts for Emergent Modularity

Aug 22, 202622 minAudio
ShareXLinkedInFacebookWhatsAppEmail

In this episode: • Introduction to Monolithic MoEs: Linda introduces EMO and Professor Norris discusses the memory bottlenecks of standard monolithic Large Language Models. • The Document-Level Routing Constraint: Linda explains EMOs core mechanism of restricting tokens in a document to a shared pool of experts. • Overcoming Training Instability: The hosts discuss the conflict with local load balancing and how global load balancing and dynamic pool sizing solved it. • Semantic Specialization and Extreme Pruning: Linda reveals the performance numbers, showing how EMO can drop over 85 percent of its experts without losing accuracy. • Future Implications for Interpretability: Professor Norris realizes the potential for model auditing and deploying specialized sub-networks on edge devices.

Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.

Transcript

From the show.

## Introduction to Monolithic MoEs

Linda: Welcome back to Mechanical Dreams, the podcast where we dive deep into the gears of machine learning and natural language processing. I am your host, Linda, and as always, sitting across the mic from me is the ever-analytical, occasionally skeptical, but always brilliant Professor Norris. Norris: I prefer the term pragmatically cautious, Linda. But thank you for the introduction, and hello to all our listeners. What paper have you brought to disrupt my peace today? Linda: Today, we are talking about Mixture of Experts, or MoEs. Specifically, a brand new paper titled EMO: Pretraining Mixture of Experts for Emergent Modularity, by Ryan Wang, Akshita Bhagia, and Sewon Min from UC Berkeley and the Allen Institute for AI. Norris: Ah, Mixture of Experts. The architectural equivalent of promising me a sleek, lightweight sports car, but forcing me to tow the entire factory behind it wherever I go. Linda: I knew you were going to bring up the memory bottlenecks! But that is exactly the problem this paper solves. Let us set the stage for our listeners. Right now, large language models are trained and deployed as massive monolithic systems. Norris: Right. In theory, MoEs are supposed to be efficient. You might have a 14 billion parameter model, but maybe only 1 billion parameters are active for any given token. But at inference time, my GPU does not care about active parameters. It cares about VRAM. Even the inactive experts have to sit in memory because you never know when the model will need them. Linda: Exactly. And for a lot of enterprise use cases, applications only require a narrow subset of capabilities. If you are deploying an agent specifically for code generation or mathematical reasoning, you do not need the model's knowledge about 18th-century French poetry. But with standard MoEs, you have to serve the full model anyway. Norris: People have tried to get around this, of course. There is plenty of literature on pruning experts or trying to extract a sub-network for a specific task. But historically, if you take a standard MoE and restrict inference to just a subset of experts for a given domain, the performance completely falls off a cliff. Why is that, Linda? You are the one who reads the fine print. Linda: It comes down to what the experts are actually learning during pretraining. In a standard MoE, the routing mechanism does not naturally organize experts by high-level semantic domains like math or code. Instead, prior work shows that the experts specialize in low-level syntactic patterns or surface-level lexical cues. Norris: You mean things like having an expert dedicated entirely to prepositions, or punctuation marks, or specific subword fragments, regardless of the actual context of the document? Linda: Spot on. Because of this syntactic specialization, a single document, even a highly technical math paper, ends up bouncing around and activating almost every single expert in the model over the course of just a few sentences. Norris: So if I try to extract a coding sub-network, I simply cannot. The coding knowledge is inextricably tangled up with the punctuation experts, the verb experts, and so on. It is like trying to bake a cake and then un-bake it to get just the flour back. Linda: A slightly messy analogy, Professor, but very accurate. Standard MoEs are functionally monolithic. You cannot decouple them. But the EMO paper challenges this exact assumption. EMO stands for Emergent Modularity. They figured out a way to make these expert subsets usable in isolation, and they do it without requiring any human-defined domain labels or priors during training. Norris: No human-defined priors? Now you really have my attention. I always hate it when a paper claims modularity but achieves it by manually partitioning the training data. If they can actually isolate domain-specific experts in a self-supervised way, that would be a massive win for memory-constrained serving. How on earth do they manage that? Linda: It is incredibly elegant. It all comes down to a very clever routing constraint that relies on document boundaries as a weak supervisory signal. Let us get into how they actually built this.

## The Document-Level Routing Constraint

Linda: So, we established that standard MoEs scatter tokens across all experts because they specialize in low-level syntax. EMO's solution to this is surprisingly simple but incredibly effective. It all revolves around what they call the document-level routing constraint. Norris: Simple is good. In my experience, complicated routing mechanisms usually break down at scale. Walk me through it. How do they force the model to learn domain-level experts without giving it domain labels? Linda: To appreciate EMO, we first have to look at the naive approach. Prior works, like FlexOlmo or Branch-Train-MiX, tried to create modularity by explicitly partitioning the training data. You literally tag the data as 'math' or 'code' or 'biology', and then train separate experts for those domains. Norris: I see. And the problem with that is human bias, not to mention the sheer logistical nightmare. How do you classify a document that uses Python code to solve a biological differential equation? Is it code, biology, or math? Linda: Exactly! Predefined labels are ambiguous, expensive to get for trillions of tokens, and they restrict the model's flexibility. So, the authors of EMO threw out the labels entirely. They realized they already had a weak supervisory signal built into the dataset: document boundaries. Norris: Document boundaries. So it just uses the natural start and end of a text snippet or file in the pretraining corpus? Linda: Right. The core observation is that tokens within a single document almost always come from the same domain. So, EMO forces all tokens within a single document to select their active experts from a shared, restricted pool. Norris: That makes intuitive sense. You do not usually switch from explaining quantum mechanics to writing a lasagna recipe in the middle of a paragraph. But how does it work mathematically? Does it route the whole document at once? Linda: Sort of a two-stage process. Let us say we have a model with 128 total experts, and we want to activate 8 experts per token. That is a standard MoE setup. Norris: Standard so far, yes. Linda: But in EMO, for a given document, the router first computes the standard token-level routing probabilities. Then, it averages those probabilities across all tokens in the document to find the most desired experts for the document as a whole. Norris: Ah, so it gets a macroscopic view of what the document needs. Linda: Exactly. From that average, it selects a 'document expert pool' of a certain size, let us call it 'd'. For example, 'd' could be 32. Once that pool of 32 is chosen, all other experts are masked out. Every single token in that document is now forced to choose its 8 active experts only from that shared pool of 32. Norris: Oh, that is brilliant. So if a token really wants to use expert number 50 because it is the 'comma' expert, but expert 50 is not in the document's pool of 32, it is simply out of luck. Linda: Yes! And that constraint is the magic trick. Because the pool is restricted per document, the experts can no longer afford to specialize in surface-level syntax like commas or prepositions. They are forced to learn higher-level semantic concepts that are broadly useful across the entire document. Norris: You are essentially starving the syntactic patterns. If an expert wants to minimize the loss, it has to be useful for the overall topic. But wait, let us talk about that hyperparameter 'd', the size of the document pool. If 'd' is too small, you bottleneck the model. Linda: Precisely. The hyperparameter 'd' controls the granularity of the subsets. If 'd' equals 'k', which is 8 in our example, you force every single token in the document to use the exact same 8 experts. The authors noted that this enforces highly specialized subsets, but it limits expressivity. Norris: Right, because even within a single topic, a document has varied structures. You still need some dynamic routing to handle verbs versus nouns, or equations versus text. And I assume if 'd' equals the total number of experts, 128, you just recover the standard monolithic MoE. Linda: Exactly. You need a sweet spot. And because different documents can select different pools of experts, the model naturally learns recurring expert subsets across the entire training corpus. The modularity is entirely emergent. Norris: I have to admit, Linda, I love the elegance of this. It completely bypasses the need for human annotation, and it organically structures the network into domain-specific modules. But knowing how sensitive MoEs are during pretraining, I cannot imagine this was easy to optimize. Linda: It was not. In fact, the moment they tried to train this with standard settings, they ran into a massive wall. Norris: Let me guess. Load balancing. If you force an entire document to route to just a fraction of the experts, the standard load balancing loss is going to throw a complete tantrum. Linda: You hit the nail on the head, Professor. The routing constraint and the load balancer were completely at war. But they found a great fix, which we will dive into right after this.

## Overcoming Training Instability

Norris: I left off with a rather grim prediction about load balancing. Tell me I was right, Linda. I do enjoy being right. Linda: Oh, you were absolutely right, Professor. The training dynamics were incredibly unstable at first. If you look at their ablation studies in the appendix, using standard load balancing led to massive gradient norm spikes. The loss would suddenly shoot up and ruin the run. Norris: Well, it is obvious why. Standard load balancing operates on a micro-batch level. It looks at a handful of sequences on a single GPU and says, we need to use all one hundred twenty-eight experts equally right now! It aggressively penalizes the model if any expert is left idle. Linda: Exactly. But EMOs document constraint is telling those same tokens within a document that they can only use a small subset of experts. By design, it leaves the rest of the experts untouched for that specific sequence. The local load balancer starts screaming that the routing is uneven and tries to force tokens out of the document pool. The two objectives were literally pulling the network in opposite directions. Norris: So, how did they mediate this architectural tug-of-war? You cannot just turn off load balancing, or you end up with representation collapse where only three experts do all the work, everyone routes to them, and the remaining one hundred twenty-five experts just take a nap. Linda: Right, you absolutely need it for uniform expert utilization across the whole model. Their solution was to adopt global load balancing, aggregating routing statistics across data-parallel groups, similar to the technique used in the Qwen 3 models. Norris: Ah, I see! That is a very elegant workaround. By calculating the load balancing penalty over the global batch, rather than just the micro-batch on a single device, you are evaluating a much larger, much more diverse set of documents at once. Linda: Precisely. Globally, across hundreds of different documents spanning various domains like biology, code, and casual chat, all the experts are being utilized uniformly. The global load balancer is happy. But locally, within any single document, the routing remains tightly constrained to its specific pool. Modularity is preserved. Norris: The objectives become complementary instead of adversarial. Very smart. That solves the training spikes. But wait, earlier you mentioned they pick a pool size, which they call d, like 32. If I train the model with d fixed at 32, isn't it going to heavily overfit to that specific capacity? Models are notoriously lazy, they will only learn exactly what you force them to learn. Linda: You are two for two today, Professor! Yes, that was their second major technical hurdle. They found that if they fixed the pool size during training, the model performed perfectly fine when they evaluated expert subsets of size 32. But it degraded terribly if someone tried to deploy it later with an expert subset of a different size. Norris: Which defeats the whole purpose of flexible, modular deployment. If I am deploying to a mobile device, I might only have enough memory for 8 experts. If I am on a local server, maybe I want 64. I do not want to be locked into 32 just because that is what the pretraining script used. Linda: Exactly. So to fix this, they made the pool size dynamic. For every single document during pretraining, they sample the pool size as a random variable from a uniform distribution. Norris: Randomizing it? That is a bold move for pretraining. What are the bounds of that distribution? Linda: It ranges from k, which is the number of active experts per token, up to the total number of routable experts. In their one billion active parameter setup, k was 8, and there were 127 routable experts. They also had one shared expert that is always active, which improves general performance without needing to be routed. Norris: Randomizing the pool size per document is fascinating. It acts as a form of regularization. The model is constantly forced to organize its knowledge hierarchically, so it can function whether it has a tiny slice of the network or the whole pie. It has to learn which experts are the absolute most critical for a topic, and which are nice-to-haves. Linda: Yes, and it worked beautifully. Exposing the model to a range of pool sizes during training enables it to support expert subsets of all capacities. At inference time, you can extract exactly what you need for your specific memory budget, and the model already knows how to operate under those constraints. Norris: Alright, you have convinced me the engineering is sound. They stabilized the training with global load balancing and made it flexible with dynamic pool sizing. But the proof of the pudding is in the eating. I want to know what happens when we actually slice this model up and run it on a real benchmark.

## Semantic Specialization and Extreme Pruning

Linda: You asked for the benchmark numbers, Professor, so let us get right to the main event. First, as a baseline, when they evaluate the full EMO model—14 Billion total parameters with 1 Billion active—it perfectly matches the performance of a standard, monolithic MoE trained on the same 1 Trillion tokens. Norris: That is a crucial sanity check. If imposing this document-level constraint degraded the model's overall capacity as a general-purpose assistant, it would be a non-starter. But we are here for the pruning. What happens when you actually slice it up? Linda: They tested this extensively on benchmarks like MMLU, MMLU-Pro, and GSM8K. Let us say you are targeting a specific domain, like physics or math. They found that if you retain only 25 percent of the experts—which is just 32 out of the 128—EMO suffers only about a 1 percent absolute drop in performance. Norris: A 1 percent drop for throwing away 75 percent of the model's parameter footprint? That is absurd. But earlier you mentioned GSM8K and dropping to 12.5 percent. How does it fare under that kind of extreme constraint? Linda: Even when retaining just 16 experts—that is 12.5 percent of the model—performance drops by only about 3 percent. And on GSM8K specifically, if you perform a bit of domain-specific fine-tuning on that tiny subset, it perfectly recovers the full model's performance. Norris: To put that in perspective for our listeners, you are discarding nearly 88 percent of the model's weights and still matching the state-of-the-art for that parameter class. What happens if you try that with the standard, monolithic MoE? Linda: It completely falls apart. Under the exact same 25 percent expert retention, the standard MoE sees performance drops of over 10 percent. At 12.5 percent, it drops by 15 percent or more. It essentially becomes worse than a tiny dense model. Norris: That makes total sense given our earlier discussion. You cannot just slice out a random assortment of punctuation and verb experts and expect them to solve calculus. But practically speaking, Linda, how do you know which 16 or 32 experts to keep for a given domain? Do you need to run a massive validation dataset through the model to figure out the routing? Linda: That is one of the best parts! EMO is incredibly sample-efficient when it comes to expert selection. You just take a small validation set, aggregate the routing probabilities, and rank the experts. But that validation set can be minuscule. The authors found that even a single 5-shot example is often enough to identify the perfect expert subset. Norris: Just five examples? That is almost zero-shot extraction. You literally just prompt it a few times, see which experts light up, crop the model, and deploy it. That is a game changer for customized deployment. Linda: Exactly. And the authors proved exactly why this works by looking at the representations. They sampled tokens from 12,000 documents, extracted their routing probabilities, and ran a PCA clustering algorithm. The visualizations are stunning. Norris: Let me guess. The standard MoE clusters are all syntactic, just like we talked about. Linda: Right. In the standard MoE, the clusters literally map to things like 'prepositions', 'proper names', or 'definite articles'. The tokens for a single document are violently dispersed across all these clusters. Norris: And EMO? Linda: EMO’s clusters align almost perfectly with human-interpretable semantic themes. You get one cluster for 'film, music, and TV reviews'. Another for 'health, medical, and wellness'. Another for 'U.S. politics', and so on. Tokens from the same document heavily concentrate into just one or two of these semantic clusters. Norris: It is exactly what we hypothesized in chapter two. By forcing the document into a shared expert pool, the model realizes that dedicating an entire expert to the word 'the' is a massive waste of its limited capacity. It has to learn broad, conceptual features. Did they include any qualitative examples of the text it generates? Linda: They did, and it is pretty funny to read. They prompted both models with a math word problem using just an 8-expert subset. The EMO subset calmly output the correct algebraic steps and arrived at the right answer. The standard MoE subset just started hallucinating random numbers and equal signs in a loop, like '5 4 equals 5 4 equals 5 4'. Norris: Because the standard MoE subset was probably missing the 'math logic' expert, or maybe it was missing the 'generate a coherent noun' expert! It is a beautiful demonstration of emergent modularity. This goes way beyond just saving VRAM, Linda. If the model is organically compartmentalizing its knowledge into semantic modules, the implications for interpretability and safety are absolutely enormous.

## Future Implications for Interpretability

Norris: Picking up on that point about safety, Linda, the interpretability angle here is staggering. We are always talking about the black-box nature of LLMs, but EMO gives us a transparent window. If a user asks a simple coding question, and suddenly the 'US politics' or 'religion' clusters start firing heavily, you instantly know the model is going off the rails or being jailbroken. Linda: Exactly! The authors specifically highlight this as a new form of model auditing. But it goes even further than just monitoring. You get fine-grained control at inference time. In their cluster analysis, they actually identified specific experts associated with spam, gambling, and low-quality adult content. Norris: Oh, that is brilliant. So if you are deploying an agent for a child-facing educational app, you do not need to rely on flimsy prompt-based guardrails. You can literally just unplug the gambling and adult content experts. The model physically cannot access that knowledge anymore. Linda: Yes, it is a physical, architectural safety filter rather than just a behavioral one. And this modularity also opens up a completely new paradigm for model maintenance. Right now, updating a monolithic model means an incredibly expensive retraining process. But with EMO, the authors did a preliminary test where they fine-tuned just a 32-expert subset in isolation, and then hot-swapped it back into the original 128-expert model. Norris: Let me guess, the overall model performance improved? Linda: It did! It provides early evidence that in the future, we could have modular pretraining and patching. The open-source community could train highly specialized experts independently and just plug them into a shared base model without needing thousands of GPUs. Norris: That is the decentralized AI dream right there. Instead of one massive corporation training a monolith, you have specialized labs contributing their own expert modules to a composable architecture. I must say, Linda, you really brought a winner today. EMO actually delivers on the original promise of Mixture of Experts. Linda: I am so glad you liked it! It really does prove that large language models do not have to remain monolithic black boxes. That is all the time we have for today's episode. Thank you all for joining us on Mechanical Dreams, and keep dreaming in high dimensions!

Open the transcript file

Hosts and Guests

Nobody is credited on this episode yet.

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. You don’t need long context

    Nov 12, 202620 minAudio

    In this episode: • The Context Window Arms Race: Professor Norris and Linda introduce the episode and discuss a new NVIDIA paper challenging the necessity of massive context windows, highlighting the hidden...

    Credit the people on this episode

  2. Scaling Hierarchical Networks

    Nov 11, 202621 minAudio

    In this episode: • Intro and The Bitter Lesson: Introducing the podcast and the Cartesia paper on Hierarchical Networks. • Scaling Ladders and The BPE Comparison: Discussing the compute efficiency gains of 1-stage...

    Credit the people on this episode

  3. Perturbing Inputs Improves Pretraining Distillation

    Nov 10, 202621 minAudio

    In this episode: • Introduction and Standard Distillation: Professor Norris and Linda introduce the podcast and set the baseline for standard knowledge distillation in language models. • The Core Idea of Perturbed...

    Credit the people on this episode

  4. Why is AI-generated language so hard to understand

    Nov 9, 202620 minAudio

    In this episode: • Introduction: The Reader-Patience Budget: Professor Norris and Linda introduce the episode's topic, discussing the growing sentiment that AI-generated text is becoming overly convoluted. • The...

    Credit the people on this episode

  5. Muse Glimmer 30B

    Nov 8, 202622 minAudio

    In this episode: • Introduction & Paper Overview: Professor Norris and Linda introduce the episode and the Muse Glimmer 30B paper, outlining its goal of bringing agentic capabilities to consumer hardware. • Architecture...

    Credit the people on this episode