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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 14 code samples harvested from 2 repositories linked to this paper: 3 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 11 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code; here there are none.

By repository: official repository: 5 samples from 1 repository, 0 ran (0 with no instrument failure; 0 where Syntology's instrument failed); found in paper text by Syntology: 9 samples from 1 repository, 3 ran (3 with no instrument failure; 0 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

michiyasunaga/LinkBERT officialmentioned in papermentioned on GitHubpytorchApache-2.0Syntology: 5 samples, 0 ran · 5 unverified 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: 3 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 11 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

3ran
11unverified

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; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity.

michiyasunaga/LinkBERT official repository 5 samples, 0 ran · 5 unverified
compute_p_r_f src/seqcls/utils_hoc.py unverified Apache-2.0 (permissive) · 74040dc1e7877b49 · report
divide in 14 papers src/seqcls/utils_hoc.py unverified Apache-2.0 (permissive) · c2cd56888edff13a · report
eval_hoc src/seqcls/utils_hoc.py unverified Apache-2.0 (permissive) · e3f1559c8f5f8688 · report
postprocess_qa_predictions in 10 papers src/qa/utils_qa.py unverified Apache-2.0 (permissive) · 3957d7cb42610910 · report
postprocess_qa_predictions_with_beam_search in 10 papers src/qa/utils_qa.py unverified Apache-2.0 (permissive) · 31453e36e3e54527 · report
titipata/pubmed_parser found in paper text by Syntology 9 samples, 3 ran (0 instrument-failed) · 6 unverified
flatten_zip_author pubmed_parser/pubmed_oa_parser.py ran MIT (permissive) · bf61041fdd6647e6 · report fixture: signature author_list:list/1/list · returned list · level recorded 2026-09-24
list_xml_path pubmed_parser/pubmed_oa_parser.py ran fingerprinted MIT (permissive) · 9b111e4814825d40 · report fixture: signature path_dir:str/0/str · returned list · level recorded 2026-09-24
zip_author pubmed_parser/pubmed_oa_parser.py ran MIT (permissive) · 89ed942af19f2fac · report fixture: signature author:list/1/str · returned list · level recorded 2026-09-24
parse_doi pubmed_parser/medline_parser.py unverified MIT (permissive) · 8abb78363c80dab0 · report
parse_mesh_terms pubmed_parser/medline_parser.py unverified MIT (permissive) · 0d69b1b23dd6057d · report
parse_pmid pubmed_parser/medline_parser.py unverified MIT (permissive) · 0a88d93a2312fac0 · report
parse_pubmed_web_tree pubmed_parser/pubmed_web_parser.py unverified MIT (permissive) · 5b766af778be529d · report
stringify_affiliation pubmed_parser/utils.py unverified MIT (permissive) · 3ad8ed067be5af35 · report
stringify_children pubmed_parser/utils.py unverified MIT (permissive) · bec7a30d2cf6ff0d · 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