arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.13705cs.CVcs.AIcs.CL
收藏

通过防御性后缀生成缓解 LLMs 中的对抗攻击

Mitigating Adversarial Attacks in LLMs through Defensive Suffix Generation

Asan Medical Center(峨山医疗中心);Yonsei University(延世大学)

Minkyoung Kim, Yunha Kim, Hyeram Seo, Heejung Choi, Jiye Han, Gaeun Kee, Soyoung Ko, HyoJe Jung, Byeolhee Kim, Young-Hak Kim, Sanghyun Park, Tae Joon Jun

AI总结:

本文提出一种基于梯度的防御性后缀生成算法,结合防御与对抗损失优化后缀,在不需大量重训练的情况下有效缓解 LLMs 对抗攻击,将攻击成功率平均降低 11% 并显著提升模型安全性。

摘要:

大型语言模型(LLMs)在自然语言处理任务中表现出色。然而,这些模型仍易受对抗攻击,轻微的输入扰动可能导致有害或误导性的输出。本文设计了一种基于梯度的防御性后缀生成算法,以增强 LLMs 的鲁棒性。通过将精心优化的防御性后缀附加到输入提示中,该算法在保持模型效用的同时缓解了对抗性影响。为了增强对对抗性的理解,一种结合防御损失($L_{\ ext{def}}$)和对抗损失($L_{\ ext{adv}}$)的新型总损失函数($L_{\ ext{total}}$)能更有效地生成防御性后缀。在 Gemma-7B、mistral-7B、Llama2-7B 和 Llama2-13B 等开源 LLMs 上进行的实验评估表明,与无防御后缀的模型相比,所提方法将攻击成功率(ASR)平均降低了 11%。此外,当应用 openELM-270M 生成的防御性后缀时,Gemma-7B 的困惑度得分从 6.57 降至 3.93。并且,TruthfulQA 评估显示出一致的改进,在所有测试配置中 Truthfulness 得分最高提升了 10%。该方法无需大量重训练,即显著提升了 LLMs 在关键应用中的安全性。

英文摘要:

Large language models (LLMs) have exhibited outstanding performance in natural language processing tasks. However, these models remain susceptible to adversarial attacks in which slight input perturbations can lead to harmful or misleading outputs. A gradient-based defensive suffix generation algorithm is designed to bolster the robustness of LLMs. By appending carefully optimized defensive suffixes to input prompts, the algorithm mitigates adversarial influences while preserving the models' utility. To enhance adversarial understanding, a novel total loss function ($L_{\text{total}}$) combining defensive loss ($L_{\text{def}}$) and adversarial loss ($L_{\text{adv}}$) generates defensive suffixes more effectively. Experimental evaluations conducted on open-source LLMs such as Gemma-7B, mistral-7B, Llama2-7B, and Llama2-13B show that the proposed method reduces attack success rates (ASR) by an average of 11\% compared to models without defensive suffixes. Additionally, the perplexity score of Gemma-7B decreased from 6.57 to 3.93 when applying the defensive suffix generated by openELM-270M. Furthermore, TruthfulQA evaluations demonstrate consistent improvements with Truthfulness scores increasing by up to 10\% across tested configurations. This approach significantly enhances the security of LLMs in critical applications without requiring extensive retraining.

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

↑