ultrabert-clinical-judge
A fine-tuned UltraBERT-150M pairwise judge for clinical term mapping. It scores a (clinical entity + note context, candidate code + description) pair and is used to rerank candidate codes before the final chooser. It is the first stage of the HILabs ICD-10-CM / SNOMED CT mapping system.
- Base:
dmis-lab/UltraBERT-150M(UltrabertForSequenceClassification, one logit). - Training: 60,600 pairs built from the training split — the gold candidate against 20 hard negatives drawn from the source-diverse candidate pool; 90/10 entity-hash split; 2 epochs, lr 4e-5, bf16. Pairwise validation accuracy 96.5%.
- Role: per-option score used in a judge blend
0.5*z(UltraBERT) + 0.5*z(Qwen3-Reranker-8B); the blend ranks the shortlist (ICD K=10, SNOMED K=30). Accuracy is measured downstream (this model is a ranker, not a classifier of codes).
Usage
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("d3let3/ultrabert-clinical-judge", trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained(
"d3let3/ultrabert-clinical-judge", num_labels=1, trust_remote_code=True,
dtype=torch.bfloat16).eval().cuda()
state = "history of diabetes mellitus || past medical history: ... history of diabetes mellitus"
candidate = "Z86.39 | Personal history of other endocrine, nutritional and metabolic disease"
b = tok([state], [candidate], truncation=True, max_length=256, padding=True, return_tensors="pt").to("cuda")
score = model(**b).logits.squeeze(-1).item() # higher = better match
Input convention: state is "<entity> || <context>"; candidate is "<code> | <description>".
Both sides are truncated to 256 tokens.
Intended use and limitations
- Reranking a small candidate shortlist whose gold is usually present; it is not a standalone code generator.
- Scores are logits for ranking; they are not calibrated probabilities.
- Trained on de-identified clinical notes; review your data-governance requirements before redistribution.