Abstract
Despite extensive efforts in safety alignment, large language models (LLMs) remain vulnerable to jailbreak attacks. Activation steering offers a training-free defense method but relies on fixed steering coefficients, resulting in suboptimal protection and increased false rejections of benign inputs. To address this, we propose AdaSteer, an adaptive activation steering method that dynamically adjusts model behavior based on input characteristics. We identify two key properties: Rejection Law (R-Law), which shows that stronger steering is needed for jailbreak inputs opposing the rejection direction, and Harmfulness Law (H-Law), which differentiates adversarial and benign inputs. AdaSteer steers input representations along both the Rejection Direction (RD) and Harmfulness Direction (HD), with adaptive coefficients learned via logistic regression, ensuring robust jailbreak defense while preserving benign input handling. Experiments on LLaMA-3.1, Gemma-2, and Qwen2.5 show that AdaSteer outperforms baseline methods across multiple jailbreak attacks with minimal impact on utility. Our results highlight the potential of interpretable model internals for real-time, flexible safety enforcement in LLMs.
Introduction
Large Language Models (LLMs) are increasingly integrated into critical applications, yet they remain susceptible to "jailbreak" attacks—adversarial prompts designed to bypass safety guardrails. Current defense strategies typically involve safety post-training (fine-tuning) or static activation steering. Fine-tuning is computationally expensive and can degrade general performance, while static activation steering—adding a fixed "refusal vector" to internal representations—suffers from a rigid trade-off: a weak steering coefficient fails against sophisticated attacks, while a strong one leads to "over-refusal" of benign queries.
AdaSteer introduces a dynamic, training-free defense that leverages the model's internal representations to apply tailored safety interventions in real-time. By identifying specific directions in the activation space, AdaSteer distinguishes between harmless queries and adversarial attempts, applying the precise amount of steering required for each input.
Methodology: Dual-Direction Adaptive Steering
AdaSteer moves beyond fixed vectors by utilizing two learned directions within the model's activation space:
- Rejection Direction (RD): Derived from the difference in activations when a model complies with versus rejects a harmful prompt.
- Harmfulness Direction (HD): Derived by comparing activations of benign prompts against harmful prompts that the model initially complied with.
Empirical Laws of Steering
The method is grounded in two key observations:
- Rejection Law (R-Law): Adversarial inputs that successfully bypass safety filters tend to be positioned further from the model's "rejection center." Consequently, these inputs require a higher steering coefficient ($\lambda_r$) to be effectively neutralized.
- Harmfulness Law (H-Law): Benign inputs can be clearly separated from jailbreak attempts along the HD axis. This allows AdaSteer to apply "compliance steering" ($\lambda_c$) to ensure harmless queries are processed without interference.
During inference, AdaSteer projects the input's hidden states onto these directions. A lightweight logistic regression model calculates the optimal $\lambda_r$ and $\lambda_c$ for each token, modifying the hidden state $h$ as: $h' = h + \lambda_r v_{RD} + \lambda_c v_{HD}$.
Experimental Results
AdaSteer was evaluated across several state-of-the-art models, including LLaMA-3.1-8B, Gemma-2-9B, and Qwen2.5-7B/14B, against a wide array of jailbreak benchmarks (e.g., AutoDAN, GCG, Cipher).
Defense and Utility
On LLaMA-3.1, AdaSteer achieved a Defense Success Rate (DSR) of 91.86%, a massive improvement over the base model's 38.14%. Crucially, this security gain did not come at the cost of utility; the model maintained a ~50% win rate on AlpacaEval, matching the original model's helpfulness. This demonstrates that decoupling refusal from compliance allows for aggressive safety without the typical "over-refusal" penalty.
Efficiency and Scalability
Unlike decoding-based defenses that significantly slow down inference, AdaSteer operates with minimal overhead. As shown in the performance-efficiency analysis, AdaSteer provides the highest DSR while maintaining an inference speed comparable to the original un-defended model.
Conclusion
AdaSteer demonstrates that aligned LLMs inherently possess the internal mechanisms necessary for self-defense. By adaptively steering activations along learned rejection and harmfulness directions, AdaSteer provides a robust, efficient, and "plug-and-play" solution to the jailbreak problem. Future work will explore non-linear steering representations and the potential for internalizing these adaptive behaviors directly into model weights.
Summary updated