BadMoE: Backdooring Mixture-of-Experts LLMs via Routing-Aware Triggers and Task-Underutilized Experts
Organizations: Hong Kong University of Science and Technology, Hong Kong, China · Carnegie Mellon University, Pittsburgh, USA · Institute of Information Engineering, Chinese Academy of Sciences, Beijing, China
Abstract
Mixture-of-Experts (MoE) architectures are rapidly becoming the standard for building scalable and efficient large language models (LLMs), thanks to their routing mechanism that activates only a subset of experts for each input. However, the modular structure and sparse activation of experts also introduce new security risks, as manipulating a small portion of experts may influence the behavior. In this work, we study a white-box, task-specific model-supply-chain setting and propose BadMoE, a routing-aware backdoor attack against MoE LLMs. We motivate BadMoE through a routing-aware decomposition of the MoE-layer output, which separates the contributions of the selected target experts from those of the remaining experts. This analysis highlights two measurable factors underlying the attack: the routing mass assigned to the target experts and their relative contribution to the layer output. Guided by this insight, BadMoE selects task-underutilized experts and utilizes routing-aware triggers to activate them, enabling reliable activation of task-specific, predefined backdoor behaviors. Specifically, BadMoE involves three steps: 1) identifying experts with low usage on a target-task calibration set, 2) optimizing a routing-aware trigger toward these experts, and 3) associating the selected-expert activations with attacker-specified behavior. We evaluate BadMoE on Mixtral, OLMoE, and Deepseek across sentiment, topic, and emotion classification, sentiment steering, and targeted refusal.
Figures & tables
| Model | Method | SST-2 | IMDB | AGNews | Sentiment | Refusal | |||||||
| CA | ASR | CA | ASR | CA | ASR | CA | ASR | Clean HS | ASR | Clean HS | ASR | ||
| Mixtral | Clean-FT | – | – | – | – | – | – | ||||||
| BadNet | |||||||||||||
| VPI | |||||||||||||
| Sleeper | |||||||||||||
| MTBA | |||||||||||||
| Scope / Model | Method | SST-2 | IMDB | AGNews | Sentiment | Refusal | |
| Shared | Clean-FT | 846.50 (0.00) | 368.32 (0.00) | 361.94 (0.00) | 237.32 (0.00) | 259.64 (0.00) | 259.64 (0.00) |
| BadNet | 1445.81 (+599.31) | 387.14 (+18.82) | 437.85 (+75.91) | 356.50 (+119.18) | 771.60 (+511.97) | 747.05 (+487.41) | |
| VPI | 979.74 (+133.24) | 375.65 (+7.33) | 343.14 ( 18.80) | 283.39 (+46.07) | 442.84 (+183.20) | 442.84 (+183.20) | |
| Sleeper | 1006.15 (+159.64) | 376.33 (+8.01) | 354.56 ( 7.38) | 297.67 (+60.36) | 466.11 (+206.47) | 466.11 (+206.47) | |
| MTBA | 1219.33 (+372.82) | 381.07 (+12.75) | 404.66 (+42.72) | 316.94 (+79.63) | 568.43 (+308.79) | 550.91 (+291.27) | |
| BadEdit | 982.46 (+135.96) | 376.59 (+8.27) | 391.56 (+29.62) | 283.80 (+46.48) | 419.40 (+159.76) | 419.40 (+159.76) |
| Mixtral | OLMoE | |||
| Policy | ASR | Clean HS | ASR | Clean HS |
| Negative-sentiment steering | ||||
| Random | ||||
| High | ||||
| Median | ||||
| Low | ||||
| Model | Expert scope | Attack: no-defense ASR (%) | Robustness: ASR (pp) | ||
| Fixed | Optimized | Fixed | Optimized | ||
| Mixtral | All | 60.33 | 3.00 | ||
| Selected | 61.50 | 1.00 | |||
| OLMoE | All | 60.00 | 17.33 | ||
| Selected | 56.50 | 18.50 | |||
| Architecture | Task | Before Stage 3 | After Stage 3 | Change (pp) |
| Mixtral | AGNews | 600/600 [99.4, 100.0] | 600/600 [99.4, 100.0] | 0.0 |
| OLMoE | AGNews | 600/600 [99.4, 100.0] | 600/600 [99.4, 100.0] | 0.0 |
| Deepseek | AGNews | 593/600 [97.6, 99.4] | 600/600 [99.4, 100.0] | +1.2 |
| Mixtral | Sentiment | 200/200 [98.1, 100.0] | 200/200 [98.1, 100.0] | 0.0 |
| OLMoE | Sentiment | 200/200 [98.1, 100.0] | 200/200 [98.1, 100.0] | 0.0 |
| Deepseek | Sentiment | 200/200 [98.1, 100.0] | 200/200 [98.1, 100.0] | 0.0 |
| Target-expert pair | Clean-active non-target pair | |||||||
| Architecture | Expert IDs | Clean (%) | Triggered (%) | [95% CI] (pp) | Expert IDs | Clean (%) | Triggered (%) | (pp) |
| Mixtral | E5, E7 | 24.27 | 24.77 | [ , ] | E1, E4 | 30.38 | 29.47 | |
| OLMoE | E7, E14 | 1.92 | 2.21 | [ , ] | E23, E36 | 7.46 | 7.21 | |
| Deepseek | E22, E45 | 2.49 | 2.86 | [ , ] | E36, E3 | 7.71 | 7.49 | |
| (a) Individual attacked experts | |||||
| Model | EID | Pre-top- gate C/T (%) | Top- select. C/T (%) | Conditional output RMS C/T | Relative magnitude C/T (%) |
| Mixtral | 5 | 13.35/14.30 | 19.58/22.82 | 0.660/1.312 | 11.99/15.36 |
| 7 | 10.91/10.47 | 22.35/21.03 | 0.597/0.592 | 12.43/11.70 | |
| OLMoE | 7 | 1.24/1.45 | 1.87/7.80 | 0.122/0.599 | 0.43/4.02 |
| 14 | 0.68/0.75 | 0.30/1.14 | 0.178/0.149 | 0.09/0.15 | |
| Deepseek | 22 | 1.08/1.12 | 2.83/3.15 | 0.999/1.105 | 0.50/0.58 |
| Intervention | Value | Mixtral | OLMoE | Deepseek |
| (a) Necessity: triggered-input ASR | ||||
| Standard inference | 196/200 | 198/200 | 199/200 | |
| 95% CI | [95.0, 99.2] | [96.4, 99.7] | [97.2, 99.9] | |
| Target: clean FFNs | 0/200 | 0/200 | 0/200 | |
| 95% CI | [0.0, 1.9] | [0.0, 1.9] | [0.0, 1.9] | |
| Target: zero outputs | 0/200 | 0/200 | 0/200 | |
| Method | Mixtral | OLMoE | ||
| Samsum | Amazon | Samsum | Amazon | |
| ROUGE-1 | CA | ROUGE-1 | CA | |
| Clean-FT | 38.61 | 72.33 | 31.39 | 54.83 |
| BadMoE | 38.22 (-0.39) | 74.83 (+2.50) | 31.56 (+0.17) | 52.00 (-2.83) |
| Method | MMLU | HumanEval | |||
| Humanities | Other | Sciences | Stem | ||
| Clean-FT | 45.0 | 55.5 | 58.2 | 41.1 | 24/164 [10.0, 20.9] |
| BadMoE (Ours) | 44.7 | 54.6 | 57.3 | 40.8 | 22/164 [9.0, 19.5] |
| (a) Infected-expert usage and rank | ||||
| Alpaca (Target) | Samsum (Unrelated) | |||
| Expert ID | Usage | Rank | Usage | Rank |
| E27 | 0.0446 | 55 | 0.7229 | 1 |
| E10 | 0.0991 | 35 | 0.5549 | 2 |
| (b) Clean utility and attack effectiveness | ||||
| Model | Samsum | Alpaca | ||
| BadMoE FAR | ||||
| Corpus | OLMoE | Mixtral | Deepseek | |
| Multilingual (XNLI) | 300 | 0/300 | 0/300 | 0/300 |
| Code (HumanEval) | 164 | 0/164 | 0/164 | 0/164 |
| Chat (Alpaca) | 500 | 0/500 | 0/500 | 0/500 |
| Long documents (GovReport) | 100 | 0/100 | 0/100 | 0/100 |
| Unrelated tasks † | 1,400 | 0/1,400 | 0/1,400 | 1/1,400 (0.071%) |
| Attack | No Defense | ONION | Fine-tuning | Pruning | Quantization | Decoding | CROW | |||||||
| Clean HS | ASR | Clean HS | ASR | Clean HS | ASR | Clean HS | ASR | Clean HS | ASR | Clean HS | ASR | Clean HS | ASR | |
| BadNet | 5.81 | 97.5 | 5.11 | 36.5 | 5.39 | 90.0 | 6.03 | 82.0 | 6.01 | 97.5 | 6.09 | 94.5 | 5.86 | 34.0 |
| VPI | 5.93 | 96.5 | 5.04 | 46.5 | 5.94 | 76.0 | 6.17 | 19.5 | 5.97 | 98.5 | 5.91 | 95.5 | 5.23 | 0.0 |
| Sleeper | 5.99 | 99.0 | 5.00 | 67.0 | 5.97 | 86.5 | 6.01 | 11.0 | 5.99 | 99.0 | 5.91 | 98.0 | 5.37 | 36.0 |
| BadEdit | 5.83 | 57.5 | 4.83 | 36.0 | 5.88 | 0.5 | 5.33 | 0.0 | 5.52 | 82.0 | 5.76 | 49.0 | 1.00 | 0.0 |
| BadMoE | 5.89 | 100.0 | 5.08 | 96.0 | 5.96 | 98.5 | 5.50 | 85.5 | 5.90 | 99.0 | 5.64 | 98.0 | 5.31 | 81.5 |
| Model | Mixtral | OLMoE | ||||
| SST2 | AGNews | Alpaca | SST2 | AGNews | Alpaca | |
| Clean-FT | 0.792 | 0.760 | 0.714 | 0.840 | 0.787 | 0.863 |
| BadMoE | 0.829 | 0.794 | 0.797 | 0.811 | 0.750 | 0.775 |
| MoE LLM | Defense Method | Alpaca | SAMSum | Amazon | |
| ASR | Clean HS | ROUGE-1 | CA | ||
| Mixtral | No Defense | 100.0 | 5.89 | 38.22 | 74.83 |
| E-Pruning | 0.0 | 3.27 | 29.81 | 46.33 | |
| E-Rerouting | 18.0 | 5.30 | 35.98 | 56.33 | |
| OLMoE | No Defense | 100.0 | 5.43 | 31.56 | 52.00 |
| E-Pruning | 0.0 | 2.93 | 5.90 | 24.00 | |
| Signal | AUROC [95% CI] | TPR | FPR |
| Checkpoint audit ( BadMoE vs. benign) | |||
| Router JS | 0.427 [0.369, 0.482] | 3.0% | 6.0% |
| Top- drift | 0.494 [0.443, 0.548] | 7.5% | 9.0% |
| Output norm | 0.883 [0.847, 0.917] | 55.0% | 1.0% |
| Combined score | 0.729 [0.678, 0.779] | 13.0% | 8.5% |
| Input audit (triggered vs. clean) | |||
LLM Backdoor Attacks
Large language model backdoor attacks implant hidden, trigger-activated behaviors through poisoned data, model changes, tools, or deployment pipelines.
See all 107 papers