You need to agree to share your contact information to access this model

The information you provide might be collected, stored, processed and shared.

Bleed-BERT Hugging Face Model Usage Terms

The hosted AI model contains weights derived from datasets that may include Protected Health Information (PHI). Users must agree to the following:
- The model is provided strictly for research and development purposes.
- It must not be used for diagnostic, treatment, or clinical decision-making.
- Appropriate security and compliance measures must be implemented.
- Any model modifications must comply with AGPLv3.
- Reverse engineering or attempts to extract training data from the model are strictly prohibited.

Log in or Sign Up to review the conditions and access this model content.

Bleed-BERT Model Card

Bleed-BERT is a fine-tuned BioClinical-ModernBERT-large model for detecting cancer-associated bleeding in clinical notes. It performs binary classification of individual notes.

Model Details

  • Developed by: Omid Jafari
  • Research affiliation and acknowledgement: Ang Li Lab
  • Base model: BioClinical-ModernBERT-large
  • Fine-tuning dataset: 2,828 clinical notes from patients with cancer, including 1,151 positive and 1,677 negative notes.
  • Task: Binary text classification.
  • Language: English.
  • Maximum input length used for fine-tuning: 1,024 tokens.
Class ID Meaning
0 Negative for bleeding
1 Positive for bleeding

The saved classifier uses the label strings 0 and 1. The positive-class probability is the probability for class 1.

Intended Use

Bleed-BERT is intended for research involving the identification of bleeding in clinical documentation. It may assist researchers and informaticists in screening large collections of clinical notes.

The model classifies individual notes. Patient-level bleeding detection requires aggregation across notes. Classification as major bleeding (MB) or clinically relevant non-major bleeding (CRNMB) requires the separate severity algorithm incorporating bleeding-site, hemoglobin, and red blood cell transfusion information; these are not outputs of this model.

The model is not intended for diagnosis, treatment, or clinical decision-making.

Usage

Request access through this model's HuggingFace page and review the repository's access terms. Once access has been granted, authenticate locally using a HuggingFace token with permission to read this repository:

hf auth login

The following example requires PyTorch, Transformers, and huggingface_hub. It uses a synthetic example and returns the probability of a positive bleeding classification.

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_id = "ang-li-lab/Bleed-BERT"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

tokenizer = AutoTokenizer.from_pretrained(model_id, token=True)
model = AutoModelForSequenceClassification.from_pretrained(
    model_id,
    token=True,
    attn_implementation="sdpa",
).to(device)
model.eval()

text = "The patient presented with hematemesis and melena."
inputs = tokenizer(
    text,
    return_tensors="pt",
    truncation=True,
    max_length=1024,
)
inputs = {name: value.to(device) for name, value in inputs.items()}

with torch.inference_mode():
    logits = model(**inputs).logits
    probability = torch.softmax(logits, dim=-1)[0, 1].item()

threshold = 0.50
result = {
    "prob_positive": probability,
    "predicted_class": int(probability >= threshold),
    "label": "Bleeding" if probability >= threshold else "No bleeding",
}
print(result)

Fine-tuning

The selected model used a batch size of 16, an initial learning rate of 2e-05, weight decay of 0.01, and linear learning-rate decay without warmup. Training was performed on a single NVIDIA RTX PRO 6000 GPU.

Access and Licensing

Model files are distributed through gated access. Access and permitted use are governed by the repository's license and usage terms. Training notes and patient-level data are not distributed with the model.

Resources

Contact

For questions or inquiries, please contact our team through the Ang Li Lab website.

Downloads last month
4
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ang-li-lab/Bleed-BERT