BioGPT: Generative Pre-trained Transformer for Biomedical Text Generation and Mining
Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon, Tie-Yan Liu
Introduction
Text mining and knowledge discovery from biomedical literature play important roles in drug discovery, clinical therapy, pathology research, etc. Typical tasks include recognizing named entities in the articles, mining the interaction between drugs and proteins/diseases/other drugs, answering questions given reference text, generating abstracts for given phrases/words, etc. People have accumulated large amounts of literature in the previous studies. For example, PubMedhttps://pubmed.ncbi.nlm.nih.gov, one of the most popular biomedical search engines, covers more than articles and the number still rapidly increases every day as new discoveries are continuously coming out. Therefore, automatically mining the knowledge from literature becomes an urgent demand.
Pre-training models have demonstrated their powerful capability in natural language processing (NLP). On the GLUE benchmark, a widely used benchmark for natural language understanding, pre-training based methods outperform non-pre-training methods by a large margin wang2018glue https://gluebenchmark.com/leaderboard. There are two main kinds of pre-training models: (1) the BERT-like models devlin2019bert ; liu2019roberta ; clark2019electra , mainly for language understanding tasks; (2) the GPT-like models radford2018improving ; radford2019language ; brown2020language , mainly for language generation tasks.
These models are first pre-trained on large scale corpora collected from the Web via self-supervised learning task (e.g., masked language modeling for BERT, auto-regressive language modeling for GPT), and then fine-tuned on specific donwstream tasks. The BERT-like models are widely used in sequence classification and sequence labeling, where we need to encode the complete document. In comparison, the GPT-like models are often used in generation tasks (e.g., abstract generation, knowledge triplet generation).
By witnessing the success of pre-training in general NLP, people explore adapting these techniques into biomedical domain. However, directly applying these models to the biomedical domain leads to unsatisfactory performance due to domain shift peng-etal-2019-transfer ; pubmedbert . A natural solution is to develop pre-training models on biomedical texts (e.g., PubMed). BioBERT biobert and PubMedBERT pubmedbert ) are two representative BERT-like models pre-trained on biomedical domain, and they obtain superior performances than general pre-trained models on biomedical benchmarks. However, previous works mainly focus on BERT models which are more appropriate for understanding tasks, not generation tasks. In comparison, GPT models have demonstrated their abilities on generation tasks but demonstrate inferior performance when directly applying to the biomedical domain moradi2021gpt ; gutierrez2022thinking .
In this work, we propose BioGPT, a domain-specific generative pre-trained Transformer language model for biomedical text generation and mining. BioGPT follows the Transformer language model backbone, and is pre-trained on PubMed abstracts from scratch. We apply BioGPT to six biomedical NLP tasks: end-to-end relation extraction on BC5CDR 10.1093/database/baw068 , KD-DTI hou2021discovering and DDI herrero2013ddi , question answering on PubMedQA jin2019pubmedqa , document classification on HoC baker2016automatic , and text generation. To adapt to the downstream tasks, we carefully design and analyze the target sequence format and the prompt for better modeling the tasks. Experiments demonstrate that BioGPT achieves better performance compared to baseline methods and other well-performing methods across all the tasks.
Related Work
It has proven to be a very successful pattern in deep learning to pre-train models on large scale unlabeled data via careful designed self-supervision tasks and then transfer to downstream tasks by fine-tuning on them. Downstream tasks can benefit from the learned representations from the pre-trained models. BERT devlin2019bert is a bidirectional transformer based contextualized language model pre-trained on large scale text corpus English Wikipedia and BooksCorpus. It is pre-trained via carefully designed self-supervision tasks: masked language modeling (MLM) task where random word tokens of the input text are replaced by a special token [MASK] which is to be predicted by the model from the context, and the next sentence prediction (NSP) task where two sentences are to be predicted whether the second one is probable given the first one. The pre-trained BERT provides contextualized word representations that can be used by downstream tasks by just fine-tuning on the tasks and has achieved great success on various natural language understanding tasks. Subsequent works mainly focus on pre-training on larger-scale data and models liu2019roberta and advanced pre-training task clark2019electra . Though BERT and various biomedical BERT models have been successful in language understanding tasks and classification tasks, few efforts have been devoted to generative models. As BERT learns powerful word representations through the Transformer encoder model architecture in a bi-directional way, it limits its ability of generation.
Generative Pre-trained Transformer (GPT) radford2018improving is proposed for language generation tasks via pre-training Transformer decoder model on large scale text corpus in a classical casual language modeling task where model learns to predict the next word token only dependent on the previous word tokens. Further, GPT-2 radford2019language and GPT-3 brown2020language with larger model size pre-trained on larger scale text corpus are proposed with remarkable performance in various downstream tasks (e.g., translation, summarization) including classification tasks (e.g., reading comprehension) even without fine-tuning (zero-shot) via appropriate prompts design.
2 Pre-trained Language Models in Biomedical Domain
When applying to specific domain (e.g., biomedicine), BERT models pre-trained on general domain can be further improved if pre-trained on in-domain text data peng-etal-2019-transfer ; beltagy-etal-2019-scibert ; biobert . Specifically, biobert and peng-etal-2019-transfer start from the original pre-trained BERT model devlin2019bert that are pre-trained on general domain (Wikipedia and BooksCorpus) and continue pre-training on biomedical literature. Specifically, biobert continue pre-training using PubMed abstracts and PubMed Central full text articles and peng-etal-2019-transfer continue pre-training on both PubMed text and clinical notes from MIMIC-III johnson2016mimic . As they are initialized from the original BERT that are pre-trained on general domain, they use the same vocabulary as the original BERT, which is quite different from the target biomedical domain. Instead of continue pre-training from the pre-trained BERT model, beltagy-etal-2019-scibert pre-train the BERT model from scratch on large corpus of scientific literature (mainly biomedical and computer science literature) where the vocabulary is more suitable for science domain but still contains out-domain information for biomedicine. pubmedbert propose that it is a better strategy to pre-train on domain-specific data from scratch where the vocabulary is more suitable for the biomedical domain. Consequently, they propose PubMedBERT which is pre-trained on PubMed abstracts from scratch. Similarly, miolo2021electramed pre-train on data as in peng-etal-2019-transfer also from scratch, using the more advanced ELECTRA model. All these works have shown improved performance on plenty of biomedical literature language processing tasks compared to the original BERT pre-trained on general domain, while none of them is for biomedical generation tasks.
Noticing the powerful generation ability of GPT models, it is quite curious how GPT models perform on biomedical domain which is very different from general domain. However, recent works show that GPT models, even much more powerful GPT-3 model, perform poorly on biomedical tasks moradi2021gpt ; gutierrez2022thinking . A previous work on pre-training GPT on biomedical literature is DARE papanikolaou2020dare . However, they pre-train GPT on very limited amount of data (only PubMed abstracts) and use it only for data-augmentation for relation extraction task. A recent work on using GPT model is agrawal2022large , where they design converters for GPT-3 brown2020language for several unconventional downstream clinical tasks.
3 Downstream Tasks
In this subsection, we introduce the downstream tasks we will work on. A summary of those tasks is in Table 1. All these tasks can be formulated as text generation / mining tasks.
Relation extraction is a key task for biomedicine and life science research. Classical pipeline-based methods zeng2014relation ; zhou2016attention ; wang2020global resolve the task into several separate sub-tasks that require additional intermediate annotations and information which may suffer from the lack of intermediate annotated data and error accumulation. Joint extraction aims to jointly extract the entities and the relations between them from the text. Sequence labeling methods tackle the task by labeling the word tokens in the text with different tags to mark out all the entity mentions and then perform the relation classification between them via classifiers sun2019joint ; yuan2020relation ; liu2021attention ; wei2020novel . Table filling methods formulate the task as a table constituted by the Cartesian product of itself and predicts the relations between the token pairs fu2019graphrel ; wang-etal-2020-tplinker ; yan-etal-2021-partition . These methods may suffer from error accumulation caused by previous tagging process and laborious intermediate annotations (i.e., named entity recognition). Text generation methods reframe the task as a sequence-to-sequence learning task, by taking the text as the input sequence and the triplet as the target sequence and employing an encoder-decoder network to learn to generate the triplet from the text zeng2018extracting ; zhang2020minimize ; hou2021discovering ; cabot2021rebel ; giorgi2022sequence . However, many joint extraction methods still require additional entity information wei2020novel ; sui2020joint . In this work, we focus on the end-to-end relation extraction, which formulates the task as an text generation task that takes only the text as the input and generates the relational triplets in an end-to-end way without additional intermediate annotations cabot2021rebel ; hou2021discovering ; giorgi2022sequence .
3.2 Question Answering
Question answering (QA) is the task of answering questions given a context (reading comprehension). Typical methods predict a span in the source context as the answer text, or predicts a label (e.g., yes or no) for simpler tasks with predefined categorical answers yu2018qanet ; hu2017reinforced ; yamada2020luke . pubmedbert ; kanakarajan-etal-2021-bioelectra ; yasunaga2022linkbert mainly focus on the biomedical domain question answering task via pre-trained language models. Generative models radford2019language ; brown2020language directly generate the answer sequence or the label words.
3.3 Document Classification
Document classification is to classify a document into predefined categories (single label or multi label). Recent works on biomedical document classification also leverage large pre-trained language models for understanding the text and predicting the label peng-etal-2019-transfer ; pubmedbert ; kanakarajan-etal-2021-bioelectra ; yasunaga2022linkbert . Generative models radford2019language ; brown2020language generate the label words instead of predicting from the predefined set.
Pre-training Method
In this section, we describe our BioGPT from the perspective of dataset, vocabulary, and model.
Dataset: Dataset is crucial for language model pre-training, in terms of amount, quality and domain. As Gu et al. pubmedbert point, training only on in-domain data from scratch is important for specific domain. Therefore, we only consider in-domain text data and pre-train our model from scratch on the collected data. We collected all the PubMed itemshttps://pubmed.ncbi.nlm.nih.gov that were updated before 2021 from the official sitehttps://ftp.ncbi.nlm.nih.gov/pubmed/ using the wget tool. We then filtered out all the empty items with only title but no abstract. We used the left items (each with both title and abstract) as our pre-training dataset.
Vocabulary: pubmedbert also points that in-domain vocabulary is vital. Instead of using the vocabulary of GPT-2, we learn the vocabulary on our collected in-domain corpus. Specifically, we use byte pair encoding (BPE) sennrich2016neural to segment the words in the corpus into word pieces and learn the vocabulary. We adopt the fastBPEhttps://github.com/glample/fastBPE implementation of BPE. The final learned vocabulary size is .
Model: We adopt the GPT-2 model architecture radford2019language as the backbone of our BioGPT, which is a Transformer decoder vaswani2017attention . Currently we cannot follow the GPT-3 setting due to its extremely large model with 15 billion parameters. The core component of Transformer as well as our BioGPT is the multi-head attention. Given the input, three linear transformations are applied to produce the query , the key and the value , and then the output is calculated as follows:
where (1) is the number of heads; (2) , and are equally split into , and along the feature dimension, ; (3) Concat denotes concatenating all inputs as a large tensor along the feature dimension; (4) is the parameter for the affine transformation. The output of multi-head attention layer is then fed into a feed-forward layer to construct a Transformer layer (or Transformer block). Practically, we adopt GPT-2 as the backbone network which has 24 layers, 1024 hidden size and 16 attention heads resulting in parameters in total, and our BioGPT has parameters (the difference only comes from the different embedding size and output projection size caused by the different vocabulary size).
Training criteria: BioGPT is trained via the standard language modeling task as the same as in radford2018improving ; radford2019language . Let denote the collection of sequences, and sequence is made up of tokens, i.e., . The training objective is to minimize the negative log-likelihood:
Fine-tuning Method
In this section, we introduce how to adapt the pre-trained BioGPT to downstream tasks: end-to-end relation extraction, question answering (QA) and document classification. The inputs of the tasks are all sequences, while they have different output formats.
To use BioGPT for these tasks, we need to convert the labels into sequences. In this way, the downstream task is consistent with the pre-training task in terms of the format.
Considering that BioGPT is pre-trained on massive natural language corpus, we convert the labels to sequences in natural language rather than the structured format using special tokens explored in other works hou2021discovering ; cabot2021rebel ; giorgi2022sequence . In this way, our reformed labels are semantically smoother than using special tokens. We will show the detailed implementation for each task and empirically verify the effectiveness of our method later.
Task description: Given a source sequence , we need to find all triplets head_entityi, tail_entityi, relation, that can be inferred from . refers to the number of all possible triplets. Examples include extracting the drug-target-interaction, chemical-disease-relation and drug-drug-interaction.
Method: We convert the triplets into a simple natural language sequence with the same grammatical structures. We explore three forms in this paper:
the “subject verb object” form (svo), where the entities correspond to the head entity, the relation and the tail entity in the triplet.
the “subject is the rel.noun of object” form (is-of), where the “rel.noun” refers to the noun form of the relation.
the “ the relation between subject and object is rel.noun” form (rel-is).
If there are multiple relational triplets for an input document, we sort them according to their order of appearance in the document and use semicolons to concatenated them together.
Let us use a drug, target, interaction triplet as example. Suppose we would like to extract triplet dextropropoxyphene (drug name), mu-type opioid receptor (target name), inhibitor (relation) from an input document. Then the svo representation is:
dextropropoxyphene inhibits mu-type opioid receptor.
dextropropoxyphene is the inhibitor of mu-type opioid receptor.
and mu-type opioid receptor is inhibitor.
The natural sentences can be converted back to triplets using regular expression. Users can also design customized formats depending on tasks.
2 Question Answering
Task description Given a question, a reference context and an answer, the goal is to answer the question given the reference context. The label is within the category of yes, no, or maybe.
Method: We pre-pend the description word “question:” and “context:” before the question and the context respectively and concatenate them together as the source sequence. Then for the target sequence, we generate it using the format “the answer to the question given the context is label”. For example:
source: question: question text. context: context text. target: the answer to the question given the context is yes.
3 Document Classification
Task description Given a document text, the goal is to classify the type of the document.
Method: We generate the target sequence using the format “the type of this document is label”. For example:
the type of this document is genomic instability and mutation.
4 Prompt-based Fine-tuning
We have formatted the labels to target sequences. The last question is, how do we use the source and the target to fine-tune and inference with BioGPT? A naive way is to concatenate the source and the target sequences together but is difficult for the model to generate during inference as it does not know what to generate for the specific task given the source text input.
Prompt is recently extensively explored in NLP liu2021pre to elicit the knowledge from a pre-trained language model. Prompt is to append task-specific instructions to the input for the model to better generate output that meets the demand of the task. GPT-3 brown2020language uses hard prompts (manually designed discrete language phrases) to generate for different tasks. Though hard prompts can achieve satisfactory performance, designing task specific prompts is laborious and it is found that different prompts lead to different performance.
In this work, we mainly adopt soft prompts in prefix-tuning li-liang-2021-prefix , which leverage continuous embeddings (virtual tokens) to steer the pre-trained language model by directly appending several additional virtual tokens before the text as the prompts. Such continuous embeddings are randomly initialized and learned end-to-end on the downstream tasks to be task-specific. Different from li-liang-2021-prefix , we do not append the virtual tokens to the very beginning of the source input, but only before the target sequence (between the source and the target). Equipped with the prompt, our final sequence is constructed as , as depicted in Fig. 1. During the inference, we provide the source text and the prompt as the prefix for the language model to condition on and let the language model to generate the target output as in Fig. 1.
Experiments
In this section, we pre-train our BioGPT and evaluate it on the following four biomedical NLP tasks across six datasets: end-to-end relation extraction on BC5CDR 10.1093/database/baw068 , KD-DTI hou2021discovering and DDI herrero2013ddi , question answering on PubMedQA jin2019pubmedqa , document classification on HOC baker2016automatic , and text generation on self-created dataset. We use fairseq ott2019fairseq as our code base for implementation. We adopt the GPT-2 model configuration as our backbone model configuration. We perform BPE to learn to tokenize the corpus and construct the vocabulary instead of using the learned vocabulary from GPT-2 due to the domain gap between the biomedical domain and the general domain.
For pre-training, we pre-train BioGPT on 8 NVIDIA V100 GPUs for steps, with 1024 tokens per GPU and 64 accumulated steps (i.e., the final batch size is tokens). We use Adam kingma2015adam as the optimizer with a peak learning rate of and 20000 warm-up steps. The learning rate follows an inverse square root decay schedule after reaching the peak as in vaswani2017attention .
All the fine-tuning experiments are conducted on a single NVIDIA V100 GPU, with a batch size of 1024 tokens and 32 accumulated steps.
During the inference, we adopt beam search with beam size=5 for the text generation task, and greedy search for all the other tasks.
We make comparison to general domain GPT-2 for all the experiments. Specifically, we use the GPT-2 model from the Hugging face library wolf-etal-2020-transformers https://huggingface.co/gpt2-medium which is the backbone network of our BioGPT.
Relation extraction is an important task in information extraction. Here we target at the end-to-end relation extraction setting where the model takes the text as the input and directly generates the relational triplets. We mainly compare to REBEL cabot2021rebel , a recently proposed end-to-end triplet extraction approach based on sequence-to-sequence model, which employs BART pre-trained model lewis-etal-2020-bart as the backbone model, and further enhances it by pre-training on additional large relational triplet dataset created from Wikipedia as REBEL.
BC5CDR is a dataset for chemical-disease-relation extraction task introduced by 10.1093/database/baw068 which consists of 500/500/500 documents as the training/validation/test set. We fine-tune GPT-2 and BioGPT for 100 epochs with a peak learning rate and 100 warm-up steps. We use continuous embeddings with length=9 as prompts and the rel-is target sequence format. Since BC5CDR is a binary relation dataset where the entities are labeled if the relationship exists instead of a specific relation type, we use the pattern “the relation between head_entity and tail_entity exists” as the target sequence format. We average the checkpoints of the last 5 epochs for evaluation. We mainly measure and compare the micro-F1 score. We compare BioGPT to REBEL and seq2rel giorgi2022sequence where both methods are end-to-end relation extraction methods based on sequence-to-sequence modeling. We also compare with a pipeline-based extraction method, GLRE wang2020global which requires NER (named entity recognition) information as the intermediate annotations in the pipeline. Originally, GLRE uses the ground truth NER information. To make a fair comparison, we experiment with GLRE for two settings: 1) using ground-truth NER information during the training and using open-source NER tool during the inference (i.e., GLRE (gt+pred)) and 2) using open-source NER tool for both the training and the inference (i.e., GLRE (pred+pred)). We use the open-source NER toolhttps://huggingface.co/samrawal/bert-base-uncased_clinical-ner for the NER tagging. We try our best to run the baseline methods and evaluate them.
From the results in Table 2, we can see that BioGPT achieves the best result () among all the methods, with large improvements. We have several findings: 1) pipeline-based method GLRE significantly drops when using NER tagged by open-source tools instead of ground truth NER. However, this is often the common case in practical situation where the annotations for NER are lacked or expensive to collect. When applying open-source NER tools to some specific domains, errors occur and lead to inferior performance of relation extraction. 2) Compared to REBEL, BioGPT has a large gain with 8.28% improvement. Notice that seq2rel giorgi2022sequence is trained on both the training set and validation set, while our BioGPT is only trained on the training set and still outperforms it with 4.78% improvement. Moreover, when also trained on both the training set and the validation set, BioGPT further improves to 46.17% with 5.97% improvement against seq2rel giorgi2022sequence .
1.2 KD-DTI
KD-DTI is dataset for drug-target-interaction introduced by hou2021discovering , consisting of // documents as the train/validation/test set. We fine-tune GPT-2 and BioGPT on the task for 30 epochs using Adam optimizer with a peak learning rate of and 1000 warm-up steps. We use continuous embeddings with length=9 as prompts and the rel-is target sequence format for constructing the target sequence. We average the checkpoints of the last 5 epochs for evaluation. We mainly measure and compare the micro-F1 score and the results are listed in Table 3.
We compare BioGPT with GPT-2, Transformer + PubMedBERT-attn evaluated in hou2021discovering and REBEL. It can be shown that BioGPT achieves 38.42% f1 score, with 14.23%, 9.97% and 8.03% improvement compared to Transformer + PubMedBERT-attn, GPT-2 and REBEL. Particularly, it surpasses REBEL by 5.1% which is further pre-trained on large relation extraction dataset while BioGPT does not.
1.3 DDI
DDI extraction 2013 corpus is a dataset for drug-drug-interaction task introduced by herrero2013ddi , consisting of 792 texts selected from the DrugBank database and other 233 Medline abstracts. We use the original dataset and use a train/validation/test split of 664/50/191 files. We fine-tune GPT-2 and BioGPT for 100 epochs with a peak learning rate and 500 warm-up steps. We also use continuous embeddings with length=9 as prompts and the rel-is target sequence format. The last 5 epochs are averaged for evaluation. The micro-F1 score is measured and compared.
The results are shown in Table 4 from which we can see that BioGPT achieves 40.76% with 16.08% and 12.49% improvement against GPT-2 and REBEL. It also surpasses REBEL which uses additional large relation extraction dataset for two-stage pre-training.
2 Question Answering
PubMedQA jin2019pubmedqa is a biomedical question answering dataset. Each sample is constructed from a PubMed abstract, containing a question, a reference context, a long answer, and a yes/no/maybe label which is the answer to the question. We use the original train/validation/test split with 450, 50 and 500 respectively, noted as PQA-L in jin2019pubmedqa for evaluation. We also use the additional dataset noted as PQA-A and PQA-U in jin2019pubmedqa for fine-tuning. We use the continuous embedding with length=9 as the soft prompt. We format the data into source sequence and target sequence as described before. We apply techniques such as two-stage fine-tuning jin2019pubmedqa and noisy labels to improve the performance. We measure and compare the classification accuracy of the reasoning required setting described in jin2019pubmedqa .
From the results in Table 5 we can see that BioGPT achieves 78.2 accuracy with 6.0 improvement over previous best performance obtained by BioLinkBERT yasunaga2022linkbert , achieving a new state-of-the-art on this task.
3 Document Classification
HoC (the Hallmarks of Cancers corpus) consists of 1580 PubMed abstracts manually annotated at sentence level by experts with ten currently known hallmarks of cancer baker2016automatic . We follow the same training/test split as in peng-etal-2019-transfer . We use the continuous embedding with length=1 as the prompt and format the label into the target sequence as described before. We fine-tune GPT-2 and BioGPT for 20000 steps with a peak learning rate and 1000 warm-up steps. Micro-F1 score is measured and reported for comparison.
We can see from the results in Table 6 that BioGPT achieves accuracy with improvement over general domain GPT-2, and surpasses BioBERT, PubMedBERT and BioLinkBERT with , , improvements respectively.
4 Text Generation
GPT, GPT-2 and GPT-3 demonstrate remarkable text generation ability. Given words, phrases or simple sentences as prefix, they can continue to generate text that are syntactically correct and semantically smooth conditioning on the given text. We are also curious about the text generation ability of the pre-trained BioGPT in the biomedical domain, and how does general domain GPT-2 perform in the biomedical domain.
We evaluate the biomedical text generation ability of BioGPT and GPT-2. Specially, we extract all the entities within the triplets from the KD-DTI test set (i.e., drugs and targets). Then for each drug/target name, we provide it to the language model as the prefix and let the model generate text conditioned on it. We then investigate whether the generated text is meaningful and fluent.
For this task, no objective evaluation metric is reported here. Instead, we provide a few examples here for demonstration.
From the results in Table 7, we can see that: (1) Given relatively common names as input, for example in the first two cases (i.e., Bicalutamide and JAK-3), GPT-2 can generate meaningful and fluent text that is related to the word and biomedicine, while BioGPT generates more specific and professional descriptions. (2) When given some uncommon names (e.g., in the Apricitabine and Xylazine cases), GPT-2 cannot generate meaningful descriptions while BioGPT still generates specific descriptions. Especially in the Apricitabine case, GPT-2 seems to generate a piece of text that comes from a specific scientific paper while BioGPT generates more general description. (3) When given some very uncommon and domain specific names that even lose semantic information from their surface names (e.g., Psoralen, CP-673451 and BIIB-021), GPT-2 trained on general completely failed to generate any informative text. Given Psoralen, GPT-2 treats it as a city name and generates some text though fluent but unrelated to the given name. Given CP-673451, GPT-2 even begins to count numbers. Given BIIB-021, GPT-2 treats it as a name of a pdf document. For these types, BioGPT is still able to generate text that describes the names or is highly related to them.
Besides these samples, we also manually input several keywords or phrases that are of interest (e.g., COVID-19 related terms) and see what GPT-2 and our BioGPT generate. The results are listed in Table 8, where we input many COVID-19 related key words/phrases as the prefix for the language model to condition on. We can see that GPT-2 treats the term “COVID-19” and “SARS-CoV-2” as some codes within a link or file name rather the entities we care about while BioGPT can generate clear descriptions. More interestingly, when prompting “The drug that can treat COVID-19 is”, BioGPT is able to answer it with the drug “hydroxychloroquine” which is indeed noticed at MedlinePlushttps://medlineplus.gov/druginfo/meds/a601240.html. Notice that GPT-2 is pre-trained on the corpus before COVID-19 while BioGPT is pre-trained on the corpus before 2021 that contains COVID-19 information, therefore it is not surprising that BioGPT performs much better than GPT-2 on COIVD-19 related key words in Table 8. However, in the last example in Table 8, both models do not have any knowledge of the Omicron variants of SARS-CoV-2 which appear in the late 2021, while BioGPT still generates more fluent and relevant text compared to GPT-2.
Overall, we can see that BioGPT pre-trained on in-domain biomedical literature from scratch performs better than general domain GPT-2 across various biomedical NLP tasks, and performs better than most previous methods on respective tasks, achieving state-of-the-art on four out of six tasks.
Ablation Study
In this section, we conduct ablation study on the prompt design and the target sequence format of the label.
Previous works cabot2021rebel ; phan2021scifive; giorgi2022sequence ; hou2021discovering directly format the labels into structured formats using special tokens. Taking the triplet generation task as an example, in REBEL cabot2021rebel , the triplets are represented by:
where
Although these methods achieved promising results in their tasks respectively, such formulation pattern is not the best choice for BioGPT. Previous works use an encoder-decoder framework, where two separated modules are leveraged to process the input (by the encoder) and generate the answers (by the decoder). The two modules can be trained to fit the two different types of sequences (natural language sequence v.s. structured sequence).
In contrast, in BioGPT, we use a unified module to encode context and generate answers. Intuitively, it is better to maintain the format consistency between the inputs and answers. Consequently, instead of the structured target format with special tokens as in previous works, we format the label within a natural language sentence for the language model to smoothly learn and generate. However, there are also various patterns that can be used to construct the target sentence. We explore several target sequence formats, including the structured format, on the KD-DTI dataset for end-to-end relation extraction task. We fix the prompt to continuous embeddings with length=9. From the results in Table 9 we can see that the formats in natural language perform better than structured format, and that the rel-is format performs the best among all the formats in terms of F1 which provides a more semantically smooth and clear description. We also conduct experiments on BC5CDR and DDI to further compare the structure format and the rel-is format. The F1 scores of the structure format on BC5CDR and DDI are and , while those two scores with rel-is format are and , which further verify our conclusion.
2 Prompt Design
We conduct experiment with manually designed hard prompts and continuous embedding soft prompts on the KD-DTI extraction task. We fix the target format to the rel-is format (i.e., ”the relation between head_entity and tail_entity is relation”). From the results in Table 10 we can see that the best performing prompt is continuous embeddings with length of 13 virtual tokens. Moreover, we have several observations: (1) Different manually designed hard prompts result in different performance and more instructive and informative prompt (e.g., “we can conclude that”) achieve better performance. (2) Generally, continuous embedding soft prompts perform better than manually designed hard prompts. (3) The performance of the continuous embedding soft prompts are roughly irrelevant to the length. In our previous experiments, we empirically choose length=9 according to the performance on validation set.
Conclusion
In this work, we proposed BioGPT, a generative pre-trained Transformer language model for biomedical text generation and mining. We adopted GPT-2 as our backbone model and pre-trained on PubMed abstracts corpus. We carefully designed and investigated the prompt and the target sequence format when applying pre-trained BioGPT to downstream tasks. We applied the pre-trained BioGPT to biomedical NLP tasks: end-to-end relation extraction task, question answering task, document classification task and text generation task. BioGPT achieves SOTA results on three end-to-end relation extraction tasks and one question answering task. It also demonstrates better biomedical text generation ability compared to GPT-2 on the text generation task. For future work, we plan to train larger scale BioGPT on larger scale biomedical data and apply to more downstream tasks.
Key Points Our contributions are summarized as follows: • We propose BioGPT, a generative pre-trained Transformer language model on biomedical domain. BioGPT can be used for biomedical literature text generation and mining. • BioGPT achieves state-of-the-art results on four benchmarks: BC5CDR, KD-DTI and DDI end-to-end relation extraction task, and PubMedQA question answering task. We also demonstrate the capability of biomedical text generation of BioGPT compared to standard GPT trained on general domain. • We study the prompt design and the target sequence design when applying BioGPT to downstream tasks and find that target sequence with natural language semantics are better than structured prompts explored in previous works.
Scaling to Larger Size
We also scaled our model to larger size. We built BioGPT-Large, based on the GPT-2 XL architecture (the largest version of GPT-2), with 1.5B model parameters. We fine-tune and evaluate its performance on the downstream tasks, as shown in Table 11.