Mitigating Adversarial Attacks in LLMs through Defensive Suffix Generation

Minkyoung Kim, Yunha Kim, Hyeram Seo, Heejung Choi, Jiye Han +7 more
12/18/2024
cs.CVcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{kim2024mitigating,
  title  = {Mitigating Adversarial Attacks in LLMs through Defensive Suffix Generation},
  author = {Minkyoung Kim and Yunha Kim and Hyeram Seo and Heejung Choi and Jiye Han and Gaeun Kee and Soyoung Ko and HyoJe Jung and Byeolhee Kim and Young-Hak Kim and Sanghyun Park and Tae Joon Jun},
  year   = {2024},
  eprint = {2412.13705},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2412.13705v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2412.13705.svg)](https://codeofpaper.com/paper/2412.13705)

Discussion