Shaping the Safety Boundaries: Understanding and Defending Against Jailbreaks in Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Gao, Lang, Geng, Jiahui, Zhang, Xiangliang, Nakov, Preslav, Chen, Xiuying
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915295910690816
author Gao, Lang
Geng, Jiahui
Zhang, Xiangliang
Nakov, Preslav
Chen, Xiuying
author_facet Gao, Lang
Geng, Jiahui
Zhang, Xiangliang
Nakov, Preslav
Chen, Xiuying
contents Jailbreaking in Large Language Models (LLMs) is a major security concern as it can deceive LLMs to generate harmful text. Yet, there is still insufficient understanding of how jailbreaking works, which makes it hard to develop effective defense strategies. We aim to shed more light into this issue: we conduct a detailed large-scale analysis of seven different jailbreak methods and find that these disagreements stem from insufficient observation samples. In particular, we introduce \textit{safety boundary}, and we find that jailbreaks shift harmful activations outside that safety boundary, where LLMs are less sensitive to harmful information. We also find that the low and the middle layers are critical in such shifts, while deeper layers have less impact. Leveraging on these insights, we propose a novel defense called \textbf{Activation Boundary Defense} (ABD), which adaptively constrains the activations within the safety boundary. We further use Bayesian optimization to selectively apply the defense method to the low and the middle layers. Our experiments on several benchmarks show that ABD achieves an average DSR of over 98\% against various forms of jailbreak attacks, with less than 2\% impact on the model's general capabilities.
format Preprint
id arxiv_https___arxiv_org_abs_2412_17034
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Shaping the Safety Boundaries: Understanding and Defending Against Jailbreaks in Large Language Models
Gao, Lang
Geng, Jiahui
Zhang, Xiangliang
Nakov, Preslav
Chen, Xiuying
Computation and Language
Jailbreaking in Large Language Models (LLMs) is a major security concern as it can deceive LLMs to generate harmful text. Yet, there is still insufficient understanding of how jailbreaking works, which makes it hard to develop effective defense strategies. We aim to shed more light into this issue: we conduct a detailed large-scale analysis of seven different jailbreak methods and find that these disagreements stem from insufficient observation samples. In particular, we introduce \textit{safety boundary}, and we find that jailbreaks shift harmful activations outside that safety boundary, where LLMs are less sensitive to harmful information. We also find that the low and the middle layers are critical in such shifts, while deeper layers have less impact. Leveraging on these insights, we propose a novel defense called \textbf{Activation Boundary Defense} (ABD), which adaptively constrains the activations within the safety boundary. We further use Bayesian optimization to selectively apply the defense method to the low and the middle layers. Our experiments on several benchmarks show that ABD achieves an average DSR of over 98\% against various forms of jailbreak attacks, with less than 2\% impact on the model's general capabilities.
title Shaping the Safety Boundaries: Understanding and Defending Against Jailbreaks in Large Language Models
topic Computation and Language
url https://arxiv.org/abs/2412.17034