Downloads · 30 days
10
16% of all-time downloads
martinarra31/medrag-llama33-70b-qlora
medrag-llama33-70b-qlora is a text generation model from martinarra31. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as other.
LoRA adapters (rank=16) fine-tuned on MedQA-USMLE with QLoRA. Achieves 78.48% accuracy on the MedQA-US test set — within 3 points of GPT-4 (83.97%). Combined with a FAISS RAG pipeline over medical textbooks, reaches 8…
Downloads · 30 days
10
16% of all-time downloads
All-time downloads
61
Public
Repo size
432 MB
Likes
0
Public
Click a slice to open those files.
.safetensors414 MB · 96%
From the Hugging Face model README
LoRA adapters (rank=16) fine-tuned on MedQA-USMLE with QLoRA. Achieves 78.48% accuracy on the MedQA-US test set — within 3 points of GPT-4 (83.97%). Combined with a FAISS RAG pipeline over medical textbooks, reaches 80.99%.
| Model | MedQA-US Accuracy |
|---|---|
| GPT-4 — Xiong et al. (ACL 2024) | 83.97% |
| Llama 3.3 70B + QLoRA + RAG | 80.99% |
| Llama 3.3 70B + QLoRA (this model) | 78.48% |
| Llama 3.3 70B base | 74.45% |
| GPT-3.5 — Xiong et al. (ACL 2024) | 65.04% |
Full code and RAG pipeline: github.com/MartinLiarte/medqa-llm
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.3-70B-Instruct")
base = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.3-70B-Instruct",
quantization_config=bnb_config,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "martinarra31/medrag-llama33-70b-qlora")
model.eval()
MedQA-USMLE-4-options — 9,160 train / 1,018 val / 1,273 test (4-option USMLE format).
| Parameter | Value |
|---|---|
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Target modules | q, k, v, o, gate, up, down proj |
| Learning rate | 5e-5 |
| LR scheduler | cosine |
| Effective batch size | 64 (1 × 16 grad accum × 4 GPUs) |
| Epochs | 3 |
| Max sequence length | 1024 |
| Quantization | 4-bit NF4 (QLoRA) |
Evaluated on the MedQA-US test set (1,273 questions, greedy decoding).
These adapters are intended for research purposes only. The model should not be used for real clinical decision-making. Performance was evaluated on USMLE-style multiple choice questions and may not generalize to other medical tasks or real patient scenarios.
Martín Liarte — CS student at UPV (Valencia), specializing in Computing & AI.