Extending Logic Explained Networks to Text Classification (2022)

Abstract: Recently, Logic Explained Networks (LENs) have been proposed as explainable-by-design neural models providing logic explanations for their predictions.However, these models have only been applied to vision and tabular data, and they mostly favour the generation of global explanations, while local ones tend to be noisy and verbose.For these reasons, we propose LEN<sup>p</sup>, improving local explanations by perturbing input words, and we test it on text classification. Our results show that (i) LEN<sup>p</sup> provides better local explanations than LIME in terms of sensitivity and faithfulness, and (ii) its logic explanations are more useful and user-friendly than the feature scoring provided by LIME as attested by a human survey.

## introduction the development of deep neural networks has enabled the creation of high accuracy text classifiers @xcite with state-of-the-art models leveraging different forms of architectures, like rnns (gru, lstm) @xcite or transformer models @xcite . however, these architectures are considered as blackbox models @xcite , since their decision processes are not easy to explain and depend on a very large set of parameters. in order to shed light on neural models' decision processes, explainable artificial intelligence (xai) techniques attempt to understand text attribution to certain classes, for instance by using white-box models. interpretable-by-design models engender higher trust in human users with respect to explanation methods for black-boxes, at the cost, however, of lower prediction performance. recently, @xcite and @xcite introduced the logic explained network (len), an explainable-by-design neural network combining interpretability of white-box * corresponding author: rj412@cam.ac.uk models with high performance of neural networks. however, the authors only compared lens with white-box models and on tabular/computer vision tasks. for this reason, in this work we apply an improved version of the len (len p ) to the text classification problem, and we compare it with lime @xcite , a very-well known explanation method. len and lime provide different kind of explanations, respectively fol formulae and feature-importance vectors, and we assess their user-friendliness by means of a user-study. as an evaluation benchmark, we considered multi-label text classification for the tag classification task on the "stacksample: 10% of stack overflow q&a" dataset @xcite . contribution the paper aims to: (i) improve len explanation algorithm (len p ) foot_0 ; (ii) compare the faithfulness and the sensitivity of the explanations provided by lens and lime; (iii) assess the user-friendliness of the two kinds of explanations. len the logic explained network @xcite is a novel xai architectural framework forming special kind of neural networks that are explainable-by-design. in particular, lens impose len input categories local explanation python importing "i have a file, myfile.py, which imports class1 from file.py and file.py contains imports to [...] tf-idf figure 1: example of len local explanations for a text predicted as 'python' tag. architectural sparsity to provide explanations for a given classification task. explanations are in the form of first-order logic (fol) formulas approximating the behaviour of the whole network. a len f is a mapping from [0, 1] d -valued input concepts to @xmath0, that can be used either to directly classify data and provide relevant explanations or to explain an existing black-box classifier. at test time, a prediction f i (x) = 1 is locally explained by the conjunction ϕ (i) l of the most relevant input features for the class @xmath1, . . . , r}: len local exp.: ϕ (i) l (x) = for global explanations, lens consider the disjunction of the most important local explanations: ## conclusion this paper proposes len p , an improved version of lens whose results clearly show that len p expla-nations outperform both len and lime on different metrics (sensitivity and faithfulness). moreover, a user study demonstrated that the logic explanations are more useful than the importance vector and provide a better user-experience (particularly on global explanation). this has wide-ranging impact, as lime is a popular strategy used in various fields (e.g., @xcite and @xcite ).