Lune

ACL Findings2023

Detecting Adversarial Samples through Sharpness of Loss Landscape

Rui Zheng, Shihan Dou, Yuhao Zhou, Qin Liu, Tao Gui, Qi Zhang, Zhongyu Wei, Xuanjing Huang, Menghan Zhang

Abstract

Deep neural networks (DNNs) have been proven to be sensitive towards perturbations on input samples, and previous works highlight that adversarial samples are even more vulnerable than normal ones. In this work, this phenomenon is illustrated from the perspective of sharpness via visualizing the input loss landscape of models. We first show that adversarial samples locate in steep and narrow local minima of the loss landscape (high sharpness) while normal samples, which differs distinctly from adversarial ones, reside in the loss surface that is more flatter (low sharpness). Based on this, we propose a simple and effective sharpness-based detector to distinct adversarial samples by maximizing the loss increment within the region where the inference sample is located. Considering that the notion of sharpness of a loss landscape is relative, we further propose an adaptive optimization strategy in an attempt to fairly compare the relative sharpness among different samples. Experimental results show that our approach can outperform previous detection methods by large margins (average +6.6 F1 score) for four advanced attack strategies considered in this paper across three text classification tasks. Our codes are publicly available at https://github.com/ ruizheng20/sharpness_detection.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Guided Perturbation Sensitivity (GPS): Detecting Adversarial Text via Embedding Stability and Word Importance cites BERT-ATTACK: Adversarial Attack Against BERT Using BERT
  • Guided Perturbation Sensitivity (GPS): Detecting Adversarial Text via Embedding Stability and Word Importance cites Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment
  • BERT-ATTACK: Adversarial Attack Against BERT Using BERT cites Word-level Textual Adversarial Attacking as Combinatorial Optimization
  • Generating Natural Language Attacks in a Hard Label Black Box Setting cites Word-level Textual Adversarial Attacking as Combinatorial Optimization
  • Reevaluating Adversarial Examples in Natural Language cites Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Guided Perturbation Sensitivity (GPS): Detecting Adversarial Text via Embedding Stability and Word ImportanceBryan E. Tuck, Rakesh M. VermaAAAI 2026 · 1 citation
  2. REMIND: Memorization and Unlearning in LLMs Through the Lens of Input Loss LandscapesLiran Cohen, Yaniv Nemcovsky, Avi MendelsonACL 2026

Builds on15

  1. Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and EntailmentDi Jin, Zhijing Jin, Joey Tianyi Zhou, Peter SzolovitsAAAI 2020 · 1,333 citations
  2. BERT-ATTACK: Adversarial Attack Against BERT Using BERTLinyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue et al.EMNLP 2020 · 529 citations
  3. Word-level Textual Adversarial Attacking as Combinatorial OptimizationYuan Zang, Fanchao Qi, Chenghao Yang, Zhiyuan Liu et al.ACL 2020 · 188 citations
  4. Generating Natural Language Attacks in a Hard Label Black Box SettingRishabh Maheshwary, Saket Maheshwary, Vikram PudiAAAI 2021 · 128 citations
  5. Reevaluating Adversarial Examples in Natural LanguageJohn X. Morris, Eli Lifland, Jack Lanchantin, Yangfeng Ji et al.EMNLP Findings 2020 · 93 citations

Related papers

  1. CASN: Class-Aware Score Network for Textual Adversarial DetectionRong Bao, Rui Zheng, Liang Ding, Qi Zhang et al.ACL 2023 · 3 citations
  2. Detecting Adversarial Examples from Sensitivity Inconsistency of Spatial-Transform DomainJinyu Tian, Jiantao Zhou, Yuanman Li, Jia DuanAAAI 2021 · 72 citations
  3. GA-SAM: Gradient-Strength based Adaptive Sharpness-Aware Minimization for Improved GeneralizationZhiyuan Zhang, Ruixuan Luo, Qi Su, Xu SunEMNLP 2022 · 9 citations
  4. Sharpness-Aware Data Poisoning AttackPengfei He, Han Xu, Jie Ren, Yingqian Cui et al.ICLR 2024 · 10 citations
  5. Sharpness-aware Minimization for Efficiently Improving GeneralizationPierre Foret, Ariel Kleiner, Hossein Mobahi, Behnam NeyshaburICLR 2021 · 1,861 citations
Dusk over the sea between two cliffs drawn in fine vertical lines