Universal Jailbreak Suffixes Are Strong Attention Hijackers

Matan Ben-Tov, Mor Geva, Mahmood Sharif

TL;DR

Suffix-based jailbreaks bypass LLM safety alignment by aggressively "hijacking" the model's attention mechanism at the final chat template tokens, effectively erasing the context of the harmful instruction. By understanding this shallow mechanistic vulnerability, the authors show how to both amplify an attack's universality for better red-teaming and surgically suppress it to defend models with minimal loss in general utility.

What Problem Does This Paper Address?

Large Language Models (LLMs) are heavily safety-aligned to refuse harmful prompts, yet they remain vulnerable to adversarial prompt injections. Suffix-based jailbreaks—most notably Greedy Coordinate Gradient (GCG)—append a short string of optimized gibberish to a harmful instruction to trick the model into complying.

Intriguingly, these suffixes vary wildly in their efficacy: some are highly "universal," meaning a single suffix can jailbreak many entirely unseen harmful instructions, while others only work on the prompt they were optimized for. Prior work has noted that jailbreaks shift internal representations away from "harmfulness" directions, but a clear, localized mechanistic explanation of how these suffixes manipulate internal model dynamics to achieve universality has been missing.

Methods

The authors employ mechanistic interpretability tools to dissect the internal information flow of LLMs during an attack:

  • Attention Knockout: They systematically ablate specific attention edges (setting attention logits to $-\infty$) to isolate which token-to-token pathways are critical for the jailbreak's success.
  • Causal Activation Patching: They validate causality by taking the internal attention activations from a successful jailbreak and patching them into a failed jailbreak attempt to see if compliance is restored.
  • Dominance Score: They introduce a dot-product-based metric to quantify how much a specific token subsequence (the instruction vs. the adversarial suffix) contributes to the representation of the final chat template tokens (chat) right before generation begins.
  • GCG-Hij (Offensive Application): They modify the standard GCG optimization objective by adding an attention-score proxy loss that explicitly rewards suffixes for maximizing their attention dominance in the middle layers of the model.
  • Hijacking Suppression & Detection (Defensive Applications): They develop a training-free defense that identifies the top 1% of attention vectors driving context hijacking and scales them down during inference, alongside an offline/online classification scheme to detect attacks before token generation.
Figure 1: We explore suffix-based jailbreaks on safety-aligned LLMs, which (a) append an adversar- ial suffix ( adv ) to a harmful instruction ( instr ) and elicit an affirmative, unsafe response. We find that (b) the final chat template tokens ( chat ) play a crucial part in jailbreak behavior, specifically (c) common suffix-based jailbreaks effectively hijack the chat representation with irregular strength, and (d) the more universal the suffix, the stronger the hijacking; (e) our insights enable both enhancing and mitigating these attacks.

Datasets

The paper utilizes several standard benchmarks for optimization and evaluation:

  • AdvBench: A dataset of 520 diverse harmful instructions used to train and evaluate GCG suffixes.
  • StrongReject: A challenging dataset of 221 custom harmful instructions used to test the limits of suffix universality.
  • AlpacaEval & MMLU: Standard benchmarks consisting of benign instructions and multi-choice questions, used to verify that defensive interventions do not destroy the model's general utility and helpfulness.
  • HuggingFace Instruction Dataset: Used alongside AlpacaEval to form a negative (benign) baseline for evaluating jailbreak detection.

Key Insights and Ideas

  • The Mechanism is "Shallow": The critical turning point for a jailbreak happens almost entirely within the final chat template tokens (chat) right before generation starts. It does not require deep, sequential manipulation throughout the generation phase.
  • Context Hijacking: Successful adversarial suffixes act as "strong attention hijackers." In later-mid layers of the model, the suffix's representation completely dominates the attention sub-layer output, effectively drowning out and erasing the influence of the harmful instruction itself.
  • Universality Correlates with Hijacking Strength: Suffixes that generalize well across different prompts are consistently those that hijack attention the most aggressively. This establishes a clear geometric signature for attack universality.

Key Results

  • Localization: Knocking out the attention pathway from the adversarial suffix to the chat template tokens (adv $\rightarrow$ chat) consistently flips successful jailbreaks back to safe refusals, even when the model's response is prefilled with an affirmative phrase like "Sure, here's...".
Figure 3: Knockout effect of edges on GCG jail- break suffixes (dots), measured by the proportion of failed jailbreaks (Jailbreak Flip Rate). (a–b) highlight the critical role of adv →chat in en- abling jailbreaks, even prefilled with affirmation.
  • Zero-Overhead Universality Boost: By optimizing prompts using GCG-Hij (encouraging hijacking), the authors increased the average universality of single-instruction suffixes by up to $\times$5 (e.g., boosting Llama 3.1 universality from 2.10% to 9.45%) without incurring any additional computational cost.
  • Surgical Mitigation: Applying Hijacking Suppression successfully mitigated suffix-based attacks, cutting jailbreak success rates by a factor of $1.5\times$ to $10\times$ (e.g., dropping Gemma2 GCG success from 60.02% to 9.32%). Crucially, this defense caused less than a 2% drop in general model utility on MMLU and AlpacaEval.
  • High-Accuracy Detection: The hijacking-based detection framework achieved a Receiver Operating Characteristic (ROC) Area Under Curve (AUC) of $\ge 0.95$ across multiple models, reliably flagging malicious prompts before generation.

Limitations and Future Work

  • Model and Architecture Scope: While validated across multiple models (Gemma2, Qwen2.5, Llama3.1), the mathematical decomposition relies strictly on Transformer architectures; generalization to alternative architectures remains unstudied.
  • Focus on Attention Magnitudes: The analysis focuses primarily on the magnitude of the vectors contributed by the attention sub-layers. The authors note that exploring the exact semantic directions amplified by this hijacking, as well as the role of MLPs, is an important avenue for future work.
  • Computational Overhead of Defense: The proposed Hijacking Suppression requires materializing or scoring attention matrices, which can introduce inference overhead unless bypassed using highly optimized custom attention kernels.

Summary updated

Abstract

We study suffix-based jailbreaks$\unicode{x2013}$a powerful family of attacks against large language models (LLMs) that optimize adversarial suffixes to circumvent safety alignment. Focusing on the widely used foundational GCG attack, we observe that suffixes vary in efficacy: some are markedly more universal$\unicode{x2013}$generalizing to many unseen harmful instructions$\unicode{x2013}$than others. We first show that a shallow, critical mechanism drives GCG's effectiveness. This mechanism builds on the information flow from the adversarial suffix to the final chat template tokens before generation. Quantifying the dominance of this mechanism during generation, we find GCG irregularly and aggressively hijacks the contextualization process. Crucially, we tie hijacking to the universality phenomenon, with more universal suffixes being stronger hijackers. Subsequently, we show that these insights have practical implications: GCG's universality can be efficiently enhanced (up to $\times$5 in some cases) at no additional computational cost, and can also be surgically mitigated, at least halving the attack's success with minimal utility loss. We release our code and data at http://github.com/matanbt/interp-jailbreak.
BibTeX
@inproceedings{bentov2026universal,
  author = {Matan Ben-Tov and Mor Geva and Mahmood Sharif},
  title = {{Universal Jailbreak Suffixes Are Strong Attention Hijackers}},
  booktitle = {TACL},
  year = {2026},
  url = {https://openreview.net/forum?id=xsdTrSzWtv},
}
Figure