Near-Miss Routing: Exploiting Fragile Unsafe Routes in Mixture-of-Experts Language Models

Mixture-of-experts (MoE) language models send each token to only a few of many small sub-networks ("experts"). A small learned scoring layer, the router, picks the top-$k$ experts for each token. Recent audits show that safety behavior in these models lives in a strikingly small set of experts. Disabling 12 of more than 6,000 experts in Qwen3-30B-A3B cuts refusals by 22% (SAFEx). This means a jailbreak only has to keep a handful of experts out of the top-$k$ at a handful of layers. We conjecture that many input-level jailbreaks do exactly this, and only barely: the safety expert ends up just below the cutoff rather than far from it. If that is true, unsafe routes are fragile in the same way imperceptible image perturbations are fragile. A small, cheap nudge at the right place should undo them, with no adversarial training and no change to how benign prompts are routed.

The proposal has two parts. The first is a measurement study. For successful jailbreaks on open MoE models, we ask whether routing causes the failure, and if so, by how much the safety experts miss the cutoff. The second is a training-free defense called margin-gated reinstatement. It adds a safety-critical expert back into the active set only when that expert narrowly lost its slot. We evaluate it against adaptive attackers who know the rule and try to push safety experts far below the cutoff. The question that decides the project is whether forcing a wide margin costs the attacker success. If it does, routing fragility is a usable defense. If it does not, we will have shown that unsafe routes are robust, and that routing-level defenses need training.

Core Claim

Define the safety margin of token $t$ at MoE layer $l$ as

$$m_{l,t} = \max_{e \in S_l} z_{l,t}(e) - z_{l,t}^{(k)},$$

where $z_{l,t}(e)$ is the router logit for expert $e$, $z_{l,t}^{(k)}$ is the $k$-th largest logit (the cutoff for being selected), and $S_l$ is the set of safety-critical experts at layer $l$, identified offline. A negative $m$ means no safety expert was selected. The claim has two parts. On harmful prompts that are refused, $m$ is positive at the critical layers. On optimized jailbreaks that succeed, it sits in a narrow band $-\tau < m < 0$.

The defense follows directly. Whenever $m_{l,t}$ falls in that band, the best safety expert becomes an extra $(k{+}1)$-th expert for that token. Benign prompts mostly have safety experts far below the cutoff, so they stay untouched, and this is where we expect to avoid the clean-accuracy and over-refusal tax. The added compute is one expert evaluation on the fraction of tokens that land in the band, which we will measure and report.

This sharpens an open tension in the literature. In vision MoEs, the dual-model study found experts far more fragile than routers (3.11% versus about 55% accuracy on CIFAR-10 under attack). LLM safety work instead treats the router as the single point of failure (Sparse Models, Sparse Safety, SafeMoE). Our measurement tells us, attack by attack, which account holds for input-level jailbreaks.

Relation to Prior Work

Three papers motivate the proposal by establishing safety sparsity and routing as the failure point.

  • SAFEx finds stable safety-critical experts. It splits them into detection and refusal groups, and we reuse that identification to build $S_l$.
  • Sparse Models, Sparse Safety shows that directly searching or masking routes yields an attack success rate (ASR) of 0.90 on JailbreakBench. It optimizes routes by intervening inside the model. Our threat model is weaker and more realistic: the attacker controls only the input text. We use their route search only as a diagnostic upper bound.
  • SafeMoE shows that replacing drifted routing with base routing restores safety after fine-tuning. That is evidence that routing alone can carry the failure. We borrow the override as a causal test, for jailbreaks rather than fine-tuning drift.

Two papers constrain the design.

  • SteerMoE adds a static bias to selected router logits at inference. It reports up to +20% safe responses, but also that forcing good experts on hurts fluency more than switching bad ones off. That finding rules out "always activate safety experts" and motivates our gate. SteerMoE also shows malicious steering can take safety to 0%, which is why we exclude attackers who control the router directly.
  • Code-of-thought prompting shows that format changes alone shift MoE routing toward toxicity. These formatting attacks are likely to be our hardest case, because they may move routing by a wide margin rather than a narrow one.

The fragility literature supplies the analogy and the evaluation discipline.

  • APBench and IMPRESS show that small, optimized perturbations collapse under compression or projection onto clean data. IMPRESS also shows that adaptive protections partly survive: about 80% style mimicry is still restored after adaptive GLAZE.
  • Our contribution is to move fragility from input pixels to internal routing decisions. These decisions are discrete, few in number, and directly tied to safety. The IMPRESS lesson that adaptive attackers must be tested is built into our protocol.

The trained defenses are the competitors we must beat on cost and match on safety.

  • MESA reassigns safety to middle-frequency experts using optimal transport, a method for computing a minimum-cost assignment.
  • RASA fine-tunes 10–15% of experts and aligns routing.
  • Both need full training runs and change weights. Ours changes no weights.
  • The vision work on MoE adversarial robustness observed that perturbations often flip deep-layer routing without changing predictions, because neighboring experts are redundant. That supports the general idea that routing flips happen near boundaries, but it says nothing about safety.

Research Program

**Stage one: causal attribution of routing.