Certified Robustness Against Natural Language Attacks by Causal Intervention

Haiteng Zhao, Chang Ma, Xinshuai Dong, Anh Tuan Luu, Zhi-Hong Deng, Hanwang Zhang · DOI

TL;DR

This paper introduces Causal Intervention by Semantic Smoothing (CISS), a novel framework that leverages causal inference to achieve certified robustness against natural language adversarial attacks. By learning causal effects rather than just observational correlations, CISS demonstrates improved robustness and scalability to deep architectures, outperforming existing methods on benchmark datasets.

What Problem Does This Paper Address?

Deep learning models, despite their success, are notoriously vulnerable to adversarial examples – subtly modified inputs designed to fool the model. In natural language processing (NLP), this vulnerability poses a significant security risk. Existing defenses often struggle to generalize to unseen attack types or scale to complex models like Transformers. This paper addresses this by proposing a new perspective: adversarial vulnerability arises from spurious correlations learned by models, which can be exploited by attackers. The goal is to build models that are robust by understanding and mitigating these causal confounders.

Methods

The core of CISS lies in its causal perspective. Instead of learning the observational distribution $p(y|x)$, CISS aims to learn the interventional distribution $p(y|do(x))$, which represents the causal effect of input $x$ on output $y$. This is achieved through Semantic Smoothing:

  • Causal Graph: The authors model the data generation process with a causal graph where $X$ is the input, $Y$ is the label, $C$ is the content, and $N$ is a set of confounders (e.g., stylistic elements) that can be manipulated by attackers. Spurious correlations arise from the path $X \leftarrow N \rightarrow Y$.
  • Semantic Smoothing: CISS maps the input $x$ into a latent semantic space using an encoder $s(\cdot)$. Gaussian noise is then added to this latent representation, and the model predicts by taking the expectation over this noise. This process effectively "smooths out" the influence of confounders in the latent space, mimicking causal intervention.
  • IBP Encoder: To ensure the semantic space is well-behaved for certification, an Interval Bound Propagation (IBP) encoder is used. This allows for the calculation of bounds on the semantic representation under perturbations.
  • Training Objective: The training objective combines a classification loss ($L_{cls}$) with a robustness loss ($L_{robust}$) that encourages the model to satisfy the certification conditions derived from causal inference and IBP.

This approach differs from traditional randomized smoothing by operating in a learned latent semantic space, making it more flexible for discrete NLP perturbations and scalable to deep architectures.

Datasets

The paper evaluates CISS on two standard NLP datasets for text classification:

  • YELP: A dataset for sentiment analysis.
  • IMDB: A dataset for movie review sentiment analysis.

The authors do not introduce new benchmarks but focus on comparing their method against existing state-of-the-art approaches on these established datasets.

Key Insights and Ideas

  • Causality as the Key to Robustness: The paper argues that adversarial vulnerability in NLP stems from models learning spurious correlations with confounders, rather than true causal relationships. By modeling causal effects ($p(y|do(x))$), models can become inherently more robust.
  • Semantic Space Smoothing: Applying smoothing (like randomized smoothing) in a learned latent semantic space, rather than directly on the input text, is more effective for NLP. This allows for flexible handling of discrete perturbations and better scalability.
  • IBP for Scalable Certification: Integrating Interval Bound Propagation (IBP) into a shallow encoder allows for certified robustness guarantees without suffering from the exponential looseness of IBP in deep architectures.
  • Unseen Attack Robustness: CISS demonstrates empirical robustness against unseen attack types (syntactic and editing attacks) that were not part of the training data, suggesting a more generalized defense mechanism.

Key Results

  • Certified Robustness: CISS achieves state-of-the-art certified robust accuracy on both YELP and IMDB datasets against word substitution attacks.
  • On YELP, CISS achieves 90.58% certified robustness, surpassing the runner-up by 6.8%.
  • On IMDB, CISS achieves 76.45% certified robustness, surpassing the runner-up by 7.2%.
  • Empirical Robustness: CISS also shows strong empirical robustness, particularly against integrated attacks (word substitution combined with syntactic and editing attacks).
  • On YELP, CISS achieves 80.7% empirical robustness.
  • On IMDB, CISS achieves 74.4% empirical robustness against syntactic attacks and 74.3% against editing attacks.
  • Accuracy-Robustness Trade-off: CISS demonstrates a favorable trade-off between clean accuracy and robust accuracy, with its curve closely approximating the theoretical upper bound.
  • Scalability: The method scales to deep architectures like BERT, unlike some other IBP-based methods that struggle with deep models.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that IBP encoders, while shallow in CISS, can still lead to looser bounds in deeper architectures.
  • The empirical robustness against integrated attacks, while strong, still shows a drop in accuracy compared to clean accuracy.
  • Future Work:
    • The authors plan to explore a more generalized framework for robustness in both computer vision (CV) and NLP.

Summary updated

BibTeX
@inproceedings{zhao2022certified,
  author = {Haiteng Zhao and Chang Ma and Xinshuai Dong and Anh Tuan Luu and Zhi-Hong Deng and Hanwang Zhang},
  title = {{Certified Robustness Against Natural Language Attacks by Causal Intervention}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=jNdmcovaL_m},
}
Figure