Views
No views yet
| Experiment | AUROC | Avg Precision | F1 | Precision | Recall | NDCG@10 | Time |
|---|---|---|---|---|---|---|---|
| Exp1: Zero-Shot BGE Embedding | 0.503 | 0.538 | 0.520 | 0.538 | 0.504 | 0.548 | 181s |
| Exp2: LoRA BiomedBERT (this model) | 0.702 | 0.697 | 0.721 | 0.636 | 0.833 | 0.609 | 6703s |
| Exp3: Evidence-Weighted Ensemble | 0.712 | 0.706 | 0.697 | 0.665 | 0.732 | 0.668 | 1s |
microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext (110M params)bigbio/chemprot (chemprot_full_source) — BioCreative VI chemical-protein RE
1from transformers import AutoModelForSequenceClassification, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# Load base model + LoRA adapter
6base_model = AutoModelForSequenceClassification.from_pretrained(
7 "microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext",
8 num_labels=2
9)
10model = PeftModel.from_pretrained(base_model, "omshrivastava/omnibimol-chemprot-lora")
11tokenizer = AutoTokenizer.from_pretrained("omshrivastava/omnibimol-chemprot-lora")
12
13model.eval()
14
15# Score a chemical-protein interaction
16chemical = "metformin"
17protein = "ampk"
18context = "Metformin activates AMP-activated protein kinase (AMPK) in hepatocytes, leading to decreased hepatic glucose production."
19
20inputs = tokenizer(
21 f"{chemical} interacts with {protein}",
22 context[:256],
23 truncation=True, max_length=256, return_tensors="pt"
24)
25
26with torch.no_grad():
27 logits = model(**inputs).logits
28 prob = torch.softmax(logits, dim=-1)[0, 1].item()
29
30print(f"Interaction probability: {prob:.4f}")
31# Output: ~0.85 (high confidence interaction)1# After getting LoRA prob:
2import numpy as np
3from sklearn.linear_model import LogisticRegression
4
5# Text evidence features (from abstract)
6features = {
7 "bge_cosine_sim": 0.72, # BGE embedding similarity
8 "lora_prob": prob, # This model's prediction
9 "chem_in_context": 1, # Chemical mentioned in abstract
10 "prot_in_context": 1, # Protein mentioned in abstract
11 "cooccurrence": 1, # Both in same sentence
12 "keyword_count": 3, # Interaction keywords found
13 "context_length": 25, # Word count
14 "entity_distance": 0.15 # Normalized distance in text
15}
16# Feature weights from trained ensemble:
17# lora_prob: +0.8713 (dominant signal)
18# cooccur: +0.3643, kw_count: +0.1169, distance: +0.10891@inproceedings{hu2022lora,
2 title={LoRA: Low-Rank Adaptation of Large Language Models},
3 author={Hu, Edward and others},
4 booktitle={ICLR},
5 year={2022}
6}
7
8@article{gu2021pubmedbert,
9 title={Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing},
10 author={Gu, Yu and others},
11 journal={ACM THBI},
12 year={2021}
13}
14
15@inproceedings{krallinger2017chemprot,
16 title={Overview of the BioCreative VI chemical-protein interaction Track},
17 author={Krallinger, Martin and others},
18 booktitle={BioCreative VI Workshop},
19 year={2017}
20}