All models

MedCPT

BERT-base pretrained from scratch on PubMed, captured here as the MedCPT biomedical query encoder.

Language · 302 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (26 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
109.5M
Operations
302
Framework
PyTorch
Recurrent
No
Published
ACM Transactions on Computing for Healthcare (arXiv 2020)
Cited by
2,144 (as of 18 October 2026)
Authors
Yu Gu, Robert Tinn, Hao Cheng and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m13748
Graph hash
2a44819f7901329b9e226ffba40697ca1c43cc66e6315e4043a09198798416e1
Skeleton hash
6e2351ffa82f55b6b05932459b5f9d5ee28a2b29a846468ef19a6c8ea1ad8329
Architecture hash
930aa5023ffbfb645387133ef6bf30f6d6a7f88927fd614f3485771559afe7ed
Diagram SHA-256
b1aeb9f961474c759a66a006a73c3eedd12f414c88be3e3bfa354c97c8612241
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

transformers.AutoModel.from_config()

What it is

PubMedBERT is a BERT-base encoder pretrained from scratch on biomedical text, and the paper behind it challenges a common assumption: that domain-specific models should start from a general-domain checkpoint. Its central finding is that for domains with abundant unlabeled text, such as biomedicine, pretraining from scratch gives substantial gains over continual pretraining of general-domain models. The practical advantage is an in-domain vocabulary: general-domain BERT splits naloxone into four word pieces and acetyltransferase into seven, while both terms are single entries in PubMedBERT's vocabulary.

The pretraining corpus was the PubMed abstract collection: 14 million abstracts, 3.2 billion words, 21 GB. Training ran for 62,500 steps with a batch size of 8,192. That took about 5 days on one DGX-2 machine with 16 V100 GPUs. The model is uncased and was trained with whole-word masking at a masking rate of 15%. The authors kept to BERT-BASE for a head-to-head comparison with prior biomedical models, even though BERT-LARGE looked better in preliminary experiments. On the Hub the model was later renamed BiomedBERT; the card notes it was previously named PubMedBERT (abstracts + full text).

The member traced here is not PubMedBERT's own checkpoint but MedCPT's query encoder, part of a dense retriever for biomedical search whose query and article encoders were both initialized from PubMedBERT. MedCPT was trained contrastively on 255M query-article pairs from PubMed search logs with in-batch negatives. Its embeddings live in the same space as those generated by the MedCPT article encoder, which is what makes query-to-article search work. The NCBI team could not release the PubMed user logs for privacy reasons and ships BioASQ question-article pairs as a surrogate training set instead.

Key idea. PubMedBERT demonstrated that pretraining BERT from scratch on PubMed text, with a vocabulary derived from the domain, beats continual pretraining of general-domain models across a biomedical benchmark.

  • PubMedBERT
  • BiomedBERT
  • BiomedNLP
  • MedCPT
  • MedCPT Query Encoder
  • biomedical BERT
  • biomedical language model
  • PubMed
  • BLURB
  • domain-specific pretraining
  • biomedical search
  • dense retrieval
  • semantic search

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gu2021domainspecificlanguagemodelpretraining,
      title={Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing}, 
      author={Yu Gu and Robert Tinn and Hao Cheng and Michael Lucas and Naoto Usuyama and Xiaodong Liu and Tristan Naumann and Jianfeng Gao and Hoifung Poon},
      year={2021},
      eprint={2007.15779},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      doi={https://doi.org/10.1145/3458754},
      url={https://arxiv.org/abs/2007.15779}, 
}