Downloads · 30 days
0
raselmeya2194/med_dialogue2soap
med_dialogue2soap is a summarization model from raselmeya2194. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as mit.
meddialogue2soap is a fine-tuned model based on microsoft/Phi-3-mini-4k-instruct. The model has been specifically trained to generate SOAP notes (Subjective, Objective, Assessment, Plan) from medical dialogues. It pro…
Downloads · 30 days
0
Access
Public
Updated Oct 24, 2025
Repo size
36.2 MB
Likes
0
Public
Click a slice to open those files.
.safetensors35.7 MB · 90%
From the Hugging Face model README
med_dialogue2soap is a fine-tuned model based on microsoft/Phi-3-mini-4k-instruct. The model has been specifically trained to generate SOAP notes (Subjective, Objective, Assessment, Plan) from medical dialogues. It processes doctor-patient conversations and automatically summarizes them into structured medical documentation, aiding healthcare professionals in creating accurate patient records efficiently.
microsoft/Phi-3-mini-4k-instruct2e-4gradient_accumulation_steps=8eval_loss)You can directly use this model to generate SOAP notes from a doctor-patient dialogue by passing the conversation as input. Here's how you can use the model:
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load the fine-tuned model and tokenizer
model_name = "raselmeya2194/med_dialogue2soap"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Define the doctor-patient dialogue (input_text)
input_text = """
Doctor: Hello, can you please tell me about your past medical history?
Patient: Hi, I don't have any past medical history.
Doctor: Okay. What brings you in today?
...
Patient: Alright, thank you, Doctor.
"""
# Format the input with special tokens
prompt = f"<|user|>\nGenerate a SOAP note based on the following doctor-patient dialogue:\n\n{input_text}<|end|>\n<|assistant|>SOAP Notes:\n"
# Tokenize the input with special tokens
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=512)
# Generate the SOAP note
outputs = model.generate(
inputs["input_ids"],
max_new_tokens=512, # Adjust based on the size of the output you want
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
# Decode the output tokens to text
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
# Print the generated SOAP note
print(generated_text)
Input:
Doctor: Hello, can you please tell me about your past medical history?
Patient: Hi, I don't have any past medical history.
Doctor: Okay. What brings you in today?
Patient: I've been experiencing painless blurry vision in my right eye for a week now...
Generated SOAP Note:
SOAP Notes:
- **Subjective**: Patient reports blurry vision in the right eye for the past week. Also experiencing intermittent fevers, headache, body aches, and a nonpruritic rash on the lower legs for the past 6 months.
- **Objective**: Vital signs are normal. Physical exam reveals bilateral papilledema, optic nerve erythema in the right eye, and a right afferent pupillary defect.
- **Assessment**: Possible underlying inflammatory or infectious process, including autoimmune or infectious causes like viral infections or systemic lupus erythematosus.
- **Plan**: Further testing and specialist consultation needed. Continue supportive care and monitor symptoms.
The model was evaluated on a dataset containing doctor-patient dialogues, focusing on the model's ability to generate coherent and accurate SOAP notes from medical conversations.
Evaluation Metrics:
The model performed well in generating relevant and structured SOAP notes, with a mean token accuracy of 77.19% and a relatively low entropy, indicating good confidence in the generated output.
The model requires input in the form of a dialogue between a doctor and a patient. You should format the input text as a conversation with clear speaker labels.
The model generates a structured SOAP note containing:
The model may exhibit biases present in its training data. The data primarily includes English-language doctor-patient dialogues, which may limit its generalization to other languages or healthcare systems.
The generated SOAP notes should always be reviewed by qualified healthcare providers. The model is intended as a tool for automating the documentation process and should not be solely relied upon for clinical decision-making.
The model was fine-tuned on a curated medical dialogue dataset, which includes conversations between doctors and patients on various health conditions. The dataset was preprocessed to remove sensitive information and ensure the training quality.
2e-4The model is based on the Phi-3-mini-4k-instruct architecture, a smaller and more efficient version of a larger GPT-like model. It was fine-tuned using PEFT (Parameter-Efficient Fine-Tuning) with LoRA to optimize for SOAP note generation.
If you use this model, please cite the following:
BibTeX:
@misc{meddialogue2soap2025,
author = {Rasel Meya},
title = {med_dialogue2soap: A Model for Generating SOAP Notes from Medical Dialogue},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/raselmeya2194/med_dialogue2soap}
}
APA: Meya, R. (2025). med_dialogue2soap: A model for generating SOAP notes from medical dialogue. Hugging Face. URL: https://huggingface.co/raselmeya2194/med_dialogue2soap
This model is licensed under the MIT License (or other chosen license).
For more information, visit the model repository.