arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.13420cs.CRcs.AI
收藏

通过前缀共享KV缓存加速后缀劫持攻击

Accelerating Suffix Jailbreak attacks with Prefix-Shared KV-cache

King Abdullah University of Science and Technology(卡塔尔国王阿卜杜勒阿齐兹大学);Zhejiang University(浙江大学)

Xinhai Wang, Shaopeng Fu, Shu Yang, Liangyu Wang, Tianhang Zheng, Di Wang

AI总结:

本文提出PSKV技术,通过共享前缀KV缓存减少后缀劫持攻击的计算开销,实验表明在五种广泛部署的LLM上,PSKV将推理时间减少40%,峰值内存使用减少50%。

摘要:

后缀劫持攻击是一种系统性的红队方法,用于测试大型语言模型(LLMs)的鲁棒性,但存在计算成本高的问题,因为需要评估大量候选后缀才能找到有效的劫持后缀。本文提出Prefix-Shared KV Cache(PSKV),一种用于劫持后缀生成的即插即用推理优化技术。我们的方法受到关键观察的启发:在进行后缀劫持时,尽管需要评估大量候选提示,但它们共享相同的靶向有害指令作为前缀。因此,PSKV维护一个单一的KV缓存用于此前缀,并将其共享给每一个候选提示,从而实现对不同后缀的并行推理,同时保持最小的内存开销。这种设计使得能够采用更激进的批处理策略,这些策略以前受限于内存约束。在六个广泛使用的后缀攻击和五种广泛部署的LLM上进行了大量实验,结果表明PSKV将推理时间减少了40%,峰值内存使用减少了50%,同时保持原始攻击成功率(ASR)。代码已提交并将公开发布。

英文摘要:

Suffix jailbreak attacks serve as a systematic method for red-teaming Large Language Models (LLMs) but suffer from prohibitive computational costs, as a large number of candidate suffixes need to be evaluated before identifying a jailbreak suffix. This paper presents Prefix-Shared KV Cache (PSKV), a plug-and-play inference optimization technique tailored for jailbreak suffix generation. Our method is motivated by a key observation that when performing suffix jailbreaking, while a large number of candidate prompts need to be evaluated, they share the same targeted harmful instruction as the prefix. Therefore, instead of performing redundant inference on the duplicated prefix, PSKV maintains a single KV cache for this prefix and shares it with every candidate prompt, enabling the parallel inference of diverse suffixes with minimal memory overhead. This design enables more aggressive batching strategies that would otherwise be limited by memory constraints. Extensive experiments on six widely used suffix attacks across five widely deployed LLMs demonstrate that PSKV reduces inference time by 40\% and peak memory usage by 50\%, while maintaining the original Attack Success Rate (ASR). The code has been submitted and will be released publicly.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑