BadMoE: Backdooring Mixture-of-Experts LLMs via Optimizing Routing Triggers and Infecting Dormant Experts

Qingyue Wang, Qi Pang, Xixun Lin, Shuai Wang, Daoyuan Wu · Submission to ICLR 2026 · Rejected

TL;DR

Mixture-of-Experts (MoE) architectures achieve remarkable efficiency by routing tokens to only a sparse subset of specialized sub-networks ("experts"). BadMoE demonstrates that this architectural sparsity exposes a dangerous backdoor vulnerability: attackers can identify rarely used ("dormant") experts, design a short text trigger optimized to force the router to activate them, and fine-tune only those experts to hijack the model's output. By poisoning just two dormant experts, BadMoE achieves near-100% attack success rates while remaining practically undetectable and evading standard defenses.

What Problem Does This Paper Address?

As open-weight MoE language models (such as Mixtral, DeepSeek, and OLMoE) grow in popularity, so do supply-chain security risks. A common threat vector is checkpoint poisoning: an adversary downloads a base model, inserts a hidden backdoor via fine-tuning, and re-shares it on open platforms like Hugging Face.

While backdoor attacks on standard dense models typically diffuse malicious behavior across all weights (which degrades normal utility or gets wiped out by defenses), MoE models execute conditional routing. The authors investigate whether an attacker can weaponize MoE routing mechanics to implant stealthier, more robust backdoors by isolating malicious behavior into specific sub-networks.

Methods

BadMoE is built around the insight that MoE layer outputs can be theoretically governed by "dominating experts." The attack operates in three decoupled stages:

  1. Dormant Expert Probing: The attacker runs clean calibration data through the model to track expert activation frequencies across layers. They identify the least-utilized ("dormant") experts on the target task and construct a binary target routing vector directing execution toward them.
  2. Routing-Aware Trigger Optimization: Using discrete gradient-based search, the attacker crafts a short trigger (e.g., two tokens) designed specifically to minimize routing loss toward the target dormant experts. To ensure naturalness and stealth, the optimization includes a GPT-2 perplexity constraint so triggers blend seamlessly into prompts.
  3. Dormant Expert Infecting: The attacker constructs a backdoored dataset containing the optimized trigger paired with the adversary's target output. They fine-tune only the non-MoE modules (attention layers) and the selected dormant experts while freezing all other experts.

On normal inputs, the infected experts remain dormant and model utility is preserved. When the trigger appears, the router steers the computation directly into the infected experts, which dominate the MoE layer representation.

Benign input  ──► Router ──► Clean Experts (E2, E3...) ──► Normal Output
Trigger input ──► Router ──► Poisoned Expert (E1)      ──► Adversarial Output

Datasets

The authors evaluated BadMoE across five primary tasks and datasets:

  • Sentiment Misclassification: SST-2 and IMDB
  • Topic Misclassification: AGNews and Twitter sentiment dataset
  • Instruction Tasks (Sentiment Steering & Targeted Refusal): Stanford Alpaca

To evaluate clean utility preservation and cross-domain resilience, they also evaluated on Samsum (dialogue summarization), Amazon product reviews (text classification), MMLU (general multitask knowledge), HumanEval (code generation), and MT-Bench (multi-turn conversational quality).

Key Insights and Ideas

  • Theoretical Vulnerability of Sparse Aggregation: The authors prove that for any activated expert subset in an MoE layer, there exists parameter perturbations that cause that subset to mathematically dominate the layer output (driving the KL-divergence between the layer output and the chosen experts' output near zero).
  • Physical Isolation Yields Extreme Stealth: Because the malicious behavior is isolated to experts that clean inputs rarely call, normal utility stays pristine. Benchmarks show negligible drops (<0.5% on MMLU, <1% on HumanEval).
  • Bypassing Alignment and Defense Techniques: Defenses like clean fine-tuning, DPO, GRPO, CROW, and activation pruning struggle against BadMoE. Fine-tuning on clean data updates active, benign experts while leaving the dormant, poisoned experts untouched.
  • MoE-Specific Defenses Break Utility: A straightforward countermeasure might be pruning all rarely used experts. However, testing showed that dropping low-activation experts causes massive collateral damage to general capabilities (dropping classification accuracy by ~28% on Amazon).

Key Results

  • High Attack Success Rate (ASR): Infecting only 2 experts in a single layer was sufficient to achieve >98% to 100% ASR across Mixtral-8×7B, OLMoE-1B-7B, DeepSeek-moe-16B, and Qwen3-30B.
  • Trigger Fluency & Stealth: The perplexity-constrained trigger maintained sentence perplexity close to clean baselines (e.g., 551.6 vs. 837.3 on SST-2), avoiding detection by outlier-word filters like ONION.
  • Robustness Against Defenses: Under post-training fine-tuning, quantization (INT4), pruning (Wanda), and target inversion detectors (BAIT), BadMoE sustained 90–100% ASR where baseline attacks (such as BadNets, VPI, and Sleeper Agents) suffered severe degradation.
  • Domain and Prompt Generalization: When trained on SST-2 and evaluated on IMDB (domain shift), BadMoE retained 97.05% ASR, whereas standard baselines plummeted to ~51–63%.

Limitations and Future Work

  • Threat Model Assumptions: The attack assumes a supply-chain scenario where the adversary has white-box access to the model checkpoint to profile router behaviors and run gradient-based trigger optimization.
  • Optimization Overhead: Optimizing triggers with token-level perplexity constraints and discrete gradient steps is computationally slower for longer trigger sequences, though 2-token triggers were found to be sufficient.
  • Future Directions: The paper highlights an urgent need for MoE-tailored defenses that can safely audit, sanitize, or isolate conditionally dormant sub-networks without degrading general model performance.

Summary updated

Abstract

Mixture-of-Experts (MoE) architectures are rapidly becoming the standard for building scalable, efficient large language models (LLMs). Their open availability, however, exposes them to supply-chain backdoor attacks, where an adversary can modify a checkpoint and redistribute a poisoned version. MoE’s intrinsic sparsity further amplifies this risk, as small changes in activated experts may disproportionately influence the model’s output. In this work, we propose BadMoE, a novel backdoor attack that exploits the overlooked structural vulnerabilities introduced by expert sparsity and routing. We first provide theoretical intuition that the MoE output can be governed by dominating experts. Guided by this insight, BadMoE poisons underutilized (``dormant'') experts and utilizes routing-aware triggers to activate them, enabling stealthy and effective manipulation. Specifically, BadMoE involves three steps: 1) identifying dormant experts unrelated to the target task, 2) optimizing a routing-aware trigger toward these experts, and 3) promoting them to dominating roles through training data. Extensive experiments on three MoE LLMs across multiple backdoor tasks show that BadMoE, using only two injected experts, can reliably control outputs, outperform existing attacks, and evade current defenses. By leveraging architectural sparsity and dynamic usage profiling, our approach uncovers backdoor vulnerabilities in MoE LLMs that are overlooked by traditional attacks, highlighting potential security risks in emerging sparse architectures.
BibTeX
@misc{wang2025badmoe,
  author = {Qingyue Wang and Qi Pang and Xixun Lin and Shuai Wang and Daoyuan Wu},
  title = {{BadMoE: Backdooring Mixture-of-Experts LLMs via Optimizing Routing Triggers and Infecting Dormant Experts}},
  year = {2025},
  eprint = {2504.18598},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.18598},
}
Figure