CoolFace
Modelpublic

txmedai/ClinicalEase-Qwen3-1.7B

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes155downloads
Model Card

ClinicalEase-Qwen3-1.7B

LoRA adapter on top of Qwen/Qwen3-1.7B that rewrites clinical / medical text into plain, patient-friendly language. Built to make discharge notes, medication instructions, and provider documentation legible to a non-clinician audience without losing clinical accuracy.

The latest weights live on main. Earlier training phases are preserved as named revisions so the curriculum is reproducible.

Versions

revisionwhat it is
main / phase2Latest. Continued training from phase1 on additional / harder data.
phase1First SFT pass on the base curriculum.
seed20Earliest run on this task (seed 20). Kept for provenance; superseded by phase1 / phase2.

Load a specific revision with revision="phase1" (or "phase2", "seed20") on PeftModel.from_pretrained.

Usage

python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_id    = "Qwen/Qwen3-1.7B"
adapter_id = "txmedai/ClinicalEase-Qwen3-1.7B"   # main = phase2
# adapter_id, revision="phase1"  # to pin to an earlier phase

tok  = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()

SYSTEM = ("Rewrite the clinical text below in plain, patient-friendly language. "
          "Preserve every clinical fact, dose, and instruction exactly. "
          "Avoid jargon; explain abbreviations; keep it warm and direct.")

def explain(text, max_new_tokens=400):
    msgs = [{"role": "user", "content": f"{SYSTEM}\n\n{text}"}]
    prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
    ids = tok(prompt, return_tensors="pt").to(model.device)
    out = model.generate(**ids, max_new_tokens=max_new_tokens,
                         temperature=0.4, top_p=0.9, do_sample=True,
                         pad_token_id=tok.eos_token_id)
    return tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True).strip()

Runs comfortably on a single consumer GPU.

Training

  • —Framework: TRL SFT
  • —PEFT: LoRA, r=16, α=32, dropout=0.05, bias=none, task=CAUSAL_LM
  • —Targets: qproj, kproj, vproj, oproj, gateproj, upproj, down_proj (full attn + MLP)
  • —Curriculum: seed20 → phase1 → phase2 (continued training on improved data)

Intended use

Generating plain-language explanations of clinical text for patient-facing applications: discharge summaries, medication instructions, lab-result explainers. Not a substitute for a clinician's review. Always verify clinical accuracy before delivering output to a patient.

Limitations

  • —Small model (1.7 B). Strong rewriting, but limited reasoning over complex multi-system cases.
  • —Inherits Qwen3-1.7B's training-data biases.
  • —No safety system for medication-dosage edge cases or contraindications — downstream review is required.

License

Apache-2.0 for the adapter weights. The base model Qwen/Qwen3-1.7B is governed by Qwen3's own license.

History

This repository consolidates three previously-separate repos (ClinicalEase-Qwen3-1.7B, -Phase1, -Phase2). Older repos have been retired in favor of the revision= mechanism above.