SMAB: MAB based word Sensitivity Estimation Framework and its Applications in Adversarial Text Generation

Saurabh Kumar Pandey, Sachin Vashistha, Debrup Das, Somak Aditya, Monojit Choudhury

Introduction

Modern Pre-trained Language Models (PLMs) often operate as "black boxes," making it difficult to identify which specific components of an input string drive their decisions. A theoretical concept known as sensitivity offers a way to measure this by determining how many disjoint subsets of an input can be modified to flip a model's output. However, calculating sensitivity is computationally expensive, typically requiring exponential time complexity. Furthermore, existing explainability tools like LIME or SHAP provide local explanations for individual sentences but fail to offer a global perspective on word importance across an entire dataset.

This paper introduces SMAB (Sensitivity-based Multi-Armed Bandit), a scalable framework designed to estimate word-level sensitivity in black-box text classifiers efficiently. By treating sensitivity estimation as a resource allocation problem, SMAB identifies "high-stakes" words that consistently influence model predictions across a corpus.

The SMAB Framework

The core of the SMAB framework is a two-level bandit system that transforms an exponential search problem into a linear one. The process operates through a cycle of sampling, replacement, and prediction:

  1. Two-Level Bandit Architecture: The Outer Arm represents every unique word in the dataset, using strategies like Thompson Sampling to select words for testing. The Inner Arm represents all sentences containing the selected word.
  2. Sample-Replace-Predict: Once a word ($w_1$) is chosen, the framework identifies sentences containing it. It utilizes a Masked Language Model (MLM), specifically XLM-ROBERTA LARGE, to generate contextually appropriate perturbations.
  3. Sensitivity Calculation: If replacing a word flips the target classifier's label, that word is assigned a high Local Sensitivity ($L_{w_1}$).
  4. Global Aggregation: These local scores are aggregated to update a Global Sensitivity value for the word, identifying its overall influence across the dataset.
The SMAB framework architecture showing the two-level bandit approach for global sensitivity estimation.

Sensitivity as a Performance Proxy

A significant finding of this research is that the distribution of sensitivity can serve as a powerful unsupervised proxy for model accuracy. The researchers discovered that if a model's sensitivity distribution on a new, unlabeled language (e.g., Hindi) deviates significantly from its distribution on a known language (e.g., English), this deviation strongly correlates with a drop in accuracy.

By measuring the KL divergence between these sensitivity distributions, researchers can estimate model performance decay without requiring gold-standard labels. Empirical results showed a high negative correlation—up to -0.91 for the XNLI task—between KL divergence and model accuracy.

Correlation between KL divergence of sensitivity distributions and model accuracy on the XNLI task.

Enhancing Adversarial Attacks

Beyond performance prediction, SMAB's sensitivity scores can be used to guide the generation of highly effective adversarial attacks. By identifying the most "sensitive" words in a sentence, the framework provides a roadmap for flipping a model's prediction with minimal changes.

  • PromptAttack: Integrating SMAB sensitivity values into prompts for Large Language Models (like GPT-3.5) improved the Attack Success Rate (ASR) by 15.58% over standard baselines.
  • ParaphraseAttack: Using sensitivity as a reward signal in generating adversarial paraphrases led to a 12.00% improvement over previous state-of-the-art methods.

Validation using the CheckList dataset confirmed that SMAB accurately distinguishes between words intended to flip labels (Directional Expectation) and those that should remain invariant, assigning significantly higher sensitivity scores to the former.

Conclusion

SMAB provides a scalable and efficient method for global sensitivity estimation in black-box models. By bridging the gap between local explanations and global model behavior, it enables unsupervised accuracy prediction and significantly boosts the effectiveness of adversarial text generation. While currently focused on sequence classification, future work may extend these techniques to generative tasks such as translation and summarization.

Summary updated

Abstract

To understand the complexity of sequence classification tasks, Hahn et al. (2021) proposed sensitivity as the number of disjoint subsets of the input sequence that can each be individually changed to change the output. Though effective, calculating sensitivity at scale using this framework is costly because of exponential time complexity. Therefore, we introduce a Sensitivity-based Multi-Armed Bandit framework (SMAB), which provides a scalable approach for calculating word-level local (sentence-level) and global (aggregated) sensitivities concerning an underlying text classifier for any dataset. We establish the effectiveness of our approach through various applications. We perform a case study on CHECKLIST generated sentiment analysis dataset where we show that our algorithm indeed captures intuitively high and low-sensitive words. Through experiments on multiple tasks and languages, we show that sensitivity can serve as a proxy for accuracy in the absence of gold data. Lastly, we show that guiding perturbation prompts using sensitivity values in adversarial example generation improves attack success rate by 15.58%, whereas using sensitivity as an additional reward in adversarial paraphrase generation gives a 12.00% improvement over SOTA approaches. Warning: Contains potentially offensive content.
BibTeX
@inproceedings{pandey2025smab,
  author = {Saurabh Kumar Pandey and Sachin Vashistha and Debrup Das and Somak Aditya and Monojit Choudhury},
  title = {{SMAB: MAB based word Sensitivity Estimation Framework and its Applications in Adversarial Text Generation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.463},
}
Figure