Robust Harmful Features Under Jailbreak Attacks: Mechanistic Evidence from Attention Head Specialization in Large Language Models
Yanchen Yin, Dongqi Han, Linghui Li
Overview
Modern large language models (LLMs) undergo rigorous safety alignment to prevent the generation of harmful content, yet these safety mechanisms are routinely circumvented by jailbreak attacks. Despite the prevalence of these attacks, the internal computational dynamics of how a jailbreak successfully alters model behavior remain poorly understood. This talk investigates a fundamental question: what does a successful jailbreak actually change inside a model? The central finding is that successful jailbreak attacks do not erase a model's internal safety representation; instead, they bypass it. Even when an aligned model complies with a harmful request under a jailbreak, its internal representations continue to register the request as harmful.

Key moments
- 0:00 Introduction and core observation on safety bypass
- 2:00 Data filtering and attribution method for attention heads
- 4:00 Interventions on ACH and SH head types
- 6:00 Token decomposition and the role of attack templates
- 8:00 Training-free detector performance and scale validation
- 10:00 Conclusion, limitations, and audience Q&A
Robust Harmful Features Under Jailbreak Attacks: Mechanistic Evidence from Attention Head Specialization in Large Language Models
Speakers: Yanchen Yin; Dongqi Han; Linghui Li
Conference: ICML
YouTube: https://slideslive.com/39083600
Overview
Modern large language models (LLMs) undergo rigorous safety alignment to prevent the generation of harmful content, yet these safety mechanisms are routinely circumvented by jailbreak attacks. Despite the prevalence of these attacks, the internal computational dynamics of how a jailbreak successfully alters model behavior remain poorly understood. This talk investigates a fundamental question: what does a successful jailbreak actually change inside a model? The central finding is that successful jailbreak attacks do not erase a model's internal safety representation; instead, they bypass it. Even when an aligned model complies with a harmful request under a jailbreak, its internal representations continue to register the request as harmful.
The speakers demonstrate that internal safety features persist because attention heads specialize into distinct operational roles. Specifically, early layers contain Attack-Suppressed Heads (ACH) that are forcefully driven down by jailbreak templates, while middle layers house Safety Heads (SH) that autonomously maintain the underlying harmful feature representation. By analyzing these specialized pathways, the authors reveal a critical structural gap between what a compromised model outputs and what it computes internally. This mechanistic insight underpins a simple, highly effective, training-free detector that exploits the residual safety signal to flag adversarial attacks without modifying the underlying model weights.
Background
▶ Watch: Introduction and core observation on safety bypass (0:00)
The machine learning and systems safety community has long relied on patching-based defenses to secure LLMs against prompt injection and adversarial jailbreaks. However, these defenses operate primarily at the behavioral surface, treating the model as a black box that either refuses or complies with a prompt. While extensive prior work examines internal model safety during standard, unperturbed refusals—where the model correctly identifies and rejects malicious inputs—virtually no prior work investigates the internal mechanics of what happens after an attack has successfully won.
This gap exists because studying successful jailbreaks requires filtering massive datasets to isolate true bypass cases—instances where a model staunchly refuses an original harmful prompt but readily complies when that same prompt is wrapped in an adversarial template. In strongly aligned models, such successful bypasses occur in only 2 to 3 percent of roughly 10,000 tested attacks. Consequently, understanding the mechanistic transition from refusal to compliance requires peering inside the activation space during these rare, successful attacks to determine whether safety features are actively erased or merely decoupled from the final output generation.
Key Findings
▶ Watch: Interventions on ACH and SH head types (4:00)
The investigation yields several core discoveries regarding how safety representations behave under adversarial pressure:
- Safety is Bypassed, Not Erased: Under a successful jailbreak attack, early-layer representations go quiet, but middle-layer representations maintain strong activations corresponding to the harmful nature of the request. The model complies behaviorally, but its internal activations still process the input as harmful.
- Specialized Attention Head Layout: Attention heads divide cleanly into two functional categories based on their layer depth and response to adversarial pressure:
- Attack-Suppressed Heads (ACH): Located in the earliest layers of the network; these heads are actively suppressed by jailbreak templates.
- Safety Heads (SH): Located in the middle layers; these heads remain active and sustain the underlying harmful feature signal despite the attack.
- Structural Consistency Across Scales: This layout remains identical across differently trained models and scales up reliably. When tested on a 70-billion parameter model, the exact same ACH-early and SH-middle dichotomy appears, with token splits becoming even sharper.
- High-Performance Training-Free Detection: Because the robust harmful feature signal survives in the middle layers, it can be read directly via a novel, training-free detection algorithm. On Llama 3, this detector achieves a score of 0.88—outperforming trained guard models like WildGuard—and maintains adversarial detection scores between 0.85 and 0.98 in scenarios where the model's own internal refusal signal collapses below 0.5.
- Template-Driven Suppression: Ablation and decomposition experiments reveal that the harmful content tokens themselves do not trigger the divergence between ACH and SH; rather, the adversarial template tokens explicitly drive the suppression of ACH heads while leaving SH heads intact.
Technical Deep Dive
▶ Watch: Token decomposition and the role of attack templates (6:00)
To map the internal mechanics of jailbreaks, the methodology isolates true bypass cases from a corpus of roughly 10,000 attack iterations. The authors extract activations at the exact end of the instruction phase, where the model decides whether to output a refusal or compliance token. Because refusal behavior maps to a single linear direction in activation space—meaning that subtracting this direction forces compliance—the authors trace the middle-layer refusal signal backward using attention attribution. Because attention heads are linear operations, this attribution is exact, allowing researchers to quantify the precise contribution of each early-layer head to the middle-layer refusal signal.
The validation of these heads proceeds through strict two-step filtering and intervention protocols:
- Head Screening: Heads are evaluated to determine whether they can distinguish harmful inputs from benign ones. Non-responsive heads are discarded.
- Behavioral Intervention on ACH: To prove causality, the authors intervene directly on the ACH heads. By artificially subtracting the learned feature from the ACH heads during a normally refused prompt, the Attack Success Rate (ASR) jumps from 0% to approximately 94%. By contrast, applying the same intervention to random heads yields an ASR of only 4%, confirming that ACH suppression is a direct causal mechanism utilized by jailbreak attacks.
- Representational Intervention on SH: Rather than driving behavior, SH heads sustain the internal representation. Removing them causes downstream middle-layer activation signals to drop by approximately 15%, demonstrating that SH heads act as upstream generators of the persistent safety signal.
The training-free detector leverages these robust features in three computational steps:
- Standardization: Each path is standardized against benign inputs to quantify abnormality.
- Filtering: Only paths that cleanly separate harmful inputs from benign ones are retained.
- Averaging: The top $M$ strongest paths are averaged to prevent massive feature dilution, as a genuine harmful input hits a small subset of paths intensely.
Experimental Setup & Results
▶ Watch: Training-free detector performance and scale validation (8:00)
The empirical evaluation encompasses multiple model architectures, most notably Llama 3 and its larger 70B parameter variant. The primary dataset consists of approximately 10,000 adversarial prompts paired with their corresponding benign counterparts, filtered strictly to isolate the 2% to 3% of prompts where the base model refuses the original request but complies with the attacked version.
- Intervention Ablation Results: For standard models, ablating the ACH heads shifts the attack success rate from 0% to 94% (and up to 98% on the 70B model). Control interventions on random heads restrict success to 4%.
- Downstream Signal Degradation: Ablating SH heads results in a direct 15% drop in middle-layer activation magnitude.
- Detector Performance:
- On standard evaluation benchmarks, the training-free detector achieves an ROC-AUC of 0.88 on Llama 3, matching or exceeding trained guard architectures such as WildGuard.
- Under adversarial bypass conditions—where the target model's native refusal signal drops below baseline detection thresholds (< 0.5) due to successful manipulation—the robust feature detector scores between 0.85 and 0.98.
- Stability Testing: Varying the bandwidth parameters in the density estimation pipeline results in a Spearman rank correlation coefficient of 0.98 for head rankings, proving that the attention head specialization is a structural property of the network rather than statistical noise.
Practical Implications
▶ Watch: Conclusion, limitations, and audience Q&A (10:00)
These findings fundamentally alter how infrastructure teams, model builders, and security deployers must view LLM safety alignment. Relying solely on behavioral checks—monitoring whether a model outputs a refusal string—is fundamentally flawed because a model can be internally processing a request as highly harmful while simultaneously generating compliant text.
For model builders, this proves that current alignment training methods leave structural vulnerabilities in early attention layers that adversarial prompt templates can exploit without erasing the deeper semantic understanding of harm. For infrastructure and deployment teams, the emergence of a high-performing, training-free detector utilizing internal attention activations offers a powerful new paradigm for runtime defense. Because the detector requires no model fine-tuning or labeled adversarial training data, it can be integrated directly into inference pipelines to intercept jailbreaks at the exact point where internal representations diverge from behavioral outputs. However, practitioners must account for the limitations of this approach: the current methodology focuses strictly on attention mechanisms while omitting Multilayer Perceptron (MLP) layers, relies on a single linear refusal direction assumption, and requires white-box access to internal model activations.
Key Takeaways
- Bypass vs. Erasure: Successful jailbreaks suppress early-layer attention heads to route around safety protocols without destroying the model's underlying capacity to recognize harmful intent.
- Attention Head Specialization: Model safety computations are segregated into early-layer Attack-Suppressed Heads (ACH) and middle-layer Safety Heads (SH).
- Causal Validation: Artificially suppressing ACH heads drives the attack success rate from 0% to 94%–98%, proving their causal role in enabling bypasses.
- Robust Internal Signals: Middle-layer SH heads maintain a persistent representation of harmful intent, enabling the detection of malicious prompts even when the model's native behavioral output fails.
- Training-Free Detection: Extracting these robust features yields an adversarial detector scoring 0.85 to 0.98 AUC under active jailbreak conditions, outperforming traditional trained guard models without requiring gradient updates.
- Scale Invariance: The structural specialization of ACH and SH layers remains stable across model scales, replicating precisely when moving from standard architectures to 70-billion parameter models.
About the Speaker(s)
- Yanchen Yin: Researcher working on mechanistic interpretability of safety features in large language models, studying how jailbreak attacks suppress them.
Co-authors: Dongqi Han, Linghui Li.
Reviews
→ Top-rated talks at International Conference on Machine Learning 2026
All talks from International Conference on Machine Learning 2026