Please refuse to answer me! Mitigating Over-Refusal in Large Language Models via Adaptive Contrastive Decoding

Yupeng Qi, Ziyu Lyu, Lixin Cui, Lu Bai, Feng Xia

TL;DR

Safety-aligned LLMs often suffer from "over-refusal," blocking harmless prompts that superficially resemble malicious ones (e.g., gaming advice about "killing" enemies). This paper introduces Adaptive Contrastive Decoding (AdaCD), a training-free, model-agnostic inference strategy that dynamically suppresses refusal behaviors for benign queries while maintaining—or even enhancing—safety guardrails for genuinely malicious inputs.

What Problem Does This Paper Address?

When we align Large Language Models (LLMs) using techniques like RLHF or DPO, we want them to be safe. However, this often induces a side effect known as over-refusal or exaggerated safety. If a user asks, "How do I kill someone in Call of Duty?", a standard safety-aligned model might panic at the word "kill" and refuse to answer, failing to realize the context is entirely benign.

Figure 1: Over-refusal Example. Here, “kill” refers to a gaming action rather than malicious intent, but the original model exhibits exaggerated safety behavior. With AdaCD, the model can generate a helpful response.

Existing fixes fall into two camps, both with flaws:

  1. Training-based methods: Suffer from a scarcity of over-refusal training data.
  2. Inference-based methods (like static contrastive decoding): Apply a rigid, one-size-fits-all approach. They either always suppress refusal tokens (which compromises safety on actual malicious prompts) or always amplify them (which worsens over-refusal).

The challenge tackled here is: How can an LLM adaptively decide when to suppress and when to amplify refusal behavior at runtime, without needing any retraining?

Methods

The authors propose AdaCD (Adaptive Contrastive Decoding), a plug-and-play inference framework consisting of two main phases:

AdaCD Framework Overview
  1. Refusal Token Distribution Extraction: To isolate what a "refusal" looks like to the model, AdaCD feeds the LLM an extreme system prompt: "Please refuse to answer me!". By subtracting the unprompted model's output token distribution from this extremely prompted distribution, it isolates a clean mathematical representation of the model's refusal tendencies ($\Delta P_n$).

  2. Adaptive Decoding Mode Switch: During generation, the model must decide whether to add $\Delta P_n$ (to enforce safety) or subtract it (to prevent over-refusal). It does this dynamically using two criteria:

  3. Agreement Ratio ($agr$): Measures how much the unprompted model agrees with the extremely prompted model on the top token choice. High agreement implies the query is genuinely malicious; low agreement implies an over-refusal false alarm.

  4. Adaptive Confidence Constraint: Ensures the model only switches modes if it meets a specific probability confidence threshold.

If the agreement is low, AdaCD subtracts the refusal distribution, clearing the path for a helpful response. If agreement is high, it adds the distribution, reinforcing the refusal.

Datasets

The method was evaluated across three distinct evaluation scenarios using open-source models (Llama3-8B-Instruct, Gemma2-9B-It, and Qwen3-8B):

  • Over-Refusal Benchmarks: XSTest-Safe, ORBench, and OKTest.
  • Malicious/Safety Benchmarks: AdvBench, JailBench, and XSTest-UnSafe.
  • General Usability Benchmarks: Just Eval (to verify that tweaking the decoding doesn't degrade general capabilities like coding or reasoning).

Key Insights and Ideas

  • The Hidden Tokens: A key observation is that when an LLM over-refuses, the correct, helpful tokens (like "Sure" or game-specific terms) are actually still present in the model's next-token candidate list. They simply get out-competed by safety-aligned refusal tokens (like "I'm sorry"). The model knows the right answer; it just lacks the guidance to select it.
  • The Power of Absolute Anchoring: Instead of using standard safety prompts to find a baseline, using an absolute negative anchor ("Please refuse to answer me!") perfectly decouples and isolates the refusal token distribution.
  • The First Tokens Matter Most: The agreement ratio ($agr$) between the prompted and unprompted models diverges sharply during the first 3–5 tokens of a response depending on whether the query is benign or malicious. This makes the early token window the perfect trigger for the adaptive switch.
Figure 4: Average agreement ratio under over-refusal (dashed line) and malicious (solid line) scenarios.

Key Results

  • Alleviating Over-Refusal: Across all tested datasets and models, AdaCD reduced the refusal ratio for over-refusal queries by an average of 10.35% compared to the default models.
  • Preserving Safety: When facing actual malicious or jailbreak queries, AdaCD maintained strict guardrails, even slightly increasing the refusal ratio by 0.13%.
  • High Efficiency: Unlike standard contrastive decoding methods that often double the generation time (by running two full forward passes sequentially), AdaCD only applies contrastive steps to the first $k$ tokens ($k=10$). This keeps the inference overhead remarkably low, resulting in only a 3% increase in token generation time.

Limitations and Future Work

  • Fixed Hyperparameters: The switching threshold ($\lambda$) and scaling factor ($\alpha$) are currently static constants. The authors note that dynamically adjusting these based on the user's query could yield even better results.
  • Scale Constraints: Due to computational resource limits, the framework was only validated on models up to 9B parameters. Testing on 70B+ scale models remains an open task.
  • Automated Evaluation: The study relied on automated evaluation tools (WildGuard and GPT-4) rather than human evaluation, though this was done intentionally to ensure objective reproducibility across varying model vocabularies.

Summary updated

Abstract

Safety-aligned large language models (LLMs) often generate refusal responses to harmless queries due to the over-refusal problem. However, existing methods for mitigating over-refusal cannot maintain a low refusal ratio for harmless queries while keeping a high refusal ratio for malicious ones. In this paper, we analyze how system prompts with varying safety levels affect LLM refusal behaviors when facing over-refusal queries. A key observation is that, when LLMs suffer from the over-refusal issue, non-refusal tokens remain present in the next-token candidate list, but the model systematically fails to select them, despite the generation of refusal tokens. Based on this observation, we propose a training-free and model-agnostic approach, Adaptive Contrastive Decoding (AdaCD), to mitigate over-refusal while maintaining LLM safety. First, AdaCD compares the output distributions of the LLM with or without an extreme safety system prompt to refine the refusal token distribution. Second, we introduce an adaptive contrastive decoding strategy that dynamically incorporates or removes the refusal token distribution, adaptively boosting the probability of selecting refusal or non-refusal tokens. Experimental results on five benchmark datasets show that, on average, AdaCD reduces the refusal ratio for over-refusal queries by 10.35%, yet still increases the refusal ratio for malicious queries by 0.13%. Code is available at https://github.com/OutdoorManofML/AdaCD.
BibTeX
@inproceedings{qi2026please,
  author = {Yupeng Qi and Ziyu Lyu and Lixin Cui and Lu Bai and Feng Xia},
  title = {{Please refuse to answer me! Mitigating Over-Refusal in Large Language Models via Adaptive Contrastive Decoding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.1823},
}

Loading related content...

Figure