litert-community/medgemma-2-e4b-it-litert-lm
Main Model Card: google/medgemma-2-E4B-it
MedGemma 2 E4B is an open multimodal foundation model for health AI from the MedGemma 2 family under Google's Health AI Developer Foundations (HAI-DEF) program. This model card provides a quantized version of the model as a starting point for experimentation and adaptation on Android, iOS and Desktop, as well as colabs that demonstrate how to fine-tune this model to fit your specific needs.
These models are provided in the .litertlm format for use with the LiteRT-LM framework. LiteRT-LM is a specialized orchestration layer built directly on top of LiteRT, Google's high-performance multi-platform runtime trusted by millions of Android and edge developers. LiteRT-LM adds the specialized GenAI libraries and APIs, such as KV-cache management, prompt templating, and function calling.
Disclaimer: HAI-DEF models, including MedGemma, are intended to be used as a starting point that enables efficient development of downstream healthcare applications involving medical text, images, audio, video, and tool-calling workflows. HAI-DEF models are not intended to be used without appropriate validation, adaptation and/or making meaningful modification by developers for their specific use case. The outputs generated by these models are not intended to directly inform clinical diagnosis, patient management decisions, treatment recommendations, or any other direct clinical practice applications, including mental and behavioral health applications. Performance benchmarks reported here highlight baseline capabilities and are not intended to imply that MedGemma is safe to use in any given medical application. Inaccurate model outputs beyond those shown here are possible. All model outputs should be considered preliminary and require independent verification, clinical correlation, and further investigation through established research and development methodologies. Please refer to terms of use and prohibited use policy for more details.
Build with MedGemma 2 E4B
LiteRT-LM provides developer building blocks for both prototyping with pre-converted checkpoints and custom domain adaptation for health AI developers:
Path 1: Prototype with a Pre-Converted .litertlm Checkpoint
To prototype with a pre-converted MedGemma 2 E4B checkpoint using LiteRT-LM, see the MedGemma 2 guide.
Path 2: Fine-Tune Your Own Model
Because MedGemma 2 is a foundation model intended to be adapted and validated with local data, you can fine-tune, quantize, and re-package your adapted checkpoint into a portable .litertlm bundle. Alongside our pre-converted PTQ checkpoint, we provide three open, Apache 2.0-licensed colab notebooks in the MedGemma GitHub Repository:
- Multimodal fine-tuning (SFT): Fine-tune MedGemma 2 E4B on your own image-and-text health data (shown on SCIN dermatology), export a quantized
.litertlmbundle, and verify local inference in one Colab workflow. - Reasoning fine-tuning (GRPO): Help preserve reasoning quality, yet keep outputs concise enough for tight on-device latency and memory budgets (shown on MedQA), then package a compact
.litertlmbundle with litert-torch and litert-quantizer. - Test & Serve: Profile, benchmark, and compare base vs. fine-tuned multimodal
.litertlmmodels (shown on SCIN dermatology) across CLI, Python and a local OpenAI-compatible server.
MedGemma 2 E4B Performance on LiteRT-LM
All text benchmarks were taken using 1024 prefill tokens and 256 decode tokens with a context length of 4096 tokens via LiteRT-LM. The model can support up to 32k context length. Vision processing time was recorded using the 280 vision encoder signature (960x672 PNG file). Measurements were taken across 5 runs and the median results were recorded.
Benchmarks were run with caches enabled and initialized. During the first run, the latency and memory usage may differ. The inference on CPU is accelerated via the LiteRT XNNPACK delegate with 4 threads.
Memory was measured using rusage::ru_maxrss on Android and Linux, task_vm_info::phys_footprint on iOS and MacBook and process_memory_counters::PrivateUsage on Windows. These fields primarily record CPU memory only.
Android
| Device | Backend | Prefill (token/s) | Decode (token/s) | Vision encoder (s) |
|---|---|---|---|---|
| Google Pixel 11 Pro | TPU | 1,353 | 18.2 | 1.09 |
| S26 Ultra | GPU | 1,138 | 17.2 | 0.68 |
| S26 Ultra | CPU | 162 | 13.7 | 2.19 |
| Device | Backend | Text CPU memory (MB) | Text + Vision CPU memory (MB) |
|---|---|---|---|
| Google Pixel 11 Pro | TPU | 183 | 561 |
| S26 Ultra | GPU | 948 | 978 |
| S26 Ultra | CPU | 3,631 | 3,766 |
iOS
| Device | Backend | Prefill (token/s) | Decode (token/s) | Vision encoder (s) |
|---|---|---|---|---|
| iPhone 17 Pro | GPU | 1,433 | 21.7 | 0.49 |
| iPhone 17 Pro | CPU | 443 | 14.5 | 1.34 |
| Device | Backend | Text CPU/GPU memory (MB) | Text + Vision CPU/GPU memory (MB) |
|---|---|---|---|
| iPhone 17 Pro | GPU | 492 | 527 |
| iPhone 17 Pro | CPU | 882 | 954 |
macOS
| Device | Backend | Prefill (token/s) | Decode (token/s) | Vision encoder (s) |
|---|---|---|---|---|
| MacBook Pro M5 | GPU | 1,109 | 58.1 | 0.31 |
| MacBook Pro M5 | CPU | 661 | 35.1 | 0.68 |
| Device | Backend | Text CPU/GPU memory (MB) | Text + Vision CPU/GPU memory (MB) |
|---|---|---|---|
| MacBook Pro M5 | GPU | 694 | 717 |
| MacBook Pro M5 | CPU | 1,178 | 1,182 |
Windows
| Device | Backend | Prefill (token/s) | Decode (token/s) | Vision encoder (s) |
|---|---|---|---|---|
| MSI Vector 16 HX AI (NVIDIA RTX 5080) | GPU | 2,024 | 89.2 | 0.14 |
| MSI Vector 16 HX (Core Ultra 9 275HX) | CPU | 153 | 8.4 | 2.16 |
| ASUS ProArt PX13 (Radeon 8060S) | GPU | 941 | 45.7 | 0.35 |
| ASUS ProArt PX13 (Ryzen AI Max+ 395) | CPU | 191 | 11.1 | 1.80 |
| Dell XPS 14 (Intel Arc B390) | GPU | 1,384 | 27.9 | 0.29 |
| Dell XPS 14 (Intel Core Ultra X7) | CPU | 126 | 10.6 | 4.81 |
| Device | Backend | Text CPU/GPU memory (MB) | Text + Vision CPU/GPU memory (MB) |
|---|---|---|---|
| MSI Vector 16 HX (NVIDIA RTX 5080) | GPU | 3,900 | 4,195 |
| MSI Vector 16 HX | CPU | 976 | 981 |
| ASUS ProArt PX13 (AMD Radeon 8060S) | GPU | 3,917 | 4,211 |
| ASUS ProArt PX13 (Ryzen AI Max+ 395) | CPU | 973 | 989 |
| Dell XPS 14 (Intel Arc B390) | GPU | 4,293 | 4,658 |
| Dell XPS 14 (Intel Core Ultra X7) | CPU | 973 | 980 |
Linux
| Device | Backend | Prefill (token/s) | Decode (token/s) | Vision encoder (s) |
|---|---|---|---|---|
| NVIDIA GeForce RTX 4090 | GPU | 2,229 | 96.0 | 0.15 |
| Arm 2.3 & 2.8GHz | CPU | 79 | 14.5 | 3.47 |
| Device | Backend | Text CPU memory (MB) | Text + Vision CPU memory (MB) |
|---|---|---|---|
| NVIDIA GeForce RTX 4090 | GPU | 1,026 | 1,046 |
| Arm 2.3 & 2.8GHz | CPU | 3,678 | 3,767 |