Views
No views yet
| Field | Value |
|---|---|
| Base model | meta-llama/Llama-3.2-1B-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_1B_MedMentions_st21pv",
6 trust_remote_code=True,
7 torch_dtype=torch.bfloat16,
8 device_map="auto",
9)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: 0.997
6
7 - Beam 2:
8 Predicted concept name: Pregnant Women
9 Predicted code: C0033011
10 Beam score: 0.024
11
12 - Beam 3:
13 Predicted concept name: Pregnancy Partner
14 Predicted code: C3538996
15 Beam score: 0.000
16
17 - Beam 4:
18 Predicted concept name: Pregnant Woman
19 Predicted code: C0033011
20 Beam score: 0.000
21
22 - Beam 5:
23 Predicted concept name: Pregnant Women
24 Predicted code: C0033011
25 Beam score: 0.000
26
27## Mention 2: severe-range hypertension
28 - Beam 1:
29 Predicted concept name: Hypertensive crisis
30 Predicted code: C0020546
31 Beam score: 0.312
32
33 - Beam 2:
34 Predicted concept name: Hypertensive crisis (disorder)
35 Predicted code: C0020546
36 Beam score: 0.235
37
38 - Beam 3:
39 Predicted concept name: Hypertensive disease (disorder)
40 Predicted code: C0020538
41 Beam score: 0.203
42
43 - Beam 4:
44 Predicted concept name: Hypertensive disease
45 Predicted code: C0020538
46 Beam score: 0.168
47
48 - Beam 5:
49 Predicted concept name: Hypertension arterial
50 Predicted code: C0020538
51 Beam score: 0.114
52
53## Mention 3: proteinuria
54 - Beam 1:
55 Predicted concept name: Proteinurias
56 Predicted code: C0033687
57 Beam score: 0.999
58
59 - Beam 2:
60 Predicted concept name: Proteinuric diabetic nephropathy (disorder)
61 Predicted code: C0403519
62 Beam score: 0.030
63
64 - Beam 3:
65 Predicted concept name: Proteinuria
66 Predicted code: C0033687
67 Beam score: 0.012
68
69 - Beam 4:
70 Predicted concept name: Proteinuria (disorder)
71 Predicted code: C0033687
72 Beam score: 0.006
73
74 - Beam 5:
75 Predicted concept name: Proteinuric diabetic nephropathy
76 Predicted code: C0403519
77 Beam score: 0.006
78
79## Mention 4: PET
80 - Beam 1:
81 Predicted concept name: Investigation Finding
82 Predicted code: C0243095
83 Beam score: 0.081
84
85 - Beam 2:
86 Predicted concept name: PET - Pre-eclamptic toxemia
87 Predicted code: C0032914
88 Beam score: 0.017
89
90 - Beam 3:
91 Predicted concept name: PET - Pre-eclamptic toxaemia
92 Predicted code: C0032914
93 Beam score: 0.010
94
95 - Beam 4:
96 Predicted concept name: PET - Severe pre-eclamptic toxemia
97 Predicted code: C0341950
98 Beam score: 0.005
99
100 - Beam 5:
101 Predicted concept name: PET - Severe pre-eclamptic toxaemia
102 Predicted code: C0341950
103 Beam score: 0.0041predictions, 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-1B baseline | 2.4 GB | 5.4 GB | 69.6 mentions/s |
| LongBEL-1B | 2.4 GB | 5.4 GB | 48.5 mentions/s |