Rewiring Experts on the Fly: Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert Models

Guinan Su, Yanwu Yang, Li Shen, Lu Yin, Shiwei Liu, Jonas Geiping

Introduction: The Routing Bottleneck in MoE Models

Mixture-of-Experts (MoE) architectures have become the standard for efficiently scaling large language models. By utilizing a "router" to activate only a sparse subset of parameters (the experts) for each token, MoE models deliver the reasoning capabilities of massive networks at a fraction of the computational cost.

However, this architecture introduces a unique vulnerability. The router is typically a simple linear layer trained during the pre-training phase. When deployed, these models frequently encounter "distribution shifts"—prompts, topics, or tasks that deviate from their training data. Under these conditions, the router often makes suboptimal decisions, sending tokens to the wrong experts and bottlenecking the model's overall performance. While existing test-time adaptation methods can address similar issues in dense models, they generally require access to external reference data, limiting their practical use for on-the-fly MoE generation.

A Data-Free Solution: Continuous Rerouting

To solve this, researchers have introduced a novel, data-free, online test-time framework that continuously adapts MoE routing decisions during text generation. Instead of relying on external gold-standard data, this method uses the model's own input context and previously generated tokens as a self-supervised training signal.

The framework operates in a continuous cycle of two phases:

  1. In-Context Routing Optimization: During the prefill stage and at regular intervals thereafter, the model evaluates its current context. It performs a few steps of gradient descent to minimize cross-entropy loss. Crucially, it does not update the massive expert weights. Instead, it learns a lightweight additive vector ($\delta$) that adjusts the router's logits (the raw scores used to select experts).
  2. Steered Generation: The model then generates the next sequence of text (e.g., 128 tokens) utilizing these newly optimized routing decisions, maintaining the modified router until the next adaptation cycle.

To ensure stability and computational efficiency, the framework employs Dynamic Layer Selection. Rather than updating every layer, the system calculates a specialization score to identify which layers are most confident in their routing. Adaptation is focused exclusively on these layers, preventing "over-adaptation" where a model might unlearn general knowledge to overfit a specific prompt.

Experimental Setup

The researchers evaluated this continuous rerouting method across several challenging benchmarks using prominent MoE models, including DeepSeek-V2-Lite, OLMoE, and Qwen1.5-MoE. The evaluation suite spanned multiple domains:

  • Coding: HumanEval and MBPP (sanitized)
  • Mathematics: GSM8K and MATH500
  • General Knowledge: MMLU-redux
  • Advanced Reasoning: AIME24 and AIME25

Key Findings and Performance Gains

The continuous rerouting framework demonstrated significant and consistent improvements across tasks without requiring external supervision.

  • Consistent Performance Boosts: The method achieved notable gains across the board, including a 5.5% improvement on HumanEval when applied to the OLMoE model.
  • Plug-and-Play Synergy: The framework easily complements existing test-time scaling techniques. When combined with Self-Consistency (generating multiple reasoning paths and voting), it yielded a 6% average performance gain on DeepSeek-V2-Lite.
  • The Long-Context Advantage: The benefits of self-supervised rerouting scale with sequence length. For sequences exceeding 640 tokens, the method demonstrated a massive 13.3% improvement over baseline models, as the model has more self-generated context to learn from.
  • Increased Decisiveness: Analysis revealed that rerouting gradually decreases the entropy of expert selection. As the generation progresses, the model becomes more decisive and focused on specific experts.
  • High Efficiency: Despite the added optimization steps, the method is highly efficient. It requires 1.6x fewer FLOPs than a standard 5-shot In-Context Learning approach while delivering superior results. Furthermore, it remains robust to context shifts and distracting information.

Limitations and Future Directions

The primary limitation of this data-free approach is its reliance on the model's own predictions. If a model produces a highly inaccurate initial generation, self-supervision can lead to a "confirmation bias," where the model optimizes its router to reinforce its own errors. The researchers found that capping the optimization at 3–5 steps helps mitigate this risk.

Future work will explore more sophisticated optimization objectives beyond simple cross-entropy. Integrating real-time reward signals or reinforcement learning during the generation process could provide safer, more accurate guardrails for rewiring experts on the fly.

Summary updated

BibTeX
@inproceedings{su2026rewiring,
  author = {Guinan Su and Yanwu Yang and Li Shen and Lu Yin and Shiwei Liu and Jonas Geiping},
  title = {{Rewiring Experts on the Fly: Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=vqOaUyUeO3},
}
Figure