RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Eviction

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Jiang, Tanqiu, Wang, Zian, Liang, Jiacheng, Li, Changjiang, Wang, Yuhui, Wang, Ting
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917818345193472
author Jiang, Tanqiu
Wang, Zian
Liang, Jiacheng
Li, Changjiang
Wang, Yuhui
Wang, Ting
author_facet Jiang, Tanqiu
Wang, Zian
Liang, Jiacheng
Li, Changjiang
Wang, Yuhui
Wang, Ting
contents Jailbreak attacks circumvent LLMs' built-in safeguards by concealing harmful queries within jailbreak prompts. While existing defenses primarily focus on mitigating the effects of jailbreak prompts, they often prove inadequate as jailbreak prompts can take arbitrary, adaptive forms. This paper presents RobustKV, a novel defense that adopts a fundamentally different approach by selectively removing critical tokens of harmful queries from key-value (KV) caches. Intuitively, for a jailbreak prompt to be effective, its tokens must achieve sufficient `importance' (as measured by attention scores), which inevitably lowers the importance of tokens in the concealed harmful query. Thus, by strategically evicting the KVs of the lowest-ranked tokens, RobustKV diminishes the presence of the harmful query in the KV cache, thus preventing the LLM from generating malicious responses. Extensive evaluation using benchmark datasets and models demonstrates that RobustKV effectively counters state-of-the-art jailbreak attacks while maintaining the LLM's general performance on benign queries. Moreover, RobustKV creates an intriguing evasiveness dilemma for adversaries, forcing them to balance between evading RobustKV and bypassing the LLM's built-in safeguards. This trade-off contributes to RobustKV's robustness against adaptive attacks. (warning: this paper contains potentially harmful content generated by LLMs.)
format Preprint
id arxiv_https___arxiv_org_abs_2410_19937
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Eviction
Jiang, Tanqiu
Wang, Zian
Liang, Jiacheng
Li, Changjiang
Wang, Yuhui
Wang, Ting
Cryptography and Security
Artificial Intelligence
Computation and Language
Jailbreak attacks circumvent LLMs' built-in safeguards by concealing harmful queries within jailbreak prompts. While existing defenses primarily focus on mitigating the effects of jailbreak prompts, they often prove inadequate as jailbreak prompts can take arbitrary, adaptive forms. This paper presents RobustKV, a novel defense that adopts a fundamentally different approach by selectively removing critical tokens of harmful queries from key-value (KV) caches. Intuitively, for a jailbreak prompt to be effective, its tokens must achieve sufficient `importance' (as measured by attention scores), which inevitably lowers the importance of tokens in the concealed harmful query. Thus, by strategically evicting the KVs of the lowest-ranked tokens, RobustKV diminishes the presence of the harmful query in the KV cache, thus preventing the LLM from generating malicious responses. Extensive evaluation using benchmark datasets and models demonstrates that RobustKV effectively counters state-of-the-art jailbreak attacks while maintaining the LLM's general performance on benign queries. Moreover, RobustKV creates an intriguing evasiveness dilemma for adversaries, forcing them to balance between evading RobustKV and bypassing the LLM's built-in safeguards. This trade-off contributes to RobustKV's robustness against adaptive attacks. (warning: this paper contains potentially harmful content generated by LLMs.)
title RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Eviction
topic Cryptography and Security
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2410.19937