```
Run the above line of code at node rank-0, rank-1, rank-2, and rank3 to start a 4-node finetuning process.
**Important!**: Make sure to have the proper paths defined in `sft.py` and `finetune_sft.sh`.
### Finetuning Hyperparameters
| | |
| --- | ------ |
| bf16 | true |
| lr | 2e-5 |
| eps | 1e-5 |
| betas | \[0.9, 0.95\] |
| clip_grad | 1 |
| weight decay | 0.1 |
| DP size | 16 |
| TP size | 4 |
| PP size | 1 |
| seq length | 2048 or 4096 |
| lr scheduler | cosine|
| min lr | 2e-6 |
| warmup ratio | 0.1 |
| added tokens | [<\|im_start\|>, <\|im_end\|>] |
| | |
## Uses
Meditron-70B is being made available for further testing and assessment as an AI assistant to enhance clinical decision-making and democratize access to an LLM for healthcare use. Potential use cases may include but are not limited to:
- Medical exam question answering
- Supporting differential diagnosis
- Disease information (symptoms, cause, treatment) query
- General health information query
It is possible to use this model to generate text, which is useful for experimentation and understanding its capabilities. It should not be used directly for production or work that may impact people.
We do not recommend using this model for natural language generation in a production environment, finetuned or otherwise.
### Downstream Use
Meditron-70B and Meditron-7B are both foundation models without finetuning or instruction-tuning. They can be finetuned, instruction-tuned, or RLHF-tuned for specific downstream tasks and applications.
There are two ways we have used this model for downstream question-answering tasks.
1. We apply in-context learning with k demonstrations (3 or 5 in our paper) added to the prompt.
2. We finetuned the models for downstream question-answering tasks using specific training sets.
We encourage and look forward to the adaption of the base model for more diverse applications.
If you want a more interactive way to prompt the model, we recommend using a high-throughput and memory-efficient inference engine with a UI that supports chat and text generation.
You can check out our deployment guide below, where we used [FastChat](https://github.com/lm-sys/FastChat) with [vLLM](https://github.com/vllm-project/vllm). We collected generations for our qualitative analysis through an interactive UI platform, [BetterChatGPT](https://github.com/ztjhz/BetterChatGPT). Here is the prompt format we used as an example:
## Medical Benchmark Inference & Evaluation
### Requirements
Before you start, please install the necessary packages:
vllm >= 0.2.1
transformers >= 4.34.0
datasets >= 2.14.6
torch >= 2.0.1
For detailed instructions to run inference and evaluation with medical benchmarks, please read the documentation here [inference & evaluation instructions](./evaluation/README.md).
## Model Deployment
For detailed instructions to deploy meditron models and have an interactive chat session, please read the documentation here [Model Deployment](./deployment/README.md)
## Citation
If you use this software or our paper, please cite them:
@misc{chen2023meditron70b,
title={MEDITRON-70B: Scaling Medical Pretraining for Large Language Models},
author={Zeming Chen and Alejandro Hernández-Cano and Angelika Romanou and Antoine Bonnet and Kyle Matoba and Francesco Salvi and Matteo Pagliardini and Simin Fan and Andreas Köpf and Amirkeivan Mohtashami and Alexandre Sallinen and Alireza Sakhaeirad and Vinitra Swamy and Igor Krawczuk and Deniz Bayazit and Axel Marmet and Syrielle Montariol and Mary-Anne Hartley and Martin Jaggi and Antoine Bosselut},
year={2023},
eprint={2311.16079},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@software{epfmedtrn,
author = {Zeming Chen and Alejandro Hernández-Cano and Angelika Romanou and Antoine Bonnet and Kyle Matoba and Francesco Salvi and Matteo Pagliardini and Simin Fan and Andreas Köpf and Amirkeivan Mohtashami and Alexandre Sallinen and Alireza Sakhaeirad and Vinitra Swamy and Igor Krawczuk and Deniz Bayazit and Axel Marmet and Syrielle Montariol and Mary-Anne Hartley and Martin Jaggi and Antoine Bosselut},
title = {MediTron-70B: Scaling Medical Pretraining for Large Language Models},
month = November,
year = 2023,
url = {https://github.com/epfLLM/meditron}
}