CoolFace
Modelpublic

Aremaki/LongBEL_8B_QUAERO_EMEA

sourceHugging Facellama3.1updated 3mo agoView on Hugging Face
0likes9downloads
Model Card

LongBEL: Long-Context and Document-Consistent Biomedical Entity Linking

LongBEL

LongBEL is a novel document-level framework for biomedical entity linking (BEL). Instead of normalizing each mention independently, LongBEL conditions each prediction on the document context and on previous normalizations produced in the same document. This design enforces document-level consistency and is enhanced by our robust memory mechanism. The method is introduced in our paper, currently under review.

LongBEL (QUAERO-EMEA Edition)

This is a finetuned version of LLaMA-3-8B trained on QUAERO-EMEA, applying the LongBEL framework to enable long context and robust memory predictions.

FieldValue
Base modelmeta-llama/Llama-3.1-8B-Instruct
TaskBiomedical Entity Linking
DatasetQUAERO-EMEA
Knowledge baseUMLS 2014AA
InputBigBio-like documents with mention spans and semantic groups
OutputRanked UMLS concept predictions
DecodingSemantic-guided constrained decoding
Main metricRecall@1

Intended Use

This model is intended for research on biomedical entity linking and document-level consistency.

It assumes that mention spans and semantic groups are already provided. It does not perform named entity recognition. In a full pipeline, a NER model should first detect mentions and assign semantic groups, then LongBEL can normalize these mentions to UMLS concepts.

Usage

Loading the model

python
import torch
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
    "AnonymousARR42/LongBEL_8B_QUAERO_EMEA",
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

Inference example

The model expects BigBio-like documents. Each entity should include a mention text, character offsets, and a semantic group in the type field.

python
num_beams = 5

bigbio_pages = [
    {
        "id": "001",
        "document_id": "doc_001",
        "passages": [
            {
                "id": "0",
                "type": "paragraph",
                "text": [
                    "Une femme enceinte de 29 ans s'est présentée avec une hypertension sévère, "
                    "des céphalées et une douleur épigastrique. Les analyses biologiques ont montré "
                    "une protéinurie et une légère élévation des enzymes hépatiques. Elle a été "
                    "hospitalisée pendant la nuit avec une suspicion de PET et un traitement urgent "
                    "a été débuté."
                ],
                "offsets": [[0, 321]],
            }
        ],
        "entities": [
            {
                "id": "T1",
                "type": "Living Beings",
                "text": ["femme enceinte"],
                "offsets": [[4, 18]],
            },
            {
                "id": "T2",
                "type": "Disorders",
                "text": ["hypertension sévère"],
                "offsets": [[54, 73]],
            },
            {
                "id": "T3",
                "type": "Disorders",
                "text": ["protéinurie"],
                "offsets": [[158, 169]],
            },
            {
                "id": "T4",
                "type": "Disorders",
                "text": ["PET"],
                "offsets": [[280, 283]],
            },
        ],
        "events": [],
        "coreferences": [],
        "relations": [],
    }
]

predictions = model.sample(
    bigbio_pages=bigbio_pages,
    num_beams=num_beams,
)

for i in range(0, len(predictions), num_beams):
    mention = predictions[i]["mention"]
    print(f"## Mention {(i // num_beams) + 1}: {mention}")

    for j in range(num_beams):
        pred = predictions[i + j]
        print(
            f"   - Beam {j + 1}:\n"
            f"     Predicted concept name: {pred['pred_concept_name']}\n"
            f"     Predicted code: {pred['pred_concept_code']}\n"
            f"     Beam score: {pred['beam_score']:.3f}\n"
        )

Example Output:

text
## Mention 1: femme enceinte
   - Beam 1:
     Predicted concept name: Femmes enceintes
     Predicted code: C0033011
     Beam score: 1.000

   - Beam 2:
     Predicted concept name: Femmes (mariage)
     Predicted code: C0242665
     Beam score: 0.000

   - Beam 3:
     Predicted concept name: Femmes en postpartum
     Predicted code: C0032804
     Beam score: 0.000

   - Beam 4:
     Predicted concept name: Femmes en post-partum
     Predicted code: C0032804
     Beam score: 0.000

   - Beam 5:
     Predicted concept name: Females
     Predicted code: C0086287
     Beam score: 0.000

## Mention 2: hypertension sévère
   - Beam 1:
     Predicted concept name: Hypotension, non précisée
     Predicted code: C0020649
     Beam score: 0.029

   - Beam 2:
     Predicted concept name: Pression sanguine augmentée
     Predicted code: C0497247
     Beam score: 0.007

   - Beam 3:
     Predicted concept name: Hypertension; encephalopathy
     Predicted code: C1396475
     Beam score: 0.001

   - Beam 4:
     Predicted concept name: Hypertension;in pregnancy
     Predicted code: C0565599
     Beam score: 0.001

   - Beam 5:
     Predicted concept name: Pression sanguine non mesurable
     Predicted code: C0858911
     Beam score: 0.000

## Mention 3: protéinurie
   - Beam 1:
     Predicted concept name: Protéinurie
     Predicted code: C0033687
     Beam score: 1.000

   - Beam 2:
     Predicted concept name: Protéinurie - aggravée
     Predicted code: C0856146
     Beam score: 0.002

   - Beam 3:
     Predicted concept name: Protéine urinaire positive
     Predicted code: C0033687
     Beam score: 0.000

   - Beam 4:
     Predicted concept name: Protéine urinaire de Bence Jones présente
     Predicted code: C0854075
     Beam score: 0.000

   - Beam 5:
     Predicted concept name: Protéine urinaire de Bence Jones absente
     Predicted code: C0855589
     Beam score: 0.000

## Mention 4: PET
   - Beam 1:
     Predicted concept name: Petechial hemorrhage
     Predicted code: C0031256
     Beam score: 0.073

   - Beam 2:
     Predicted concept name: Petechial; hemorrhage
     Predicted code: C0031256
     Beam score: 0.022

   - Beam 3:
     Predicted concept name: Petechia
     Predicted code: C0031256
     Beam score: 0.008

   - Beam 4:
     Predicted concept name: PET - Pre-eclamptic toxaemia
     Predicted code: C0032914
     Beam score: 0.001

   - Beam 5:
     Predicted concept name: Petechial hemorrhages
     Predicted code: C0031256
     Beam score: 0.000

Saliency map example

The model can also return token-level saliency maps during inference.

python
predictions, saliency_maps = model.sample(
    bigbio_pages=bigbio_pages,
    num_beams=num_beams,
    with_saliency_maps=True,
)

model.display_saliency_map(saliency_maps[3])

Example saliency map for the mention PET:

<p align="center"> <img src="saliency_map.png" alt="Saliency map for PET prediction" width="900"> </p>

Evaluation

Entity linking performance is reported using Recall@1 with bootstrap confidence intervals. The best result is shown in bold, and the second-best result is <u>underlined</u> and ⭐ marks the main LongBEL-8B model.

ModelMM-ST21PV<br>(English)QUAERO-EMEA<br>(French)SympTEMIST<br>(Spanish)DisTEMIST<br>(Spanish)MedProcNER<br>(Spanish)
Context-Free BEL
SciSpacy53.8 ± 1.037.1 ± 4.39.8 ± 1.321.1 ± 1.910.3 ± 1.2
SapBERT65.6 ± 1.059.7 ± 3.834.2 ± 2.038.6 ± 2.630.4 ± 2.1
CODER-all62.9 ± 1.166.9 ± 4.042.2 ± 2.247.0 ± 2.642.7 ± 2.1
SapBERT-all64.6 ± 1.167.9 ± 3.949.8 ± 2.449.6 ± 2.645.1 ± 2.2
BERGAMOT60.9 ± 1.163.8 ± 4.948.0 ± 2.748.9 ± 2.442.3 ± 2.2
Local-Context BEL
ArboEL76.9 ± 0.963.0 ± 3.955.4 ± 2.554.7 ± 2.659.7 ± 2.6
GENRE / mBART-large69.6 ± 1.069.3 ± 5.459.8 ± 2.758.7 ± 2.766.0 ± 2.3
GENRE / Llama-1B73.1 ± 1.075.1 ± 3.660.5 ± 2.462.5 ± 2.367.4 ± 2.1
GENRE / Llama-8B75.0 ± 0.973.8 ± 4.061.7 ± 2.563.2 ± 2.568.3 ± 2.2
Global-Context BEL: LongBEL
LongBEL-1B77.6 ± 0.974.5 ± 3.759.8 ± 2.561.9 ± 2.466.6 ± 2.1
LongBEL-1B + Ensemble78.6 ± 0.8<u>77.2 ± 3.0</u>61.8 ± 2.5<u>64.3 ± 2.2</u><u>69.0 ± 2.0</u>
⭐ LongBEL-8B<u>79.3 ± 0.8</u>75.4 ± 3.4<u>62.0 ± 2.6</u>63.6 ± 2.1<u>69.0 ± 2.1</u>
LongBEL-8B + Ensemble80.0 ± 0.877.6 ± 3.063.3 ± 2.565.8 ± 2.271.0 ± 2.0

The score reported for this checkpoint is the single LongBEL-8B model. The ensemble result requires fusing several LongBEL input configurations and is not produced by this checkpoint alone.

Speed and Memory

Measured on a single NVIDIA H100 80GB GPU.

ModelModel memoryCandidate memorySpeed
GENRE-Llama-8B baseline28.6 GB5.4 GB38.2 mentions/s
LongBEL-8B28.6 GB5.4 GB15.2 mentions/s

LongBEL has the same model memory footprint as the sentence-level Llama-8B baseline, but it is slower because it processes longer contexts and updates document-level memory during inference.

Limitations

This model assumes that mention spans and semantic groups are given. It does not perform mention detection.

LongBEL is most useful when concepts recur within a document. When most concepts appear only once, the memory mechanism has less information to exploit.

Because LongBEL uses previous predictions as memory, early mistakes can still influence later predictions. Robust memory training reduces this risk but does not remove it completely.

This model is intended for research use. It should not be used for clinical decision-making without additional validation and human oversight.

Reproducibility

Code and evaluation scripts are available in this GitHub repository.

Trained model checkpoints and processed datasets are available in the anonymous Hugging Face collection associated with LongBEL.