The Problem: MoE Routing Breaks During Domain Switching
Imagine a sparse MoE model with 4 experts, each handling a different knowledge domain. A token about medicine routes to the medical expert; the next token switches to legal content and should route to the legal expert. In a controlled experiment (4 experts, 5 repetitions), standard affinity-based routing gave the correct expert only 0.006 (0.6%) probability, and the number of experts needed for 99% coverage was infeasible.
Why? Standard routing looks only at the current token, not the context:
- No memory: routing is stateless; each token is decided independently, with no knowledge of the previous token's domain.
- Affinity is insufficient: the switch token itself may be ambiguous, and affinity cannot distinguish old vs. new domains.
- Expert count explodes: guaranteeing coverage requires activating many experts, destroying sparsity and efficiency.
- Correct-expert probability: 0.6% → 74.8% (a 124x improvement)
- Experts needed for 99% coverage: infeasible → a small constant
- Biological plausibility: real neurons have membrane potentials and inertia — recently active neurons are easier to re-activate; the brain does minimize prediction error.
- Theoretical grounding: rather than blindly searching routing strategies, design is guided by a principled framework that explains *why* it works.
- Generalizability: the Free Energy Principle is a universal framework applicable beyond MoE to other AI systems.
The Fix: Applying the Free Energy Principle
The paper draws on the Free Energy Principle (Friston, 2006), where biological systems minimize free energy — balancing accuracy (matching predictions to observations) and complexity (the cost of the prediction relative to priors).
Three mechanisms applied to MoE routing:
1. Temporal Memory (β): each expert maintains a "membrane potential" that accumulates routing context. Recently activated experts have higher potential, creating inertia — keep the current expert unless there is a strong switching signal. 2. Precision-Weighted Gating (Pi): each expert estimates the precision (inverse variance) of its predictions; higher-precision experts get higher gating weight (implementing the accuracy term). 3. Complexity Regularization: penalizes frequent expert switching (implementing the complexity term).
Results:
In effect, this gives MoE routing short-term memory: it remembers "what we were just doing" and only switches on strong evidence.
Why Neuroscience-Inspired Design Works
Takeaways
If you are building MoE or conditional-computation systems, ask:
1. Does my routing have memory — or does it only look at the current input? 2. How does my system behave during domain switches? 3. Can neuroscience insights improve my design? 4. Can a theoretical framework (like the Free Energy Principle) guide engineering decisions?
Paper: Affinity Is Not Enough: Recovering the Free Energy Principle in Mixture-of-Experts — Man Yung Wong, arXiv:2605.00604 (2026-04-30)
The core lesson: the best AI engineering learns from nature. When MoE routing meets the Free Energy Principle, we gain not only a better algorithm but a deeper understanding of intelligence, prediction, and choice in complex environments.