Evaluating the Robustness of Adverse Drug Event Classification Models using Templates (2024)

Abstract: An adverse drug effect (ADE) is any harmful event resulting from medical drug treatment. Despite their importance, ADEs are often under-reported in official channels. Some research has therefore turned to detecting discussions of ADEs in social media. Impressive results have been achieved in various attempts to detect ADEs. In a high-stakes domain such as medicine, however, an in-depth evaluation of a model’s abilities is crucial. We address the issue of thorough performance evaluation in detecting ADEs with hand-crafted templates for four capabilities, temporal order, negation, sentiment and beneficial effect. We find that models with similar performance on held-out test sets have varying results on these capabilities.

## introduction when a trained model is applied to real-world data, it may be confronted with phenomena that are under-represented or non-existent in the training data @xcite . this raises the question of how to evaluate a model's performance and generalization abilities. reporting summary statistics and heldout test set performance is a common practice in model evaluation. while this can provide an indication of the model's performance and ability to generalize, there are some issues with this practice. firstly, held-out test sets often arise from the same distribution as the training data and will, therefore, exhibit the same patterns and biases to a high degree. real-world data, however, may have different feature distribution or exhibit noise. held-out testing, therefore, often provides an unsatisfactory estimation of a model's performance and generalization abilities @xcite @xcite . secondly, a high model score does not necessarily reveal what the model has learned during train-ing. research has shown that a model may not learn relevant patterns but instead base its decisions on shallow heuristics or proxies @xcite . benchmark challenges have attempted to address this issue by testing models on a wide range of aspects of language @xcite . however, not all aspects can be tested in a benchmark, and the benchmark itself may exhibit unintended biases @xcite , so the question of what a model has learned remains. inspired by the behavioral testing suite check-list @xcite , we propose the use of template-based test cases to test different capabilities of adverse drug effect (ade) classification models. ades are any harmful consequence to a patient due to medical drug intake. due to the potential detrimental outcomes of ades, the detection of ades is an important goal in health-related nlp and has been a subject of research for a considerable time. we test models in understanding of temporal order, positive sentiment, beneficial effects and negation (see in high-stakes domains such as medicine, an indepth evaluation of a model's abilities is crucial. related work (section 2), however, suggests that shortcomings towards selected linguistic phenomena and reliance on proxies for model decisions may exist in models in the biomedical domain. in this work foot_0 , two transformer-based models for the detection of ades in user reports on social media were fine-tuned and tested by conventional held-out testing as well as additional templatebased tests. the results of held-out testing and the template-based tests were compared in order to better understand (i) the models' shortcomings and (ii) the potential gaps in knowledge that can occur when a model's abilities are only evaluated via test set performance. we find that models underper- test name label test description example test case temporal order standard no ade ade occurs before drug intake before taking cymbalta, i experienced insomnia. ade ade occurs after drug intake before having acid reflux, i was put on zoloft. temporal order single time entity no ade ade occurs before drug intake expressed by a time entity i was experiencing bad pain in my right arm for 2 weeks, now i started being medicated with effexor xr. ade ade occurs after drug intake expressed by a time entity 3 months ago i started being treated with zoloft, now i started encountering excellerated heart rate. temporal order double time entities no ade ade occurs before drug intake expressed by two related time entities 3 weeks ago i started suffering from bad pain in my right arm, i have been taking effexor for 2 days. ade ade occurs after drug intake expressed by two related time entities i was enduring insomnia for 6 weeks, 8 weeks ago i started taking cymbalta. positive sentiment ade ade occurrence is reported with positive sentiment i'm taking cymbalta and experiencing cravings for sweets. still, i am happy my symptoms have reduced. beneficial effect no ade secondary effect of a drug that is beneficial to the patient i'm taking effexor xr and experiencing weight loss. i'm happy because i was trying to lose weight anyway. ade secondary effect of a drug that is an ade as it is not beneficial for me, weight loss is a side-effect of effexor. it's a problem because i am already underweight. negation no ade ade is negated i am taking zoloft without suffering from acid reflux. ade statement contains negation, ade is not negated that's not true, i took zoloft and encountered insomnia. ## related work studies on the detection of ades in user-generated texts have been conducted since approximately 2010, when leaman et al. published the first english dataset within this domain. the usual downstream tasks are those common in information extraction: document classification, to find relevant documents containing mentions of adverse effects; named entity recognition, to identify medication and disease-related mentions; and relation classification, to establish associations between the entity mentions. approaches for all of these tasks range from rule-and lexicon-based systems @xcite to traditional machine learning pipelines @xcite @xcite and, recently, deep neural networks @xcite , specifically transformer-based setups @xcite @xcite . however, even advanced models struggle with the supposedly simple task of classifying a document into either "contains an ade" (henceforth ade) or "does not contain an ade" (no ade), a standard binary classification that is still necessary to find relevant documents for further information extraction. this is often due to a strong class imbalance (in most cases, the documents containing ades are in the minority), the usual noise in social media data, ambiguities in health-related statements of patients, and general weaknesses of language models in coping with certain linguistic phenomena not only with respect to ades. for example, @xcite have studied the extraction of ades from tweets using bert, spanbert @xcite , and pubmedbert @xcite . they tested all three models' ability to handle negation and detect shortcomings in all three models. @xcite investigated the robustness of four transformer models specialized in the biomedical and clinical domain over a variety of tasks such as sentence classification, inference, and question answering. the models' robustness is tested by adding minor meaning-preserving changes to the input with the goal of fooling the model. their findings highlight the vulnerability of state-of-the-art transformer-based models to adversarial input. finally, there is checklist (ribeiro et al., 2020), a model-agnostic framework aimed at testing a trained model's behavior and gaining an in-depth understanding of its potential shortcomings. check-list guides the creation of test cases based on natural language capabilities, which are used as new inputs to the trained model and subsequently evaluated. the idea is to determine which capabilities (e.g., negation handling, robustness) are necessary for the task the model is intended to perform. ribeiro et al. (2020) identify three possible test types which can be used for testing the capabilities: the minimum functionality test (mft), which targets a specific behavior similar to a unit test; the invariance test (inv), where the model's robustness to irrelevant perturbations is tested; and the directional expectation test (dir), which consists of adding perturbations that are expected to lead to a specific outcome. @xcite observe that the checklist-based evaluation approach could not only uncover bugs in previously tested models but also that checklist can make the search for bugs more systematic. recently, updates to checklist, adatest (ribeiro and lundberg, 2022) and adat-est++ @xcite , were proposed which assist the user in finding bugs by suggesting topics and test cases in a semi-automated process. while these are valuable additions, we decided to use the template-based approach for this project because we had pre-selected capabilities that we wanted to test with full control over the template design. checklist applications include the evaluation of general capabilities of models @xcite as well as evaluating models in specialized tasks such as offensive speech detection @xcite and automatic text simplification @xcite . for the specialized tasks, the authors use checklist to guide their testing approach by defining new capabilities specific to the task at hand. in the biomedical and clinical domain, ahsan et al. (2021) use checklist to test four linguistic capabilities (negation, temporal order, misspellings, and attributions) on their transformer-based model with a dataset of clinical discharge notes. one of their findings is that the model struggles to correctly distinguish between past and present mentions of substance use in the discharge notes. the detection of ades, however, is not part of the research. the exposure of potential weaknesses in transformer-based models in the biomedical domain motivates an in-depth analysis of models used for ade detection. to our knowledge, a systematic template-based approach to test model capabilities has not yet been applied to ade detection. ## methods we use templates to test a selection of linguistic capabilities of binary ade classification models. to this end, we first manually create templates (see section 3.1) and then sets of test cases, by using entities to fill placeholders in the templates (see section 3.3). we then evaluate two fine-tuned classification models on these test cases and compare their predictions with each other and with the models' performance on the held-out test set. example 1: template for temporal order (ade) i started taking {drug} before i experienced {ade}. we test four capabilities: temporal order, positive sentiment, beneficial effect, and negation (see section 3.2). 99 base templates are created with 1505 variations (for details see ## experiments we frame ade detection as a binary classification task. we first describe the experiments on the custom dataset and then the experiments on our template-based test cases. ## results the following presents the results of both the baselines and the template-based test cases. ## conclusion and future work in this work, we present a template-based approach for evaluating capabilities of models on the task of ade detection in social media texts. four capabilities, temporal order, positive sentiment, beneficial effect, and negation, were identified and corresponding tests were created. two high-performing models for the task of ade detection were evaluated using the adapted approach. results show that the models' performances vary across capabilities. while both models perform well on the positive sentiment tests, bioreddit-bert outperforms xlm-roberta on negation. the models are not able to distinguish between ades and beneficial effects and are not robust to changes in the expression of temporal structure in text. in summary, the template-based approach adapted to ade classification has provided a better understanding of the shortcomings of highperforming models and can highlight previously undetected differences between models that perform almost identically on a held-out test set. we publish the templates to enable researchers to evaluate their own ade classification models. further research may expand on this work by adding tests for more capabilities and evaluating other models using this approach. for example, in the phenomena annotation described in section 3.2, we found 1.6% questions and 1.1% speculative content in the tweets. the linguistic variety of the templates could be improved by using a large language model to generate templates or test cases. a different direction of research may focus on improving the model's faults detected during evaluation. one method of improvement is to include a subset of the test cases as new training data @xcite .