Despite the widespread success of self-supervised learning via masked language models (MLM), accurately capturing fine-grained semantic relationships in the biomedical domain remains a challenge. This is of paramount importance for entity-level tasks such as entity linking where the ability to model entity relations (especially synonymy) is pivotal. To address this challenge, we propose SAPBERT , a pretraining scheme that self-aligns the representation space of biomedical entities. We design a scalable metric learning framework that can leverage UMLS, a massive collection of biomedical ontologies with 4M+ concepts. In contrast with previous pipeline-based hybrid systems, SAPBERT offers an elegant one-model-for-all solution to the problem of medical entity linking (MEL), achieving a new state-of-the-art (SOTA) on six MEL benchmarking datasets. In the scientific domain, we achieve SOTA even without task-specific supervision. With substantial improvement over various domain-specific pretrained MLMs such as BIOBERT , SCIBERT and PUBMEDBERT , our pretraining scheme proves to be both effective and robust. 1 1 Introduction Biomedical entity 2 representation is the foundation for a plethora of text mining systems in the medical domain, facilitating applications such as literature search (Lee et al., 2016), clinical decision making (Roberts et al., 2015) and relational knowledge discovery (e.g. chemical-disease, drug-drug and protein-protein relations, Wang et al. 2018). The heterogeneous naming of biomedical concepts  Work conducted prior to joining Amazon. 1 For code and pretrained models, please visit: https: //github.com/cambridgeltl/sapbert . 2 In this work, biomedical entity refers to the surface forms of biomedical concepts, which can be a single word (e.g. fever ), a compound (e.g. sars-cov-2 ) or a short phrase (e.g. abnormal retinal vascular development ). poses a major challenge to representation learning. For instance, the medication Hydroxychloroquine is often referred to as Oxichlorochine (alternative name), HCQ (in social media) and Plaquenil (brand name). MEL addresses this problem by framing it as a task of mapping entity mentions to unified concepts in a medical knowledge graph. 3 The main bottleneck of MEL is the quality of the entity representations (Basaldella et al., 2020). Prior works in this domain have adopted very sophisticated text pre-processing heuristics (D'Souza and Ng, 2015; Kim et al., 2019; Ji et al., 2020; Sung et al., 2020) which can hardly cover all the variations of biomedical names. In parallel, self-supervised learning has shown tremendous success in NLP via leveraging the masked language modelling (MLM) 3 Note that we consider only the biomedical entities themselves and not their contexts, also known as medical concept normalisation/disambiguation in the BioNLP community. objective to learn semantics from distributional representations (Devlin et al., 2019; Liu et al., 2019). Domain-specific pretraining on biomedical corpora (e.g. BIOBERT , Lee et al. 2020 and BIOMEGATRON , Shin et al. 2020) have made much progress in biomedical text mining tasks. Nonetheless, representing medical entities with the existing SOTA pretrained MLMs (e.g. PUBMEDBERT , Gu et al. 2020) as suggested in Fig. 1 (left) does not lead to a well-separated representation space. To address the aforementioned issue, we propose to pretrain a Transformer-based language model on the biomedical knowledge graph of UMLS (Boden-reider, 2004), the largest interlingua of biomedical ontologies. UMLS contains a comprehensive collection of biomedical synonyms in various forms (UMLS 2020AA has 4M+ concepts and 10M+ synonyms which stem from over 150 controlled vocabularies including MeSH, SNOMED CT, RxNorm, Gene Ontology and OMIM). 4 We design a self-alignment objective that clusters synonyms of the same concept. To cope with the immense size of UMLS, we sample hard training pairs from the knowledge base and use a scalable metric learning loss. We name our model as S elfa ligning p retrained BERT (SAPBERT ). Being both simple and powerful, SAPBERT obtains new SOTA performances across all six MEL benchmark datasets. In contrast with the current systems which adopt complex pipelines and hybrid components (Xu et al., 2020; Ji et al., 2020; Sung et al., 2020), SAPBERT applies a much simpler training procedure without requiring any preor post-processing steps. At test time, a simple nearest neighbour's search is sufficient for making a prediction. When compared with other domain-specific pretrained language models (e.g. BIOBERT and SCIBERT ), SAPBERT also brings substantial improvement by up to 20% on accuracy across all tasks. The effectiveness of the pretraining in SAPBERT is especially highlighted in the scientific language domain where SAPBERT outperforms previous SOTA even without fine-tuning on any MEL datasets. We also provide insights on pretraining's impact across domains and explore pretraining with fewer model parameters by using a recently introduced ADAPTER module in our training scheme. https://www.nlm.nih.gov/research/umls/knowledge_ sources/metathesaurus/release/statistics.html We design a metric learning framework that learns to self-align synonymous biomedical entities. The framework can be used as both pretraining on UMLS, and fine-tuning on task-specific datasets. We use an existing BERT model as our starting point. In the following, we introduce the key components of our framework. Formal Definition. Let ( x, y )  X  Y denote a tuple of a name and its categorical label. For the self-alignment pretraining step, X  Y is the set of all (name, CUI 5 ) pairs in UMLS, e.g. ( Remdesivir , C4726677); while for the fine-tuning step, it is formed as an entity mention and its corresponding mapping from the ontology, e.g. ( scratchy throat , 102618009). Given any pair of tuples ( x i , y i ) , ( x j , y j )  X  Y , the goal of the self-alignment is to learn a function f (  ;  ) : X  R d parameterised by  . Then, the similarity (cid:104) f ( x i ) , f ( x j ) (cid:105) (in this work we use cosine similarity) can be used to estimate the resemblance of x i and x j (i.e., high if x i , x j are synonyms and low otherwise). We model f by a BERT model with its output [CLS] token regarded as the representation of the input. 6 During the learning, a sampling procedure selects the informative pairs of training samples and uses them in the pairwise metric learning loss function (introduced shortly). 5 In UMLS, CUI is the C oncept U nique I dentifier. 6 We tried multiple strategies including first-token, meanpooling, [CLS] and also NOSPEC (recommended by Vulic et al. 2020) but found no consistent best strategy (optimal strategy varies on different *B ERT s). informative training examples (i.e. hard posi-tive/negative pairs) within a mini-batch for efficient training, Fig. 2. For biomedical entities, this step can be particularly useful as most examples can be easily classified while a small set of very hard ones cause the most challenge to representation learning. 7 We start from constructing all possible triplets for all names within the mini-batch where each triplet is in the form of ( x a , x p , x n ) . Here x a is called anchor , an arbitrary name in the mini-batch; x p a positive match of x a (i.e. y a = y p ) and x n a negative match of x a (i.e. y a (cid:54) = y n ). Among the constructed triplets, we select out all triplets that violate the following condition: (cid:107) f ( x a )  f ( x p ) (cid:107) 2 < (cid:107) f ( x a )  f ( x n ) (cid:107) 2 + , (1) where  is a pre-set margin. In other words, we only consider triplets with the negative sample closer to the positive sample by a margin of  . These are the hard triplets as their original representations were very far from correct. Every hard triplet contributes one hard positive pair ( x a , x p ) and one hard negative pair ( x a , x n ) . We collect all such positive & negative pairs and denote them as P , N . A similar but not identical triplet mining condition was used by Schroff et al. (2015) for face recognition to select hard negative samples. Switching-off this mining process, causes a drastic performance drop (see Tab. 2). Loss Function. We compute the pairwise cosine similarity of all the BERT -produced name representations and obtain a similarity matrix S  R |X b ||X b | where each entry S ij corresponds to the cosine similarity between the i -th and j -th names in the mini-batch b . We adapted the Multi-Similarity loss (MS loss, Wang et al. 2019), a SOTA metric learning objective on visual recognition, for learning from the positive and negative pairs: L = 1 |X b | |X b | (cid:88) i =1 (cid:32) 1  log (cid:16) 1 + (cid:88) n N i e  ( S in  (cid:15) ) (cid:17) + 1  log (cid:16) 1 + (cid:88) p P i e   ( S ip  (cid:15) ) (cid:17)(cid:33) , (2) where ,  are temperature scales; (cid:15) is an offset applied on the similarity matrix; P i , N i are indices 7 Most of Hydroxychloroquine 's variants are easy: Hydrox-ychlorochin , Hydroxychloroquine (substance) , Hidroxicloroquina , but a few can be very hard: Plaquenil and HCQ . of positive and negative samples of the anchor i . 8 While the first term in Eq. 2 pushes negative pairs away from each other, the second term pulls positive pairs together. This dynamic allows for a re-calibration of the alignment space using the semantic biases of synonymy relations. The MS loss leverages similarities among and between positive and negative pairs to re-weight the importance of the samples. The most informative pairs will receive more gradient signals during training and thus can better use the information stored in data. Data Preparation Details for UMLS Pretraining. We download the full release of UMLS 2020AA version. 9 We then extract all English entries from the MRCONSO.RFF raw file and convert all entity names into lowercase (dupli-cates are removed). Besides synonyms defined in MRCONSO.RFF , we also include tradenames of drugs as synonyms (extracted from MRREL.RRF ). After pre-processing, a list of 9,712,959 (name, CUI) entries is obtained. However, random batching on this list can lead to very few (if not none) positive pairs within a mini-batch. To ensure sufficient positives present in each mini-batch, we generate offline positive pairs in the format of (name 1 , name 2 , CUI) where name 1 and name 2 have the same CUI label. This can be achieved by enumerating all possible combinations of synonym pairs with common CUIs. For balanced training, any concepts with more than 50 positive pairs are randomly trimmed to 50 pairs. In the end we obtain a training list with 11,792,953 pairwise entries. UMLS Pretraining Details. During training, we use AdamW (Loshchilov and Hutter, 2018) with a learning rate of 2e-5 and weight decay rate of 1e-2 . Models are trained on the prepared pairwise UMLS data for 1 epoch (approximately 50k iterations) with a batch size of 512 (i.e., 256 pairs per mini-batch). We train with Automatic Mixed Precision (AMP) 10 provided in PyTorch 1.7.0. This takes approximately 5 hours on our machine (con-8 We explored several loss functions such as InfoNCE (Oord et al., 2018), NCA loss (Goldberger et al., 2005), simple cosine loss (Phan et al., 2019), max-margin triplet loss (Basaldella et al., 2020) but found our choice is empirically better. See App. B.2 for comparison. 9 https://download.nlm.nih.gov/umls/kss/2020AA/ umls-2020AA-full.zip 10 https://pytorch.org/docs/stable/amp.html scientific language social media language model NCBI BC5CDR-d BC5CDR-c MedMentions AskAPatient COMETA @1 @5 @1 @5 @1 @5 @1 @5 @1 @5 @1 @5 vanilla BERT (Devlin et al., 2019) 67.6 77.0 81.4 89.1 79.8 91.2 39.6 60.2 38.2 43.3 40.4 47.7 + SAPBERT 91.6 95.2 92.7 95.4 96.1 98.0 52.5 72.6 68.4 87.6 59.5 76.8 BIOBERT (Lee et al., 2020) 71.3 84.1 79.8 92.3 74.0 90.0 24.2 38.5 41.4 51.5 35.9 46.1 + SAPBERT 91.0 94.7 93.3 95.5 96.6 97.6 53.0 73.7 72.4 89.1 63.3 77.0 BLUEBERT (Peng et al., 2019) 75.7 87.2 83.2 91.0 87.7 94.1 41.6 61.9 41.5 48.5 42.9 52.9 + SAPBERT 90.9 94.0 93.4 96.0 96.7 98.2 49.6 73.1 72.4 89.4 66.0 78.8 CLINICALBERT (Alsentzer et al., 2019) 72.1 84.5 82.7 91.6 75.9 88.5 43.9 54.3 43.1 51.8 40.6 61.8 + SAPBERT 91.1 95.1 93.0 95.7 96.6 97.7 51.5 73.0 71.1 88.5 64.3 77.3 SCIBERT (Beltagy et al., 2019) 85.1 88.4 89.3 92.8 94.2 95.5 42.3 51.9 48.0 54.8 45.8 66.8 + SAPBERT 91.7 95.2 93.3 95.7 96.6 98.0 50.1 73.9 72.1 88.7 64.5 77.5 UMLSBERT (Michalopoulos et al., 2020) 77.0 85.4 85.5 92.5 88.9 94.1 36.1 55.8 44.4 54.5 44.6 53.0 + SAPBERT 91.2 95.2 92.8 95.5 96.6 97.7 52.1 73.2 72.6 89.3 63.4 76.9 PUBMEDBERT (Gu et al., 2020) 77.8 86.9 89.0 93.8 93.0 94.6 43.9 64.7 42.5 49.6 46.8 53.2 + SAPBERT 92.0 95.6 93.5 96.0 96.5 98.2 50.8 74.4 70.5 88.9 65.9 77.9 supervised SOTA 91.1 93.9 93.2 96.0 96.6 97.2 OOM OOM 87.5 -79.0 PUBMEDBERT 77.8 86.9 89.0 93.8 93.0 94.6 43.9 64.7 42.5 49.6 46.8 53.2 + SAPBERT 92.0 95.6 93.5 96.0 96.5 98.2 50.8 74.4 70.5 88.9 65.9 77.9 + SAPBERT (ADAPTER 13% ) 91.5 95.8 93.6 96.3 96.5 98.0 50.7 75.0  67.5 87.1 64.5 74.9 + SAPBERT (ADAPTER 1% ) 90.9 95.4 93.8  96.5  96.5 97.9 52.2  74.8 65.7 84.0 63.5 74.2 + SAPBERT (FINE-TUNED ) 92.3 95.5 93.2 95.4 96.5 97.9 50.4 73.9 89.0  96.2  75.1 ( 81.1  ) 85.5 ( 86.1  ) BIOSYN 91.1 93.9 93.2 96.0 96.6 97.2 OOM OOM 82.6 87.0 71.3 77.8 + (init. w/) SAPBERT 92.5  96.2  93.6 96.2 96.8 98.4  OOM OOM 87.6 95.6 77.0 84.2 Table 1: Top : Comparison of 7 BERT -based models before and after SAPBERT pretraining (+ SAPBERT ). Evaluation Data and Protocol. We experiment on 6 different English MEL datasets: 4 in the scientific domain (NCBI, Dogan et al. 2014; BC5CDR-c and BC5CDR-d, Li et al. 2016; MedMentions, Mohan and Li 2018) and 2 in the social media domain (COMETA, Basaldella et al. 2020 and AskAPatient, Limsopatham and Collier 2016). Descriptions of the datasets and their statistics are provided in App. A. We report Acc @1 and Acc @5 (denoted as @1 and @5 ) for evaluating performance. In all experiments, SAPBERT denotes further pretraining with our self-alignment method on UMLS. At the test phase, for all SAPBERT models we use nearest neighbour search without further fine-tuning on task data (unless stated otherwise). Except for numbers reported in previous papers, all results are the average of five runs with different random seeds. Fine-Tuning on Task Data. The red rows in Tab. 1 are results of models (further) fine-tuned on the training sets of the six MEL datasets. Similar to pretraining, a positive pair list is generated through traversing the combinations of mention and all ground truth synonyms where mentions are from the training set and ground truth synonyms are from the reference ontology. We use the same optimiser and learning rates but train with a batch size of 256 (to accommodate the memory of 1 GPU). On scientific language datasets, we train for 3 epochs while on AskAPatient and COMETA we train for 15 and 10 epochs respectively. For BIOSYN on social media language datasets, we empirically found that 10 epochs work the best. Other configurations are the same as the original BIOSYN paper. *B ERT + SAPBERT (Tab. 1, top). We illustrate the impact of SAPBERT pretraining over 7 existing BERT -based models (*B ERT = {B IOBERT , PUBMEDBERT , ...}). SAPBERT obtains consistent improvement over all *B ERT models across all datasets, with larger gains (by up to 31.0% absolute Acc @1 increase) observed in the social media domain. While SCIBERT is the leading model before applying SAPBERT , PUBMEDBERT +S APBERT performs the best afterwards. SAPBERT vs. SOTA (Tab. 1, bottom). We take PUBMEDBERT +S APBERT (w/wo fine-tuning) and compare against various published SOTA results (see App. C.1 for a full listing of 10 baselines) which all require task supervision. For the scientific language domain, the SOTA is BIOSYN (Sung et al., 2020). For the social media domain, the SOTA are Basaldella et al. (2020) and GENRANK (Xu et al., 2020) on COMETA and AskAPatient respectively. All these SOTA methods combine BERT with heuristic modules such as tf-idf, string matching and information retrieval system (i.e. Apache Lucene) in a multi-stage manner. Measured by Acc @1 , SAPBERT achieves new SOTA with statistical significance on 5 of the 6 datasets and for the dataset (BC5CDR-c) where SAPBERT is not significantly better, it performs on par with SOTA (96.5 vs. 96.6). Interestingly, on scientific language datasets, SAPBERT outperforms SOTA without any task supervision (fine-tuning mostly leads to overfitting and performance drops). On social media language datasets, unsupervised SAPBERT lags behind supervised SOTA by large margins, highlighting the well-documented complex nature of social media language (Baldwin et al., 2013; Limsopatham and Collier, 2015, 2016; Basaldella et al., 2020; Tutubalina et al., 2020). However, after fine-tuning on the social media datasets (using the MS loss introduced earlier), SAPBERT outperforms SOTA significantly, indicating that knowledge acquired during the self-aligning pretraining can be adapted to a shifted domain without much effort. The ADAPTER Variant. As an option for parameter efficient pretraining, we explore a variant of SAPBERT using a recently introduced training module named ADAPTER (Houlsby et al., 2019). While maintaining the same pretraining scheme with the same SAPBERT online mining + MS loss, instead of training from the full model of PUBMEDBERT , we insert new ADAPTER layers between Transformer layers of the fixed PUBMEDBERT , and only train the weights of these ADAPTER layers. In our experiments, we use the enhanced ADAPTER configuration by Pfeiffer et al. (2020). We include two variants where trained parameters are 13.22% and 1.09% of the full SAPBERT variant. The ADAPTER variant of SAPBERT achieves comparable performance to full-model-tuning in scientific datasets but lags behind in social media datasets, Tab. 1. The results indicate that more parameters are needed in pretraining for knowledge transfer to a shifted domain, in our case, the social media datasets. The Impact of Online Mining (Eq. (1)). As suggested in Tab. 2, switching off the online hard pairs mining procedure causes a large performance drop in @1 and a smaller but still significant drop in @5 . This is due to the presence of many easy and already well-separated samples in the mini-batches. These uninformative training examples dominated the gradients and harmed the learning process. Integrating SAPBERT in Existing Systems. SAPBERT can be easily inserted into existing BERT -based MEL systems by initialising the systems with SAPBERT pretrained weights. We use the SOTA scientific language system, BIOSYN (originally initialised with BIOBERT weights), as an example and show the performance is boosted across all datasets (last two rows, Tab. 1). We present SAPBERT , a self-alignment pretraining scheme for learning biomedical entity representations. We highlight the consistent performance boost achieved by SAPBERT , obtaining new SOTA in all six widely used MEL benchmarking datasets. Strikingly, without any fine-tuning on task-specific labelled data, SAPBERT already outperforms the previous supervised SOTA (sophisticated hybrid entity linking systems) on multiple datasets in the scientific language domain. Our work opens new avenues to explore for general domain self-alignment (e.g. by leveraging knowledge graphs such as DB-pedia). We plan to incorporate other types of relations (i.e., hypernymy and hyponymy) and extend our model to sentence-level representation learning. In particular, our ongoing work using a combination of SAPBERT and ADAPTER is a promising direction for tackling sentence-level tasks. We thank the three reviewers and the Area Chair for their insightful comments and suggestions. FL is supported by Grace & Thomas C.H. Chan Cambridge Scholarship. NC and MB would like to acknowledge funding from Health Data Research UK as part of the National Text Analytics project.
abstain abstain objective method abstain result abstain abstain abstain other abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain objective method abstain abstain abstain abstain abstain abstain objective other method abstain method method abstain abstain abstain abstain method method abstain abstain method abstain abstain method abstain method method abstain abstain method abstain abstain abstain method method abstain abstain abstain abstain abstain abstain abstain method method method abstain abstain method abstain abstain method abstain method abstain method method abstain abstain other abstain method abstain abstain method method method abstain abstain abstain abstain abstain method method method abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain result method objective abstain objective objective method other other other