Views
No views yet
| Field | Value |
|---|---|
| Base model | meta-llama/Llama-3.1-8B-Instruct |
| Task | Biomedical Entity Linking |
| Dataset | MedMentions-ST21pv |
| Knowledge base | UMLS 2017AA, ST21pv subset |
| Input | BigBio-like documents with mention spans and semantic groups |
| Output | Ranked UMLS concept predictions |
| Decoding | Semantic-guided constrained decoding |
| Main metric | Recall@1 |
1import torch
2from transformers import AutoModelForCausalLM
3
4model = AutoModelForCausalLM.from_pretrained(
5 "AnonymousARR42/LongBEL_8B_MedMentions_st21pv",
6 trust_remote_code=True,
7 device_map="auto",
8)type field.1num_beams = 5
2
3bigbio_pages = [
4 {
5 "id": "001",
6 "document_id": "doc_001",
7 "passages": [
8 {
9 "id": "0",
10 "type": "paragraph",
11 "text": [
12 "A 29-year-old pregnant woman presented with severe-range hypertension, "
13 "headache, and epigastric pain. Laboratory testing showed proteinuria "
14 "and mildly elevated liver enzymes. She was admitted overnight with "
15 "suspected PET and was started on urgent treatment."
16 ],
17 "offsets": [[0, 257]],
18 }
19 ],
20 "entities": [
21 {
22 "id": "T1",
23 "type": "Living Beings",
24 "text": ["pregnant woman"],
25 "offsets": [[14, 28]],
26 },
27 {
28 "id": "T2",
29 "type": "Disorders",
30 "text": ["severe-range hypertension"],
31 "offsets": [[44, 69]],
32 },
33 {
34 "id": "T3",
35 "type": "Disorders",
36 "text": ["proteinuria"],
37 "offsets": [[128, 139]],
38 },
39 {
40 "id": "T4",
41 "type": "Disorders",
42 "text": ["PET"],
43 "offsets": [[217, 220]],
44 },
45 ],
46 "events": [],
47 "coreferences": [],
48 "relations": [],
49 }
50]
51
52predictions = model.sample(
53 bigbio_pages=bigbio_pages,
54 num_beams=num_beams,
55)
56
57for i in range(0, len(predictions), num_beams):
58 mention = predictions[i]["mention"]
59 print(f"## Mention {(i // num_beams) + 1}: {mention}")
60
61 for j in range(num_beams):
62 pred = predictions[i + j]
63 print(
64 f" - Beam {j + 1}:\n"
65 f" Predicted concept name: {pred['pred_concept_name']}\n"
66 f" Predicted code: {pred['pred_concept_code']}\n"
67 f" Beam score: {pred['beam_score']:.3f}\n"
68 )1## Mention 1: pregnant woman
2 - Beam 1:
3 - Predicted concept name:Pregnant Woman
4 - Predicted code: C0033011
5 - Beam score: 1.000
6
7 - Beam 2:
8 - Predicted concept name:Pregnant woman
9 - Predicted code: C0033011
10 - Beam score: 0.003
11
12 - Beam 3:
13 - Predicted concept name:Pregnant woman (person)
14 - Predicted code: C0033011
15 - Beam score: 0.001
16
17 - Beam 4:
18 - Predicted concept name:Pregnancy Partner
19 - Predicted code: C3538996
20 - Beam score: 0.000
21
22 - Beam 5:
23 - Predicted concept name:Pregnant woman (person)
24 - Predicted code: C0033011
25 - Beam score: 0.000
26
27## Mention 2: severe-range hypertension
28 - Beam 1:
29 - Predicted concept name:Hypertensive disease
30 - Predicted code: C0020538
31 - Beam score: 0.078
32
33 - Beam 2:
34 - Predicted concept name:Hypertension (in some patients)
35 - Predicted code: C3280936
36 - Beam score: 0.022
37
38 - Beam 3:
39 - Predicted concept name:Hypertensive disease (disorder)
40 - Predicted code: C0020538
41 - Beam score: 0.010
42
43 - Beam 4:
44 - Predicted concept name:Hypertension, severe
45 - Predicted code: C4013784
46 - Beam score: 0.010
47
48 - Beam 5:
49 - Predicted concept name:Hypertension (patient A)
50 - Predicted code: C4313262
51 - Beam score: 0.004
52
53## Mention 3: proteinuria
54 - Beam 1:
55 - Predicted concept name:Proteinurias
56 - Predicted code: C0033687
57 - Beam score: 1.000
58
59 - Beam 2:
60 - Predicted concept name:Proteinuric diabetic nephropathy (disorder)
61 - Predicted code: C0403519
62 - Beam score: 0.003
63
64 - Beam 3:
65 - Predicted concept name:Proteinuria
66 - Predicted code: C0033687
67 - Beam score: 0.003
68
69 - Beam 4:
70 - Predicted concept name:Proteinuric diabetic nephropathy
71 - Predicted code: C0403519
72 - Beam score: 0.002
73
74 - Beam 5:
75 - Predicted concept name:Proteinuric hypertension of pregnancy (disorder)
76 - Predicted code: C0032914
77 - Beam score: 0.001
78
79## Mention 4: PET
80 - Beam 1:
81 - Predicted concept name:PET - Pre-eclamptic toxemia
82 - Predicted code: C0032914
83 - Beam score: 0.075
84
85 - Beam 2:
86 - Predicted concept name:PET - Pre-eclamptic toxaemia
87 - Predicted code: C0032914
88 - Beam score: 0.039
89
90 - Beam 3:
91 - Predicted concept name:Preeclamptic toxemia
92 - Predicted code: C2931877
93 - Beam score: 0.027
94
95 - Beam 4:
96 - Predicted concept name:Preeclampsia
97 - Predicted code: C0032914
98 - Beam score: 0.023
99
100 - Beam 5:
101 - Predicted concept name:Preeclampsia with Severe Features
102 - Predicted code: C0341950
103 - Beam score: 0.0191predictions, saliency_maps = model.sample(
2 bigbio_pages=bigbio_pages,
3 num_beams=num_beams,
4 with_saliency_maps=True,
5)
6
7model.display_saliency_map(saliency_maps[3])PET:
| Model | MM-ST21PV (English) | QUAERO-EMEA (French) | SympTEMIST (Spanish) | DisTEMIST (Spanish) | MedProcNER (Spanish) |
|---|---|---|---|---|---|
| Context-Free BEL | |||||
| SciSpacy | 53.8 ± 1.0 | 37.1 ± 4.3 | 9.8 ± 1.3 | 21.1 ± 1.9 | 10.3 ± 1.2 |
| SapBERT | 65.6 ± 1.0 | 59.7 ± 3.8 | 34.2 ± 2.0 | 38.6 ± 2.6 | 30.4 ± 2.1 |
| CODER-all | 62.9 ± 1.1 | 66.9 ± 4.0 | 42.2 ± 2.2 | 47.0 ± 2.6 | 42.7 ± 2.1 |
| SapBERT-all | 64.6 ± 1.1 | 67.9 ± 3.9 | 49.8 ± 2.4 | 49.6 ± 2.6 | 45.1 ± 2.2 |
| BERGAMOT | 60.9 ± 1.1 | 63.8 ± 4.9 | 48.0 ± 2.7 | 48.9 ± 2.4 | 42.3 ± 2.2 |
| Local-Context BEL | |||||
| ArboEL | 76.9 ± 0.9 | 63.0 ± 3.9 | 55.4 ± 2.5 | 54.7 ± 2.6 | 59.7 ± 2.6 |
| GENRE / mBART-large | 69.6 ± 1.0 | 69.3 ± 5.4 | 59.8 ± 2.7 | 58.7 ± 2.7 | 66.0 ± 2.3 |
| GENRE / Llama-1B | 73.1 ± 1.0 | 75.1 ± 3.6 | 60.5 ± 2.4 | 62.5 ± 2.3 | 67.4 ± 2.1 |
| GENRE / Llama-8B | 75.0 ± 0.9 | 73.8 ± 4.0 | 61.7 ± 2.5 | 63.2 ± 2.5 | 68.3 ± 2.2 |
| Global-Context BEL: LongBEL | |||||
| LongBEL-1B | 77.6 ± 0.9 | 74.5 ± 3.7 | 59.8 ± 2.5 | 61.9 ± 2.4 | 66.6 ± 2.1 |
| LongBEL-1B + Ensemble | 78.6 ± 0.8 | 77.2 ± 3.0 | 61.8 ± 2.5 | 64.3 ± 2.2 | 69.0 ± 2.0 |
| ⭐ LongBEL-8B | 79.3 ± 0.8 | 75.4 ± 3.4 | 62.0 ± 2.6 | 63.6 ± 2.1 | 69.0 ± 2.1 |
| LongBEL-8B + Ensemble | 80.0 ± 0.8 | 77.6 ± 3.0 | 63.3 ± 2.5 | 65.8 ± 2.2 | 71.0 ± 2.0 |
| Model | Model memory | Candidate memory | Speed |
|---|---|---|---|
| GENRE-Llama-8B baseline | 28.6 GB | 5.4 GB | 38.2 mentions/s |
| LongBEL-8B | 28.6 GB | 5.4 GB | 15.2 mentions/s |