CoolFace
Datasetpublic

MohamedAhmedAE/Med_LLaMa3_fine-tuning_dataset

Med-LLaMA3 — Medical Instruction Fine-Tuning Dataset A large, unified medical instruction-tuning corpus (~1.65 million examples) compiled, cleaned, and standardized from a diverse set of public medical sources. It is the training corpus used to fine-tune the Med-LLaMA3 family (LLaMA-3.2 1B/3B and LLaMA-3.1 8B) in the paper “Med-LLaMA3: Advancing Medical Question-Answering Through Parameter-Efficient Fine-Tuning of Large Language Models” (Applied Sciences, 2026). All sources were… See the full description on the dataset page: https://huggingface.co/datasets/MohamedAhmedAE/Med_LLaMa3_fine-tuning_dataset.

sourceHugging Faceotherupdated 3mo agoView on Hugging Face
1likes67downloads
Dataset Card

Med-LLaMA3 — Medical Instruction Fine-Tuning Dataset

A large, unified medical instruction-tuning corpus (~1.65 million examples) compiled, cleaned, and standardized from a diverse set of public medical sources. It is the training corpus used to fine-tune the Med-LLaMA3 family (LLaMA-3.2 1B/3B and LLaMA-3.1 8B) in the paper “Med-LLaMA3: Advancing Medical Question-Answering Through Parameter-Efficient Fine-Tuning of Large Language Models” (Applied Sciences, 2026). All sources were consolidated into a single instruction-style schema spanning medical examinations, clinical dialogues, biomedical literature, and encyclopedic references.


Dataset summary

Total examples1,651,357
Splitstrain (~1.64 M) · validation (~14.4 k)
File size~1.48 GB (Parquet)
FormatParquet (auto-converted; loadable with 🤗 datasets)
LanguageEnglish
DomainMedicine / clinical / biomedical
Task formatsOpen-ended QA, multiple-choice QA, clinical case reading, abstract-to-title summarization, relationship classification

Supported tasks

  • —Medical question answering — open-ended factual/clinical questions and USMLE-style reasoning.
  • —Multiple-choice QA — exam-style questions with enumerated options.
  • —Clinical dialogue — patient-message → doctor-style response.
  • —Biomedical literature tasks — e.g., summarizing an abstract into a title; causal-relationship classification.
  • —Clinical case comprehension — reading and understanding structured case passages.

These are delivered in a unified instruction format suitable for supervised fine-tuning (SFT) / instruction-tuning of causal language models.


Dataset structure

Data fields

Each row has six string fields:

FieldDescription
instructionThe task instruction / system prompt (e.g., “Answer this question truthfully”, “Choose the correct answer for the following question”, “If you are a doctor, please answer the medical questions based on the patient's description.”). ~817 distinct instruction templates.
inputThe user-facing content: a question, a patient message, an abstract, or a clinical case passage.
contextSupporting context when available — a PubMed abstract, clinical note, or reference passage. May be empty or the literal string "None".
choicesEnumerated options for multiple-choice items (e.g., "1) ... 2) ... 3) ... 4) ..."). Empty for non-MCQ rows.
outputThe target answer / response. For MCQ this is the correct option (a key such as 2/C or the option text). May be empty for some case-reading rows.
typeOne of QA, MCQ, or CASE (see below).

Record types (type)

  • —`QA` — open-ended questions answered truthfully, doctor-style patient responses, abstract-to-title summarization, and relationship-classification prompts. choices is empty.
  • —`MCQ` — multiple-choice questions; choices is populated and output is the correct option.
  • —`CASE` — clinical case passages presented for reading/understanding (instruction “Study the following case carefully and understand its details.”); input carries the passage.

Example rows

json
{
  "instruction": "Answer this question truthfully",
  "input": "What is the role of macrophages in the formation of foam cells?",
  "context": "",
  "choices": "",
  "output": "Macrophages take up excess cholesterol in the subendothelium and become lipid-laden foam cells, an early step in atherosclerotic plaque formation.",
  "type": "QA"
}
json
{
  "instruction": "Choose the correct answer for the following question",
  "input": "Which part of the nephron normally reabsorbs the most water?",
  "context": "The proximal tubule reabsorbs roughly two-thirds of filtered water...",
  "choices": "1) Proximal tubule. 2) Thick ascending limb. 3) Distal tubule. 4) Collecting duct.",
  "output": "1",
  "type": "MCQ"
}

Splits

SplitExamples
train~1,636,957
validation~14,400
Total1,651,357

How to use

python
from datasets import load_dataset

ds = load_dataset("MohamedAhmedAE/Med_LLaMa3_fine-tuning_dataset")
print(ds)
print(ds["train"][0])

A simple Alpaca-style prompt formatter:

python
def format_example(ex):
    parts = [ex["instruction"].strip()]
    if ex.get("context") and ex["context"] not in ("", "None"):
        parts.append(f"\nContext:\n{ex['context'].strip()}")
    if ex.get("input"):
        parts.append(f"\nQuestion:\n{ex['input'].strip()}")
    if ex.get("choices"):
        parts.append(f"\nChoices:\n{ex['choices'].strip()}")
    prompt = "\n".join(parts) + "\n\nAnswer:\n"
    return {"prompt": prompt, "completion": ex["output"].strip()}

train = ds["train"].map(format_example)
Tip: filter by type to build task-specific subsets, e.g. ds["train"].filter(lambda r: r["type"] == "MCQ").

Dataset creation

Curation taxonomy

To make the corpus a reproducible methodological artifact, the paper organizes all sources along three axes: (A) source type (examination QA, clinical dialogue, biomedical literature, encyclopedic reference), (B) clinical granularity (basic science, clinical reasoning, patient communication), and (C) task format (multiple-choice, open-ended QA, generative dialogue). Sources were then mapped into the unified instruction schema above.

Source composition (per the paper, Table 1)

English-language counts as reported in the paper. Exact counts in this repository may differ slightly due to cleaning, deduplication, and the train/validation split.

SourceApprox. samplesType (A)Granularity (B)Format (C)
MIMIC-III465,200Clinical notesClinicalGenerative
UMLS Metathesaurus312,450EncyclopedicBasic scienceOpen QA
MedDialog (EN)257,337DialoguePatient comm.Generative
MedMCQA194,000Exam QAClinicalMCQ
HealthCareMagic112,165DialoguePatient comm.Generative
WikiDoc Patient Info67,233EncyclopedicPatient comm.Open QA
Alpaca-EN-AN52,000InstructionClinicalOpen QA
Medical Flashcards33,955Exam QABasic scienceOpen QA
ChatDoctor (iCliniq)30,000DialoguePatient comm.Generative
Medical Meadow CORD-1917,721Biomedical lit.ClinicalOpen QA
MEDIQA16,412EncyclopedicPatient comm.Open QA
MedQA-USMLE12,723Exam QAClinicalMCQ
WikiDoc10,000EncyclopedicBasic scienceOpen QA
CovidDialog (EN)6,032DialoguePatient comm.Generative
PubMed Causal2,446Biomedical lit.ClinicalOpen QA

Preprocessing & quality assurance

As described in the paper, the pipeline included: medical-expert validation of source content; deduplication via semantic-similarity analysis to prevent leakage; terminology standardization using UMLS concepts; ethical/safety filtering to remove potentially harmful advice; and steps toward balanced representation across specialties, difficulty levels, and task types. The corpus-assembly and cleaning scripts are released in the code repository.

Evaluation integrity

The eight MMLU medical subsets (Anatomy, Clinical Knowledge, College Biology, College Medicine, Medical Genetics, Nutrition, Professional Medicine, Virology) were used only for held-out evaluation and were excluded from the fine-tuning corpus. For benchmarks with official splits (MedMCQA, MedQA-USMLE, PubMedQA), only the official training partitions were drawn into this corpus.


Considerations for using the data

Intended use

Research on medical NLP and instruction-tuning of language models. Not for clinical use. Models trained on this data must not be used for autonomous diagnosis, treatment, or any decision affecting patient care without a qualified clinician in the loop.

Limitations & biases

  • —English only, and skewed toward exam-style and dialogue formats; long-form, multi-turn, and non-English clinical text are under-represented.
  • —Source bias: counts are dominated by a few large sources (clinical notes, encyclopedic references, dialogue), which may bias models toward those styles. Rare conditions may be under-represented.
  • —Empty/`"None"` fields: context, choices, and occasionally output can be empty depending on type; handle these in preprocessing.
  • —Possible residual noise: despite cleaning, some abstract-summarization rows include non-medical or multilingual abstracts, and some case rows are bibliographic snippets.
  • —Content reflects the medical knowledge and any biases present in the underlying sources; verify against authoritative references before any applied use.

Personal & sensitive information

Clinical-note sources (e.g., MIMIC-III) are de-identified at source, but users handling any clinical text should follow applicable privacy regulations (e.g., HIPAA, GDPR) and avoid re-identification attempts.


Licensing & source restrictions

This is an aggregated corpus; the component sources carry their own, differing licenses, and some are access-controlled or non-commercial. Notably:

  • —MIMIC-III is distributed under the PhysioNet Credentialed Health Data License and a Data Use Agreement that normally requires credentialed access — review your obligations before redistributing or building on this portion.
  • —UMLS requires acceptance of the UMLS Metathesaurus License.
  • —Several instruction sources (e.g., Alpaca-derived data) are non-commercial (CC BY-NC), and dialogue datasets (ChatDoctor/HealthCareMagic) are typically research-use only.

Because of this mix, the dataset is best treated as research-use, non-commercial, with the most restrictive component license effectively governing any given use. You are responsible for reviewing and complying with the license and access terms of each original source before using or redistributing the data. The license tag is set to other to reflect this composite status.


Citation

If you use this dataset, please cite the paper:

bibtex
@article{aboelenen2026medllama3,
  title   = {Med-LLaMA3: Advancing Medical Question-Answering Through Parameter-Efficient Fine-Tuning of Large Language Models},
  author  = {Abo El-Enen, Mohamed Ahmed and Ismail, Sally S. and Nazmy, Taymoor Mohamed},
  journal = {Applied Sciences},
  volume  = {16},
  number  = {12},
  pages   = {6158},
  year    = {2026},
  publisher = {MDPI},
  doi     = {10.3390/app16126158},
  url     = {https://www.mdpi.com/2076-3417/16/12/6158}
}

Please also cite the original source datasets you rely on (MedAlpaca/Medical Meadow, MedMCQA, MedQA-USMLE, PubMedQA, MIMIC-III, UMLS, HealthCareMagic/ChatDoctor, CORD-19, COVID-QA, and others listed above).

Authors & contact

Mohamed Ahmed Abo El-Enen, Sally S. Ismail, and Taymoor Mohamed Nazmy Faculty of Computer and Information Sciences, Ain Shams University, Cairo, Egypt.