← Latest papers
🤖 machine learning

Sticky Routing: Training MoE Models for Memory-Efficient Inference

The paper proposes StickyMoE, a differentiable routing consistency loss that trains Mixture-of-Experts models to maintain expert assignments across semantically coherent token spans, thereby significantly reducing memory-intensive weight swapping on edge devices with minimal perplexity degradation.

Original authors: Ali Kayyam

Published 2026-07-13
📖 6 min read🧠 Deep dive

Original authors: Ali Kayyam

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a giant library of 64 different expert librarians, but your tiny edge device (like a phone or a smart speaker) only has enough shelf space to keep 2 of them on the desk at any given time. The rest are stored in a slow, dusty basement.

In a standard "Mixture-of-Experts" (MoE) model, every time the AI reads a new word, it flips a coin to decide which librarian to ask. The problem? It flips a coin for every single word. So, it asks Librarian A for "apple," then Librarian B for "pie," then Librarian C for "crust." Every time it switches, it has to run down to the basement, kick Librarian B out, and drag Librarian C up to the desk. This "running back and forth" is so slow that the AI spends more time fetching librarians than actually reading the story.

The paper introduces StickyMoE, a new way to train these models so they stop flipping the coin so wildly. Instead, the model learns to be "sticky." If it asks Librarian A for "apple," it's encouraged to keep asking Librarian A for "pie" and "crust" too, as long as the topic makes sense.

The Big Discovery: Train It Right, Don't Fix It Later

The authors tried a few things to fix the "running back and forth" problem, and here is what they found:

  1. The "Post-Hoc" Fix Failed: They tried taking a model that was already trained and just "fine-tuning" the coin-flipping mechanism (the router) to be less random. They called this ReMoE. The result? It didn't work. The switch rate barely changed (less than 0.5% absolute change). The authors argue this is because the librarians (the experts) were already trained to be specialists for specific, isolated words. You can't just tell the coin-flipper to be "stickier" if the librarians themselves aren't ready to handle long, continuous topics. It's like trying to teach a sprinter to be a marathon runner by only changing their starting stance; the muscles (the expert weights) are built for short bursts, not long runs.
  2. The "Hard" Fix Was Too Rigid: They also tried a method that forced the model to stick to one librarian for a set number of words using a strict rule (a "Hard-Window"). While this reduced switching, it made the AI's answers much worse (increasing "perplexity" by up to 6.8% on the medium model). It was like forcing a librarian to read a whole novel even when the topic changed to a completely different genre; the quality of the story suffered.
  3. The "Sticky" Solution Worked: The winning method, StickyMoE, adds a gentle "consistency penalty" during the very first step of training. It tells the model: "Hey, if you switch experts between two words that are right next to each other, that's a bit of a penalty." This encourages the model to learn while it learns the language.

The Results: Sticky is Better

When they tested this on small and medium-sized models using the WikiText-2 dataset (a collection of Wikipedia articles), the results were clear:

  • Less Switching: By tuning a single knob (a number called λ), they could reduce the number of times the model had to swap experts by up to 59%. For example, on the medium model, switching dropped from 0.71 (switching almost every time) down to 0.29.
  • Better Speed (Simulated): Because the model switched less, they simulated a cache (the desk shelf) that could hold 2 experts. The "Cache Hit Rate" (how often the right librarian was already on the desk) jumped from 0.54 to 0.88. This means the model would need to run to the basement 3.92 times fewer times than before.
  • Better Quality: Surprisingly, on the medium model, using a moderate amount of "stickiness" (λ = 0.05) actually made the AI smarter, lowering its "perplexity" (a measure of confusion) by 4.1%. The model learned that sticking to a topic helped it understand the context better.
  • No Collapse: A big fear was that the model would get "lazy" and just use one librarian for everything. But the "Utilisation Entropy" stayed high (above 1.92 bits out of a max of 2.0), meaning all 4 experts were still being used fairly. The model didn't get lazy; it just got organized.

What Didn't Work (And Why)

The paper explicitly rules out the idea that you can fix this problem after the model is built. The ReMoE approach (fine-tuning an old model) was shown to be ineffective because the "expert representations" (the librarians' brains) were already shaped by a training process that didn't care about sticking to topics. You can't retrofit locality; you have to bake it in from the start.

They also noted that the very first layer of the model (Layer 0) is the hardest to make "sticky." Even with the best settings, the switch rate there stayed above 0.49. This is because the first layer sees raw words before they get mixed with context, so "apple" and "pie" might genuinely look very different at that stage.

The Bottom Line

The paper suggests that if you want an AI to run fast on a device with limited memory, you shouldn't just try to be clever with caching rules or try to fix the model later. Instead, you should train the model to be "sticky" from day one. By adding a simple penalty for switching experts too often between adjacent words, you get a model that naturally stays on topic, needs fewer trips to the slow basement, and actually understands the story better.

The authors admit this is based on simulations and training on specific datasets (WikiText-2) with small and medium models (up to 22M parameters). They suggest that as models get bigger, this "stickiness" might work even better, but they haven't tested it on the massive billion-parameter models yet. They also note that their method doesn't currently know when a sentence ends, so it might get "too sticky" across a paragraph break, which is a problem for future work to solve.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →