# shibing624/medicalgpt

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/shibing624-medicalgpt).**

4,774 stars · 689 forks · Python · apache-2.0

## Links

- GitHub: https://github.com/shibing624/MedicalGPT
- awesome-repositories: https://awesome-repositories.com/repository/shibing624-medicalgpt.md

## Topics

`chatgpt` `dpo` `gpt` `llama` `llm` `medical` `medicalgpt`

## Description

MedicalGPT is an open-source framework for fine-tuning large language models, with a dedicated focus on adapting general models to the medical domain. It provides a complete pipeline that covers continued pretraining on domain-specific corpora, supervised instruction tuning, tokenizer vocabulary extension with medical terminology, and alignment to clinician preferences through direct preference optimization, reinforcement learning, or knowledge distillation. The framework also supports training models to invoke external tools and functions in multi-turn clinical conversations.

The platform distinguishes itself by integrating multiple adaptation techniques into a single, configurable workflow. It handles multi-stage domain adaptation—chaining continued pretraining, supervised fine-tuning, preference alignment, and optional knowledge distillation—to inject specialized knowledge and then align model behavior. Beyond standard alignment methods, it offers adapter-based model merging, incremental pretraining with extended vocabularies, and a unified interface that supports over twenty open-source LLM families without requiring manual architecture adaptation.

In addition to core training capabilities, MedicalGPT includes utilities for dataset preparation, such as formatting multi-turn conversations, converting dataset formats, generating synthetic role-play dialogues, and compiling pretraining corpora. It provides inference tools like an interactive command-line chat session and a web-based demo interface for serving trained models.

## Tags

### Artificial Intelligence & ML

- [Direct Preference Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/custom-model-training/reward-modeling/preference-alignment/direct-preference-optimization.md) — Implements direct preference optimization to align model outputs with clinician preferences from paired data.
- [Instruction Fine-Tuning Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/instruction-fine-tuning-frameworks.md) — A framework for fine-tuning and aligning large language models using supervised instruction, preference optimization, and reinforcement learning.
- [Supervised Instruction Fine-Tuning](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/fine-tuning-and-alignment/supervised-instruction-fine-tuning.md) — Fine‑tunes a pre‑trained language model on labeled instruction‑following data to specialise its behaviour for specific tasks within the framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/training_params.md))
- [Function Calling Fine-Tuning](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/fine-tuning-and-customization/model-fine-tuning/function-calling-fine-tuning.md) — Provides a pipeline for fine-tuning language models to invoke external functions and tools in multi-turn conversations. ([source](https://github.com/shibing624/MedicalGPT/blob/main/README.md))
- [Multi-Stage Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/fine-tuning-and-customization/model-fine-tuning/quantized-fine-tuning/domain-adaptation/multi-stage-pipelines.md) — Chains continued pretraining, supervised fine-tuning, and preference optimization to adapt general language models to the medical domain.
- [Domain-Adaptive Continued Pretraining](https://awesome-repositories.com/f/artificial-intelligence-ml/model-pretraining-frameworks/domain-adaptive-continued-pretraining.md) — Runs additional unsupervised pretraining on domain‑specific text corpora to inject specialized knowledge into the base model before fine‑tuning in the framework ([source](https://github.com/shibing624/MedicalGPT/wiki/%E8%AE%AD%E7%BB%83%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E))
- [Domain-Specific Pretraining](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing/language-model-pretraining/domain-specific-pretraining.md) — Trains a language model from scratch on an unlabeled domain‑specific corpus to produce an adapted base model for subsequent fine‑tuning with the framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/training_params.md))
- [RLHF Training Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/rlhf-alignment-algorithms/rlhf-training-pipelines.md) — Fine‑tunes the language model using a reward model and proximal‑policy optimisation to improve alignment with human preferences within the framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/training_params.md))
- [Reward Modeling](https://awesome-repositories.com/f/artificial-intelligence-ml/custom-model-training/reward-modeling.md) — Trains a separate model to predict human preferences from comparison data, providing a reward signal for reinforcement‑learning alignment stages in the framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/training_params.md))
- [Incremental Vocabulary Adaptation](https://awesome-repositories.com/f/artificial-intelligence-ml/embedding-adaptation-utilities/vocabulary-embedding-adapters/incremental-vocabulary-adaptation.md) — Resumes language model training from a checkpoint after expanding the tokenizer and freezes embedding‑output layers to adapt to new vocabulary without catastrophic forgetting ([source](https://github.com/shibing624/MedicalGPT/wiki/%E6%89%A9%E5%85%85%E4%B8%AD%E6%96%87%E8%AF%8D%E8%A1%A8))
- [Medical](https://awesome-repositories.com/f/artificial-intelligence-ml/knowledge-distillation/medical.md) — Transfers knowledge from a stronger medical teacher model to a smaller student model for efficient deployment.
- [Conversational Tool-Calling Toolkits](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/fine-tuning-and-customization/model-fine-tuning/function-calling-fine-tuning/conversational-tool-calling-toolkits.md) — A toolkit for training language models to invoke external functions and tools during multi-turn conversations.
- [Teacher-Student Distillation](https://awesome-repositories.com/f/artificial-intelligence-ml/model-distillation-methods/teacher-student-distillation.md) — Supports transferring capabilities from a stronger teacher model to a student model via on-policy generation and divergence minimization.
- [Multi-Architecture LLM Support](https://awesome-repositories.com/f/artificial-intelligence-ml/multi-architecture-llm-support.md) — Unifies training and inference interfaces across over twenty open-source LLM families without manual architecture adaptation. ([source](https://github.com/shibing624/MedicalGPT/blob/main/README_EN.md))
- [Preference Alignment Datasets](https://awesome-repositories.com/f/artificial-intelligence-ml/preference-alignment-datasets.md) — Processes chosen-and-rejected response pairs to prepare preference data for reward model or DPO training. ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/datasets.md))
- [Medical](https://awesome-repositories.com/f/artificial-intelligence-ml/synthetic-data-generators/domain-specific-generators/medical.md) — Generates synthetic medical dialogues, preference pairs, and instruction data for domain-specific fine-tuning.
- [Tokenizer Vocabulary Merging](https://awesome-repositories.com/f/artificial-intelligence-ml/vocabulary-management/tokenizer-vocabulary-merging.md) — Retrains the tokenizer on medical text and merges with a specialist vocabulary to improve clinical term segmentation.
- [Domain-Specific Vocabulary Merging](https://awesome-repositories.com/f/artificial-intelligence-ml/vocabulary-management/tokenizer-vocabulary-merging/domain-specific-vocabulary-merging.md) — Retrains the tokenizer on a custom corpus and merges with a specialized vocabulary to improve character-level and domain-term segmentation for the model fine‑tuning framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/docs/extend_vocab.md))

### Part of an Awesome List

- [Vocabulary Extension Systems](https://awesome-repositories.com/f/awesome-lists/ai/domain-specific-adaptations/vocabulary-extension-systems.md) — A system for extending tokenizer vocabularies and training models on custom corpora to inject domain-specific knowledge.
- [Medical](https://awesome-repositories.com/f/awesome-lists/ai/model-alignment-and-feedback/medical.md) — Aligns medical language models to clinician preferences using reinforcement learning or direct optimization.
- [Tokenizer Customization](https://awesome-repositories.com/f/awesome-lists/ai/medical-domain-models/tokenizer-customization.md) — Extends tokenizer vocabulary with medical terms to improve segmentation and understanding of clinical text.
- [Tool-Calling Capabilities](https://awesome-repositories.com/f/awesome-lists/ai/medical-language-models/tool-calling-capabilities.md) — Enabling language models to invoke external medical tools and functions during multi-turn clinical conversations.
- [Adapter Merging](https://awesome-repositories.com/f/awesome-lists/ai/model-adaptation-and-merging/adapter-merging.md) — Ships utilities for combining trained LoRA adapter weights with the base model into a standalone checkpoint.
- [Proximal Policy Optimization Implementations](https://awesome-repositories.com/f/awesome-lists/ai/training-and-alignment/proximal-policy-optimization-alignment/proximal-policy-optimization-implementations.md) — Refines the language model policy using a learned reward model and the PPO algorithm to align outputs with human preferences within the fine‑tuning framework ([source](https://github.com/shibing624/MedicalGPT/wiki/%E8%AE%AD%E7%BB%83%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E))
- [Machine Learning and Analytics](https://awesome-repositories.com/f/awesome-lists/ai/machine-learning-and-analytics.md) — Pipeline for training custom medical language models.
- [Medical Domain Models](https://awesome-repositories.com/f/awesome-lists/ai/medical-domain-models.md) — Medical model supporting full training stages including DPO.

### Development Tools & Productivity

- [Multi-Architecture Training Frameworks](https://awesome-repositories.com/f/development-tools-productivity/open-source-tooling/multi-architecture-training-frameworks.md) — An open-source framework supporting multiple model architectures for supervised fine-tuning, alignment, and tool calling.
- [Interactive Model Inference Sessions](https://awesome-repositories.com/f/development-tools-productivity/command-line-model-inferences/interactive-model-inference-sessions.md) — Loads the fine‑tuned model weights and supports interactive chat or batch text generation from a command‑line session within the framework ([source](https://github.com/shibing624/MedicalGPT/blob/main/README.md))

### User Interface & Experience

- [Interactive AI Demos](https://awesome-repositories.com/f/user-interface-experience/interactive-ai-demos.md) — Starts an interactive web‑based chat interface that loads a trained model base and optional LoRA adapters so practitioners can demo the framework‑tuned model live ([source](https://cdn.jsdelivr.net/gh/shibing624/medicalgpt@main/README.md))
