CoolFace
Modelpublic

elbonaparte/asclepius_v1

sourceHugging Faceotherupdated 3y agoView on Hugging Face
0likes18downloads
Model Card

Asclepius

Version: Initial (v1)

Overview

Asclepius is a state-of-the-art Language Model developed with a special focus on healthcare queries. It is as LLama-2-70b based model fine-tuned on a broad range of publicly available healthcare data. It can render timely and consistent answers to health-related queries with good accuracy.

Setup Guide & Usage

The model is available on this huggingface repository. It supports up to 4-bit quantization with sustained performance. To use the model you can use the usual HuggingFace Transformers API, like this:

python
from transformers import AutoTokenizer
import transformers
import torch

model = "elbonaparte/asclepius_v1"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)

sequences = pipeline(
    'Question: What is the most common cause of chest pain in men < 50? Answer:\n',
    do_sample=True,
    top_k=10,
    num_return_sequences=1,
    eos_token_id=tokenizer.eos_token_id,
    max_length=200,
)
for seq in sequences:
    print(f"Result: {seq['generated_text']}")

The output would be:

The most common causes of chest pain in men < 50 are:
1. Gastroesophageal reflux disease (GERD): This occurs when stomach acid flows back into the esophagus, causing a burning sensation in the chest (heartburn).

2. Musculoskeletal issues: Strained muscles or inflammation in the chest wall can cause chest pain, especially during physical activity or after an injury.

3. Anxiety and stress-related chest pain: Anxiety or panic attacks can cause chest tightness and discomfort, mimicking heart-related pain.

4. Costochondritis: Inflammation of the cartilage that connects the ribs to the breastbone can cause sharp chest pain, often aggravated by physical activity or deep breathing.

Although this is plain, non-structured text, several prompt strategies can be used to obtain structured text as lists or JSON format from the LLM.

In the asclepius_api_helpers.py we provide several prompt-optimized functions for returning structured responses for the most common use cases: medications list, most/least common findings, diagnostic hypothesis, etc.

These functions can be used to create a server tasked with querying the model (API gateway) or integrated within the application (example provided on https://asclepiusv1.streamlit.app/).

Inference server

Alternatively, a RunPod image template is available pre-configured for text-generation-inference allowing you to get the model up and running in a few clicks following these steps:

  1. 1.Choose an instance to deploy. This model needs a GPU with at least 48gb of VRAM. [image]
  1. 1.Choose the provided "Asclepius Template" image template from the dropdown list. It should be the first. Runpod will provision the VM and setup is done automatically. It takes around 15 to 20 minutes to download the model. [image]
  1. 1.The model server will be available 15 to 20 minutes after that. The URL will look like this: [POD ID]-80.proxy.runpod.net. The POD ID is the string of text under the Pod Name in the top left. [image]
  1. 1.A easy-to-use UI for interacting with Asclepius is available over https://asclepiusv1.streamlit.app. Change the Pod ID to the runnning POD ID and it will return the answers from that model. [image]

The UI code is also accessible in this repository. It can be utilized with the installation of streamlit.io and by running this command in the terminal inside the repo folder: streamlit run app.py.

The example app and use cases interact optimally with the model using input prompts engineered within the functions found in the asclepius_api_helpers.py file.

Training Data

An extensive exploration of publicly available healthcare information datasets was conducted and these were considered as potential inputs:

Dataset NameURLDescriptionAvailabilityTypeData QualityData Preparation Effort
icliniq-10kicliniq/medical_dialogconversation between patient and doctorsEasily accessibleReal world data76
HealthCareMagic-100kHMC/patientdoctorconvoconversation between patient and doctorsEasily AccessibleReal world data76
Medical Dialoghf/medical_dialogconversation between patient and doctorsEasily accessibleReal world data85
Medical Notes 40rungalileo/medicaltranscription4Hospitalist Notes (PreOp, procedure, discharge summaries, etc)Easily accessibleReal World Data95
(MIMIC) Indiana University Medical ReportsIndianaUniversityMedicalreportsoriginalRadiologic Reports and Clinical notesEasily accessibleReal World Data95
Medical Domainargilla/medical-domainClinical NotesEasily accessibleReal World Data85
Medical Keywordargilla/medical-keywordsClinical NotesEasily accessibleReal World Data85
Medical QAeswardivi/medical_qaQuestion answering to patient doubtsEasily accessibleReal World Data94
Medical Transcriptionstchebonenko/MedicalTranscriptionsClinical NotesEasily accessibleReal World Data76
Syntheasynthea.mitre.orgSynthetic health data generatorEasily accessible, graph-based logic necessarySynthetic Data810
MIMIC IV 2.0Real world medical textsAccessible after 14-modules online trainingReal World Data97
Medline Plusmedlineplus.govCurated Medical InformationNeeds web scrappingReferential Data109
CDCcdc.govCurated Medical InformationNeeds web scrappingReferential Data109
National Institutes of Healthnih.govCurated Medical InformationNeeds web scrappingReferential Data109
WHOwho.intCurated Medical InformationNeeds web scrappingReferential Data109
Mayo Clinicmayoclinic.orgCurated Medical InformationNeeds web scrappingReferential Data109
Merck Manualmerckmanuals.com/professionalCurated Medical InformationWeb scrapping unavailableReferential Data109
Open Medical Termsgamino/wikimedicaltermsExplanation of medical termsEasily accessibleReferential Data84
MedQAmedalpaca/medicalmeadowmedqaMedical question answering (USMLE)Easily accessibleReferential Data104
USMLE SAmedalpaca/medicalmeadowusmleselfassessmentUSMLE self-assesment questions and answersEasily accessibleReferential Data105
PubMed Health Advicemedalpaca/medicalmeadowhealth_adviceExtracted data from Pubmed articlesEasily accessibleReferential Data86
Wikidoc explanationsmedalpaca/medicalmeadowwikidocExplanation of medical conditions and proceduresEasily accesibleReferential Data106
Medical Flashcardmedalpaca/medicalmeadowmedical_flashcardsGeneral Healthcare questions and answersEasily accessibleReferential Data86
Pubmed Causalmedalpaca/medicalmeadowpubmed_causalCausality between health eventsEasily accessibleReferential Data97
Medical Questions DBfhirfly/medicalquestionsA dataset containing general health questions without answersEasily accessibleReferential Data89

Evaluation

The model evaluation is based on its consistency and accuracy in responding to healthcare inquiries.

- Custom QA dataset (20 questions)

(1-shot) | Model Name | Correct Answers (%) | Total Questions | | :-------------------- | :------------------- | :-------------- | | GPT-4 | 18 (90%) | 20 | | Asclepius | 16 (80%) | 20 | | Llama-2 | 15 (70%) | 20 | | Falcon-40b | 11 (55%) | 20 | | Others (GPT-J, T5, Graph-based) | < 8 | 20 |

- MMLU (Professional Medicine + Clinical Knowledge + College Medicine)

(5-shot) | Model Name | Score | | :-------------------- | :------------------- | | GPT-4 | 88% | | MedPalm-2 | 88% | | Asclepius | 67.2% | | GPT-3.5 | 67.2% | | Llama-2 | 66.8% |

- MedQA-USMLE (1200 USMLE-style questions)

(5-shot) | Model Name | Score | | :-------------------- | :------------------- | | GPT-4 | 86.1% | | MedPalm-2 | 79.7% | | Asclepius | 60.1% | | Llama-2 | 58.9% | | GPT-3.5 | 53.5% |

Limitations

Despite its impressive capabilities in answering medical questions, Asclepius occasionally errs particularly in the section of clinical cases. Consequently, output from the model should not be used without the supervision of a professional healthcare practitioner.

As a tool for physicians, it has immense potential in suggesting diagnoses and prescriptions, in addition to reviewing notes. Nevertheless, potential harm to patients due to erroneous output needs consideration and studies on outcomes should be undertaken before utilization.

This is in agreement with the FDA's recommendation on the usage of AI, ML and Software as a Medical Device (https://www.fda.gov/medical-devices/software-medical-device-samd/artificial-intelligence-and-machine-learning-software-medical-device)

License

Asclepius has been developed by Leonardo Canela Almeida, an independent contractor at Phire Health LLC. All rights are reserved by Phire Health LLC.