GuyDor007/MediSimplifier-LoRA-Adapters

Model

MediSimplifier: LoRA Adapters for Medical Text Simplification

0

4 commits

2 linked in READMEs

updated Jan 29, 2026

See the code

README

MediSimplifier: LoRA Adapters for Medical Text Simplification

Fine-tuned LoRA adapters that simplify medical discharge summaries to 6th-grade reading level for patient comprehension.

Model Overview

ModelBase ModelROUGE-LSARIBERTScoreFK-GradeImprovement
openbiollm_8b_lora πŸ†Llama3-OpenBioLLM-8B0.674974.640.94987.16+157.3%
mistral_7b_loraMistral-7B-Instruct-v0.20.649173.790.94646.91+65.9%
biomistral_7b_dare_loraBioMistral-7B-DARE0.631873.010.94396.95+53.3%

Key Achievement: ~50% readability reduction (FK 14.5 β†’ ~7.0), matching ground truth quality.

Repository Contents

β”œβ”€β”€ openbiollm_8b_lora/          # Best overall quality
β”œβ”€β”€ mistral_7b_lora/             # Best readability (FK 6.91)
β”œβ”€β”€ biomistral_7b_dare_lora/     # Medical domain baseline
└── checkpoints/
    β”œβ”€β”€ full_training_llama3/    # Epochs 1-3 (checkpoint-500/1000/1500)
    β”œβ”€β”€ full_training_mistral/   # Epochs 1-3
    └── full_training_biomistral/ # Epochs 1-3

Quick Start

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load base model + adapter (example: OpenBioLLM - best performer)
base_model = AutoModelForCausalLM.from_pretrained(
    "aaditya/Llama3-OpenBioLLM-8B",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "GuyDor007/MediSimplifier-LoRA-Adapters/openbiollm_8b_lora")
tokenizer = AutoTokenizer.from_pretrained("aaditya/Llama3-OpenBioLLM-8B")

# Inference
SYSTEM_MESSAGE = "You are a helpful medical assistant that simplifies complex medical text for patients."

TASK_INSTRUCTION = """Simplify the following medical discharge summary in plain language for patients with no medical background.
Guidelines:
- Replace medical jargon with everyday words (e.g., "hypertension" β†’ "high blood pressure")
- Keep all important information (diagnoses, medications, follow-up instructions)
- Use short, clear sentences (aim for 15-20 words per sentence)
- Aim for a 6th-grade reading level
- Maintain the same structure as the original
- Do not add or omit information"""

# ChatML format for OpenBioLLM
prompt = f"""<|im_start|>system
{SYSTEM_MESSAGE}<|im_end|>
<|im_start|>user
{TASK_INSTRUCTION}

{complex_medical_text}<|im_end|>
<|im_start|>assistant
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
simplified = tokenizer.decode(outputs[0], skip_special_tokens=True)

Using Mistral-based Models

# For mistral_7b_lora or biomistral_7b_dare_lora
base_model = AutoModelForCausalLM.from_pretrained(
    "mistralai/Mistral-7B-Instruct-v0.2",  # or "BioMistral/BioMistral-7B-DARE"
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "GuyDor007/MediSimplifier-LoRA-Adapters/mistral_7b_lora")

# Mistral format
prompt = f"""[INST] <<SYS>>
{SYSTEM_MESSAGE}
<</SYS>>

{TASK_INSTRUCTION}

{complex_medical_text} [/INST]"""

Training Configuration

ParameterValue
LoRA Rank (r)32
LoRA Alpha (Ξ±)64
Target Modulesq_proj, k_proj, v_proj, o_proj
rsLoRATrue
Dropout0.05
Epochs3
Training Samples7,999
Trainable Parameters27.3M (0.38%)
Learning Rate2e-4 (cosine, 3% warmup)
Batch Size4 (grad accum: 4, effective: 16)
PrecisionBF16
Max Sequence Length2048

Ablation Study Findings

PhaseResearch QuestionFinding
RankOptimal LoRA rank?r=32 best (contradicts Hu et al. 2021 claim of r=4-8)
ModulesBest target modules?all_attn (q,k,v,o) despite 2x params
Data SizeData efficiency?More data = better (+5.5-6.6% ROUGE-L from 2K→8K)
rsLoRAScaling method?Adopted based on literature (Kalajdzievski 2023)

Key Research Findings

  1. Ranking Reversal: Worst zero-shot model (OpenBioLLM) achieved best fine-tuned performance
  2. Medical Pretraining: Advantage disappears after domain-specific fine-tuning
  3. All Models Succeed: 50% readability reduction achieved (college β†’ 7th grade level)
  4. Statistical Significance: All ROUGE-L differences significant (p < 0.001)

Dataset

SplitSamples
Train7,999
Validation999
Test1,001

Evaluation Metrics

MetricTargetAchieved
ROUGE-LHigher0.63-0.67
SARIβ‰₯4073-75 βœ…
BERTScoreHigher0.94-0.95
Flesch-Kincaid≀66.9-7.2 (close)

Checkpoints

Training checkpoints saved at each epoch for reproducibility and analysis:

CheckpointStepEpoch
checkpoint-5005001
checkpoint-100010002
checkpoint-150015003 (final)

Citation

@misc{medisimplifier2026,
  author = {Dor, Guy and Avraham, Shmulik},
  title = {MediSimplifier: LoRA Fine-Tuning for Medical Discharge Summary Simplification},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/GuyDor007/MediSimplifier-LoRA-Adapters}}
}

License

Apache 2.0

Acknowledgments

  • Technion DS25 Deep Learning Course
  • Base models: OpenBioLLM, Mistral, BioMistral teams
  • Dataset: Asclepius-Synthetic-Clinical-Notes (starmpcc)
clinical-notes
healthcare
lora
medical
patient-education
peft
safetensors
text-generation
text-simplification

GuyDor007/MediSimplifier-LoRA-Adapters

Model

MediSimplifier: LoRA Adapters for Medical Text Simplification

0

4 commits

2 linked in READMEs

updated Jan 29, 2026

See the code

README

MediSimplifier: LoRA Adapters for Medical Text Simplification

Fine-tuned LoRA adapters that simplify medical discharge summaries to 6th-grade reading level for patient comprehension.

Model Overview

ModelBase ModelROUGE-LSARIBERTScoreFK-GradeImprovement
openbiollm_8b_lora πŸ†Llama3-OpenBioLLM-8B0.674974.640.94987.16+157.3%
mistral_7b_loraMistral-7B-Instruct-v0.20.649173.790.94646.91+65.9%
biomistral_7b_dare_loraBioMistral-7B-DARE0.631873.010.94396.95+53.3%

Key Achievement: ~50% readability reduction (FK 14.5 β†’ ~7.0), matching ground truth quality.

Repository Contents

β”œβ”€β”€ openbiollm_8b_lora/          # Best overall quality
β”œβ”€β”€ mistral_7b_lora/             # Best readability (FK 6.91)
β”œβ”€β”€ biomistral_7b_dare_lora/     # Medical domain baseline
└── checkpoints/
    β”œβ”€β”€ full_training_llama3/    # Epochs 1-3 (checkpoint-500/1000/1500)
    β”œβ”€β”€ full_training_mistral/   # Epochs 1-3
    └── full_training_biomistral/ # Epochs 1-3

Quick Start

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load base model + adapter (example: OpenBioLLM - best performer)
base_model = AutoModelForCausalLM.from_pretrained(
    "aaditya/Llama3-OpenBioLLM-8B",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "GuyDor007/MediSimplifier-LoRA-Adapters/openbiollm_8b_lora")
tokenizer = AutoTokenizer.from_pretrained("aaditya/Llama3-OpenBioLLM-8B")

# Inference
SYSTEM_MESSAGE = "You are a helpful medical assistant that simplifies complex medical text for patients."

TASK_INSTRUCTION = """Simplify the following medical discharge summary in plain language for patients with no medical background.
Guidelines:
- Replace medical jargon with everyday words (e.g., "hypertension" β†’ "high blood pressure")
- Keep all important information (diagnoses, medications, follow-up instructions)
- Use short, clear sentences (aim for 15-20 words per sentence)
- Aim for a 6th-grade reading level
- Maintain the same structure as the original
- Do not add or omit information"""

# ChatML format for OpenBioLLM
prompt = f"""<|im_start|>system
{SYSTEM_MESSAGE}<|im_end|>
<|im_start|>user
{TASK_INSTRUCTION}

{complex_medical_text}<|im_end|>
<|im_start|>assistant
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
simplified = tokenizer.decode(outputs[0], skip_special_tokens=True)

Using Mistral-based Models

# For mistral_7b_lora or biomistral_7b_dare_lora
base_model = AutoModelForCausalLM.from_pretrained(
    "mistralai/Mistral-7B-Instruct-v0.2",  # or "BioMistral/BioMistral-7B-DARE"
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "GuyDor007/MediSimplifier-LoRA-Adapters/mistral_7b_lora")

# Mistral format
prompt = f"""[INST] <<SYS>>
{SYSTEM_MESSAGE}
<</SYS>>

{TASK_INSTRUCTION}

{complex_medical_text} [/INST]"""

Training Configuration

ParameterValue
LoRA Rank (r)32
LoRA Alpha (Ξ±)64
Target Modulesq_proj, k_proj, v_proj, o_proj
rsLoRATrue
Dropout0.05
Epochs3
Training Samples7,999
Trainable Parameters27.3M (0.38%)
Learning Rate2e-4 (cosine, 3% warmup)
Batch Size4 (grad accum: 4, effective: 16)
PrecisionBF16
Max Sequence Length2048

Ablation Study Findings

PhaseResearch QuestionFinding
RankOptimal LoRA rank?r=32 best (contradicts Hu et al. 2021 claim of r=4-8)
ModulesBest target modules?all_attn (q,k,v,o) despite 2x params
Data SizeData efficiency?More data = better (+5.5-6.6% ROUGE-L from 2K→8K)
rsLoRAScaling method?Adopted based on literature (Kalajdzievski 2023)

Key Research Findings

  1. Ranking Reversal: Worst zero-shot model (OpenBioLLM) achieved best fine-tuned performance
  2. Medical Pretraining: Advantage disappears after domain-specific fine-tuning
  3. All Models Succeed: 50% readability reduction achieved (college β†’ 7th grade level)
  4. Statistical Significance: All ROUGE-L differences significant (p < 0.001)

Dataset

SplitSamples
Train7,999
Validation999
Test1,001

Evaluation Metrics

MetricTargetAchieved
ROUGE-LHigher0.63-0.67
SARIβ‰₯4073-75 βœ…
BERTScoreHigher0.94-0.95
Flesch-Kincaid≀66.9-7.2 (close)

Checkpoints

Training checkpoints saved at each epoch for reproducibility and analysis:

CheckpointStepEpoch
checkpoint-5005001
checkpoint-100010002
checkpoint-150015003 (final)

Citation

@misc{medisimplifier2026,
  author = {Dor, Guy and Avraham, Shmulik},
  title = {MediSimplifier: LoRA Fine-Tuning for Medical Discharge Summary Simplification},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/GuyDor007/MediSimplifier-LoRA-Adapters}}
}

License

Apache 2.0

Acknowledgments

  • Technion DS25 Deep Learning Course
  • Base models: OpenBioLLM, Mistral, BioMistral teams
  • Dataset: Asclepius-Synthetic-Clinical-Notes (starmpcc)
clinical-notes
healthcare
lora
medical
patient-education
peft
safetensors
text-generation
text-simplification