Prefix Guidance: A Steering Wheel for Large Language Models to Defend Against Jailbreak Attacks

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Zhao, Jiawei, Chen, Kejiang, Yuan, Xiaojian, Zhang, Weiming
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866916366438629376
author Zhao, Jiawei
Chen, Kejiang
Yuan, Xiaojian
Zhang, Weiming
author_facet Zhao, Jiawei
Chen, Kejiang
Yuan, Xiaojian
Zhang, Weiming
contents In recent years, the rapid development of large language models (LLMs) has achieved remarkable performance across various tasks. However, research indicates that LLMs are vulnerable to jailbreak attacks, where adversaries can induce the generation of harmful content through meticulously crafted prompts. This vulnerability poses significant challenges to the secure use and promotion of LLMs. Existing defense methods offer protection from different perspectives but often suffer from insufficient effectiveness or a significant impact on the model's capabilities. In this paper, we propose a plug-and-play and easy-to-deploy jailbreak defense framework, namely Prefix Guidance (PG), which guides the model to identify harmful prompts by directly setting the first few tokens of the model's output. This approach combines the model's inherent security capabilities with an external classifier to defend against jailbreak attacks. We demonstrate the effectiveness of PG across three models and five attack methods. Compared to baselines, our approach is generally more effective on average. Additionally, results on the Just-Eval benchmark further confirm PG's superiority to preserve the model's performance. our code is available at https://github.com/weiyezhimeng/Prefix-Guidance.
format Preprint
id arxiv_https___arxiv_org_abs_2408_08924
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Prefix Guidance: A Steering Wheel for Large Language Models to Defend Against Jailbreak Attacks
Zhao, Jiawei
Chen, Kejiang
Yuan, Xiaojian
Zhang, Weiming
Cryptography and Security
Artificial Intelligence
Computation and Language
In recent years, the rapid development of large language models (LLMs) has achieved remarkable performance across various tasks. However, research indicates that LLMs are vulnerable to jailbreak attacks, where adversaries can induce the generation of harmful content through meticulously crafted prompts. This vulnerability poses significant challenges to the secure use and promotion of LLMs. Existing defense methods offer protection from different perspectives but often suffer from insufficient effectiveness or a significant impact on the model's capabilities. In this paper, we propose a plug-and-play and easy-to-deploy jailbreak defense framework, namely Prefix Guidance (PG), which guides the model to identify harmful prompts by directly setting the first few tokens of the model's output. This approach combines the model's inherent security capabilities with an external classifier to defend against jailbreak attacks. We demonstrate the effectiveness of PG across three models and five attack methods. Compared to baselines, our approach is generally more effective on average. Additionally, results on the Just-Eval benchmark further confirm PG's superiority to preserve the model's performance. our code is available at https://github.com/weiyezhimeng/Prefix-Guidance.
title Prefix Guidance: A Steering Wheel for Large Language Models to Defend Against Jailbreak Attacks
topic Cryptography and Security
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2408.08924