When Vision Fails: Text Attacks Against ViT and OCR

Nicholas Boucher, Jenny Blessing, Ilia Shumailov, Ross Anderson, Nicolas Papernot
6/12/2023
9 citations
cs.CRcs.LG
transformer-attention

Official code: nickboucher/diacritics (1 star, Jupyter Notebook, MIT, last commit 2024-11-11).

Abstract

Text-based machine learning models are vulnerable to an emerging class of Unicode-based adversarial examples capable of tricking a model into misreading text with potentially disastrous effects. The primary existing defense against these attacks is to preprocess potentially malicious text inputs using optical character recognition (OCR).

Show full abstract

In theory, OCR models will ignore any malicious Unicode characters and will extract the visually correct input to be fed to the model. In this work, we show that these visual defenses fail to prevent this type of attack. We use a genetic algorithm to generate visual adversarial examples (i.e., OCR outputs) in a black-box setting, demonstrating a highly effective novel attack that substantially reduces the accuracy of OCR and other visual models. Specifically, we use the Unicode functionality of combining characters (e.g., ñ which combines the characters n and ~) to manipulate text inputs so that small visual perturbations appear when the text is displayed. We demonstrate the effectiveness of these attacks in the real world by creating adversarial examples against production models published by Meta, Microsoft, IBM, and Google. We additionally conduct a user study to establish that the model-fooling adversarial examples do not affect human comprehension of the text, showing that language models are uniquely vulnerable to this type of text attack.

View on arXivView PDF

Code Implementations(1)

MIT

Adversarial OCR using Unicode diacriticals

10Jupyter Notebook, PythonNov 9, 20212 years agoMIT

Similar Papers

Cite this paper

@article{boucher2023when,
  title  = {When Vision Fails: Text Attacks Against ViT and OCR},
  author = {Nicholas Boucher and Jenny Blessing and Ilia Shumailov and Ross Anderson and Nicolas Papernot},
  year   = {2023},
  eprint = {2306.07033},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2306.07033v2}
}

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

Discussion