CoolFace
Modelpublic

thealper2/flan-t5-base-medal-abbreviation-expansion

sourceHugging Faceapache-2.0updated 6d agoView on Hugging Face
0likes380downloads
Model Card

thealper2/flan-t5-base-medal-abbreviation-expansion

google/flan-t5-base fine-tuned on the MeDAL pre-training subset for context-aware medical abbreviation expansion: given a context window and an abbreviation, the model generates the full expansion.

Task format

Input:

Expand the medical abbreviation based on the context.

Context: {context}

Abbreviation: {abbreviation}

Target: the expansion string only, e.g. transverse aortic constriction.

Usage

python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("thealper2/flan-t5-base-medal-abbreviation-expansion")
model = AutoModelForSeq2SeqLM.from_pretrained("thealper2/flan-t5-base-medal-abbreviation-expansion")

context = "the patient was admitted to the ICU because of severe respiratory distress"
abbreviation = "ICU"
prompt = (
    "Expand the medical abbreviation based on the context.\n\n"
    f"Context: {context}\n\n"
    f"Abbreviation: {abbreviation}"
)

inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=320)
outputs = model.generate(**inputs, max_new_tokens=32, num_beams=4)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Training data

MeDAL rows (ABSTRACT_ID, TEXT, LOCATION, LABEL) are converted into (context, abbreviation, target) triples: the abbreviation is the token at word index LOCATION in TEXT, the target is LABEL, and the context is a symmetric word window around LOCATION (MeDAL abstracts are lower-cased and punctuation-free, so there are no sentence boundaries to cut on).

Source splitsMeDAL train / valid / test (predefined, not re-mixed)
Train examples100,000
Validation examples10,000
Test examples10,000
Context modewindow, 64 words on each side
Distinct abbreviations5,520
Abbreviations with >1 expansion4,391 (79.55%)

Sub-sampling from the full MeDAL splits uses seeded reservoir sampling; the dataset's own split boundaries are preserved and the test split is used only for the final evaluation.

Training procedure

Hyper-parameterValue
Base modelgoogle/flan-t5-base
Objectiveseq2seq cross-entropy
Learning rate0.0003
LR schedulelinear, warmup ratio 0.03
Batch size16 x 2 grad-accum = 32
Epochs2.0
Weight decay0.01
Max input / target length320 / 32
Precisionbf16
Seed42
HardwareNVIDIA GeForce RTX 5060 Ti
Runtime70.4 min
Final validation loss0.6663

Evaluation

Test split, deterministic decoding (beam search, num_beams=4, max_new_tokens=32, no sampling).

MetricValue (%)
Exact Match41.87
Normalized Exact Match41.88
Token Precision53.05
Token Recall52.68
Token F152.58
ROUGE-L52.53

Ambiguity breakdown

An abbreviation is ambiguous when more than one distinct gold expansion is observed for it in the processed splits.

SubsetnExact MatchToken F1ROUGE-L
Ambiguous9,55042.1352.8552.80
Non-ambiguous45036.4446.6846.68

Context ablation

Two checkpoints trained with identical data, hyper-parameters and seed; the only difference is whether the prompt contains the context.

Input formulationExact MatchToken F1ROUGE-L
Context-aware41.8752.5852.53
Context-free21.1826.7526.70

Limitations

  • —Trained on PubMed abstracts (MeDAL), not on clinical notes; distribution shift to real clinical text is untested.
  • —MeDAL labels are produced by automatic reverse substitution, so some gold expansions are noisy or non-canonical; metrics are relative to those labels.
  • —MeDAL text is lower-cased with punctuation removed; inputs of a different surface form are out of distribution.
  • —Generative decoding can produce expansions that are not in the label inventory.
  • —Terminology variants ("heart attack" vs. "myocardial infarction") count as errors under exact match.
  • —Not a clinical decision-support system and not validated for clinical use.

Citation

bibtex
@inproceedings{wen-etal-2020-medal,
    title = "{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining",
    author = "Wen, Zhi and Lu, Xing Han and Reddy, Siva",
    booktitle = "Proceedings of the 3rd Clinical Natural Language Processing Workshop",
    year = "2020",
    pages = "130--135",
    url = "https://www.aclweb.org/anthology/2020.clinicalnlp-1.15"
}