Doc-Glasses: BioClinical ModernBERT Real-Time Clinical Decision Engine

Official release of the Doc-Glasses BioClinical ModernBERT multi-task triage classifier and autoregressive question micro-decoder, optimized for heads-up-display (HUD) edge devices and sub-100ms emergency consultation triage.

  • GitHub Repository: G-Docglasses/clinical-pipeline-research
  • Base Model: thomas-sounack/BioClinical-ModernBERT-base
  • Attention Implementation: Native PyTorch SDPA (Flash Attention 2)
  • Latency: ~15–22 ms forward pass, < 90 ms end-to-end on NVIDIA L4 GPU

Model Capabilities

  1. 14-Organ Syndrome Multi-Task Classification (100.0% Validation Accuracy):
    • CARDIOVASCULAR, RESPIRATORY, GASTROINTESTINAL, NEUROLOGICAL, MUSCULOSKELETAL, DERMATOLOGIC, GENITOURINARY, ENDOCRINE_METABOLIC, PEDIATRIC, OBSTETRICS_GYNECOLOGY, PSYCHIATRIC, INFECTIOUS, HEMATOLOGY_ONCOLOGY, OPHTHALMIC
  2. 3-Tier Urgency Triage (100.0% Validation Accuracy):
    • HIGH (Immediate resuscitation / Emergent), MED (Urgent), LOW (Routine / Non-urgent)
  3. Red Flag Detection (100.0% Validation Accuracy):
    • Identifies acute life threats (Aortic Dissection, Tension Pneumothorax, DKA, Intussusception, Acute Angle-Closure Glaucoma).
  4. Discriminative Generative Micro-Decoder:
    • Autoregressively generates next discriminating clinical questions strictly $\le 12$ words.
    • Built with tied BioClinical embeddings to prevent token hallucination or awkward repetition.

One-Step Usage

import torch
from transformers import AutoTokenizer
from clinical_multihead_model import DocGlassesMultiHeadModel

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_id = "thomas-sounack/BioClinical-ModernBERT-base"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = DocGlassesMultiHeadModel(
    model_name=model_id,
    num_urgency=3,
    num_organs=14,
    use_generative_question=True,
    attn_implementation="sdpa"
).to(device)

# Load checkpoint from Hugging Face Hub
from huggingface_hub import hf_hub_download
ckpt_path = hf_hub_download(repo_id="Gowtham25/Doc-Glasses-BioClinical-ModernBERT", filename="doc_glasses_bioclinical_best.pt")
model.load_state_dict(torch.load(ckpt_path, map_location=device))
model.eval()

# Run real-time turn inference
dialogue = "Doctor: What happened? Patient: Sudden severe tearing pain in my back radiating between shoulder blades."
tokens = tokenizer(dialogue, return_tensors="pt").to(device)

with torch.no_grad():
    out = model(tokens["input_ids"], attention_mask=tokens["attention_mask"])
    organ_idx = out["organ_logits"].argmax(dim=-1).item()
    urg_idx = out["urgency_logits"].argmax(dim=-1).item()
    rf_idx = out["red_flag_logits"].argmax(dim=-1).item()

print("Organ:", organ_idx, "Urgency:", urg_idx, "Red Flag:", bool(rf_idx == 1))

Benchmark Performance

Benchmark Scenario Organ Domain Acuity Red Flag Latency Pass $\le 100$ms
Gastroenteritis (6-turn) GASTROINTESTINAL LOW False 88 ms PASS
Aortic Dissection CARDIOVASCULAR HIGH True 66 ms PASS
Tension Pneumothorax RESPIRATORY HIGH True 59 ms PASS
Diabetic Ketoacidosis ENDOCRINE_METABOLIC HIGH True 68 ms PASS
Pediatric Intussusception PEDIATRIC HIGH True 77 ms PASS
Acute Glaucoma OPHTHALMIC HIGH True 75 ms PASS

For full deployment and evaluation scripts, see G-Docglasses/clinical-pipeline-research.

Downloads last month
7
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Datasets used to train Gowtham25/Doc-Glasses-BioClinical-ModernBERT