Certified Robustness for Large Language Models with Self-Denoising

Zhen Zhang, Guanhua Zhang, Bairu Hou, Wenqi Fan, Qing Li +3 more
7/14/2023
cs.CLcs.LG

Official code: UCSB-NLP-Chang/SelfDenoise (14 stars, last commit 2024-05-07).

Abstract

Although large language models (LLMs) have achieved great success in vast real-world applications, their vulnerabilities towards noisy inputs have significantly limited their uses, especially in high-stake environments. In these contexts, it is crucial to ensure that every prediction made by large language models is stable, i.e., LLM predictions should be consistent given minor differences in the input. This largely falls into the study of certified robust LLMs, i.e., all predictions of LLM are certified to be correct in a local region around the input. Randomized smoothing has demonstrated great potential in certifying the robustness and prediction stability of LLMs. However, randomized smoothing requires adding noise to the input before model prediction, and its certification performance depends largely on the model's performance on corrupted data. As a result, its direct application to LLMs remains challenging and often results in a small certification radius. To address this issue, we take advantage of the multitasking nature of LLMs and propose to denoise the corrupted inputs with LLMs in a self-denoising manner. Different from previous works like denoised smoothing, which requires training a separate model to robustify LLM, our method enjoys far better efficiency and flexibility. Our experiment results show that our method outperforms the existing certification methods under both certified robustness and empirical robustness. The codes are available at https://github.com/UCSB-NLP-Chang/SelfDenoise.

View on arXivView PDF

Code Implementations(1)

142Shell, PythonJul 11, 20232 years ago

Similar Papers

Cite this paper

@article{zhang2023certified,
  title  = {Certified Robustness for Large Language Models with Self-Denoising},
  author = {Zhen Zhang and Guanhua Zhang and Bairu Hou and Wenqi Fan and Qing Li and Sijia Liu and Yang Zhang and Shiyu Chang},
  year   = {2023},
  eprint = {2307.07171},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.07171v1}
}

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/2307.07171.svg)](https://codeofpaper.com/paper/2307.07171)

Discussion