Spaces:
Restarting
on
CPU Upgrade
Restarting
on
CPU Upgrade
from src.display.utils import ModelType | |
TITLE = """<h1 align="center" id="space-title"> 𧬠Open Medical LLM Leaderboard π©Ί</h1>""" | |
INTRODUCTION_TEXT = """ | |
π©Ί The Open Medical LLM Leaderboard aims to track, rank and evaluate the performance of large language models (LLMs) on medical question answering tasks. It evaluates LLMs across a diverse array of medical datasets, including MedQA (USMLE), PubMedQA, MedMCQA, and subsets of MMLU related to medicine and biology. The leaderboard offers a comprehensive assessment of each model's medical knowledge and question answering capabilities. | |
The datasets cover various aspects of medicine such as general medical knowledge, clinical knowledge, anatomy, genetics, and more. They contain multiple-choice and open-ended questions that require medical reasoning and understanding. More details on the datasets can be found in the "LLM Benchmarks Details" section below. | |
The main evaluation metric used is Accuracy (ACC). Submit a model for automated evaluation on the "Submit" page. If you have comments or suggestions on additional medical datasets to include, please reach out to us in our discussion forum. | |
The backend of the Open Medical LLM Leaderboard uses the Eleuther AI Language Model Evaluation Harness. More technical details can be found in the "About" page. | |
""" | |
LLM_BENCHMARKS_TEXT = f""" | |
Context | |
Evaluating the medical knowledge and clinical reasoning capabilities of LLMs is crucial as they are increasingly being applied to healthcare and biomedical applications. The Open Medical LLM Leaderboard provides a platform to assess the latest LLMs on their performance on a variety of medical question answering tasks. This can help identify the strengths and gaps in medical understanding of current models. | |
How it works | |
π We evaluate the models on 9 medical Q&A datasets using the <a href="https://github.com/EleutherAI/lm-evaluation-harness" target="_blank"> Eleuther AI Language Model Evaluation Harness </a>, a unified framework to test language models on different tasks. | |
""" | |
LLM_BENCHMARKS_DETAILS = f""" | |
Datasets | |
<a href="https://arxiv.org/abs/2009.13081" target="_blank">MedQA (USMLE)</a> - 1273 real-world questions from the US Medical License Exams (USMLE) to test general medical knowledge | |
<a href="https://arxiv.org/abs/1909.06146" target="_blank">PubMedQA</a> - 500 questions constructed from PubMed article titles along with the abstracts as context to test understanding of biomedical research | |
<a href="https://proceedings.mlr.press/v174/pal22a.html" target="_blank">MedMCQA</a> - 4183 questions from Indian medical entrance exams (AIIMS & NEET PG) spanning 2.4k healthcare topics | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-Clinical knowledge</a> - 265 multiple choice questions on clinical knowledge | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-Medical genetics</a> - 100 MCQs on medical genetics | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-Anatomy</a> - 135 anatomy MCQs | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-Professional medicine</a> - 272 MCQs on professional medicine | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-College biology</a> - 144 MCQs on college-level biology | |
<a href="https://arxiv.org/abs/2009.03300" target="_blank">MMLU-College medicine</a> - 173 college medicine MCQs | |
Metric | |
Accuracy (ACC) is used as the main evaluation metric across all datasets | |
Details and logs | |
Detailed results are available in the results directory: https://huggingface.co/spaces/openlifescienceai/open_medical_llm_leaderboard/tree/main/results | |
Input/outputs for each model can be found in the details page accessible by clicking the π emoji next to the model name | |
Reproducibility | |
To reproduce the results, you can run this evaluation script: python eval_medical_llm.py. | |
To evaluate a specific dataset on a model, use the EleutherAI LLM Evaluation Harness: | |
python main.py --model=hf-auto --model_args="pretrained=<model>,revision=<revision>,parallelize=True" | |
--tasks=<dataset> --num_fewshot=<n_shots> --batch_size=1 --output_path=<output_dir> | |
Note some datasets may require additional setup, refer to the Evaluation Harness documentation. Adjust batch size based on your GPU memory if not using parallelism. Minor variations in results are expected with different batch sizes due to padding. | |
Icons | |
{ModelType.PT.to_str(" : ")} Pre-trained model | |
{ModelType.FT.to_str(" : ")} Fine-tuned model | |
{ModelType.Unknown.to_str(" : ")} Unknown model type | |
Missing icons indicate the model info is not yet added, feel free to open an issue to include it! | |
""" | |
FAQ_TEXT = """ | |
FAQ | |
1) Submitting a model | |
XXX | |
2) Model results | |
XXX | |
3) Editing a submission | |
XXX | |
""" | |
EVALUATION_QUEUE_TEXT = """ | |
Evaluation Queue for the Open Medical LLM Leaderboard | |
Models added here will be automatically evaluated. | |
Before submitting a model | |
1) Verify loading with AutoClasses: | |
python | |
Copy code | |
from transformers import AutoConfig, AutoModel, AutoTokenizer | |
config = AutoConfig.from_pretrained("model-name", revision=revision) | |
model = AutoModel.from_pretrained("model-name", revision=revision) | |
tokenizer = AutoTokenizer.from_pretrained("model-name", revision=revision) | |
Debug any loading errors before submission. Make sure the model is public. | |
Note: Models that require use_remote_code=True are not yet supported. | |
2) Convert weights to safetensors | |
This allows faster loading and enables showing model parameters in the Extended Viewer. | |
3) Select correct precision | |
Incorrect precision (e.g. loading bf16 as fp16) can cause NaN errors for some models. | |
Debugging failing models | |
For models in FAILED status, first ensure the above checks are done. | |
Then test running the Eleuther AI Harness locally using the command in the "Reproducibility" section, specifying all arguments. Add --limit to evaluate on fewer examples per task. | |
""" | |
CITATION_BUTTON_LABEL = "Copy the citation snippet" | |
CITATION_BUTTON_TEXT = r""" | |
@misc{openlifescienceai/open_medical_llm_leaderboard, | |
author = {Ankit Pal and Andreas Geert Motzfeldt and Pasquale Minervini}, | |
title = {openlifescienceai/open_medical_llm_leaderboard}, | |
year = {2024}, | |
publisher = {Hugging Face}, | |
howpublished = "\url{https://huggingface.co/spaces/openlifescienceai/open_medical_llm_leaderboard}" | |
} | |
""" |