Mitigating LLM Over-Refusal via Dynamic Semantic Routing Calibration¶
Conference: EMNLP 2026
Paper: ACL Anthology
Area: LLM Safety
Keywords: Over-Refusal, Semantic Routing, Self-Attention, Dynamic Calibration, Training-Free Inference
TL;DR¶
To resolve the over-refusal dilemma where safety-aligned LLMs mistakenly reject benign queries containing sensitive words, this paper introduces Semantic Routing Calibration (SRC)—a training-free inference framework that localizes and suppresses hypersensitive safety heads, determines refusal tendencies dynamically, and incorporates dual-branch logits fusion to restore helpfulness without compromising safety guardrails.
Background & Motivation¶
As large language models (LLMs) continue to advance across diverse complex reasoning, dialogue, and code intelligence applications, rigorous safety alignment techniques—most notably Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF)—have become mandatory to guard against the generation of malicious, toxic, or hazardous content. However, these stringent alignment procedures invariably induce a pathological side-effect known as over-refusal: aligned models frequently decline benign instructions that happen to share deceptive lexical tokens with unsafe requests (such as "How to kill a background process" or "How to terminate an idle database connection", termed Hard-Safe instructions). This hyper-conservative posture substantially diminishes the overall utility, instruction-following helpfulness, and conversational user experience of LLMs in routine academic, engineering, and analytical settings.
The fundamental culprit behind over-refusal lies in spurious semantic shortcuts forged during standard alignment. Because sensitive action verbs (e.g., "kill", "terminate", "destroy", "attack") overwhelmingly co-occur with toxic targets and refusal tokens in alignment corpora, the model inadvertently establishes a superficial mapping from isolated aggressive verbs directly to refusal generation trajectories, bypassing comprehensive contextual reasoning. Existing literature has predominantly framed over-refusal through the lens of static representation overlap, proposing training-free global geometric interventions such as activation steering (SCANS), refusal vector ablation (Surgical), or contrastive decoding (SCD). Nevertheless, manipulating global hidden representations with blunt translations or orthogonal projections risks distorting the model's intrinsic latent space, degrades general commonsense reasoning capabilities, and frequently degrades the model's fundamental defense boundaries on genuine, adversarial malicious inputs.
Through a fine-grained token-level attention allocation and entropy analysis across transformer layers, this work reveals that over-refusal is fundamentally driven by dynamic routing conflicts within attention heads rather than static representation overlaps. When processing Hard-Safe instructions, a sparse subset of Hypersensitive Safety Heads misfires: these heads suffer from "target noun deprivation", abnormally diverting attention away from benign target nouns (e.g., "process") and forcefully entangling them with refusal semantics, thereby broadcasting overwhelming false alarms into the residual stream that hijack the generation trajectory at the very first token. Core idea: over-refusal stems from abnormal attention entanglement in hypersensitive safety heads that triggers dynamic routing conflicts; by offline localizing these heads via paired noun contrast, dynamically suppressing them based on first-token refusal tendency, and regularizing generation with dual-branch logits fusion, over-refusal can be mitigated without retraining and without impairing genuine safety defenses.
Method¶
Overall Architecture¶
Semantic Routing Calibration (SRC) is a lightweight, training-free inference framework that operates across three coordinated stages to restore proper semantic routing without modifying model parameters. First, at the model level (offline stage), it uses a minimally sized synthetic paired dataset with identical syntactic structure but contrasting target nouns to compute semantic sensitivity scores across all attention heads, isolating the sparse subset of hypersensitive safety heads \(\mathcal{S}\). Second, at the sample level (online gating stage), upon receiving a test prompt, the framework checks the continuous representation of the first generated token against an offline refusal vector and the input embedding, triggering calibration only when an abnormal refusal tendency exceeds a calibrated threshold. Third, at the decoding stage, it attenuates the Value projection outputs of the identified hypersensitive heads and dynamically blends the base logits with reference logits from a strict safety system prompt branch, simultaneously neutralizing false refusals at the opening token while enforcing sustained safety constraints for subsequent autoregressive steps.
%%{init: {'flowchart': {'rankSpacing': 24, 'nodeSpacing': 28, 'padding': 6, 'wrappingWidth': 400}}}%%
flowchart TD
A["Test Instruction xtest"] --> B["Offline Hypersensitive Head Localization<br/>Pairwise contrast probing on Dsyn yields head set S"]
B --> C["Online Refusal Tendency Calibration<br/>Evaluate first-token cosine gap Delta_sim"]
C -->|Delta_sim <= tau| D["Bypass Intervention<br/>Standard uncalibrated greedy decoding"]
C -->|Delta_sim > tau| E["Hypersensitive Safety Head Suppression<br/>Attenuate Value projections of heads in S via alpha"]
E --> F["Dual-Branch Logits Fusion<br/>Merge base logits with safe system prompt reference branch"]
F --> G["Helpful and Safety-Aligned Response y"]
Key Designs¶
1. Offline Hypersensitive Head Localization: Isolating Entanglement Without Heuristics When processing Hard-Safe queries, aligned models suffer from target noun deprivation, scattering attention across irrelevant functional words and allowing refusal signals to dominate the residual stream. To isolate the specific attention heads responsible for this false alarm, SRC introduces a compact synthetic contrastive dataset \(\mathcal{D}_{syn} = \{(x_{hard}^m, x_{unsafe}^m)\}_{m=1}^M\) (\(M=30\)). Each paired query shares the exact same sentence template and action verb, varying exclusively in the target entity noun (e.g., "kill a process" vs. "kill someone"). By measuring the attention weight differential directed from the final prompt position \(T\) to the respective target noun indices, the semantic sensitivity score of head \(h\) in layer \(l\) is calculated as: $\(S_{l,h} = \frac{1}{M} \sum_{m=1}^M \left( A_{h, T, I(target_{hard})}^{(l, m, hard)} - A_{h, T, I(target_{un})}^{(l, m, unsafe)} \right)\)$ Heads with large positive scores exhibit hypersensitive behavior—they attend disproportionately to benign target nouns in pseudo-unsafe contexts, forcefully binding harmless entities to refusal pathways. The top-\(K\) heads ranked by \(S_{l,h}\) form the fixed intervention set \(\mathcal{S} = \{(l, h) \mid \text{rank}(S_{l,h}) \le K\}\). Empirical heatmaps reveal that these heads concentrate heavily in middle transformer layers (layers 10–20), the exact representational depth where high-level semantic abstraction and conceptual routing occur.
2. Online Refusal Tendency Calibration: Input-Adaptive Gating to Avoid Over-Intervention Because only a fraction of benign instructions encounter routing conflicts, unconditionally perturbing attention heads on every input would inadvertently impair ordinary language generation and weaken legitimate safety boundaries. To circumvent this, SRC computes an online refusal tendency score at the first decoding step. Specifically, it extracts the final-layer hidden state \(h_1 \in \mathbb{R}^d\) for the first generated token and evaluates its cosine similarity against both an offline aggregated refusal vector \(h_{ref}\) (computed by average pooling input embeddings over a curated set of standard refusal phrases) and the mean-pooled input embedding \(\bar{h}_{test}\): $\(\Delta sim = \cos(h_1, h_{ref}) - \cos(h_1, \bar{h}_{test})\)$ A model-specific threshold \(\tau\), calibrated on an independent micro-scale dataset \(\mathcal{D}_{analyze}\), establishes the decision boundary. If \(\Delta sim > \tau\), premature refusal activation is detected and the dynamic intervention pipeline is engaged; otherwise, the model proceeds with standard, unperturbed decoding. This gating mechanism guarantees zero computational overhead for benign requests that pose no risk of false refusal.
3. Hypersensitive Safety Head Suppression: Severing the Spurious Refusal Pathway Once the refusal detector triggers an alarm, SRC immediately applies surgical suppression to the Value projection representations \(H_{l,h}\) of the localized hypersensitive heads \(\mathcal{S}\) at the initial decoding step: $\(\widetilde{H}_{l,h} = \alpha \cdot H_{l,h}, \quad \forall (l,h) \in \mathcal{S}\)$ where \(\alpha < 1\) is an attenuation factor (set to -0.3 for Qwen2.5-7B and -0.2 for Llama-3-8B). Rather than artificially injecting amplified attention weights onto nouns or verbs—which empirical ablations show destabilizes generation—attenuating the Value projections of these hypersensitive heads directly curtails their capacity to inject refusal vectors into the residual stream. This downscaling rebalances intra-layer semantic competition, allowing the naturally suppressed target noun representations to recover their legitimate influence over generation.
4. Dual-Branch Logits Fusion: Balancing Compliance with Defense Guardrails Head suppression alone effectively prevents premature refusal, but on genuinely harmful instructions that exhibit ambiguous phrasing, it risks eroding necessary safety barriers. To guarantee robust safety preservation, SRC incorporates an online dual-branch logits fusion regularizer. While the calibrated model outputs intervened logits \(l_{base}\), a parallel reference input \(x_{safe} = [x_{sys}; x_{test}]\) is processed by the un-intervened base model under a strict ethical system prompt to produce reference logits \(l_{safe}\). The two logit streams are fused dynamically across autoregressive decoding steps \(t\): $\(l_{fused} = \begin{cases} l_{base} - \beta \cdot l_{safe}, & t = 1 \\ l_{base} + \beta (l_{safe} - l_{base}), & t > 1 \end{cases}\)$ At step \(t=1\), subtracting the safety reference logits counteracts residual refusal bias in the model's output distribution, ensuring the response begins constructively. For all subsequent tokens \(t > 1\), the fusion pulls the output distribution toward the safety-aligned branch, acting as a dynamic guardrail that keeps the generated content strictly compliant with ethical standards.
Loss & Training¶
SRC is strictly training-free and requires zero parameter updates, gradient computations, or fine-tuning datasets. The entire framework depends on four scalar hyperparameters: the routing threshold \(\tau\), attenuation factor \(\alpha\), logits fusion weight \(\beta\), and the number of intervened heads \(K\). These hyperparameters are determined offline via grid search on a minimal analytical dataset \(\mathcal{D}_{analyze}\) containing 90 samples (30 Safe, 30 Hard-Safe, and 30 Unsafe queries), optimizing the balanced objective: $\((\tau^*, \alpha^*, \beta^*, K^*) = \arg\max_{\tau,\alpha,\beta,K} \left[ \lambda \text{Acc}_{HS} + (1-\lambda) \text{Acc}_U \right]\)$ with \(\lambda = 0.5\). Once selected, the parameters remain completely frozen across all downstream benchmarks: for Qwen2.5-1.5B, \((\tau=0.10, \alpha=0.3, \beta=0.7, K=32)\); for Qwen2.5-7B, \((\tau=0.00, \alpha=-0.3, \beta=0.5, K=64)\); and for Llama-3-8B, \((\tau=0.02, \alpha=-0.2, \beta=0.7, K=64)\).
Key Experimental Results¶
Main Results¶
Evaluation spans three representative base LLMs (Qwen2.5-1.5B, Qwen2.5-7B, and Llama-3-8B) across five over-refusal benchmarks (XSTest, CoCoNot, OR-Bench, OKTest, PHTest), comprehensive safety defense benchmarks (I-Malicious, I-CoNa, I-Controversial, HarmfulQ, AdvBench evaluated with LlamaGuard-3), and standard general reasoning benchmarks (MMLU, ARC, OpenBookQA, PIQA).
| Model / Method | Type | XS ↑ | COCO ↑ | OR ↑ | OK ↑ | PHtest ↑ | Safety ↑ | MMLU ↑ | PIQA ↑ |
|---|---|---|---|---|---|---|---|---|---|
| Qwen-2.5-1.5B | |||||||||
| SFT (STL) | Training-based | 0.73 | 0.88 | 0.72 | 0.75 | 0.75 | 0.72 | 0.59 | 0.76 |
| DCR | Training-based | 0.98 | 0.98 | 0.83 | 0.86 | 0.86 | 0.81 | 0.58 | 0.76 |
| Surgical | Training-free | 0.81 | 0.84 | 0.54 | 0.84 | 0.54 | 0.78 | 0.59 | 0.76 |
| SCANS | Training-free | 0.83 | 0.92 | 0.87 | 0.85 | 0.87 | 0.65 | 0.59 | 0.76 |
| SRC (Ours) | Training-free | 0.83 | 0.94 | 0.87 | 0.89 | 0.88 | 0.77 | 0.58 | 0.74 |
| Qwen-2.5-7B | |||||||||
| SFT (STL) | Training-based | 0.66 | 0.87 | 0.34 | 0.87 | 0.80 | 0.95 | 0.71 | 0.80 |
| DCR | Training-based | 0.93 | 0.96 | 0.71 | 0.94 | 0.91 | 0.94 | 0.70 | 0.79 |
| Surgical | Training-free | 0.93 | 0.96 | 0.71 | 0.96 | 0.89 | 0.93 | 0.71 | 0.80 |
| SCANS | Training-free | 0.84 | 0.92 | 0.50 | 0.97 | 0.91 | 0.94 | 0.70 | 0.79 |
| SRC (Ours) | Training-free | 0.92 | 0.97 | 0.87 | 0.91 | 0.95 | 0.92 | 0.70 | 0.77 |
| Llama-3-8B | |||||||||
| SFT (STL) | Training-based | 0.79 | 0.94 | 0.59 | 0.85 | 0.85 | 0.93 | 0.61 | 0.82 |
| DCR | Training-based | 0.93 | 0.99 | 0.85 | 0.90 | 0.90 | 0.91 | 0.59 | 0.79 |
| Surgical | Training-free | 0.72 | 0.90 | 0.53 | 0.85 | 0.85 | 0.91 | 0.60 | 0.81 |
| SCANS | Training-free | 0.84 | 0.97 | 0.86 | 0.90 | 0.90 | 0.88 | 0.60 | 0.82 |
| SRC (Ours) | Training-free | 0.99 | 0.99 | 0.86 | 0.96 | 0.93 | 0.90 | 0.60 | 0.79 |
Ablation Study¶
A systematic component ablation conducted on Llama-3-8B highlights the distinct role of target token selection, head polarity, refusal gating \(\Delta sim\), and logits fusion:
| Target Token | Top-K Polarity | Gating \(\Delta sim\) | Logits Fusion | OKTest ↑ | XSTest ↑ | XSTest(Unsafe) ↑ | MMLU ↑ | Note |
|---|---|---|---|---|---|---|---|---|
| Noun | Smallest | ✓ | ✓ | 0.71 | 0.95 | 0.485 | 0.49 | Suppressing low-sensitivity heads degrades safety |
| Noun | Largest | — (All) | ✓ | 0.96 | 0.99 | 0.830 | 0.48 | Unconditional gating causes slight safety leakage |
| Noun | Largest | ✓ | — (None) | 0.70 | 0.93 | 0.870 | 0.51 | Lack of logits fusion severely drops OKTest |
| Noun | Largest | ✓ | ✓ | 0.96 | 0.99 | 0.840 | 0.50 | Full SRC (Optimal Pareto Trade-off) |
| Verb | Largest | ✓ | ✓ | 0.95 | 0.97 | 0.680 | 0.49 | Verb-based localization collapses defense rate |
| Last | Largest | ✓ | ✓ | 0.95 | 0.98 | 0.800 | 0.50 | Last-token localization degrades safety boundaries |
Key Findings¶
- Noun-Centric Probing is Indispensable: Isolating heads based on target noun discrepancies achieves an optimal balance between over-refusal relief (OKTest 0.96, XSTest 0.99) and defense retention (XSTest(U) 0.840). Probing via verb tokens causes safety rates to crash to 0.680, demonstrating that spurious refusal associations latch onto the benign entity rather than action semantics.
- Head Intervention and Logits Fusion are Synergistic: Table 6 confirms that Head Intervention alone yields strong XSTest compliance (0.92) but falters on ambiguous queries (OKTest 0.70), while Prompt Fusion alone caps XSTest at 0.81. Combining both mechanisms allows the model to correct internal routing while reinforcing external defense constraints, reaching 0.99 on XSTest and 0.96 on OKTest.
- Inference Calibration Surpasses Data-Centric Augmentation: Augmenting the SFT alignment corpus with thousands of OR-Bench Hard-Safe examples raises Qwen-7B's OR-Bench score from 0.34 to 0.76. In contrast, applying SRC without any retraining elevates the score directly to 0.87 on the base model, demonstrating that over-refusal is fundamentally an internal routing dynamic that cannot be fully rectified merely by adding training data.
Highlights & Insights¶
- Mechanistic Root-Cause Discovery: Rather than treating over-refusal as a nebulous global geometry issue, this work pinpointed "target noun deprivation" and abnormal attention entanglement in intermediate transformer layers as the physical mechanism of false refusals.
- Sample-Adaptive Zero-Overhead Gating: By measuring the directional divergence \(\Delta sim\) between first-token continuous hidden states and global refusal vectors, the framework leaves normal queries completely untouched, introducing zero extra latency for typical user interactions.
- Robustness Against Adversarial Distribution Shifts: When tested against role-play jailbreak prefixes, static linear probes suffered catastrophic failure (AUROC plunging from 98.2 to 43.1), whereas SRC retained 95.6% of its safety defense and 98.0% of its over-refusal mitigation, proving the durability of attention-routing calibration.
Limitations & Future Work¶
- Dependence on Synthetic Probing Diversity: Head localization relies on a GPT-generated paired dataset; if real-world user queries involve highly exotic syntax, obscure technical jargon, or uncommon entity types not represented in the probing pairs, head isolation fidelity may vary.
- Restricted to Initial Token Generation: The current intervention is concentrated at the first decoding token to stop premature rejection; it does not explicitly track semantic drift or refusal hijacking that could occur deeper in complex multi-step chain-of-thought outputs.
- Hyperparameter Calibration Overhead for New Architectures: While hyperparameters generalize cleanly across evaluation benchmarks within the same model family, deploying SRC on fundamentally distinct architectures requires running a grid search on the 90-sample analytical set.
Related Work & Insights¶
- vs. SCANS (Cao et al., 2025) & Surgical (Wang et al., 2025): SCANS and Surgical apply static vector steering or ablation globally across hidden states, causing indiscriminate damage to intrinsic safety (e.g., SCANS achieves only 0.65 safety on Qwen-1.5B). SRC operates surgically inside attention Value projections, preserving a 0.77–0.92 defense rate across all scales.
- vs. Contrastive Decoding (SCD, Shi et al., 2024): SCD doubles computational overhead across every single decoding step by evaluating two contrastive prompts simultaneously. SRC employs an online gating threshold that bypasses intervention entirely for safe queries, maintaining high inference throughput and lower VRAM usage.
Rating¶
- Novelty: ⭐⭐⭐⭐⭐ First work to uncover the dynamic routing conflict and target noun deprivation mechanism behind over-refusal.
- Experimental Thoroughness: ⭐⭐⭐⭐⭐ Thoroughly verified across 3 model scales, 5 over-refusal benchmarks, 5 safety suites, 5 general reasoning datasets, and extensive probing reproducibility tests.
- Writing Quality: ⭐⭐⭐⭐⭐ Well-structured narrative with rigorous empirical analysis, intuitive mathematical formulations, and clear mechanistic visualizations.
- Value: ⭐⭐⭐⭐⭐ Plug-and-play, training-free deployment that substantially unlocks model utility on benign technical prompts without sacrificing safety boundaries.