--- license: apache-2.0 language: - en tag: text-generation tags: - medical datasets: - Open-Orca/OpenOrca - pubmed - medmcqa - maximegmd/medqa_alpaca_format base_model: internistai/base-7b-v0.2 metrics: - accuracy pipeline_tag: text-generation ---
The model was designed by medical doctors for medical doctors and did not undergo specific training to address potential security issues when used by non medical professionals. We highly recommend against the use of this model in a live environment without extensive evaluation through prospective clinical trials and additional training to meet the required safety levels.
## Training Details
### Training Data
Internist.ai 7b contains a total of 2.3B tokens:
- [**General Domain**](https://huggingface.co/datasets/Open-Orca/OpenOrca): OpenOrca-GPT4 is a state-of-the-art general domain dataset generated from Flan prompts using GPT-4.
- **Medical Guidelines**: 11,332 articles from UpToDate were included as well as domain specific guidelines provided by physicians to cover the [USMLE Content Outline](https://www.usmle.org/sites/default/files/2021-08/USMLE_Content_Outline.pdf).
- **Medical Books**: 10,376 textbooks were sourced from PMC LitArch and our university library.
- **Synthetic Data**: We generated 400M tokens by prompting a larger model with instructions to transform and adapt extracts from the Medical Guidelines.
*Data Availability*: Considering the datasets contain proprietary information, we will not be releasing the datasets publicly. Regarding the synthetic dataset, as we show in the paper, the model trained exclusively on this dataset performs very poorly and was not up to our standards. Due to its poor quality we decided not to release it.
### Training Procedure
We used Axolotl to train on a server with 4 NVIDIA A100 80GB GPUs for a total of 450 GPU hours. We used FlashAttention, NEFTune and sample packing with the parameters described below.
#### Training Hyperparameters
| | |
| --- | ------ |
| bf16 | true |
| lr | 6e-6 |
| eps | 1e-5 |
| epochs | 4 |
| betas | \[0.9, 0.95\] |
| weight decay | 0.1 |
| Batch size | 192,000 tokens |
| seq length | 4096 |
| lr scheduler | cosine|
| min lr | 1e-8 |
| NEFT alpha | 5 |
| warmup iteration | 100 |
| | |
## Evaluation
### Testing Data & Metrics
#### Testing Data
- [MedQA (USMLE) - 4 options](https://huggingface.co/datasets/bigbio/med_qa)
- [MedMCQA](https://huggingface.co/datasets/medmcqa)
- [PubMedQA](https://huggingface.co/datasets/bigbio/pubmed_qa)
- [MMLU](https://huggingface.co/datasets/hails/mmlu_no_train)
#### Metrics
- Accuracy: we ran standardized 0-shot benchmarks using [lm-evaluation-harness](https://github.com/maximegmd/lm-evaluation-harness/tree/big-refactor/lm_eval).
### Results
We include benchmarks on MedQA (4 options), MedMCQA and PubMedQA of our model and models of similar size and achieve the first USMLE passing score of 60% on the MedQA benchmark.
| | Internist.ai 7b | PMC LLaMA 7b* | Mistral 7b | Meditron 7b** |
| ----------- | ------------- | ------------ | ---------- | ----------- |
| MedQA | **60.5** | 27.7 (44.7) | 48.7 | 52.0 |
| MedMCQA | 55.8 | 32.2 (51.4) | 45.7 | **59.2** |
| PubMedQA | **79.4** | 67.8 (74.6) | 75.8 | 74.4 |
| MMLU Professional Medicine | **76.1** | 19.5 | 65.8 | 26.6 |
| MMLU Clinical Knowledge | **70.6** | 23.8 | 61.1 | 35.5 |
| MMLU Anatomy | **65.9** | 18.5 | 52.6 | 42.6 |
| MMLU College Medicine | **63.0** | 23.7 | 55.5 | 28.9 |
| MMLU Medical Genetics | **71.0** | 32.0 | 68.0 | 46.0 |
\*: PMC LLaMA 7b performed poorly on the benchmark, likely due to a mismatch of formating and a lack of instruction tuning, we include in parenthesis the results reported by the authors when available.
\*\*: Meditron 7b's results in MMLU are reported for transparency but are inconsistent with the average of 54.2 reported in their paper, do not hesitate to communicate the details on each category so we can update the table.
## Citation
**BibTeX:**
If you use Internist.ai 7b, please cite us:
```
@article{10.1093/jamia/ocae120,
author = {Griot, Maxime and Hemptinne, Coralie and Vanderdonckt, Jean and Yuksel, Demet},
title = "{Impact of high-quality, mixed-domain data on the performance of medical language models}",
journal = {Journal of the American Medical Informatics Association},
pages = {ocae120},
year = {2024},
month = {05},
abstract = "{To optimize the training strategy of large language models for medical applications, focusing on creating clinically relevant systems that efficiently integrate into healthcare settings, while ensuring high standards of accuracy and reliability.We curated a comprehensive collection of high-quality, domain-specific data and used it to train several models, each with different subsets of this data. These models were rigorously evaluated against standard medical benchmarks, such as the USMLE, to measure their performance. Furthermore, for a thorough effectiveness assessment, they were compared with other state-of-the-art medical models of comparable size.The models trained with a mix of high-quality, domain-specific, and general data showed superior performance over those trained on larger, less clinically relevant datasets (P \\< .001). Our 7-billion-parameter model Med5 scores 60.5\\% on MedQA, outperforming the previous best of 49.3\\% from comparable models, and becomes the first of its size to achieve a passing score on the USMLE. Additionally, this model retained its proficiency in general domain tasks, comparable to state-of-the-art general domain models of similar size.Our findings underscore the importance of integrating high-quality, domain-specific data in training large language models for medical purposes. The balanced approach between specialized and general data significantly enhances the model’s clinical relevance and performance.This study sets a new standard in medical language models, proving that a strategically trained, smaller model can outperform larger ones in clinical relevance and general proficiency, highlighting the importance of data quality and expert curation in generative artificial intelligence for healthcare applications.}",
issn = {1527-974X},
doi = {10.1093/jamia/ocae120},
url = {https://doi.org/10.1093/jamia/ocae120},
eprint = {https://academic.oup.com/jamia/advance-article-pdf/doi/10.1093/jamia/ocae120/57845903/ocae120.pdf},
}
```