--- language: en license: apache-2.0 tags: - medical - soap-notes - mistral - lora - fine-tuned --- # 🏥 Mistral 7B Fine-Tuned for SOAP Note Generation This model is a fine-tuned version of [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) specialized for generating clinical SOAP notes from doctor-patient conversations. ## Model Details - **Base Model**: mistralai/Mistral-7B-v0.1 - **Fine-tuning Method**: LoRA (Low-Rank Adaptation) - **LoRA Rank**: 16 - **Training**: 25 minutes on Google Colab T4 GPU - **Output Format**: Structured JSON with Subjective, Objective, Assessment, Plan sections ## Evaluation Results (Groq Llama-3.3-70B Judge) | Metric | Score | |--------|-------| | Answer Relevancy | 0.86 | | Contextual Precision | 0.60 | | Contextual Recall | 0.66 | | Contextual Relevancy | 0.78 | | Faithfulness | 0.70 | ## Usage ```python from transformers import AutoTokenizer, AutoModelForCausalLM import torch model = AutoModelForCausalLM.from_pretrained( "SaberaBanu/mistral-soap-notes", torch_dtype=torch.float16, device_map="auto" ) tokenizer = AutoTokenizer.from_pretrained("SaberaBanu/mistral-soap-notes") PROMPT = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. ### Instruction: Generate a SOAP note from the clinical conversation. Output MUST be a valid JSON object. ### Input: {conversation} ### Response: """ inputs = tokenizer(PROMPT.format(conversation=your_conversation), return_tensors="pt").to("cuda") outputs = model.generate(**inputs, max_new_tokens=600, do_sample=False) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Limitations - Objective section may hallucinate vitals not mentioned in conversation - Works best with clearly structured doctor-patient dialogues - Not intended for real clinical use without human review