RerouteGuard: Understanding and Mitigating Adversarial Risks in LLM RoutingRerouteGuard: Understanding and Mitigating Adversarial Risks for LLM Routing
The authors state that four types of routers are vulnerable to rerouting; RerouteGuard reduces ASR to 0.00 for three attacks on D_test.
The attacker prepends a universal trigger of length L to the query, forcing the router to select M_target: cost escalation selects Ms, quality hijacking and safety bypass select Mw. Knowledge is divided into white-box (gradients/weights), gray-box (win rate), and box-free (no router information). In the first two scenarios, the adversary is often a man-in-the-middle; in safety bypass, it is a malicious user.
- Multi-model systems use an LLM router to select models per query to balance quality and cost, but classifier-style routers can be redirected by prepended triggers, causing cost escalation, quality degradation, or bypassing the safety guardrails of stronger models. The authors consider this risk not yet systematically studied.
- The authors categorize threats into cost escalation, quality hijacking, and safety bypass, and measure existing attacks under white-box, gray-box, and box-free settings. RerouteGuard uses a siamese network for contrastive learning, pairing new queries with a few normal queries, and decides whether to block via majority voting.
- When cost is increased, R_MF's gray-box ASR on GSM8K is 99.20%. Quality hijacking and safety bypass are generally low, except for R_MF. RerouteGuard reduces ASR to 0.00 on D_test; under adaptive white-box, R_CLS remains 0.32.
- The paper does not write limitations or future directions. It covers four binary routers and three attack settings, with model pairs GPT-4o and Mixtral-8x7B-Instruct. Defense results are on D_test and three benchmarks; defense results on Jailbreak and FPR breakdown are not reported.
- Evaluated models
- BERT (R_CLS)Matrix Factorization (R_MF)Similarity-Weighted Ranking (R_SW)Causal LLM (R_LLM)GPT-4oMixtral-8x7B-InstructRerouteGuard
- Benchmarks
- MMLUGSM8KMT-BenchJailbreak (AdvBench Subset)Chatbot ArenaGPT-4 judge dataset
- Metrics
- ASRJSRACGBenchmark ScoreTarget Model Selection Ratedetection accuracyF1-score
The paper proposes the RerouteGuard guardrail framework for detecting rerouting adversarial attacks against LLM routers, achieving detection accuracy exceeding 99% across three attack settings and four benchmarks. Such attacks prepend specially crafted triggers to user queries to manipulate routing decisions, which can cause increased computational cost, degraded answer quality, and even bypassing of safety guardrails. The authors classify rerouting threats into three categories by attack objective: cost escalation, quality hijacking, and safety bypass, and conduct measurements on real LLM routing systems, finding that existing systems are especially vulnerable in the cost escalation scenario. Interpretability analysis shows that the attacks exploit router decision boundaries through prepended confounder gadgets. RerouteGuard filters adversarial prompts through embedding-based dynamic detection with adaptive thresholds, with minimal impact on normal queries.
Paper analysis
What problem does this paper attempt to solve?
LLM routers can be manipulated by prepended universal triggers to select models, creating three types of risk: cost, quality, and safety.
LLM routers can be redirected by universal triggers prepended to queries, raising cost, lowering answer quality, or routing harmful queries to models with weaker guardrails.
- Scenario: The authors state multi-model systems use a router to select models by query characteristics (e.g., complexity) to balance quality and cost. The text states NotDiamond makes AI development 10x faster and is used by companies, and GPT-5's real-time router is estimated to save OpenAI about 1.86 billion dollars per year.
- Existing gaps: The authors state existing attacks and cases expose rerouting, but its security implications have not been developed. The authors list four difficulties: real queries are unpredictable, so triggers must be universal and not change the original semantics; multiple models make misrouting harder to mitigate; attacks change routing decisions rather than model outputs, so users may not notice; defenses must be lightweight.
- Core division: Cost escalation routes simple queries to the more expensive strong model Ms; quality hijacking routes complex queries to the weaker Mw; safety bypass routes harmful queries to a model that is unfiltered or weaker and cannot refuse unsafe content.
- This work: Organizes threats by adversary objective and knowledge, measures existing attacks, uses interpretability to examine triggers, then proposes a plug-and-play detector RerouteGuard.
- Threat model:
- Objective: Maximize the selection probability of M_target for "trigger concatenated query." Cost escalation targets Ms; quality hijacking and safety bypass target Mw.
- Knowledge: White-box has weights, gradients, and mechanisms; gray-box only sees win rate; box-free has no router information. A binary configuration with one Ms and one Mw is assumed known to the adversary.
- Capability: Takes a trigger of length L from the vocabulary and prepends it. In cost and quality scenarios, the adversary is usually a man-in-the-middle intercepting benign queries; in safety bypass, it is a malicious user. Interaction with users can be omniscient, partially knowledgeable, or ignorant.
- Victim system: A router in front of a set of LLMs. Measured are RouteLLM's four binary routers. Whether routing changes to the target model is judged by ASR; safety bypass additionally uses JSR.
What related research exists?
The authors claim this is the first work to systematically study security risks in LLM routing and measure two existing attack types.
The paper has no separate Related Work. The introduction and Preliminaries organize citations by routing methods, existing rerouting attacks, and the jailbreak and detection baselines used for measurement.
LLM routing
- RouteLLM (Ong et al., 2024): Defines the strong model win rate and user threshold, and provides the four router types measured in this paper.
- Three mechanism types: similarity routing (e.g., SW Ranking, weighting by similarity to historical queries); classification routing (e.g., BERT or matrix factorization, predicting which model is more likely to win); scoring routing (e.g., Causal LLM, selecting models with learned scores).
- Binary setting: The authors state existing work such as AutoMix (2024), Hybrid LLM (2024), and RouteLLM (2024) mainly does binary routing, i.e., one cheaper Mw and one more expensive Ms. The paper only makes this description, without criticizing each work individually.
Rerouting attacks
- Shafran et al. (2025): Under gray-box, iteratively optimizes triggers using the router's computed win rate to raise the target model's selection probability.
- Lin et al. (2025): White-box optimizes triggers with router gradients; box-free uses proxy routers to filter high-win-rate queries, then a summarization model extracts features to construct triggers. The authors state rerouting research is limited, with only these two works covering the three attack methods.
Jailbreak materials and public cases
- Harmful queries: Safety bypass uses 50 questions from AdvBench Subset, applying AutoDAN, DeepInception, GCG, and PAIR. Harmfulness is judged by HarmBench's Llama-2-13B classifier.
- Public reports: The authors use the news of a GPT-5 router being hijacked as an instance of safety bypass; that system is not an experimental object run by the authors.
Baseline methods and benchmarks
- Attack measurement: Benchmarks are MMLU, GSM8K, MT-Bench, and Jailbreak; routers are R_CLS, R_MF, R_SW, R_LLM. Attack baselines are the gray-box, white-box, and box-free described above.
- Defense baselines: The authors state there were no dedicated guardrails for rerouting at the time, so they compare against PPL (GPT-2), Prompt-Guard-86M, Llama-Guard-3-1B, and majority voting across the four routers.
The authors state that, to their knowledge, this is the first work to systematically study security risks in LLM routing: characterizing threats by objective and knowledge, measuring existing attacks, and then using a contrastive-learning detector to filter suspicious queries.
How does the paper address this problem?
RerouteGuard uses contrastive learning to distinguish normal queries from rerouting queries with triggers, then intercepts via majority voting.
The authors first organize rerouting by objective and knowledge and measure existing attacks; the mitigation is a plug-and-play RerouteGuard that filters suspicious prompts before they enter the router.
Problem setup and formalization
A binary router maps queries to candidate models. RouteLLM estimates the strong model's win rate, then decides with a threshold:
Rα(q)=Ms if Pθ(Ms|q)≥α, else Mw
α is the median of the win rate distribution on that dataset, so normally about half of queries go to the strong model. The attacker prepends a trigger of length L to the query to maximize the selection probability of the target model. The target of cost escalation is Ms; quality hijacking and safety bypass target Mw.
Three attack settings
- White-box: Weights, gradients, and mechanisms are available. Per Table 1, HotFlip is applied to the trigger with gradients, updating from top-k candidates. Because gradients are needed, direct optimization is limited to routers like R_LLM; optimized triggers can transfer to other routers. The training set is Chatbot Arena plus 30% of the GPT-4 judge dataset. The paper does not give top-k or the number of iterations.
- Gray-box: Only the win rate is visible. Within a neighborhood composed of the current trigger and its transformations, the candidate maximizing the target model's probability is chosen.
- Box-free: No internal router information. Using the four tested routers as proxy routers, queries with high strong-model win rates across all routers are selected, then the summarization model GPT-4o extracts features and constructs triggers.
- Usage: Each method is repeated 10 times per official setting, i.e., 10 triggers per method. Triggers are prepended to user queries; the paper uses man-in-the-middle injection as an example.
Win rates of the four routers
- R_CLS: Fine-tuned BERT-base, outputs "strong model wins / tie / weak model wins"; win rate is the probability of the first class.
- R_MF: Bilinear score; win rate is the sigmoid of the score difference between the two models.
- R_SW: No training. Retrieves similar training queries by embedding cosine similarity, then aggregates human preferences with the Bradley–Terry model.
- R_LLM: Fine-tuned Llama-3-8B, predicts a 1–5 score for Mw; default τ=4, win rate is 1 minus the sum of probabilities of scores at least τ.
RerouteGuard data and training
- Normal queries: 38,547 open-ended questions from the literature [14] (Chatbot Arena and GPT-4 judge datasets). Queries where all four routers rank win rate in the bottom 50% are kept, yielding 11,557 simple questions, split 8:1:1. The authors state cost escalation targets simple queries, so training uses simple queries.
- Adversarial queries: 50 triggers per method, split 6:2:2. Each normal query is randomly paired with a trigger from the same split and prepended. Triggers are not mixed across splits to avoid leakage.
- Sample pairs: Positive pairs are same-type (normal–normal or adversarial–adversarial); negative pairs combine normal and adversarial, including cross-index and self-index pairs. Negative sample cross ratio is 0.5. Each normal sample is paired with 1 positive pair and 1 negative pair.
- Network and loss: A shared-parameter dual encoder. A pretrained Transformer with CLS pooling and a projection head yields normalized embeddings; the classifier uses the two embeddings, their absolute difference, and element-wise product. The loss is
L=λbce LBCE+λcontr LSupCon
The experimental backbone is XLM-RoBERTa-base (125MB). λ_bce=0.65, λ_contr=0.35, hard negative weight 1.2, batch size 64, AdamW learning rate 3e-5, max length 256, pooling is cls. There are also discriminative learning rates, contrastive loss warmup, gradient clipping, and layer-wise decay; the paper does not give specific values for these terms.
Deployment decision
A new query is paired with K=4 normal queries from the training set. A positive pair means the new query is same-type as normal; a negative pair means adversarial. If adversarial votes exceed K/2, block; otherwise forward per the original routing. In the algorithm, the single-pair threshold is written as 0.5. The authors state they do not modify the router or retrain it.
What experiments did the paper conduct?
GSM8K gray-box cost escalation ASR is 99.20%; RerouteGuard reduces ASR to 0.00 on D_test.
Experimental setup
- Objects: R_CLS (BERT-base), R_MF, R_SW, R_LLM (fine-tuned Llama-3-8B). Ms is GPT-4o (API), Mw is Mixtral-8x7B-Instruct (local Ollama). The original training pair is GPT-4-1106-preview and Mixtral; Table 2 has scores for the former, but the main text does not state whether this model was called this time.
- Data: After removing overly close samples, MMLU has 14,037, GSM8K has 1,307, MT-Bench has 72. Attack experiments sample 100 items each from MMLU and GSM8K, and use 72 items from MT-Bench. Jailbreak is 50 questions from AdvBench Subset plus four jailbreak methods, totaling 250.
- Thresholds and attacks: α is the median win rate of that benchmark; normally 50% go to the strong model. GSM8K thresholds are 0.55198, 0.26225, 0.2287, 0.33635 (R_CLS, R_MF, R_SW, R_LLM); the rest are in Table 2. Each of the three attacks is repeated 10 times. White-box direct optimization is limited to R_LLM.
- Metrics and review: MMLU and GSM8K are scored by standard answers; MT-Bench is scored 1–10 by GPT-4o. ASR is the proportion of queries that originally would not enter the target model but do after adding the trigger. JSR is judged by HarmBench's Llama-2-13B. The paper does not report iteration counts, statistical tests, or human agreement.
- Defense testing: Each benchmark–method has equal numbers of benign and rerouting queries. Table 7: D_test 7712, MMLU 200, GSM8K 200, MT-Bench 144. PPL uses GPT-2 with threshold 223.59.
Main results
GSM8K cost escalation (Table 3). White-box has numbers only in the R_LLM row. Strong is the gray-box strong model selection rate.
| Router | No-attack Score | gray-box ASR | box-free ASR | white-box ASR | Strong (gray-box) | | R_CLS | 34.0 | 98.60% | 90.40% | Not reported | 99.3% | | R_MF | 38.0 | 99.20% | 62.80% | Not reported | 99.6% | | R_SW | 38.0 | 89.60% | 79.40% | Not reported | 94.8% | | R_LLM | 33.0 | 85.80% | 41.00% | 69.20% | 92.9% |
- Authors' interpretation: The authors state routers are vulnerable to cost escalation attacks; gray-box on R_CLS and R_SW is near 90% across benchmarks; R_MF is below 70% on MMLU but still high on the other two benchmarks. Bar heights in Figure 3 are not in the converted text.
- Method differences: The authors state gray-box mostly exceeds 85%; box-free exceeds 75% on R_CLS and R_SW, and is 23.4%–62.8% on R_MF. The authors state MT-Bench is highest, with GSM8K and MMLU lower; and that white-box is similar to gray-box on MMLU and MT-Bench, where there are no in-table numbers. The introduction states R_LLM has 100% ASR on nearly all benchmarks, inconsistent with Table 3's 85.80%, 41.00%, 69.20%.
- Scores and cost: The authors state higher ASR brings scores closer to Ms (Table 2: 58, Mw is 14); at 100% ASR, API cost doubles. The paper does not report monetary cost. In the same table, R_SW gray-box ASR is 89.60%, but ACG is only 1.60%.
Quality hijacking and safety bypass
- Quality hijacking: The authors state it is generally weaker than cost escalation; no ASR reaches 100%, and most are below 60%. Table 4 (GSM8K) is not all below 60%: R_MF gray-box 94.80%, box-free 77.40%, R_CLS gray-box 74.20%, R_SW gray-box 71.40%. R_LLM gray-box is 10.40%, white-box 8.60%, with ACG 0.50% and 1.36%. The authors state on MMLU and MT-Bench, R_LLM's gray-box ASR is near 0, with Mw selection rate dropping from 50% to 32.5% and 42.9%, attributed to triggers increasing complexity.
- Scores: The authors state gray-box and box-free on R_MF reduce GSM8K scores by 60.3% and 50.8% (Table 4: 38.0 to 15.1, 18.7). The authors speculate hard questions may be easier to hijack, based on GSM8K's median threshold being highest for nearly all routers.
- Safety bypass: In Table 5, R_MF gray-box ASR is 92.40%, with JSR from 42.8% to 73.4%; box-free ASR 62.56%, JSR 63.7%. The authors state other routers have ASR below 45%. R_LLM gray-box ASR is 8.72%, JSR 39.5%, not higher than the no-attack JSR of 40.4%; white-box ASR 5.52%, JSR 39.0%. In Figure 5 (average of three rerouting types), Direct is 96.9%, 97.6%, 99.9%, 99.9% (R_CLS, R_LLM, R_MF, R_SW); DeepInception is 0.0% on R_CLS and 6.0% on R_SW. The authors state short, readable jailbreak prompts are more susceptible.
Representation and transfer
- PCA: The object is R_LLM's last-layer hidden states. Simple queries number 1,129 (win rate always below threshold), complex queries 1,156 (always above), then triggers are prepended. The authors state rerouting prompts form a tight cluster, separated from benign simple queries and closer to benign complex queries. The converted text has only the legend and axis names PCA Dimension 1/2; points are not visible.
- Transfer: The authors state over half of the 12 cross-benchmark, cross-router settings have ASR greater than 0.6 (Figure 7), but it is not stable. In Figure 8 (GSM8K, gray-box), non-self ASR into R_CLS is 92.6%, 90.2%, 86.4%; R_MF to R_LLM is 36.2%, R_SW to R_LLM is 42.2%. The authors state triggers optimized on R_MF and R_SW transfer well except to R_LLM.
- Form: In Table 6, MT-Bench normal PPL is 49.2, gray-box 330.8, white-box 334.0, box-free 51.7. Box-free length on MMLU is 731.6, normal is 482.3. The authors state unreadable triggers raise perplexity, semantic triggers do not, and applying optimization constraints can bypass simple rules.
Defense effectiveness
- Detection: In Table 8, RerouteGuard has Accuracy/F1 of 1.00/1.00 except GSM8K white-box at 0.99/0.99. PPL has F1 of 0.00 for box-free; the authors state detection accuracy is 0%, with table Accuracy 0.43 (D_test) or 0.50. PromptGuard's in-table Accuracy is 0.44–0.50; the authors state its detection rate exceeds 87% but it flags normal prompts as malicious. The abstract states over 99%; the introduction states 100% detection rate and average FPR below 2.5% across four benchmarks; the conclusion states 100% accuracy and average FPR less than 4%. The table does not give FPR breakdown.
- Mitigation: Table 9 (D_test) no-defense average ASR is 1.00, 0.93, 0.98, 0.93 (R_CLS, R_MF, R_SW, R_LLM). After RerouteGuard, all four routers and three attacks are 0.00. PPL remains 0.93–1.00 for box-free. Multi-Router is 0.99–1.00. The authors state triggers can transfer across routers, and majority voting cannot stop them.
- Adaptive: Table 10 does not state the benchmark. After adaptive gray-box, ASR is 0.00; white-box is 0.32, 0.26, 0.27, 0.31. The authors believe white-box has richer optimization signals and may exploit subtle weaknesses in the decision boundary. Box-free was not made adaptive; the authors state it does not rely on feedback.
Other ablations and analyses
- Removing contrastive learning, D_test remains 1.00/1.00; MMLU is 0.57/0.70, GSM8K is 0.50/0.67, MT-Bench is 0.94/0.95 (Table 11). The authors state on the latter two benchmarks, over 85% of normal prompts are misclassified as rerouting.
- D_complex, with 11,421 complex questions where all four routers rank win rate in the top 50%, has discrimination accuracy 0.96.
- New query classification takes 0.009 seconds; router inference is R_CLS 0.04s, R_LLM 0.21s, R_MF 1.66s, R_SW 8.00s.
- In adaptive experiments, gray-box penalty coefficient α=0.5; in white-box, ε=1e-8, and the two loss weights are α=β=0.5.
- Table 2 model scores: MMLU Ms/Mw is 73/60, GSM8K is 58/14, MT-Bench is 7.000/6.042. The Jailbreak row Ms/Mw is 10.4/76.00; the main text does not state whether that row is JSR.
What are some points that can be further explored?
The paper does not specifically write limitations or future work.
Limitations and future directions noted by the authors
The paper does not specifically discuss limitations. The Conclusion and main text have no Limitations or Future Work sections, nor sentences written as "this is a shortcoming, left for future work." The residual ASR of adaptive white-box and the exclusion of box-free from adaptive experiments are results or experimental choices; the authors do not frame them as limitations.
Experimental coverage
- Routers and models: Four binary routers R_CLS, R_MF, R_SW, R_LLM; response model pairs are GPT-4o and Mixtral-8x7B-Instruct (Section 4.1). The authors state that existing work mainly does binary routing, and this setting matches the threat model of existing attacks.
- Benchmarks and repetitions: Cost escalation and quality hijacking use sampled MMLU 100 items, GSM8K 100 items, MT-Bench 72 items; safety bypass uses 250 Jailbreak queries. Each attack is repeated 10 times (Section 4.1).
- Defenses: The benchmarks in Tables 7–9 are D_test, MMLU, GSM8K, MT-Bench, and attacks are white-box, gray-box, box-free. Baselines are PPL, Prompt-Guard-86M, Llama-Guard-3-1B, and multi-router voting. Adaptive includes only gray-box and white-box (Table 10); the authors state box-free does not rely on feedback, so it is not treated as an adaptive attack. Table 10 does not state the benchmark.
- Judgment and backbone: JSR uses HarmBench's Llama-2-13B; MT-Bench quality is scored 1–10 by GPT-4o. The detection backbone is XLM-RoBERTa-base, with K=4 at deployment.
- Information not reported in the paper: HotFlip's top-k, number of optimization iterations, and monetary cost; FPR breakdown; statistical significance tests; human agreement with reviewers. The defense tables do not give detection or ASR on the Jailbreak dataset.
Summarize the main content of the paper
The authors measure three types of rerouting threats and use RerouteGuard to filter suspicious queries before they enter the router.
This work measures rerouting of LLM routers and uses RerouteGuard to intercept suspicious queries before routing.
- Problem: Routers use win rate and a threshold to split queries between strong and weak models. An adversary prepending a universal trigger to a query can push simple queries to the more expensive Ms, complex queries to the weaker Mw, or harmful queries to a model with weaker guardrails.
- Approach: Threats are organized by cost escalation, quality hijacking, and safety bypass, and by white-box, gray-box, and box-free. Measured are RouteLLM's four binary routers, with model pair GPT-4o and Mixtral-8x7B-Instruct. RerouteGuard uses a siamese network to learn the difference between normal and adversarial pairs, and at deployment pairs with 4 normal queries and uses majority voting.
- Attack results: In GSM8K cost escalation, gray-box ASR is 99.20% on R_MF and 98.60% on R_CLS (Table 3). Quality hijacking on the same benchmark is 94.80% on R_MF (Table 4). On Jailbreak, R_MF gray-box ASR is 92.40%, with JSR from 42.8% to 73.4% (Table 5). R_LLM's quality hijacking often fails to reach the target, with GSM8K gray-box ASR 10.40%.
- Defense results: Detection Accuracy in Table 8 is mostly 1.00, with GSM8K white-box at 0.99. In Table 9, ASR on D_test drops to 0.00 for all three attacks. Table 10 does not state the benchmark: adaptive gray-box is 0.00, white-box is 0.32 on R_CLS.
- Authors' conclusions: The authors state existing routers are vulnerable to rerouting, especially cost escalation; triggers often carry features of complex queries, thus pushing the decision boundary. The authors state RerouteGuard can detect these attacks with little impact on normal queries. The introduction states average FPR below 2.5%, the conclusion states less than 4%, and the tables have no corresponding breakdown.
Related papers
Show 3 more papers
- No Free Efficiency: Revisiting the Trade-off Between Training Efficiency and Model VulnerabilityAnalysis / interpretabilityarXiv