Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2024 Sep 1;31(9):1833-1843.
doi: 10.1093/jamia/ocae045.

PMC-LLaMA: toward building open-source language models for medicine

Affiliations

PMC-LLaMA: toward building open-source language models for medicine

Chaoyi Wu et al. J Am Med Inform Assoc. .

Abstract

Objective: Recently, large language models (LLMs) have showcased remarkable capabilities in natural language understanding. While demonstrating proficiency in everyday conversations and question-answering (QA) situations, these models frequently struggle in domains that require precision, such as medical applications, due to their lack of domain-specific knowledge. In this article, we describe the procedure for building a powerful, open-source language model specifically designed for medicine applications, termed as PMC-LLaMA.

Materials and methods: We adapt a general-purpose LLM toward the medical domain, involving data-centric knowledge injection through the integration of 4.8M biomedical academic papers and 30K medical textbooks, as well as comprehensive domain-specific instruction fine-tuning, encompassing medical QA, rationale for reasoning, and conversational dialogues with 202M tokens.

Results: While evaluating various public medical QA benchmarks and manual rating, our lightweight PMC-LLaMA, which consists of only 13B parameters, exhibits superior performance, even surpassing ChatGPT. All models, codes, and datasets for instruction tuning will be released to the research community.

Discussion: Our contributions are 3-fold: (1) we build up an open-source LLM toward the medical domain. We believe the proposed PMC-LLaMA model can promote further development of foundation models in medicine, serving as a medical trainable basic generative language backbone; (2) we conduct thorough ablation studies to demonstrate the effectiveness of each proposed component, demonstrating how different training data and model scales affect medical LLMs; (3) we contribute a large-scale, comprehensive dataset for instruction tuning.

Conclusion: In this article, we systematically investigate the process of building up an open-source medical-specific LLM, PMC-LLaMA.

Keywords: ChatGPT; biomedical NLP; generative language models; large language models.

PubMed Disclaimer

Conflict of interest statement

None declared.

Figures

Figure 1.
Figure 1.
In the left, we show the general comparison between our PMC-LLaMA with LLaMA-2 and GPT-3.5. On the right, we visually show the advantages of our model in model sizes. PMC-LLaMA is much smaller than the others.
Figure 2.
Figure 2.
Distribution of medical textbooks categories. The box sizes denote the book numbers for different categories.
Figure 3.
Figure 3.
The training pipeline of PMC-LLaMA. Our training flow can be separated into 2 parts, that is, data-centric knowledge injection and medical-specific instruction tuning. In knowledge injection, we collect 4.8M biomedical academic papers and 30K medical books for further injecting knowledge into LLaMA. In the instruction tuning stage, we mainly consider 3 aspects, medical conversation, medical rationale question answering, and knowledge graph, containing 202M tokens in total.
Figure 4.
Figure 4.
Examples of 3 instruction prompting cases from PMC-LLaMA and GPT-3.5. (A) Compares their responses to the patient’s query, where PMC-LLaMA proposes more concrete suggestions. (B) Shows the probing of microbiology knowledge. PMC-LLaMA analyzes both correct and incorrect options, enhancing the comprehensiveness of the analysis. Example (C) examines the models’ grasp of Pharmacology, and they respond with roughly equivalent answers. The correct options are marked bold.

Similar articles

Cited by

References

    1. OpenAI. OpenAI. Introducing ChatGPT. OpenAI; 2023. Accessed April 2, 2024. https://openai.com/blog/chatgpt/
    1. OpenAI. GPT-4 technical report. arXiv:2303.08774. 2023, preprint: not peer reviewed.
    1. Nori H, King N, et al. Capabilities of GPT-4 on medical challenge problems. arXiv 230313375. 2023, preprint: not peer reviewed.
    1. Singhal K, Azizi S, Tu TAO, et al. Large language models encode clinical knowledge. Nature. 2023;620(7972):172-180. - PMC - PubMed
    1. Touvron H, Lavril T, Izacard G, Martinet , et al. LLaMA: open and efficient foundation language models. arXiv 230213971. 2023, preprint: not peer reviewed.

MeSH terms