franciszchen/M3LLM

2

stars

18

commits

Python

primary language

Dec 27, 2025

updated

README

M3LLM: Medical Multimodal Large Language Model

M3LLM is a specialized medical vision-language model built on InternVL3-8B, finetuned on comprehensive PMC medical imaging datasets to achieve state-of-the-art performance on multi-image medical visual question answering tasks.

Overall performance

πŸ“Š Evaluation Results

PMC-MI-Benchmark

Our model demonstrates strong performance on the PMC-MI-Benchmark, a comprehensive evaluation suite for multi-image medical visual question answering:

PMC-MI-Benchmark Results PMC-MI-Benchmark Results

Public Benchmarks

M3LLM achieves competitive performance across various public medical VQA benchmarks (MMMU-Med and OmnimedVQA):

Public Benchmark Results

MIMIC Evaluation

Performance evaluation on MIMIC-CXR :

MIMIC Results


πŸ”„ Training Data Synthesis Pipeline

M3LLM's training data is generated through a comprehensive 5-stage synthetic data pipeline that processes medical images and captions from PubMed Central (PMC) literature.

Pipeline Overview

Raw PMC Data β†’ Stage 1-3: Preprocessing β†’ Stage 4: Task-Specific QA β†’ Stage 5: Context Refinement β†’ Training Data

Data Statistics

Task CategorySamplesDescription
Pure Text QA40,382Text-only medical QA
Bounding Box VQA40,293Spatial relationship questions
Single Sub-image40,287Single sub-image reasoning
Multiple Sub-images39,462Multi-image reasoning
Sub-image Options40,295Multiple-choice questions
Compound Images37,029Compound figure understanding
Total~238KSix diverse task types

Pipeline Stages

Stage 1-3: Data Preprocessing

  • 1_inline_text_summarization.py: Summarizes medical observations from inline text
  • 2_medical_knowledge_complementation.py: Extracts keywords and generates medical knowledge
  • 3_visual_perception_enhancement.py: Creates visual perception descriptions using multimodal models

Stage 4: Task-Specific QA Generation

  • Six specialized scripts for different medical VQA task types
  • Generates questions, contexts, and answers based on medical images and captions
  • Supports pure text, spatial reasoning, single/multi-image, and multiple-choice tasks

Stage 5: Context Refinement

  • Improves question contexts to prevent data leakage
  • Removes answer-revealing information while maintaining clinical reasoning requirements
  • Ensures high-quality instruction-following data

πŸ“ Detailed pipeline documentation: See Instruction_data_generation/ for implementation details and usage instructions.


πŸš€ Training

M3LLM provides two training approaches to accommodate different computational resources:

Quick Start

# Navigate to training directory
cd InternVL

# LoRA training (recommended for limited resources)
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-lora.sh

# Full model training (better performance)
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-fullmodel.sh

πŸ“ Detailed training documentation: See InternVL/ for configuration details, hyperparameters, and troubleshooting.


πŸ“¦ Installation

Step 1: Clone the Repository

git clone https://github.com/franciszchen/M3LLM.git
cd M3LLM

Step 2: Set Up Environment

We should have two conda environments.

⏱️ Typical install time: The installation process typically takes between 5 to 15 minutes on a "normal" desktop computer with a standard broadband internet connection. This includes the time required to clone the repository, create a Conda environment, and install the necessary dependencies listed in requirements.txt.

For Evaluation

Please refer to the setup guidance in the benchmark/ folder for evaluation-specific environment configuration.

For Training

Follow the installation instructions from the official InternVL repository:

Step 3: Prepare Data

Please download our training data and benchmark data here: Data

Step 4: Start Training

cd InternVL
# For LoRA training
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-lora.sh

# For full model training
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-fullmodel.sh

⏱️ Typical Training time: It takes around 30 hours for one epoch, full parameter training (InternVL-3 8B) using one H200 150G GPU.

Step 5: Run Evaluation

Please check readme for detailed implementation instructions.

Normally, it takes around 1 hour to finish evaluations (The baseline models we selected are 7B or 8B) on 6 sub-tasks of our PMC-MI-Bench dataset using A100 80G GPU.

πŸ“‚ Repository Structure

M3LLM/
β”œβ”€β”€ Instruction_data_generation/     # Synthetic data generation pipeline
β”‚   β”œβ”€β”€ 1_inline_text_summarization.py
β”‚   β”œβ”€β”€ 2_medical_knowledge_complementation.py
β”‚   β”œβ”€β”€ 3_visual_perception_enhancement.py
β”‚   β”œβ”€β”€ 4_*.py                       # Stage 4: Task-specific QA generation
β”‚   └── 5_*.py                       # Stage 5: Context refinement
β”‚
β”œβ”€β”€ InternVL/                        # Training codebase
β”‚   β”œβ”€β”€ internvl_chat/
β”‚   β”‚   β”œβ”€β”€ shell/
β”‚   β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”‚   β”‚   └── PMC-data.json   # Dataset configuration
β”‚   β”‚   β”‚   └── internvl3.0/
β”‚   β”‚   β”‚       └── 2nd_finetune/   # Training scripts
β”‚   β”‚   β”œβ”€β”€ internvl/
β”‚   β”‚   β”‚   β”œβ”€β”€ model/              # Model implementations
β”‚   β”‚   β”‚   └── train/              # Training utilities
β”‚   β”‚   └── eval/                   # Evaluation scripts
β”‚   └── README.md                   # Detailed training documentation
β”‚
β”œβ”€β”€ benchmark/                       # Evaluation benchmarks
β”‚   └── MIMIC-unified-inference/    # MIMIC evaluation framework
β”‚
└── README.md                        # This file

🎯 Model Checkpoints

We release the following model checkpoints:

ModelTraining MethodDownload Link
M3LLM-LoRALoRA (rank 16)[Coming Soon]
M3LLM-FullFull Finetuning[Coming Soon]

Loading the Model

from transformers import AutoModel, AutoTokenizer

# Load model
model = AutoModel.from_pretrained("path/to/m3llm-checkpoint")
tokenizer = AutoTokenizer.from_pretrained("path/to/m3llm-checkpoint")

# Example inference
# [Add inference example]

🀝 Contributing

We welcome contributions! Please feel free to:

  • πŸ› Report bugs
  • πŸ’‘ Suggest new features
  • πŸ“ Improve documentation
  • πŸ”§ Submit pull requests

πŸ“„ License

This project is released under the MIT License.

The InternVL codebase is subject to its original license terms. Please refer to the InternVL repository for details.


πŸ“– Citation

If you find M3LLM useful for your research, please cite:

@article{chen2025compound,
  title={From Compound Figures to Composite Understanding: Developing a Multi-Modal LLM from Biomedical Literature with Medical Multiple-Image Benchmarking and Validation},
  author={Chen, Zhen and Fu, Yihang and Madera, Gabriel and Giuffre, Mauro and Applebaum, Serina and Kim, Hyunjae and Xu, Hua and Chen, Qingyu},
  journal={arXiv preprint arXiv:2511.22232},
  year={2025}
}

Please also cite the base model:

@article{internvl3,
  title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
  author={Chen, Zhe and others},
  journal={arXiv preprint},
  year={2024}
}

If you are using MIMIC-cxr dataset, please cite:

@inproceedings{mimic_xray,
  title={Learning to exploit temporal structure for biomedical vision-language processing},
  author={Bannur, Shruthi and Hyland, Stephanie and Liu, Qianchu and Perez-Garcia, Fernando and Ilse, Maximilian and Castro, Daniel C and Boecking, Benedikt and Sharma, Harshita and Bouzid, Kenza and Thieme, Anja and others},
  booktitle={CVPR},
  pages={15016--15027},
  year={2023}
}

Contributors

KerwinFuyihang

16 commits

franciszchen

2 commits

franciszchen/M3LLM

2

stars

18

commits

Python

primary language

Dec 27, 2025

updated

README

M3LLM: Medical Multimodal Large Language Model

M3LLM is a specialized medical vision-language model built on InternVL3-8B, finetuned on comprehensive PMC medical imaging datasets to achieve state-of-the-art performance on multi-image medical visual question answering tasks.

Overall performance

πŸ“Š Evaluation Results

PMC-MI-Benchmark

Our model demonstrates strong performance on the PMC-MI-Benchmark, a comprehensive evaluation suite for multi-image medical visual question answering:

PMC-MI-Benchmark Results PMC-MI-Benchmark Results

Public Benchmarks

M3LLM achieves competitive performance across various public medical VQA benchmarks (MMMU-Med and OmnimedVQA):

Public Benchmark Results

MIMIC Evaluation

Performance evaluation on MIMIC-CXR :

MIMIC Results


πŸ”„ Training Data Synthesis Pipeline

M3LLM's training data is generated through a comprehensive 5-stage synthetic data pipeline that processes medical images and captions from PubMed Central (PMC) literature.

Pipeline Overview

Raw PMC Data β†’ Stage 1-3: Preprocessing β†’ Stage 4: Task-Specific QA β†’ Stage 5: Context Refinement β†’ Training Data

Data Statistics

Task CategorySamplesDescription
Pure Text QA40,382Text-only medical QA
Bounding Box VQA40,293Spatial relationship questions
Single Sub-image40,287Single sub-image reasoning
Multiple Sub-images39,462Multi-image reasoning
Sub-image Options40,295Multiple-choice questions
Compound Images37,029Compound figure understanding
Total~238KSix diverse task types

Pipeline Stages

Stage 1-3: Data Preprocessing

  • 1_inline_text_summarization.py: Summarizes medical observations from inline text
  • 2_medical_knowledge_complementation.py: Extracts keywords and generates medical knowledge
  • 3_visual_perception_enhancement.py: Creates visual perception descriptions using multimodal models

Stage 4: Task-Specific QA Generation

  • Six specialized scripts for different medical VQA task types
  • Generates questions, contexts, and answers based on medical images and captions
  • Supports pure text, spatial reasoning, single/multi-image, and multiple-choice tasks

Stage 5: Context Refinement

  • Improves question contexts to prevent data leakage
  • Removes answer-revealing information while maintaining clinical reasoning requirements
  • Ensures high-quality instruction-following data

πŸ“ Detailed pipeline documentation: See Instruction_data_generation/ for implementation details and usage instructions.


πŸš€ Training

M3LLM provides two training approaches to accommodate different computational resources:

Quick Start

# Navigate to training directory
cd InternVL

# LoRA training (recommended for limited resources)
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-lora.sh

# Full model training (better performance)
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-fullmodel.sh

πŸ“ Detailed training documentation: See InternVL/ for configuration details, hyperparameters, and troubleshooting.


πŸ“¦ Installation

Step 1: Clone the Repository

git clone https://github.com/franciszchen/M3LLM.git
cd M3LLM

Step 2: Set Up Environment

We should have two conda environments.

⏱️ Typical install time: The installation process typically takes between 5 to 15 minutes on a "normal" desktop computer with a standard broadband internet connection. This includes the time required to clone the repository, create a Conda environment, and install the necessary dependencies listed in requirements.txt.

For Evaluation

Please refer to the setup guidance in the benchmark/ folder for evaluation-specific environment configuration.

For Training

Follow the installation instructions from the official InternVL repository:

Step 3: Prepare Data

Please download our training data and benchmark data here: Data

Step 4: Start Training

cd InternVL
# For LoRA training
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-lora.sh

# For full model training
bash internvl_chat/shell/internvl3.0/2nd_finetune/M3LLM-fulldata-fullmodel.sh

⏱️ Typical Training time: It takes around 30 hours for one epoch, full parameter training (InternVL-3 8B) using one H200 150G GPU.

Step 5: Run Evaluation

Please check readme for detailed implementation instructions.

Normally, it takes around 1 hour to finish evaluations (The baseline models we selected are 7B or 8B) on 6 sub-tasks of our PMC-MI-Bench dataset using A100 80G GPU.

πŸ“‚ Repository Structure

M3LLM/
β”œβ”€β”€ Instruction_data_generation/     # Synthetic data generation pipeline
β”‚   β”œβ”€β”€ 1_inline_text_summarization.py
β”‚   β”œβ”€β”€ 2_medical_knowledge_complementation.py
β”‚   β”œβ”€β”€ 3_visual_perception_enhancement.py
β”‚   β”œβ”€β”€ 4_*.py                       # Stage 4: Task-specific QA generation
β”‚   └── 5_*.py                       # Stage 5: Context refinement
β”‚
β”œβ”€β”€ InternVL/                        # Training codebase
β”‚   β”œβ”€β”€ internvl_chat/
β”‚   β”‚   β”œβ”€β”€ shell/
β”‚   β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”‚   β”‚   └── PMC-data.json   # Dataset configuration
β”‚   β”‚   β”‚   └── internvl3.0/
β”‚   β”‚   β”‚       └── 2nd_finetune/   # Training scripts
β”‚   β”‚   β”œβ”€β”€ internvl/
β”‚   β”‚   β”‚   β”œβ”€β”€ model/              # Model implementations
β”‚   β”‚   β”‚   └── train/              # Training utilities
β”‚   β”‚   └── eval/                   # Evaluation scripts
β”‚   └── README.md                   # Detailed training documentation
β”‚
β”œβ”€β”€ benchmark/                       # Evaluation benchmarks
β”‚   └── MIMIC-unified-inference/    # MIMIC evaluation framework
β”‚
└── README.md                        # This file

🎯 Model Checkpoints

We release the following model checkpoints:

ModelTraining MethodDownload Link
M3LLM-LoRALoRA (rank 16)[Coming Soon]
M3LLM-FullFull Finetuning[Coming Soon]

Loading the Model

from transformers import AutoModel, AutoTokenizer

# Load model
model = AutoModel.from_pretrained("path/to/m3llm-checkpoint")
tokenizer = AutoTokenizer.from_pretrained("path/to/m3llm-checkpoint")

# Example inference
# [Add inference example]

🀝 Contributing

We welcome contributions! Please feel free to:

  • πŸ› Report bugs
  • πŸ’‘ Suggest new features
  • πŸ“ Improve documentation
  • πŸ”§ Submit pull requests

πŸ“„ License

This project is released under the MIT License.

The InternVL codebase is subject to its original license terms. Please refer to the InternVL repository for details.


πŸ“– Citation

If you find M3LLM useful for your research, please cite:

@article{chen2025compound,
  title={From Compound Figures to Composite Understanding: Developing a Multi-Modal LLM from Biomedical Literature with Medical Multiple-Image Benchmarking and Validation},
  author={Chen, Zhen and Fu, Yihang and Madera, Gabriel and Giuffre, Mauro and Applebaum, Serina and Kim, Hyunjae and Xu, Hua and Chen, Qingyu},
  journal={arXiv preprint arXiv:2511.22232},
  year={2025}
}

Please also cite the base model:

@article{internvl3,
  title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
  author={Chen, Zhe and others},
  journal={arXiv preprint},
  year={2024}
}

If you are using MIMIC-cxr dataset, please cite:

@inproceedings{mimic_xray,
  title={Learning to exploit temporal structure for biomedical vision-language processing},
  author={Bannur, Shruthi and Hyland, Stephanie and Liu, Qianchu and Perez-Garcia, Fernando and Ilse, Maximilian and Castro, Daniel C and Boecking, Benedikt and Sharma, Harshita and Bouzid, Kenza and Thieme, Anja and others},
  booktitle={CVPR},
  pages={15016--15027},
  year={2023}
}

Contributors

KerwinFuyihang

16 commits

franciszchen

2 commits

Languages

Python

59.4%

Jupyter Notebook

34.2%

Shell

5.8%