Downloads · 30 days
16
36% of all-time downloads
AiLLMBS/phi35-medquad-patient-explainer-lora
phi35-medquad-patient-explainer-lora is a text generation model from AiLLMBS. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
This repository contains a LoRA adapter fine-tuned from microsoft/Phi-3.5-mini-instruct for source-grounded patient-friendly rewriting of medical question-answer content.
Downloads · 30 days
16
36% of all-time downloads
All-time downloads
44
Public
Repo size
101 MB
Likes
2
Public
Click a slice to open those files.
.safetensors101 MB · 97%
From the Hugging Face model README
This repository contains a LoRA adapter fine-tuned from
microsoft/Phi-3.5-mini-instruct
for source-grounded patient-friendly rewriting of medical question-answer content.
The user supplies both a medical question and a source/reference answer. The adapter rewrites the supplied source answer in clearer language and adds a standardized educational safety note.
This is an educational and portfolio model. It is not intended for:
microsoft/Phi-3.5-mini-instruct16320.05down_proj, gate_up_proj, o_proj, qkv_projThis repository contains the adapter, tokenizer metadata, and chat template. It does not contain the full Phi-3.5 base-model weights.
Formatted dataset:
AiLLMBS/medquad-patient-friendly-rewrites
The dataset was derived from
lavita/MedQuAD.
Source answers were converted into patient-friendly rewrite targets, then
cleaned and filtered for:
Final local split used for training and evaluation:
Dataset audit:
Both variants were evaluated on the same 99 held-out examples with identical prompts and deterministic decoding.
| Metric | Base Phi-3.5 | LoRA |
|---|---|---|
| Source keyword coverage | 71.02% | 58.39% |
| Copy ratio | 5.53% | 6.48% |
| Safety-note rate | 84.85% | 97.98% |
Exact Plain-language answer: header rate | 0.00% | 100.00% |
| Strict structured pass rate | 0.00% | 67.68% |
| Average output characters | 1225.8 | 841.2 |
The LoRA increased safety-note inclusion and exact format compliance, and reduced average answer length by approximately 31.38%. The base model retained more literal source keywords.
The strict structured pass rate requires all of the following:
Plain-language answer: section header.Because the base model was not explicitly required to emit that exact header, the strict pass rate should be interpreted as structured task compliance, not as a measure of clinical correctness or general medical quality.
Keyword overlap is also an imperfect proxy for semantic faithfulness. A valid paraphrase may receive a lower overlap score, while an unsupported statement can still share source words.
Detailed aggregate artifacts are included under evaluation/.
Medical question:
What are the symptoms of asthma?
Source answer:
Asthma symptoms include wheezing, coughing, chest tightness, and shortness of
breath. Symptoms can vary over time and may be triggered by exercise, allergens,
cold air, or respiratory infections.
Task:
Rewrite the source answer in clear, patient-friendly language. Use only the
provided source answer. Do not add new medical claims. Use short sentences and
include a short safety note.
Plain-language answer:
Asthma can cause wheezing, coughing, a tight feeling in the chest, and trouble breathing. These symptoms may come and go. They can become more noticeable during exercise, around allergens, in cold air, or during a respiratory infection.
Important note:
This is educational information, not a diagnosis or treatment plan. Please talk with a qualified healthcare professional about personal medical concerns.
import torch
from peft import PeftModel
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
)
base_model_id = "microsoft/Phi-3.5-mini-instruct"
adapter_id = "AiLLMBS/phi35-medquad-patient-explainer-lora"
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16,
)
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
quantization_config=quantization_config,
device_map="auto",
dtype=torch.bfloat16,
attn_implementation="eager",
trust_remote_code=False,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
The adapter may:
For example, a source phrase such as coughing may be strengthened to a cough that doesn't go away, which adds a duration claim that was not explicitly
provided.
All outputs should be checked against the source answer. This model has not been clinically validated.
Use this adapter only for source-grounded educational rewriting. Do not use it as an independent medical knowledge system. A qualified professional should review any output before it is shown to patients or used in healthcare communication.