Contrastive Explanations of Text Classifiers as a Service (2022)

Abstract: The recent growth of black-box machine-learning methods in data analysis has increased the demand for explanation methods and tools to understand their behaviour and assist human-ML model cooperation. In this paper, we demonstrate ContrXT, a novel approach that uses natural language explanations to help users to comprehend how a back-box model works. ContrXT provides time contrastive (t-contrast) explanations by computing the differences in the classification logic of two different trained models and then reasoning on their symbolic representations through Binary Decision Diagrams. ContrXT is publicly available at ContrXT.ai as a python pip package.

## introduction and contribution consider a text classifier ψ 1 , retrained with new data and resulting into ψ 2 . the underlying learning function of the newly trained model might lead to outcomes considered as contradictory by the end users when compared with the previous ones, as the system does not explain why the logic is changed. hence, such a user might wonder "why do the criteria used by ψ 1 result in class c, but ψ 2 does not classify on c anymore?". this is posed as a t-contrast question, namely, "why does object a have property p at time t i , but property q at time t j ?" @xcite . ## experimental evaluation contrxt was evaluated in terms of approximation quality to the input model to be explained (i.e., the fidelity of the surrogate) on 20newsgroups, a well-known benchmark used in @xcite to build a reproducible text classifier, and in @xcite , to evaluate lime's effectiveness in providing local explanations. we ran contrxt over different classifiers, trained using popular classifiers such as linear regression (lr), random forest (rf), support vector machines (svm), naive bayes (nb), bidirectional gated recurrent unit (bi-gru) @xcite , and bert @xcite (bert-base-uncased) with a sequence classification layer on top. results are shown in to date, contrxt relies on decision trees to build the surrogate, though it can employ any surrogate algorithms. ## conclusion, limitations and future work in this demonstration we presented a system to deliver contrastive explanations of text classifiers as a service. the system is built on top of contrxt @xcite , a novel modelagnostic tool to globally explain how a black box text classifier change its learning criteria with regard to the past (t-contrast) by manipulating bdds. given two classifiers trained on the same target class set, the system we presented provides time contrastive explanations of their behaviour, together with detailed insights and metrics. among them, we presented the possibility to highlight how and how much the classification rules differ along time. a load test demonstrated that our architecture has a throughput of 2.55 users per second. beyond this value, the api service puts the additional requests into a queue but keeps working. to date, contrxt is bounded to explain text classifiers. we are working to extend contrxt to tabular classifiers.