paper-with-me

Papers

DETAM: Defending LLMs Against Jailbreak Attacks via Targeted Attention Modification

2025-04-18 · Yu Li, Han Jiang, Zhihua Wei

With the widespread adoption of Large Language Models (LLMs), jailbreak attacks have become an increasingly pressing safety concern. While safety-aligned LLMs can effectively defend against normal harmful queries, they remain vulnerable to such attacks. Existing defense methods primarily rely on fine-tuning or input modification, which often suffer from limited generalization and reduced utility. To address this, we introduce DETAM, a finetuning-free defense approach that improves the defensive capabilities against jailbreak attacks of LLMs via targeted attention modification. Specifically, we analyze the differences in attention scores between successful and unsuccessful defenses to identify the attention heads sensitive to jailbreak attacks. During inference, we reallocate attention to emphasize the user's core intention, minimizing interference from attack tokens. Our experimental results demonstrate that DETAM outperforms various baselines in jailbreak defense and exhibits robust generalization across different attacks and models, maintaining its effectiveness even on in-the-wild jailbreak data. Furthermore, in evaluating the model's utility, we incorporated over-defense datasets, which further validate the superior performance of our approach. The code will be released immediately upon acceptance.

📄 PDF Abstract BibTeX arXiv:2504.13562

Code (0)

등록된 구현이 없습니다.

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음

Similar Papers 제목 키워드 기반

Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritization

2023-11-15 · Zhexin Zhang, Junxiao Yang, Pei Ke, Fei Mi 외

While significant attention has been dedicated to exploiting weaknesses in LLMs through jailbreaking attacks, there remains a paucity of effort in defending against these attacks. We point out a pivotal factor contributi…

Instruction Following

No Free Lunch for Defending Against Prefilling Attack by In-Context Learning

2024-12-13 · Zhiyu Xue, Guangliang Liu, Bocheng Chen, Kristen Marie Johnson 외

The security of Large Language Models (LLMs) has become an important research topic since the emergence of ChatGPT. Though there have been various effective methods to defend against jailbreak attacks, prefilling attacks…

In-Context LearningSafety AlignmentSentence

Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editing

2024-05-28 · Wei Zhao, Zhe Li, Yige Li, Ye Zhang 외

Large language models (LLMs) are increasingly being adopted in a wide range of real-world applications. Despite their impressive performance, recent studies have shown that LLMs are vulnerable to deliberately crafted adv…

Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks

2024-01-30 · Andy Zhou, Bo Li, Haohan Wang

Despite advances in AI alignment, large language models (LLMs) remain vulnerable to adversarial attacks or jailbreaking, in which adversaries can modify prompts to induce unwanted behavior. While some defenses have been …

Defending Jailbreak Prompts via In-Context Adversarial Game

2024-02-20 · Yujun Zhou, Yufei Han, Haomin Zhuang, Kehan Guo 외

Large Language Models (LLMs) demonstrate remarkable capabilities across diverse applications. However, concerns regarding their security, particularly the vulnerability to jailbreak attacks, persist. Drawing inspiration …