TextHacker: Learning based Hybrid Local Search Algorithm for Text Hard-label Adversarial Attack

Zhen Yu, Xiaosen Wang, Wanxiang Che, Kun He
1/20/2022
cs.CLcs.LG

Official code: JHL-HUST/TextHacker (9 stars, Python, Apache-2.0, last commit 2022-10-14).

Abstract

Existing textual adversarial attacks usually utilize the gradient or prediction confidence to generate adversarial examples, making it hard to be deployed in real-world applications. To this end, we consider a rarely investigated but more rigorous setting, namely hard-label attack, in which the attacker can only access the prediction label.

Show full abstract

In particular, we find we can learn the importance of different words via the change on prediction label caused by word substitutions on the adversarial examples. Based on this observation, we propose a novel adversarial attack, termed Text Hard-label attacker (TextHacker). TextHacker randomly perturbs lots of words to craft an adversarial example. Then, TextHacker adopts a hybrid local search algorithm with the estimation of word importance from the attack history to minimize the adversarial perturbation. Extensive evaluations for text classification and textual entailment show that TextHacker significantly outperforms existing hard-label attacks regarding the attack performance as well as adversary quality.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

TextHacker: Learning based Hybrid Local Search Algorithm for Hard-label Text Adversarial Attack

91Python, ShellOct 14, 20224 years agoApache-2.0

Similar Papers

Cite this paper

@article{yu2022texthacker,
  title  = {TextHacker: Learning based Hybrid Local Search Algorithm for Text Hard-label Adversarial Attack},
  author = {Zhen Yu and Xiaosen Wang and Wanxiang Che and Kun He},
  year   = {2022},
  eprint = {2201.08193},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2201.08193}
}

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

Discussion