Rewire-then-Probe: A Contrastive Recipe for Probing Biomedical Knowledge of Pre-trained Language Models

Zaiqiao Meng, Fangyu Liu, Ehsan Shareghi, Yixuan Su, Charlotte Collins, Nigel Collier

Abstract

Knowledge probing is essential for understanding how pre-trained language models (PLMs) transfer knowledge. While general-domain probing has advanced, specialized fields like biomedicine remain under-explored. We introduce MedLAMA, a biomedical knowledge probing benchmark based on the UMLS Metathesaurus. Our evaluation shows that standard PLMs perform poorly on this task, achieving at most 3% acc@10. We propose Contrastive-Probe, a self-supervised approach that "rewires" PLMs without labeled probing data. Contrastive-Probe significantly improves performance, reaching 28% acc@10. Human expert evaluation suggests that PLMs may possess even more knowledge than current benchmarks can measure, as many correct model predictions are missing from the gold-standard UMLS.

Introduction: The Challenges of Biomedical Probing

Large language models (LLMs) like BERT capture vast amounts of knowledge during pre-training, but their effectiveness in specialized domains like biomedicine is limited by two primary factors:

  1. The Multi-token Challenge: Most medical entities (e.g., "Acute Myeloid Leukemia") consist of multiple words. Standard generative probing, which predicts one token at a time, struggles with these complex terms.
  2. Vocabulary Bias: Models often favor high-frequency words from their training data, which may not align with factual biomedical knowledge.

Existing benchmarks like LAMA focus on general knowledge and single-token answers, failing to capture the complexity of the biomedical domain.

MedLAMA: A Specialized Benchmark

To address these gaps, we developed MedLAMA, a benchmark derived from the Unified Medical Language System (UMLS). It comprises 19,000 queries across 19 distinct relations, such as may_prevent and disease_mapped_to_gene. MedLAMA highlights the difficulty of biomedical probing by including a "hard" subset where answers cannot be easily inferred from lexical overlaps.

The distribution of token lengths in MedLAMA shows that very few answers are single-token, explaining why traditional generative probing fails.

Methodology: The Rewire-then-Probe Recipe

We introduce a two-stage approach called Rewire-then-Probe:

1. Rewiring via Contrastive Learning

Instead of traditional fine-tuning, we "rewire" the PLM using a small set of unlabeled biomedical sentences (e.g., 10,000 sentences from PubMed). We employ a self-supervised contrastive objective (InfoNCE) to align the model's internal representations, encouraging similar embeddings for different parts of the same sentence. This process takes less than a minute on a single GPU and prepares the model's embedding space for the biomedical domain without exposing it to test questions.

2. Retrieval-based Probing

We move away from text generation and treat probing as a retrieval task. A query is converted into an embedding, and we perform a nearest-neighbor search among all possible biomedical entities in the embedding space. This approach effectively bypasses the multi-token generation bottleneck.

The Contrastive-Probe approach treats knowledge probing as a retrieval task, searching for the nearest entity embedding to a query embedding.

Key Results and Insights

The transition from generative to contrastive probing yields a substantial performance boost. Standard "Mask Predict" methods on PubMedBERT achieved nearly 0% acc@10. In contrast, Contrastive-Probe reached 24.31% accuracy on the same model, and over 30% when applied to models already specialized for medical text, such as SapBERT.

Our findings suggest:

  • Generation is a Bottleneck: Retrieval-based methods are crucial for extracting multi-token knowledge.
  • Efficient Adaptation: Minimal domain-specific "rewiring" significantly enhances the model's ability to surface factual knowledge.
  • Layered Knowledge: Knowledge is not uniformly distributed; middle layers of the Transformer architecture are often more "knowledgeable" for certain relations than the final layers.
  • Benchmark Limitations: Human experts identified many correct answers provided by the models that were absent from the UMLS gold standard, indicating that current benchmarks may underestimate PLM knowledge.

Conclusion

MedLAMA and Contrastive-Probe offer a new framework for evaluating and improving knowledge extraction in specialized domains. While a performance gap remains, these tools provide a foundation for developing more sophisticated probing techniques. Future research will explore combining prompt optimization with representation-space rewiring to further unlock the knowledge stored within PLMs.

Summary updated

Abstract

Knowledge probing is crucial for understanding the knowledge transfer mechanism behind the pre-trained language models (PLMs). Despite the growing progress of probing knowledge for PLMs in the general domain, specialised areas such as biomedical domain are vastly under-explored. To catalyse the research in this direction, we release a well-curated biomedical knowledge probing benchmark, MedLAMA, which is constructed based on the Unified Medical Language System (UMLS) Metathesaurus. We test a wide spectrum of state-of-the-art PLMs and probing approaches on our benchmark, reaching at most 3% of acc@10. While highlighting various sources of domain-specific challenges that amount to this underwhelming performance, we illustrate that the underlying PLMs have a higher potential for probing tasks. To achieve this, we propose Contrastive-Probe, a novel self-supervised contrastive probing approach, that adjusts the underlying PLMs without using any probing data. While Contrastive-Probe pushes the acc@10 to 28%, the performance gap still remains notable. Our human expert evaluation suggests that the probing performance of our Contrastive-Probe is still under-estimated as UMLS still does not include the full spectrum of factual knowledge. We hope MedLAMA and Contrastive-Probe facilitate further developments of more suited probing techniques for this domain.
BibTeX
@inproceedings{meng2022rewire,
  author = {Zaiqiao Meng and Fangyu Liu and Ehsan Shareghi and Yixuan Su and Charlotte Collins and Nigel Collier},
  title = {{Rewire-then-Probe: A Contrastive Recipe for Probing Biomedical Knowledge of Pre-trained Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.acl-long.329},
}
Figure