RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Cache EvictionRobustKV: Defending Large Language Models against Jailbreak Attacks via KV Eviction
The paper proposes RobustKV, a jailbreak defense method that strategically evicts key tokens from the KV cache at inference time, with the aim of weakening harmful queries hidden in jailbreak prompts. The authors argue that for a jailbreak prompt to take effect, its tokens must receive sufficiently high attention scores, which suppresses the importance of the hidden harmful query tokens; therefore, evicting the KV of the lowest-ranked tokens reduces the presence of the harmful query in the KV cache and prevents the model from generating harmful responses. The authors state that evaluations on benchmark datasets and multiple models show that the method withstands current state-of-the-art jailbreak attacks while maintaining the model's general performance on benign queries; RobustKV also creates a dilemma for attackers, forcing them to trade off between evading RobustKV and bypassing the model's built-in guardrails, and this trade-off enhances its robustness to adaptive attacks.