Downloads · 30 days
10
8% of all-time downloads
YousefBadr/gptneo-medical-lora
gptneo-medical-lora is a text generation model from YousefBadr. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a medical-domain fine-tuned version of EleutherAI/gpt-neo-125M, trained using LoRA (Low-Rank Adaptation) on the Medical Meadow Medical Flashcards dataset.
Downloads · 30 days
10
8% of all-time downloads
All-time downloads
121
Public
Parameters
125M
501 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors501 MB · 99%
From the Hugging Face model README
This model is a medical-domain fine-tuned version of EleutherAI/gpt-neo-125M, trained using LoRA (Low-Rank Adaptation) on the Medical Meadow Medical Flashcards dataset.
The model generates accurate, structured medical responses given a medical instruction and question.
Fine-tuning significantly improved performance compared to the base GPT-Neo model, reducing perplexity by 97.95%.
This model was trained using parameter-efficient fine-tuning, allowing efficient adaptation with minimal computational cost.
Model link:
https://huggingface.co/YousefBadr/gptneo-medical-lora
This is a causal language model fine-tuned for medical question answering using LoRA.
Expected prompt format:
Instruction: Answer this question truthfully
Question: <medical question>
Response:
The model generates structured medical explanations.
Yousef Badr
Causal Language Model (GPT-Neo architecture) fine-tuned using LoRA
English
EleutherAI/gpt-neo-125M
https://huggingface.co/EleutherAI/gpt-neo-125M
Low-Rank Adaptation (LoRA)
LoRA enables efficient fine-tuning by training less than 1% of the total model parameters.
Example:
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("YousefBadr/gptneo-medical-lora")
tokenizer = AutoTokenizer.from_pretrained("YousefBadr/gptneo-medical-lora")
prompt = """Instruction: Answer this question truthfully
Question: What causes diabetes?
Response:"""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=200,
temperature=0.7,
top_p=0.9
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model is NOT intended for:
Always consult licensed medical professionals.
Medical Meadow Medical Flashcards
https://huggingface.co/datasets/medalpaca/medical_meadow_medical_flashcards
Dataset size: ~34,000 samples
Format:
Instruction: Answer this question truthfully
Question: <medical question>
Response: <medical answer>
Split:
This approach reduces training cost while maintaining high performance.
| Parameter | Value |
|---|---|
| Base Model | GPT-Neo-125M |
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.1 |
| Batch Size | 8 |
| Learning Rate | 2e-4 |
| Optimizer | AdamW |
| Precision | FP16 |
| GPU | NVIDIA Tesla T4 |
| Platform | Google Colab |
Perplexity was used as the primary evaluation metric.
Lower perplexity indicates better performance.
Evaluation performed on validation dataset.
| Model | Loss | Perplexity |
|---|---|---|
| Base GPT-Neo | 4.7494 | 115.51 |
| GPT-Neo + LoRA | 0.8638 | 2.37 |
Improvement:
Perplexity reduction: 97.95%
This demonstrates significant improvement in medical language modeling performance.
The fine-tuned model produces:
Detailed comparison available in:
generation_comparison.csv
Available files:
These files contain full quantitative and qualitative comparisons.
Input:
Instruction: Answer this question truthfully
Question: What causes asthma?
Response:
Output:
Asthma is a chronic inflammatory disease of the airways characterized by bronchial hyperresponsiveness, airflow obstruction, and inflammation.
GPT-Neo Transformer
Hardware:
Software:
Parameter-efficient LoRA significantly reduces compute cost compared to full fine-tuning.
Training performed on single GPU using Google Colab.
Yousef Badr. GPT-Neo Medical LoRA Fine-Tuned Model. 2026.
Yousef Badr
Machine Learning Engineer
Hugging Face: https://huggingface.co/YousefBadr
Special thanks to Eng. Mahmoud Khorshid for guidance and support.