Skip to main content
QUICK REVIEW

[Paper Review] Differentiable Language Model Adversarial Attacks on Categorical Sequence Classifiers

Ivan Fursov, Alexey Zaytsev|arXiv (Cornell University)|Jun 19, 2020
Adversarial Robustness in Machine LearningComputer Science36 references4 citations
TL;DR

This paper proposes DILMA, a differentiable adversarial attack framework for categorical sequence classifiers using fine-tuned masked language models. By formulating a differentiable loss combining surrogate classifier scores and a differentiable Levenshtein distance, DILMA generates semantically coherent adversarial examples that are robust to adversarial training and detection, outperforming existing methods on NLP, healthcare, and financial datasets.

ABSTRACT

An adversarial attack paradigm explores various scenarios for the vulnerability of deep learning models: minor changes of the input can force a model failure. Most of the state of the art frameworks focus on adversarial attacks for images and other structured model inputs, but not for categorical sequences models. Successful attacks on classifiers of categorical sequences are challenging because the model input is tokens from finite sets, so a classifier score is non-differentiable with respect to inputs, and gradient-based attacks are not applicable. Common approaches deal with this problem working at a token level, while the discrete optimization problem at hand requires a lot of resources to solve. We instead use a fine-tuning of a language model for adversarial attacks as a generator of adversarial examples. To optimize the model, we define a differentiable loss function that depends on a surrogate classifier score and on a deep learning model that evaluates approximate edit distance. So, we control both the adversability of a generated sequence and its similarity to the initial sequence. As a result, we obtain semantically better samples. Moreover, they are resistant to adversarial training and adversarial detectors. Our model works for diverse datasets on bank transactions, electronic health records, and NLP datasets.

Motivation & Objective

  • To address the challenge of generating effective adversarial examples for discrete categorical sequence classifiers, where standard gradient-based attacks fail due to non-differentiability.
  • To overcome the limitations of token-level discrete optimization, which is computationally expensive and often suboptimal.
  • To develop a method that leverages pre-trained language models for efficient, high-quality adversarial example generation with semantic coherence.
  • To ensure robustness against adversarial defense mechanisms such as adversarial training and detection models.
  • To validate the approach across diverse domains including NLP, electronic health records, and bank transaction data.

Proposed method

  • Fine-tune a transformer-based masked language model (MLM) to generate adversarial sequences by optimizing a differentiable loss function.
  • Define a differentiable loss as a weighted sum of the classifier score difference between original and adversarial sequences and the approximate edit distance between them.
  • Use a differentiable version of the Levenshtein distance to measure sequence similarity in a gradient-compatible manner.
  • Apply the Gumbel-Softmax trick to backpropagate gradients through discrete token generation in the sequence generation process.
  • Support two attack regimes: random sampling for baseline generation and targeted optimization for improved attack success.
  • Leverage strong pre-trained language models to reduce the need for task-specific training and hyperparameter tuning.

Experimental results

Research questions

  • RQ1Can a differentiable loss function be designed to enable gradient-based optimization for adversarial attacks on discrete sequence classifiers?
  • RQ2How can semantic coherence and minimal perturbation be preserved in adversarial examples for categorical sequences?
  • RQ3To what extent can a fine-tuned language model generate adversarial examples that evade both adversarial training and detection mechanisms?
  • RQ4How does the proposed method compare to existing state-of-the-art attacks in terms of attack success and perturbation quality across diverse datasets?
  • RQ5What hyperparameter settings yield robust performance across multiple domains without extensive tuning?

Key findings

  • DILMA achieves a Word Error Rate (WER) of 0.52 on the Tr.Gender dataset, outperforming HotFlip (0.61) and FGSM (0.34), with a mean probability difference of 0.25 for the true class, indicating strong misclassification capability.
  • On the SST-2 dataset, DILMA achieves a WER of 0.60 and a probability difference of 0.46, demonstrating high attack success while maintaining semantic plausibility.
  • DILMA with sampling (DILMA w/ sampling) achieves a WER of 0.56 on TREC and a probability difference of 0.41, showing strong performance across diverse NLP datasets.
  • The method remains effective after adversarial training, with a mean probability difference of 0.25 on Tr.Gender and 0.27 on Tr.Age, indicating resistance to standard defenses.
  • Hyperparameter ablation shows that performance is stable across datasets with consistent settings, reducing the need for extensive tuning.
  • The approach outperforms FGSM, DeepFool, and HotFlip in both WER and probability drop metrics, especially in post-adversarial training evaluation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.