Revisiting Character-level Adversarial Attacks for Language Models

Elias Abad Rocamora, Yongtao Wu, Fanghui Liu, Grigorios G. Chrysos, Volkan Cevher
5/7/2024
cs.LGcs.AIcs.CL

Official code: LIONS-EPFL/Charmer (19 stars, MIT, last commit 2025-02-12).

Abstract

Adversarial attacks in Natural Language Processing apply perturbations in the character or token levels. Token-level attacks, gaining prominence for their use of gradient-based methods, are susceptible to altering sentence semantics, leading to invalid adversarial examples. While character-level attacks easily maintain semantics, they have received less attention as they cannot easily adopt popular gradient-based methods, and are thought to be easy to defend. Challenging these beliefs, we introduce Charmer, an efficient query-based adversarial attack capable of achieving high attack success rate (ASR) while generating highly similar adversarial examples. Our method successfully targets both small (BERT) and large (Llama 2) models. Specifically, on BERT with SST-2, Charmer improves the ASR in 4.84% points and the USE similarity in 8% points with respect to the previous art. Our implementation is available in https://github.com/LIONS-EPFL/Charmer.

View on arXivView PDF

Code Implementations(1)

LIONS-EPFL/CharmerOfficial100%
MIT

Revisiting Character-level Adversarial Attacks for Language Models, ICML 2024

192Shell, PythonMay 6, 20241 years agoMIT

Similar Papers

Cite this paper

@article{rocamora2024revisiting,
  title  = {Revisiting Character-level Adversarial Attacks for Language Models},
  author = {Elias Abad Rocamora and Yongtao Wu and Fanghui Liu and Grigorios G. Chrysos and Volkan Cevher},
  year   = {2024},
  eprint = {2405.04346},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.04346v2},
  journal = {ICML 2024 2024}
}

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

Discussion