Text Counterfactuals via Latent Optimization and Shapley-Guided Search

31651

Authors

nan

Abstract

AbstractWe study the problem of generating counterfactual text for a classifier as a means for understanding and debugging classification. Given a textual input and a classification model, we aim to minimally alter the text to change the model’s prediction. White-box approaches have been successfully applied to similar problems in vision where one can directly optimize the continuous input. Optimization-based approaches become difficult in the language domain due to the discrete nature of text. We bypass this issue by directly optimizing in the latent space and leveraging a language model to generate candidate modifications from optimized latent representations. We additionally use Shapley values to estimate the combinatoric effect of multiple changes. We then use these estimates to guide a beam search for the final counterfactual text. We achieve favorable performance compared to recent white-box and black-box baselines using human and automatic evaluations. Ablation studies show that both latent optimization and the use of Shapley values improve success rate and the quality of the generated counterfactuals.

Keywords

nan

Full Content

Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 5578–5593 November 7–11, 2021. c⃝2021 Association for Computational Linguistics 5578 Text Counterfactuals via Latent Optimization and Shapley-Guided Search Quintin Pope and Xiaoli Z. Fern School of Electrical Engineering and Computer Science Oregon State University popeq,xfern@oregonstate.edu Abstract We study the problem of generating counter- factual text for a classifier as a means for under- standing and debugging classification. Given a textual input and a classification model, we aim to minimally alter the text to change the model’s prediction. White-box approaches have been successfully applied to similar prob- lems in vision where one can directly optimize the continuous input. Optimization-based ap- proaches become difficult in the language do- main due to the discrete nature of text. We bypass this issue by directly optimizing in the latent space and leveraging a language model to generate candidate modifications from op- timized latent representations. We addition- ally use Shapley values to estimate the com- binatoric effect of multiple changes. We then use these estimates to guide a beam search for the final counterfactual text. We achieve favor- able performance compared to recent white- box and black-box baselines using human and automatic evaluations. Ablation studies show that both latent optimization and the use of Shapley values improve success rate and the quality of the generated counterfactuals. 1 Introduction Deep neural networks have achieved state-of-the- art performances for many natural language pro- cessing (NLP) tasks (Otter et al., 2020; Ruder et al., 2019). When applying such models in real world applications, understanding their behavior can be challenging — the ever increasing complexity of such models makes it difficult to understand and debug their predictions. A human can explain why an example belongs to a specific concept class by constructing a counterfactual of an example that is minimally altered but belongs to a different class. Contrasting the original example with its counter- factual highlights the critical aspects signifying the concept class. We study a similar approach to un- derstand deep NLP models’ classification criteria. Given a classifier and an input text, our goal is to generate a counterfactual by making a set of mini- mal modifications to the text that change the label assigned by the classifier. Additionally, our goal is to understand the model’s behavior when process- ing naturally occurring inputs, hence we wish to generate grammatically correct and semantically plausible counterfactuals. Automatic generation of text counterfactuals has been studied in different settings. Qin et al. (2019) considered counterfactual story rewriting which aims to minimally rewrite an original story to be compatible with a counterfactual event. Wu et al. (2021) used a fine-tuned GPT-2 model to gen- erate general purpose counterfactuals that are not tied to a particular classification model. Yang et al. (2020) aim to generate plausible-sounding counter- factuals that flip a classification model’s decision for financial texts. Related, textual adversaries also aim to change the model prediction (with modifications resem- bling natural text). The difference is that adver- saries further aim to …

Content truncated to 500 words

Labeled Text

AbstractWe study the problem of generating counterfactual text for a classifier as a means for understanding and debugging classification. Given a textual input and a classification model, we aim to minimally alter the text to change the model’s prediction. White-box approaches have been successfully applied to similar problems in vision where one can directly optimize the continuous input. Optimization-based approaches become difficult in the language domain due to the discrete nature of text. We bypass this issue by directly optimizing in the latent space and leveraging a language model to generate candidate modifications from optimized latent representations. We additionally use Shapley values to estimate the combinatoric effect of multiple changes. We then use these estimates to guide a beam search for the final counterfactual text. We achieve favorable performance compared to recent white-box and black-box baselines using human and automatic evaluations. Ablation studies show that both latent optimization and the use of Shapley values improve success rate and the quality of the generated counterfactuals.

Publication Details

Paper ID:
31651
Year:
2021
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan