Papers › LinkBERT: Pretraining Language Models with Document Links

LinkBERT: Pretraining Language Models with Document Links

29 Mar 2022ACL 2022 5arXiv:2203.15827archive 2025-07-28

Michihiro Yasunaga, Jure Leskovec, Percy Liang

Language model (LM) pretraining can learn various knowledge from text corpora, helping downstream tasks. However, existing methods such as BERT model a single document, and do not capture dependencies or knowledge that span across documents. In this work, we propose LinkBERT, an LM pretraining method that leverages links between documents, e.g., hyperlinks. Given a text corpus, we view it as a graph of documents and create LM inputs by placing linked documents in the same context. We then pretrain the LM with two joint self-supervised objectives: masked language modeling and our new proposal, document relation prediction. We show that LinkBERT outperforms BERT on various downstream tasks across two domains: the general domain (pretrained on Wikipedia with hyperlinks) and biomedical domain (pretrained on PubMed with citation links). LinkBERT is especially effective for multi-hop reasoning and few-shot QA (+5% absolute improvement on HotpotQA and TriviaQA), and our biomedical LinkBERT sets new states of the art on various BioNLP tasks (+7% on BioASQ and USMLE). We release our pretrained models, LinkBERT and BioLinkBERT, as well as code and data at https://github.com/michiyasunaga/LinkBERT.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2203.15827")

Code

Syntology Ran 0 of 14 code samples harvested from 2 repositories linked to this paper; 14 have no recorded run.

By repository: official repository: 5 samples from 1 repository, 0 ran; found in paper text by Syntology: 9 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

michiyasunaga/LinkBERT officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 0 ran; 0 honoured the contract we drafted; 14 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

14unverified

Licence: 0 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

compute_p_r_f michiyasunaga/LinkBERT/src/seqcls/utils_hoc.py official repository unverified Apache-2.0 (permissive) · 74040dc1e7877b49 · report
divide michiyasunaga/LinkBERT/src/seqcls/utils_hoc.py official repository unverified Apache-2.0 (permissive) · c2cd56888edff13a · report
eval_hoc michiyasunaga/LinkBERT/src/seqcls/utils_hoc.py official repository unverified Apache-2.0 (permissive) · e3f1559c8f5f8688 · report
postprocess_qa_predictions michiyasunaga/LinkBERT/src/qa/utils_qa.py official repository unverified Apache-2.0 (permissive) · 3957d7cb42610910 · report
postprocess_qa_predictions_with_beam_search michiyasunaga/LinkBERT/src/qa/utils_qa.py official repository unverified Apache-2.0 (permissive) · 31453e36e3e54527 · report
flatten_zip_author titipata/pubmed_parser/pubmed_parser/pubmed_oa_parser.py found in paper text by Syntology unverified MIT (permissive) · bf61041fdd6647e6 · report
list_xml_path titipata/pubmed_parser/pubmed_parser/pubmed_oa_parser.py found in paper text by Syntology unverified MIT (permissive) · 9b111e4814825d40 · report
parse_doi titipata/pubmed_parser/pubmed_parser/medline_parser.py found in paper text by Syntology unverified MIT (permissive) · 8abb78363c80dab0 · report
parse_mesh_terms titipata/pubmed_parser/pubmed_parser/medline_parser.py found in paper text by Syntology unverified MIT (permissive) · 0d69b1b23dd6057d · report
parse_pmid titipata/pubmed_parser/pubmed_parser/medline_parser.py found in paper text by Syntology unverified MIT (permissive) · 0a88d93a2312fac0 · report
parse_pubmed_web_tree titipata/pubmed_parser/pubmed_parser/pubmed_web_parser.py found in paper text by Syntology unverified MIT (permissive) · 5b766af778be529d · report
stringify_affiliation titipata/pubmed_parser/pubmed_parser/utils.py found in paper text by Syntology unverified MIT (permissive) · 3ad8ed067be5af35 · report
stringify_children titipata/pubmed_parser/pubmed_parser/utils.py found in paper text by Syntology unverified MIT (permissive) · bec7a30d2cf6ff0d · report
zip_author titipata/pubmed_parser/pubmed_parser/pubmed_oa_parser.py found in paper text by Syntology unverified MIT (permissive) · 89ed942af19f2fac · report

Tasks

Document ClassificationLanguage ModelingLanguage ModellingMasked Language ModelingMedical Relation ExtractionNamed Entity Recognition (NER)PICOQuestion AnsweringRelation ExtractionRelation PredictionSemantic SimilaritySentence SimilarityText ClassificationTriviaQA

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Document Classification HOC BioLinkBERT (large) F1 88.1 #1 of 5 Archive leaderboard report
Document Classification HOC BioLinkBERT (large) Micro F1 84.87 #1 of 5 Archive leaderboard report
Medical Relation Extraction DDI extraction 2013 corpus BioLinkBERT (large) F1 83.35 #1 of 2 Archive leaderboard report
Named Entity Recognition (NER) BC2GM BioLinkBERT (large) F1 85.18 #8 of 13 Archive leaderboard report
Named Entity Recognition (NER) BC5CDR BioLinkBERT (large) F1 90.22 #6 of 16 Archive leaderboard report
Named Entity Recognition (NER) BC5CDR-chemical BioLinkBERT (large) F1 94.04 #9 of 13 Archive leaderboard report
Named Entity Recognition (NER) BC5CDR-disease BioLinkBERT (large) F1 86.39 #5 of 10 Archive leaderboard report
Named Entity Recognition (NER) JNLPBA BioLinkBERT (large) F1 80.06 #6 of 17 Archive leaderboard report
Named Entity Recognition (NER) NCBI-disease BioLinkBERT (large) F1 88.76 #9 of 26 Archive leaderboard report
PICO EBM PICO BioLinkBERT (large) Macro F1 word level 74.19 #1 of 3 Archive leaderboard report
PICO EBM PICO BioLinkBERT (base) Macro F1 word level 73.97 #2 of 3 Archive leaderboard report
Question Answering BLURB BioLinkBERT (large) Accuracy 83.5 #1 of 4 Archive leaderboard report
Question Answering BLURB BioLinkBERT (base) Accuracy 80.81 #2 of 4 Archive leaderboard report
Question Answering BioASQ BioLinkBERT (large) Accuracy 94.8 #1 of 7 Archive leaderboard report
Question Answering BioASQ BioLinkBERT (base) Accuracy 91.4 #3 of 7 Archive leaderboard report
Question Answering MRQA LinkBERT (large) Average F1 81.0 #1 of 2 Archive leaderboard report
Question Answering MedQA BioLinkBERT (base) Accuracy 40.0 #21 of 27 Archive leaderboard report
Question Answering NewsQA LinkBERT (large) F1 72.6 #17 of 18 Archive leaderboard report
Question Answering PubMedQA BioLinkBERT (large) Accuracy 72.2 #22 of 30 Archive leaderboard report
Question Answering PubMedQA BioLinkBERT (base) Accuracy 70.2 #23 of 30 Archive leaderboard report
Question Answering SQuAD1.1 LinkBERT (large) EM 87.45 #16 of 213 Archive leaderboard report
Question Answering SQuAD1.1 LinkBERT (large) F1 92.7 #16 of 213 Archive leaderboard report
Question Answering TriviaQA LinkBERT (large) F1 78.2 #51 of 56 Archive leaderboard report
Relation Extraction ChemProt BioLinkBERT (large) F1 79.98 #3 of 13 Archive leaderboard report
Relation Extraction ChemProt BioLinkBERT (large) Micro F1 79.98 #3 of 13 Archive leaderboard report
Relation Extraction DDI BioLinkBERT (large) F1 83.35 #1 of 3 Archive leaderboard report
Relation Extraction DDI BioLinkBERT (large) Micro F1 83.35 #1 of 3 Archive leaderboard report
Relation Extraction GAD BioLinkBERT (large) F1 84.90 #1 of 3 Archive leaderboard report
Relation Extraction GAD BioLinkBERT (large) Micro F1 84.90 #1 of 3 Archive leaderboard report
Semantic Similarity BIOSSES BioLinkBERT (large) Pearson Correlation 0.9363 #1 of 3 Archive leaderboard report
Semantic Similarity BIOSSES BioLinkBERT (base) Pearson Correlation 0.9325 #2 of 3 Archive leaderboard report
Text Classification BLURB BioLinkBERT (large) F1 84.88 #1 of 3 Archive leaderboard report
Text Classification BLURB BioLinkBERT (base) F1 84.35 #2 of 3 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionAttention DropoutBERTBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections