Robust Harmful Features Under Jailbreak Attacks: Mechanistic Evidence from Attention Head Specialization in Large Language Models

Yanchen Yin, Dongqi Han, Linghui Li

TL;DR

Jailbreak attacks don't actually erase an LLM's safety training; they surgically suppress a tiny group of "Adversarially Compromised Heads" (ACHs) in the early layers. Even when an attack succeeds, the model’s internal "alarm bells" (Safety-Aligned Heads) continue to ring in the middle layers—a discovery the authors use to build a highly effective, training-free jailbreak detector.

What Problem Does This Paper Address?

Despite extensive safety alignment (like RLHF), Large Language Models (LLMs) remain vulnerable to "jailbreaks"—cleverly crafted prompts that trick the model into generating harmful content.

The research community has been divided on why this happens. Does the attack "overwrite" the model's safety features, or does it just find a way around them? Previous research identified a "refusal direction" in the model's activation space, but this paper goes deeper. It seeks a mechanistic explanation: which specific components (attention heads) are failing, which ones are holding firm, and can we use this "internal conflict" to better detect attacks?

Methods

The authors employ several sophisticated mechanistic interpretability techniques:

  • Backward Propagation of Refusal: They take the "refusal direction" (the vector representing the model saying "No") from the middle layers and project it backward through the model’s attention heads to see which heads contribute most to that signal.
  • Distribution Overlap (OVL) Classification: Using Kernel Density Estimation (KDE), they compare how attention heads react to three types of input: benign, harmful (refused), and jailbroken (successful attack).
  • Functional Taxonomy: They categorize heads into:
  • ACHs (Adversarially Compromised Heads): Early-layer heads that activate on harmful prompts but are silenced by jailbreak templates.
  • SAHs (Safety-Aligned Heads): Mid-layer heads that stay active regardless of the attack.
  • Causal Ablation: To prove these heads matter, they manually suppress ACHs to see if it induces a "synthetic jailbreak" (it does) and remove SAHs to see if the internal safety signal weakens (it does).
  • Token-Level Attribution: They map activations back to specific words in the prompt to see exactly which part of a jailbreak (e.g., the "roleplay" instructions) causes the suppression.

Datasets

The study utilizes a robust suite of public safety benchmarks:

  • Benign: Alpaca.
  • Harmful/Adversarial: Samples from HarmBench, AdvBench, and JailbreakBench.
  • Attack Methods: GCG, AutoDAN, PAIR, and many-shot jailbreaking.
  • Evaluation Frameworks: 10 datasets including WildGuardTest, ToxicChat, OpenAI Moderation, and SALAD-Bench.

Key Insights and Ideas

  • Bypass, Not Break: The most striking finding is that jailbreaks are a "bypass" mechanism. The model's internal representation of "this is harmful" (the SAHs) remains active even while the model is typing out the harmful response.
  • The Early-Layer Gatekeepers: ACHs act as early-layer gatekeepers. Attack templates (like "Imagine you are a movie scriptwriter...") specifically target these heads to suppress the refusal signal before it can propagate.
  • Spatial Specialization: There is a clear "division of labor" in the architecture. ACHs are concentrated in layers 0–3, while SAHs dominate layers 5–12.
  • Robust Harmful Features: Because the safety signal (SAHs) persists internally even during a successful attack, the authors term this phenomenon "Robust Harmful Features." The model "knows" it's doing something wrong, but the "refusal" command has been intercepted.

Key Results

  • Surgical Precision: In Llama-3-8B, suppressing just 8 specific ACHs (out of hundreds of heads) was enough to increase the Attack Success Rate (ASR) from 0% to 95%.
  • Detection Power: By simply "reading" the activations of these robust features (without any training), the authors' detector achieved a 0.888 weighted F1 score on Llama-3-8B, outperforming specialized, trained guardrail models like WildGuard (0.880).
  • Adversarial Robustness: On the SALAD-Bench (a difficult adversarial benchmark), their method improved Gemma-2B’s detection performance from a "vanilla" F1 of 0.270 to a staggering 0.976.
  • Scale Invariance: Preliminary tests on Llama-3-70B confirmed that these patterns hold true even as models get much larger.

Limitations and Future Work

  • Scope: The study focuses almost exclusively on attention heads. The authors acknowledge that MLP (Multi-Layer Perceptron) layers and LayerNorm also play roles that weren't fully modeled here.
  • White-Box Requirement: Their detection method requires "white-box" access (the ability to read internal activations), meaning it can't be used by third-party developers calling an API (like GPT-4).
  • Refusal Direction: The analysis uses a single "refusal direction" as a proxy for safety; future work could explore more complex "refusal subspaces."
  • Attack Diversity: While they tested many attacks, the "cat-and-mouse" game of AI safety means new attack paradigms might find ways to suppress the "robust" SAHs as well.

Summary updated

Abstract

Jailbreak attacks bypass LLM safety alignment, yet their mechanisms remain poorly understood. We provide evidence that attacks do not comprehensively eliminate safety features, but instead selectively suppress specific attention heads. We identify two functionally differentiated types: **Adversarially Compromised Heads (ACHs)** concentrated in early layers, which are suppressed under attacks, and **Safety-Aligned Heads (SAHs)** in mid-layers, which maintain robust activations even when attacks succeed. Ablation studies support the causal role of ACHs and the contribution of SAHs to robust activations: suppressing a small number of ACHs is sufficient to induce jailbreak-like behavior on normally refused inputs, while removing SAHs substantially weakens mid-layer safety activations. Token-level attribution further shows that ACH suppression is driven specifically by attack-template tokens, providing a mechanistic account of why attacks can bypass refusal decisions through ACH suppression while leaving internal safety signals sustained by SAHs—a phenomenon we term **Robust Harmful Features**. To validate the practical significance of this robustness, we show that simply reading these persistent activations—without any training—yields competitive aggregate detection performance with strong adversarial robustness.
BibTeX
@inproceedings{yin2026robust,
  author = {Yanchen Yin and Dongqi Han and Linghui Li},
  title = {{Robust Harmful Features Under Jailbreak Attacks: Mechanistic Evidence from Attention Head Specialization in Large Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=LTF6LtBo0E},
}
Figure