Skip to main content
QUICK REVIEW

[论文解读] Advancing the Robustness of Large Language Models through Self-Denoised Smoothing

Jiabao Ji, Bairu Hou|arXiv (Cornell University)|Apr 18, 2024
Natural Language Processing TechniquesComputer Science被引用 3
一句话总结

本文提出 SelfDenoise,一种新颖的自去噪平滑方法,通过利用大语言模型(LLMs)自身的多任务能力,在预测前对噪声输入进行去噪,从而提升 LLM 对对抗性攻击和越狱攻击的鲁棒性。与以往的随机平滑方法不同,该方法利用 LLM 本身重建掩码输入,显著提升了经验鲁棒性和认证鲁棒性,且无需微调或外部去噪器,在下游任务和对齐防御中均优于现有方法。

ABSTRACT

Although large language models (LLMs) have achieved significant success, their vulnerability to adversarial perturbations, including recent jailbreak attacks, has raised considerable concerns. However, the increasing size of these models and their limited access make improving their robustness a challenging task. Among various defense strategies, randomized smoothing has shown great potential for LLMs, as it does not require full access to the model's parameters or fine-tuning via adversarial training. However, randomized smoothing involves adding noise to the input before model prediction, and the final model's robustness largely depends on the model's performance on these noise corrupted data. Its effectiveness is often limited by the model's sub-optimal performance on noisy data. To address this issue, we propose to leverage the multitasking nature of LLMs to first denoise the noisy inputs and then to make predictions based on these denoised versions. We call this procedure self-denoised smoothing. Unlike previous denoised smoothing techniques in computer vision, which require training a separate model to enhance the robustness of LLMs, our method offers significantly better efficiency and flexibility. Our experimental results indicate that our method surpasses existing methods in both empirical and certified robustness in defending against adversarial attacks for both downstream tasks and human alignments (i.e., jailbreak attacks). Our code is publicly available at https://github.com/UCSB-NLP-Chang/SelfDenoise

研究动机与目标

  • 为解决大语言模型(LLMs)对对抗性扰动(包括越狱攻击)的脆弱性问题,此类攻击会损害模型的安全性和可靠性。
  • 克服原始随机平滑方法的局限性,即 LLM 在噪声输入上表现欠佳,导致鲁棒性下降。
  • 开发一种参数高效、黑盒的防御方法,无需访问模型权重或对抗性微调。
  • 利用 LLM 的多任务特性,在分类前对扰动输入进行去噪,从而在下游任务和对齐设置中提升鲁棒性。
  • 相比现有随机平滑基线方法(如 SmoothLLM 和 RanMask),实现更强的经验鲁棒性和认证鲁棒性。

提出的方法

  • 该方法对输入文本应用随机词掩码,生成多个扰动版本。
  • 将每个扰动输入输入 LLM,通过提示其利用内在语言理解能力完成或去噪被掩码的片段。
  • 将去噪后的输出重新输入 LLM 以执行原始任务(如分类或越狱检测)。
  • 通过在多个去噪并重新预测的样本上进行多数投票,确定鲁棒预测结果。
  • 该方法完全为黑盒,无需模型微调或额外训练,仅依赖 LLM 的上下文学习和补全能力。
  • 该方法同时应用于下游分类任务和越狱防御,基于 Cohen 等人(2019)的方法进行认证鲁棒性分析。
Figure 1: The prediction process of SelfDenoise .
Figure 1: The prediction process of SelfDenoise .

实验结果

研究问题

  • RQ1在不需模型微调或外部去噪器的前提下,对扰动输入进行自去噪是否能提升 LLM 在随机平滑中的鲁棒性?
  • RQ2与现有随机平滑方法(如 SmoothLLM 和 RanMask)相比,自去噪平滑在防御下游 NLP 任务中的对抗性攻击时表现如何?
  • RQ3在高噪声水平下,自去噪在多大程度上减少了模型拒绝行为(如“我无法帮助您”),从而避免破坏防御功能?
  • RQ4在越狱防御场景中,自去噪平滑能否实现比基线方法更强的认证鲁棒性边界?
  • RQ5利用 LLM 自身的补全能力进行去噪,是否相比外部去噪器或直接平滑,能带来更好的泛化性和鲁棒性?

主要发现

  • 在 15% 掩码率下,SelfDenoise 对 GCG 攻击的防御成功率达到 30%,显著优于 SmoothLLM(10%)和 RanMask(15%)。
  • 在 15% 掩码率下,SelfDenoise 对 PAIR 攻击的成功率为 24%,而 SmoothLLM 为 8%,RanMask 为 0%。
  • SelfDenoise 在所有设置下的拒绝率均低于 5%,而 SmoothLLM 和 RanMask 在 20% 掩码率下拒绝率超过 50%,表明其功能稳定性更优。
  • SelfDenoise 在下游分类和越狱防御中均展现出更优的认证鲁棒性,相较于基线方法具有更优的鲁棒性裕量。
  • 该方法有效缓解了高掩码率导致的语义破坏,保留了模型功能,而其他方法因过度拒绝而失效。
  • 消融研究证实,自去噪步骤至关重要,因为直接平滑(无去噪)会导致性能下降,尤其在高噪声水平下更为明显。
Figure 2: Certified accuracy under different perturbation scale $d$ (%) on SST-2 ( left ) and Agnews ( right ).
Figure 2: Certified accuracy under different perturbation scale $d$ (%) on SST-2 ( left ) and Agnews ( right ).

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。