Interacting Knowledge Sources, Inspection and Analysis: Case-studies on Biomedical text processing (2021)

Abstract: In this paper we investigate the recently proposed multi-input RIM for inspectability. This framework follows an encapsulation paradigm, where external knowledge sources are encoded as largely independent modules, enabling transparency for model inspection.

## introduction deep learning with pre-trained language models is widely used in a variety of nlp tasks. such models are often trained using an end-to-end approach, which assumes that the structure of the network is sufficient to capture the inductive bias from adequate data, using a gradient-descent approach. deploying language models for applications such as biomedical text processing, however, poses two main challenges. first, adequate training data is often not available due to the cost of annotation by domain experts and, indeed, the exploratory nature of most biomedical tasks. second, the biomedical domain uses many terms with a more specialized meaning and language models often cannot demonstrate an understanding of this meaning. for instance, consider example 1: example 1 defines tnfaip3 as a gene in a copula construction and its expression in a relative clause. we mask the token gene and ask biobert @xcite (as a masked language model) to predict the masked token. the top 5 predictions are simulation, coordinates, diffusion, heat, and pyramid. the default solution is to continue the pretraining process of the language models on larger corpora, which is often prohibitive for users with limited access to computational resources. moreover, biomedical terminologies are always growing and enough textual data might not be available for new concepts. a cheaper option is to use extant quality knowledge sources, in form of ontologies, hierarchies, or specialized gazetteer lists. in the developing field of knowledge injected models, these high-quality, general knowledge sources are expected to work in tandem to address the problem at hand @xcite @xcite . current knowledge injection models introduce specialized layers to language models or add new training objectives. for instance, @xcite developed knowbert (an extension to bert), to inject information from wordnet into an intermediate layer of bert, which requires retraining the bert model. to leverage medical concepts from the medical knowledge base ulms, @xcite added an auxiliary prediction task to the bert model by training a binary classifier to predict relations between two concepts. the chosen knowledge source is an integral part of these language models making their contribution difficult to inspect. in precision-oriented applications, users require to understand why and how a prediction is made. inspection of a system helps developers to detect fallacies in a system and provide insight for the improvement of the system @xcite and users to trust the autonomous system. different knowledge sources might include overlapping, contradicting, or differently aimed knowledge, foot_0 and the wrong components may hamper rather than enhance the learning progress (glasmachers, 2017). in contrast, if the knowledge sources can adapt to the domain separately and only interact sparingly, the resulting model is expected to be robust @xcite (bagherzadeh and bergler, 2021b) introduced the multi-input recurrent independent mechanisms (mi-rim), which comprise a set of independent and competitive recurrent modules that operate individually on different knowledge embeddings. they report that adding gazetteer and pos tag modules consistently improves performance on a variety of tasks. the mi-rim architecture injects knowledge in form of different knowledge sources as largely independent modules. they suggest that activation visualizations of each module allow for inspection but do not further probe whether they provide enough insight to explain the system predictions. this paper offers an in-depth analysis of the contribution of several knowledge sources in several tasks within the mi-rim framework. we confirm that once modules compete, they specialize to focus on different parts of the input and inspect the competition patterns during processing as a source for explanation and user feed-back. input selection each module r m augments the token input x m t to x m @xmath0, where 0 is an all-zero vector and ⊕ denotes row-level concatenation. then, using an attention mechanism, unit r m selects input: communication to obtain the actual hidden states h m t , the active units communicate using an attention mechanism: both the key k t,: and the value v t,: depend on the temporary hidden states of all units, therefore h m t in equation 4 is determined by attending to all units. as pointed out by @xcite , the attention-based models can provide explanation when the attention is applied to individual elements in an input sequence, rather than contextualized ones. similarly, input selection attention for the mi-rim architecture also operates on raw input encoding. when an input is considered to be relevant to the task, the corresponding module is allowed to be active and to be updated with its additional, specialized input. the activation patterns for each module are traced to inspect what elements in the input sequence were used. sm21-1a concerns adverse drug event classification of tweets @xcite . examples 6 and 7 are instances of tweets with and without an adverse drug event respectively. the task is evaluate by f1 score. note that since the gold labels for bc7-3, sm21-1a, and sm21-6 have not been disclosed, we report the result on a hold out set (20% of the training data). ## knowledge sources for reproducibility, we use off the shelf knowledge sources that are available from standard nlp and deep learning environments, or can be easily accessed from online ontological repositories. morphology drug or gene names often have a specific morphology, favoring certain prefixes, suffixes, etc. the suffix -statin, for instance, is observed in drug names of this type, including torvastatin, lovastatin, and pravastatin. such morphological information foot_2 can be used to detect possible mentions of drugs or genes that have not been observed in training data, or those that are not present in drug or gene lists. word embeddings biobert @xcite word embeddings provide a meaning representation based on co-occurrence statistics. pos part-of-speech tags are the most widely used linguistic feature and are available from many standard nlp environments. pos tags provide useful information such as types of pronouns and tense for verbs, allimportant clues for sequence labeling and text classification. drug drugbank includes commercial drug names as well as the scientific names of their active ingredients @xcite . 4 anatomy body part mentions are important evidence for detection of health experience mentions, in particular adverse drug reactions or disease symptoms. relevant anatomy terms are extracted from sub-tree a of mesh @xcite into a gazetteer list. disease disease mentions are important evidence for adverse drug event classification and self-reports of disease symptoms. a gazetteer was compiled from subtree c in mesh which includes terms for infections, wounds, injuries, pain, etc.. gene to identify mentions of genes, we compile a gazetteer list from the ncbi gene database. foot_4 5 implementation preprocessing we preprocess the data using a gate pipeline @xcite and use the annie tweet tokenizer as well as the hashtag tokenizer for bc7-3, sm21-6, and sm21-1a data, and the pennbio tokenzier for bc2-1a data. for tweet tasks, we remove urls and user mentions. modules each module m comprises an embedder e m (for encoding a knowledge source) and a recurrent unit r m . for the token at position t, e m emits its knowledge representation x m @xmath1. morph. following @xcite we use a character-level convolutional neural network to obtain a morphological representation for each token. we use multiple convolution filters f l with different lengths of @xmath2, 3, 4, 5}. the resulting character-based representations are in a 100-dimensional space. word emb. we use the last layer of biobert @xcite to obtain word embeddings. the embeddings are then used as input to a lstm. pos following (bagherzadeh and bergler, 2021a), we pre-train pos tags using word2vec @xcite to initialize an embedding layer. gazetteer modules each gazetteer list is embedded by two trainable vectors, one corresponding to a match against the gazetteer, and another one for a mismatch. the gazetteer embedings are then used as input to simple rnn units rather than lstms. all nn components are implemented using py-torch @xcite , using cross-entropy to calculate loss and the adam optimizer @xcite . ## experiments we report three sets of experiments. first, we inject different knowledge sources using the mi-rim model, and evaluate their effectiveness in terms of precision (p), recall (r), and f1 scores. second, we inspect the activity profiles of the modules for several samples. third, we provide a quantitative analysis on whether module activity can be used to provide insight into model's predictions using total variation distance (tvd) @xcite as a measure of change between output distributions.