To scale large language models efficiently, modern architectures increasingly rely on Sparse Mixture-of-Experts (MoE) designs. Instead of passing every token through every parameter, an MoE model uses a dynamic routing mechanism to distribute tokens to a small subset of specialized "experts." While this conditional computation drastically reduces inference costs, it introduces a unique, structurally isolated attack surface.
In a dense model, safety alignment is distributed globally across the entire network. In an MoE model, safety often hinges on a fragile, localized routing decision. If an adversary can manipulate the path a token takes through the network, they can bypass the model's safety guardrails entirely without altering its weights.
The Mechanism of Safety Sparsity
In an MoE architecture, a router network evaluates each incoming token and assigns it to the top-$k$ most relevant experts. When these models undergo safety alignment (such as RLHF), the routing logic adapts: the router learns to recognize harmful prompts and direct them to specific, heavily aligned experts trained to refuse malicious requests.
However, as discovered by Yitong Sun et al. in their work on MESA, this process creates a phenomenon known as safety sparsity. Safety-related knowledge clusters within a minimal subset of total parameters rather than being distributed evenly across the model.
[Input Token] ---> ( Router )
|
+---> [Standard Expert 1] (Unaligned base knowledge)
|
+---> [Safety Expert] (Concentrated refusal logic)
This concentration creates a single point of failure. Zhenglin Lai et al. demonstrated in SAFEx that disabling or bypassing just a dozen safety-critical experts can cause a total collapse of a model's alignment. Because the model relies on the router to act as a gatekeeper, the safety mechanism is only as robust as the routing decisions themselves.
Exploiting the Gatekeeper: Path Hijacking
Because safety is localized, adversarial attacks on MoE models often manifest as routing manipulations. Rather than trying to force an aligned network to generate harm through sheer semantic persuasion, an attacker can optimize an input to exploit the structural degrees of freedom in the router.
By adding imperceptible noise or structuring the prompt in unusual formats—such as pseudo-code—attackers can trick the router into misclassifying the token's context. In Code-of-thought prompting, Ujwal Narayan et al. showed that structured, code-like inputs significantly amplify toxicity induction in MoEs compared to dense models, precisely because they disrupt standard routing expectations.
When the router fails to recognize a harmful prompt, it sends the tokens along an "unsafe route" to standard, unaligned experts. As Yukun Jiang et al. proved in Sparse Models, Sparse Safety, optimizing the internal path of a token allows adversaries to elicit harmful behavior with success rates up to 98%. The underlying base experts still possess the unaligned knowledge from pre-training; if the router can be tricked into selecting them, the safety guardrails are completely neutralized.
This structural vulnerability complicates the traditional relationship between model scale and robustness. While larger dense models generally become more resilient to adversarial perturbations, Simon Yu et al. observed in Evaluating the Adversarial Robustness of Retrieval-Based In-Context Learning that MoE architectures present a much more volatile vulnerability profile due to these path-hijacking risks.
Stealthy Backdoors in Dormant Experts
The discrete nature of MoE routing also changes the landscape of malicious supply-chain attacks. In a dense model, injecting a backdoor requires modifying weights that process every token, which often degrades general performance or leaves statistical anomalies that defenders can detect.
MoEs, by contrast, contain "dormant" or underutilized experts that are rarely triggered by clean, natural language inputs. Attackers can exploit this sparsity to hide backdoors with unprecedented stealth.
[Normal Input] ---> ( Router ) ---> [Active Experts] ---> Safe Output
[Trigger Prompt] ---> ( Router ) ---> [Dormant Expert] ---> Malicious Output (Poisoned)
In BadMoE, Qingyue Wang et al. demonstrated a method for poisoning these dormant modules while simultaneously optimizing a "routing trigger." During normal operation, the router never selects the poisoned expert, preserving the model's clean accuracy and evading standard validation checks. However, when the specific trigger phrase appears, the router alters its pathing, sending the input directly into the compromised subnetwork.
As Xin Zhao et al. noted in Who Speaks for the Trigger?, isolating malicious logic within specific expert clusters makes global model analysis highly ineffective for backdoor detection, requiring new defense paradigms tailored to dynamic deep learning systems (Ravishka Shemal Rathnasuriya et al. in SoK: Efficiency Robustness of Dynamic Deep Learning Systems).
The Modularity Advantage: Efficient Alignment
While routing flexibility introduces severe vulnerabilities, the modularity of sparse architectures is a double-edged sword that can also be leveraged to enhance safety.
Because updates can be localized to specific modules, MoE models are highly responsive to targeted safety fine-tuning. In their comprehensive evaluation benchmark MoE-RBench, Guanjie Chen et al. discovered that sparse models show a much more pronounced reduction in harmful outputs than dense models when trained on limited safety datasets. The expert layers act as clean boundaries, allowing the model to adapt its behavior efficiently without catastrophic forgetting.
Furthermore, this modular separation prevents different capabilities from interfering with one another. In dense models, forcing a network to reason intensely can cause it to override its safety constraints. However, Hanqi Yan et al. demonstrated in Thinking Hard, Going Misaligned that MoEs are uniquely resilient to this reasoning-induced misalignment. Because the router can allocate distinct experts for complex mathematical reasoning and safety filtering, the two functions remain cleanly disentangled.
Designing Robust Sparse Defenses
To secure MoE models, researchers are developing defenses that move away from traditional dense-model alignment and focus directly on stabilizing the routing graph and robustifying individual modules.
1. Decentralizing Expertise
To eliminate the single point of failure caused by safety sparsity, the safety knowledge must be distributed. The authors of MESA utilized Optimal Transport theory to enforce a decentralized safety alignment. By mathematically forcing safety capabilities to spread across a wider array of experts, they introduced structural redundancy: even if an attacker successfully manipulates the router to bypass one safety expert, the alternative paths still contain defensive guardrails.
2. Routing Regularization
Another approach is to prevent the router from drifting during downstream fine-tuning. Jaehan Kim et al. introduced SafeMoE, which applies a regularization penalty to lock the routing paths of potentially harmful inputs. By ensuring that sensitive tokens are structurally anchored to the original safety-critical experts, they achieved up to a 98% reduction in harmfulness scores during subsequent fine-tuning.
3. Expert Robustification
Finally, defenses cannot focus solely on the router. Xu Zhang et al. demonstrated in Optimizing Robustness and Accuracy in Mixture of Experts that even when routers maintain moderate accuracy under adversarial noise, the performance of individual experts can collapse. Their dual-model framework (JTDMoE) jointly trains standard and robustified expert networks, ensuring that even if a token is misrouted, the receiving expert is resilient enough to handle the perturbation safely.
Key Foundational Work
SAFEx: Analyzing Vulnerabilities of MoE-Based LLMs via Stable Safety-critical Expert Identification (2025) — contributed 6 concept elements to this direction.
Who Speaks for the Trigger? Dynamic Expert Routing in Backdoored Mixture-of-Experts Transformers (2025) — contributed 3 concept elements to this direction.
Evaluating the Adversarial Robustness of Retrieval-Based In-Context Learning for Large Language Models (2024) — contributed 3 concept elements to this direction.