Add files using upload-large-folder tool
Browse files- .gitattributes +6 -0
- README.md +528 -0
- config.json +38 -0
- medgemma-27b-text-it-Q4_K_M.gguf +3 -0
- medgemma-27b-text-it-UD-IQ1_S.gguf +3 -0
- medgemma-27b-text-it-UD-Q2_K_XL.gguf +3 -0
- medgemma-27b-text-it-UD-Q3_K_XL.gguf +3 -0
- medgemma-27b-text-it-UD-Q4_K_XL.gguf +3 -0
- medgemma-27b-text-it-UD-Q5_K_XL.gguf +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
medgemma-27b-text-it-UD-IQ1_S.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
medgemma-27b-text-it-UD-Q2_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
medgemma-27b-text-it-UD-Q3_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
39 |
+
medgemma-27b-text-it-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
40 |
+
medgemma-27b-text-it-UD-Q4_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
medgemma-27b-text-it-UD-Q5_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-foundations/terms
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: image-text-to-text
|
7 |
+
extra_gated_heading: Access MedGemma on Hugging Face
|
8 |
+
extra_gated_prompt: >-
|
9 |
+
To access MedGemma on Hugging Face, you're required to review and agree to
|
10 |
+
[Health AI Developer Foundation's terms of
|
11 |
+
use](https://developers.google.com/health-ai-developer-foundations/terms). To
|
12 |
+
do this, please ensure you're logged in to Hugging Face and click below.
|
13 |
+
Requests are processed immediately.
|
14 |
+
extra_gated_button_content: Acknowledge license
|
15 |
+
base_model:
|
16 |
+
- google/medgemma-27b-text-it
|
17 |
+
tags:
|
18 |
+
- medical
|
19 |
+
- unsloth
|
20 |
+
- clinical-reasoning
|
21 |
+
- thinking
|
22 |
+
---
|
23 |
+
<div>
|
24 |
+
<p style="margin-top: 0;margin-bottom: 0;">
|
25 |
+
<em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>
|
26 |
+
</p>
|
27 |
+
<div style="display: flex; gap: 5px; align-items: center; ">
|
28 |
+
<a href="https://github.com/unslothai/unsloth/">
|
29 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
30 |
+
</a>
|
31 |
+
<a href="https://discord.gg/unsloth">
|
32 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
33 |
+
</a>
|
34 |
+
<a href="https://docs.unsloth.ai/basics/qwen3-how-to-run-and-fine-tune">
|
35 |
+
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
36 |
+
</a>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
|
41 |
+
# MedGemma model card
|
42 |
+
|
43 |
+
**Model documentation:** [MedGemma](https://developers.google.com/health-ai-developer-foundations/medgemma)
|
44 |
+
|
45 |
+
**Resources:**
|
46 |
+
|
47 |
+
* Model on Google Cloud Model Garden: [MedGemma](https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/medgemma)
|
48 |
+
* Model on Hugging Face: [MedGemma](https://huggingface.co/collections/google/medgemma-release-680aade845f90bec6a3f60c4)
|
49 |
+
* GitHub repository (supporting code, Colab notebooks, discussions, and
|
50 |
+
issues): [MedGemma](https://github.com/google-health/medgemma)
|
51 |
+
* Quick start notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb)
|
52 |
+
* Fine-tuning notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb)
|
53 |
+
* [Patient Education Demo built using MedGemma](https://huggingface.co/spaces/google/rad_explain)
|
54 |
+
* Support: See [Contact](https://developers.google.com/health-ai-developer-foundations/medgemma/get-started.md#contact)
|
55 |
+
* License: The use of MedGemma is governed by the [Health AI Developer
|
56 |
+
Foundations terms of
|
57 |
+
use](https://developers.google.com/health-ai-developer-foundations/terms).
|
58 |
+
|
59 |
+
**Author:** Google
|
60 |
+
|
61 |
+
## Model information
|
62 |
+
|
63 |
+
This section describes the MedGemma model and how to use it.
|
64 |
+
|
65 |
+
### Description
|
66 |
+
|
67 |
+
MedGemma is a collection of [Gemma 3](https://ai.google.dev/gemma/docs/core)
|
68 |
+
variants that are trained for performance on medical text and image
|
69 |
+
comprehension. Developers can use MedGemma to accelerate building
|
70 |
+
healthcare-based AI applications. MedGemma currently comes in two variants: a 4B
|
71 |
+
multimodal version and a 27B text-only version.
|
72 |
+
|
73 |
+
MedGemma 27B has been trained exclusively on medical text and optimized for
|
74 |
+
inference-time computation. MedGemma 27B is only available as an
|
75 |
+
instruction-tuned model.
|
76 |
+
|
77 |
+
MedGemma variants have been evaluated on a range of clinically relevant
|
78 |
+
benchmarks to illustrate their baseline performance. These include both open
|
79 |
+
benchmark datasets and curated datasets. Developers can fine-tune MedGemma
|
80 |
+
variants for improved performance. Consult the Intended Use section below for
|
81 |
+
more details.
|
82 |
+
|
83 |
+
A full technical report will be available soon.
|
84 |
+
|
85 |
+
### How to use
|
86 |
+
|
87 |
+
Below are some example code snippets to help you quickly get started running the
|
88 |
+
model locally on GPU. If you want to use the model at scale, we recommend that
|
89 |
+
you create a production version using [Model
|
90 |
+
Garden](https://cloud.google.com/model-garden).
|
91 |
+
|
92 |
+
First, install the Transformers library. Gemma 3 is supported starting from
|
93 |
+
transformers 4.50.0.
|
94 |
+
|
95 |
+
```sh
|
96 |
+
$ pip install -U transformers
|
97 |
+
```
|
98 |
+
|
99 |
+
**Run model with the `pipeline` API**
|
100 |
+
|
101 |
+
```python
|
102 |
+
from transformers import pipeline
|
103 |
+
import torch
|
104 |
+
|
105 |
+
pipe = pipeline(
|
106 |
+
"text-generation",
|
107 |
+
model="google/medgemma-27b-text-it",
|
108 |
+
torch_dtype=torch.bfloat16,
|
109 |
+
device="cuda",
|
110 |
+
)
|
111 |
+
|
112 |
+
messages = [
|
113 |
+
{
|
114 |
+
"role": "system",
|
115 |
+
"content": "You are a helpful medical assistant."
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"role": "user",
|
119 |
+
"content": "How do you differentiate bacterial from viral pneumonia?"
|
120 |
+
}
|
121 |
+
]
|
122 |
+
|
123 |
+
output = pipe(text=messages, max_new_tokens=200)
|
124 |
+
print(output[0]["generated_text"][-1]["content"])
|
125 |
+
```
|
126 |
+
|
127 |
+
**Run the model directly**
|
128 |
+
|
129 |
+
```python
|
130 |
+
# pip install accelerate
|
131 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
132 |
+
import torch
|
133 |
+
|
134 |
+
model_id = "google/medgemma-27b-text-it"
|
135 |
+
|
136 |
+
model = AutoModelForCausalLM.from_pretrained(
|
137 |
+
model_id,
|
138 |
+
torch_dtype=torch.bfloat16,
|
139 |
+
device_map="auto",
|
140 |
+
)
|
141 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
142 |
+
|
143 |
+
messages = [
|
144 |
+
{
|
145 |
+
"role": "system",
|
146 |
+
"content": "You are a helpful medical assistant."
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"role": "user",
|
150 |
+
"content": "How do you differentiate bacterial from viral pneumonia?"
|
151 |
+
}
|
152 |
+
]
|
153 |
+
|
154 |
+
inputs = tokenizer.apply_chat_template(
|
155 |
+
messages,
|
156 |
+
add_generation_prompt=True,
|
157 |
+
tokenize=True,
|
158 |
+
return_dict=True,
|
159 |
+
return_tensors="pt",
|
160 |
+
).to(model.device)
|
161 |
+
|
162 |
+
input_len = inputs["input_ids"].shape[-1]
|
163 |
+
|
164 |
+
with torch.inference_mode():
|
165 |
+
generation = model.generate(**inputs, max_new_tokens=200, do_sample=False)
|
166 |
+
generation = generation[0][input_len:]
|
167 |
+
|
168 |
+
decoded = tokenizer.decode(generation, skip_special_tokens=True)
|
169 |
+
print(decoded)
|
170 |
+
```
|
171 |
+
|
172 |
+
### Examples
|
173 |
+
|
174 |
+
See the following Colab notebooks for examples of how to use MedGemma:
|
175 |
+
|
176 |
+
* To give the model a quick try, running it locally with weights from Hugging
|
177 |
+
Face, see [Quick start notebook in
|
178 |
+
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb). Note that you will need to use Colab
|
179 |
+
Enterprise to run the 27B model without quantization.
|
180 |
+
|
181 |
+
* For an example of fine-tuning the model, see the [Fine-tuning notebook in
|
182 |
+
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb).
|
183 |
+
|
184 |
+
### Model architecture overview
|
185 |
+
|
186 |
+
The MedGemma model is built based on [Gemma 3](https://ai.google.dev/gemma/) and
|
187 |
+
uses the same decoder-only transformer architecture as Gemma 3. To read more
|
188 |
+
about the architecture, consult the Gemma 3 [model
|
189 |
+
card](https://ai.google.dev/gemma/docs/core/model_card_3).
|
190 |
+
|
191 |
+
### Technical specifications
|
192 |
+
|
193 |
+
* **Model type**: Decoder-only Transformer architecture, see the [Gemma 3
|
194 |
+
technical
|
195 |
+
report](https://storage.googleapis.com/deepmind-media/gemma/Gemma3Report.pdf)
|
196 |
+
* **Modalities**: **4B**: Text, vision; **27B**: Text only
|
197 |
+
* **Attention mechanism**: Utilizes grouped-query attention (GQA)
|
198 |
+
* **Context length**: Supports long context, at least 128K tokens
|
199 |
+
* **Key publication**: Coming soon
|
200 |
+
* **Model created**: May 20, 2025
|
201 |
+
* **Model version**: 1.0.0
|
202 |
+
|
203 |
+
### Citation
|
204 |
+
|
205 |
+
A technical report is coming soon. In the meantime, if you publish using this
|
206 |
+
model, please cite the Hugging Face model page:
|
207 |
+
|
208 |
+
```none
|
209 |
+
@misc{medgemma-hf,
|
210 |
+
author = {Google},
|
211 |
+
title = {MedGemma Hugging Face}
|
212 |
+
howpublished = {\url{https://huggingface.co/collections/google/medgemma-release-680aade845f90bec6a3f60c4}},
|
213 |
+
year = {2025},
|
214 |
+
note = {Accessed: [Insert Date Accessed, e.g., 2025-05-20]}
|
215 |
+
}
|
216 |
+
```
|
217 |
+
|
218 |
+
### Inputs and outputs
|
219 |
+
|
220 |
+
**Input**:
|
221 |
+
|
222 |
+
* Text string, such as a question or prompt
|
223 |
+
* Total input length of 128K tokens
|
224 |
+
|
225 |
+
**Output**:
|
226 |
+
|
227 |
+
* Generated text in response to the input, such as an answer to a question,
|
228 |
+
analysis of image content, or a summary of a document
|
229 |
+
* Total output length of 8192 tokens
|
230 |
+
|
231 |
+
### Performance and validation
|
232 |
+
|
233 |
+
MedGemma was evaluated across a range of different multimodal classification,
|
234 |
+
report generation, visual question answering, and text-based tasks.
|
235 |
+
|
236 |
+
### Key performance metrics
|
237 |
+
|
238 |
+
#### Text evaluations
|
239 |
+
|
240 |
+
MedGemma 4B and text-only MedGemma 27B were evaluated across a range of
|
241 |
+
text-only benchmarks for medical knowledge and reasoning.
|
242 |
+
|
243 |
+
The MedGemma models outperform their respective base Gemma models across all
|
244 |
+
tested text-only health benchmarks.
|
245 |
+
|
246 |
+
| Metric | MedGemma 27B | Gemma 3 27B | MedGemma 4B | Gemma 3 4B |
|
247 |
+
| :---- | :---- | :---- | :---- | :---- |
|
248 |
+
| MedQA (4-op) | 89.8 (best-of-5) 87.7 (0-shot) | 74.9 | 64.4 | 50.7 |
|
249 |
+
| MedMCQA | 74.2 | 62.6 | 55.7 | 45.4 |
|
250 |
+
| PubMedQA | 76.8 | 73.4 | 73.4 | 68.4 |
|
251 |
+
| MMLU Med (text only) | 87.0 | 83.3 | 70.0 | 67.2 |
|
252 |
+
| MedXpertQA (text only) | 26.7 | 15.7 | 14.2 | 11.6 |
|
253 |
+
| AfriMed-QA | 84.0 | 72.0 | 52.0 | 48.0 |
|
254 |
+
|
255 |
+
For all MedGemma 27B results, [test-time
|
256 |
+
scaling](https://arxiv.org/abs/2501.19393) is used to improve performance.
|
257 |
+
|
258 |
+
### Ethics and safety evaluation
|
259 |
+
|
260 |
+
#### Evaluation approach
|
261 |
+
|
262 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
263 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
264 |
+
different teams, each with different goals and human evaluation metrics. These
|
265 |
+
models were evaluated against a number of different categories relevant to
|
266 |
+
ethics and safety, including:
|
267 |
+
|
268 |
+
* **Child safety**: Evaluation of text-to-text and image-to-text prompts
|
269 |
+
covering child safety policies, including child sexual abuse and
|
270 |
+
exploitation.
|
271 |
+
* **Content safety:** Evaluation of text-to-text and image-to-text prompts
|
272 |
+
covering safety policies, including harassment, violence and gore, and hate
|
273 |
+
speech.
|
274 |
+
* **Representational harms**: Evaluation of text-to-text and image-to-text
|
275 |
+
prompts covering safety policies, including bias, stereotyping, and harmful
|
276 |
+
associations or inaccuracies.
|
277 |
+
* **General medical harms:** Evaluation of text-to-text and image-to-text
|
278 |
+
prompts covering safety policies, including information quality and harmful
|
279 |
+
associations or inaccuracies.
|
280 |
+
|
281 |
+
In addition to development level evaluations, we conduct "assurance evaluations"
|
282 |
+
which are our "arms-length" internal evaluations for responsibility governance
|
283 |
+
decision making. They are conducted separately from the model development team,
|
284 |
+
to inform decision making about release. High-level findings are fed back to the
|
285 |
+
model team, but prompt sets are held out to prevent overfitting and preserve the
|
286 |
+
results' ability to inform decision making. Notable assurance evaluation results
|
287 |
+
are reported to our Responsibility & Safety Council as part of release review.
|
288 |
+
|
289 |
+
#### Evaluation results
|
290 |
+
|
291 |
+
For all areas of safety testing, we saw safe levels of performance across the
|
292 |
+
categories of child safety, content safety, and representational harms. All
|
293 |
+
testing was conducted without safety filters to evaluate the model capabilities
|
294 |
+
and behaviors. For text-to-text, image-to-text, and audio-to-text, and across
|
295 |
+
both MedGemma model sizes, the model produced minimal policy violations. A
|
296 |
+
limitation of our evaluations was that they included primarily English language
|
297 |
+
prompts.
|
298 |
+
|
299 |
+
## Data card
|
300 |
+
|
301 |
+
### Dataset overview
|
302 |
+
|
303 |
+
#### Training
|
304 |
+
|
305 |
+
The base Gemma models are pre-trained on a large corpus of text and code data.
|
306 |
+
MedGemma 4B utilizes a [SigLIP](https://arxiv.org/abs/2303.15343) image encoder
|
307 |
+
that has been specifically pre-trained on a variety of de-identified medical
|
308 |
+
data, including radiology images, histopathology images, ophthalmology images,
|
309 |
+
and dermatology images. Its LLM component is trained on a diverse set of medical
|
310 |
+
data, including medical text relevant to radiology images, chest-x rays,
|
311 |
+
histopathology patches, ophthalmology images and dermatology images.
|
312 |
+
|
313 |
+
#### Evaluation
|
314 |
+
|
315 |
+
MedGemma models have been evaluated on a comprehensive set of clinically
|
316 |
+
relevant benchmarks, including over 22 datasets across 5 different tasks and 6
|
317 |
+
medical image modalities. These include both open benchmark datasets and curated
|
318 |
+
datasets, with a focus on expert human evaluations for tasks like CXR report
|
319 |
+
generation and radiology VQA.
|
320 |
+
|
321 |
+
#### Source
|
322 |
+
|
323 |
+
MedGemma utilizes a combination of public and private datasets.
|
324 |
+
|
325 |
+
This model was trained on diverse public datasets including MIMIC-CXR (chest
|
326 |
+
X-rays and reports), Slake-VQA (multimodal medical images and questions),
|
327 |
+
PAD-UFES-20 (skin lesion images and data), SCIN (dermatology images), TCGA
|
328 |
+
(cancer genomics data), CAMELYON (lymph node histopathology images), PMC-OA
|
329 |
+
(biomedical literature with images), and Mendeley Digital Knee X-Ray (knee
|
330 |
+
X-rays).
|
331 |
+
|
332 |
+
Additionally, multiple diverse proprietary datasets were licensed and
|
333 |
+
incorporated (described next).
|
334 |
+
|
335 |
+
### Data Ownership and Documentation
|
336 |
+
|
337 |
+
* [Mimic-CXR](https://physionet.org/content/mimic-cxr/2.1.0/): MIT Laboratory
|
338 |
+
for Computational Physiology and Beth Israel Deaconess Medical Center
|
339 |
+
(BIDMC).
|
340 |
+
* [Slake-VQA](https://www.med-vqa.com/slake/): The Hong Kong Polytechnic
|
341 |
+
University (PolyU), with collaborators including West China Hospital of
|
342 |
+
Sichuan University and Sichuan Academy of Medical Sciences / Sichuan
|
343 |
+
Provincial People's Hospital.
|
344 |
+
* [PAD-UFES-20](https://pmc.ncbi.nlm.nih.gov/articles/PMC7479321/): Federal
|
345 |
+
University of Espírito Santo (UFES), Brazil, through its Dermatological and
|
346 |
+
Surgical Assistance Program (PAD).
|
347 |
+
* [SCIN](https://github.com/google-research-datasets/scin): A collaboration
|
348 |
+
between Google Health and Stanford Medicine.
|
349 |
+
* [TCGA](https://portal.gdc.cancer.gov/) (The Cancer Genome Atlas): A joint
|
350 |
+
effort of National Cancer Institute and National Human Genome Research
|
351 |
+
Institute. Data from TCGA are available via the Genomic Data Commons (GDC)
|
352 |
+
* [CAMELYON](https://camelyon17.grand-challenge.org/Data/): The data was
|
353 |
+
collected from Radboud University Medical Center and University Medical
|
354 |
+
Center Utrecht in the Netherlands.
|
355 |
+
* [PMC-OA (PubMed Central Open Access
|
356 |
+
Subset)](https://catalog.data.gov/dataset/pubmed-central-open-access-subset-pmc-oa):
|
357 |
+
Maintained by the National Library of Medicine (NLM) and National Center for
|
358 |
+
Biotechnology Information (NCBI), which are part of the NIH.
|
359 |
+
* [MedQA](https://arxiv.org/pdf/2009.13081): This dataset was created by a
|
360 |
+
team of researchers led by Di Jin, Eileen Pan, Nassim Oufattole, Wei-Hung
|
361 |
+
Weng, Hanyi Fang, and Peter Szolovits
|
362 |
+
* [Mendeley Digital Knee
|
363 |
+
X-Ray](https://data.mendeley.com/datasets/t9ndx37v5h/1): This dataset is
|
364 |
+
from Rani Channamma University, and is hosted on Mendeley Data.
|
365 |
+
* [AfriMed-QA](https://afrimedqa.com/): This data was developed and led by
|
366 |
+
multiple collaborating organizations and researchers include key
|
367 |
+
contributors: Intron Health, SisonkeBiotik, BioRAMP, Georgia Institute of
|
368 |
+
Technology, and MasakhaneNLP.
|
369 |
+
* [VQA-RAD](https://www.nature.com/articles/sdata2018251): This dataset was
|
370 |
+
created by a research team led by Jason J. Lau, Soumya Gayen, Asma Ben
|
371 |
+
Abacha, and Dina Demner-Fushman and their affiliated institutions (the US
|
372 |
+
National Library of Medicine and National Institutes of Health)
|
373 |
+
* [MedExpQA](https://www.sciencedirect.com/science/article/pii/S0933365724001805):
|
374 |
+
This dataset was created by researchers at the HiTZ Center (Basque Center
|
375 |
+
for Language Technology and Artificial Intelligence).
|
376 |
+
* [MedXpertQA](https://huggingface.co/datasets/TsinghuaC3I/MedXpertQA): This
|
377 |
+
dataset was developed by researchers at Tsinghua University (Beijing, China)
|
378 |
+
and Shanghai Artificial Intelligence Laboratory (Shanghai, China).
|
379 |
+
|
380 |
+
In addition to the public datasets listed above, MedGemma was also trained on
|
381 |
+
de-identified datasets licensed for research or collected internally at Google
|
382 |
+
from consented participants.
|
383 |
+
|
384 |
+
* Radiology dataset 1: De-identified dataset of different CT studies across
|
385 |
+
body parts from a US-based radiology outpatient diagnostic center network.
|
386 |
+
* Ophthalmology dataset 1: De-identified dataset of fundus images from
|
387 |
+
diabetic retinopathy screening.
|
388 |
+
* Dermatology dataset 1: De-identified dataset of teledermatology skin
|
389 |
+
condition images (both clinical and dermatoscopic) from Colombia.
|
390 |
+
* Dermatology dataset 2: De-identified dataset of skin cancer images (both
|
391 |
+
clinical and dermatoscopic) from Australia.
|
392 |
+
* Dermatology dataset 3: De-identified dataset of non-diseased skin images
|
393 |
+
from an internal data collection effort.
|
394 |
+
* Pathology dataset 1: De-identified dataset of histopathology H&E whole slide
|
395 |
+
images created in collaboration with an academic research hospital and
|
396 |
+
biobank in Europe. Comprises de-identified colon, prostate, and lymph nodes.
|
397 |
+
* Pathology dataset 2: De-identified dataset of lung histopathology H&E and
|
398 |
+
IHC whole slide images created by a commercial biobank in the United States.
|
399 |
+
* Pathology dataset 3: De-identified dataset of prostate and lymph node H&E
|
400 |
+
and IHC histopathology whole slide images created by a contract research
|
401 |
+
organization in the United States.
|
402 |
+
* Pathology dataset 4: De-identified dataset of histopathology, predominantly
|
403 |
+
H\&E whole slide images created in collaboration with a large, tertiary
|
404 |
+
teaching hospital in the United States. Comprises a diverse set of tissue
|
405 |
+
and stain types, predominantly H&E.
|
406 |
+
|
407 |
+
### Data citation
|
408 |
+
|
409 |
+
* MIMIC-CXR Johnson, A., Pollard, T., Mark, R., Berkowitz, S., & Horng, S.
|
410 |
+
(2024). MIMIC-CXR Database (version 2.1.0). PhysioNet.
|
411 |
+
* Johnson, A.E.W., Pollard, T.J., Berkowitz, S.J. et al. [MIMIC-CXR, a
|
412 |
+
de-identified publicly available database of chest radiographs with
|
413 |
+
free-text reports. Sci Data 6, 317
|
414 |
+
(2019).](https://doi.org/10.1038/s41597-019-0322-0)
|
415 |
+
* Available on Physionet Goldberger, A., Amaral, L., Glass, L., Hausdorff, J.,
|
416 |
+
Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). [PhysioBank,
|
417 |
+
PhysioToolkit, and PhysioNet: Components of a new research resource for
|
418 |
+
complex physiologic signals. Circulation \[Online\]. 101 (23), pp.
|
419 |
+
E215–e220.](https://pubmed.ncbi.nlm.nih.gov/10851218/)
|
420 |
+
* Bo Liu, Li-Ming Zhan, etc. [SLAKE: A Semantically-Labeled Knowledge-Enhanced
|
421 |
+
Dataset for Medical Visual Question
|
422 |
+
Answering](https://arxiv.org/abs/2102.09542).
|
423 |
+
* [PAD-UFES-20: A skin lesion dataset composed of patient data and clinical
|
424 |
+
images collected from
|
425 |
+
smartphones](https://pmc.ncbi.nlm.nih.gov/articles/PMC7479321/)
|
426 |
+
* [The Cancer Genome Atlas Program (TCGA)](https://www.cancer.gov/ccg/research/genome-sequencing/tcga)
|
427 |
+
* Babak Ehteshami Bejnordi, etc.: [Diagnostic Assessment of Deep Learning
|
428 |
+
Algorithms for Detection of Lymph Node Metastases in Women With Breast
|
429 |
+
Cancer](https://jamanetwork.com/journals/jama/fullarticle/2665774)
|
430 |
+
* MedQA: [https://arxiv.org/abs/2009.13081](https://arxiv.org/abs/2009.13081)
|
431 |
+
* Mendeley Digital Knee X-Ray: Gornale, Shivanand; Patravali, Pooja (2020),
|
432 |
+
"Digital Knee X-ray Images", Mendeley Data, V1, doi: 10.17632/t9ndx37v5h.1
|
433 |
+
* AfriMed-QA: [https://arxiv.org/abs/2411.15640](https://arxiv.org/abs/2411.15640)
|
434 |
+
* VQA-RAD: [Lau, J., Gayen, S., Ben Abacha, A. et al. A dataset of clinically
|
435 |
+
generated visual questions and answers about radiology images. Sci Data 5,
|
436 |
+
180251 (2018).
|
437 |
+
https://doi.org/10.1038/sdata.2018.251](https://doi.org/10.1038/sdata.2018.251)
|
438 |
+
* [MedExpQA: Multilingual benchmarking of Large Language Models for
|
439 |
+
Medical Question
|
440 |
+
Answering](https://www.sciencedirect.com/science/article/pii/S0933365724001805)
|
441 |
+
* MedXpertQA: [arXiv:2501.18362v2](https://arxiv.org/abs/2501.18362)
|
442 |
+
|
443 |
+
### De-identification/anonymization:
|
444 |
+
|
445 |
+
Google and partnerships utilize datasets that have been rigorously anonymized or
|
446 |
+
de-identified to ensure the protection of individual research participants and
|
447 |
+
patient privacy
|
448 |
+
|
449 |
+
## Implementation information
|
450 |
+
|
451 |
+
Details about the model internals.
|
452 |
+
|
453 |
+
### Software
|
454 |
+
|
455 |
+
Training was done using [JAX](https://github.com/jax-ml/jax).
|
456 |
+
|
457 |
+
JAX allows researchers to take advantage of the latest generation of hardware,
|
458 |
+
including TPUs, for faster and more efficient training of large models.
|
459 |
+
|
460 |
+
## Use and limitations
|
461 |
+
|
462 |
+
### Intended use
|
463 |
+
|
464 |
+
MedGemma is an open multimodal generative AI model intended to be used as a
|
465 |
+
starting point that enables more efficient development of downstream healthcare
|
466 |
+
applications involving medical text and images. MedGemma is intended for
|
467 |
+
developers in the life sciences and healthcare space. Developers are responsible
|
468 |
+
for training, adapting and making meaningful changes to MedGemma to accomplish
|
469 |
+
their specific intended use. MedGemma models can be fine-tuned by developers
|
470 |
+
using their own proprietary data for their specific tasks or solutions.
|
471 |
+
|
472 |
+
MedGemma is based on Gemma 3 and has been further trained on medical images and
|
473 |
+
text. MedGemma enables further development in any medical context (image and
|
474 |
+
textual), however the model was pre-trained using chest X-ray, pathology,
|
475 |
+
dermatology, and fundus images. Examples of tasks within MedGemma's training
|
476 |
+
include visual question answering pertaining to medical images, such as
|
477 |
+
radiographs, or providing answers to textual medical questions. Full details of
|
478 |
+
all the tasks MedGemma has been evaluated can be found in an upcoming technical
|
479 |
+
report.
|
480 |
+
|
481 |
+
### Benefits
|
482 |
+
|
483 |
+
* Provides strong baseline medical image and text comprehension for models of
|
484 |
+
its size.
|
485 |
+
* This strong performance makes it efficient to adapt for downstream
|
486 |
+
healthcare-based use cases, compared to models of similar size without
|
487 |
+
medical data pre-training.
|
488 |
+
* This adaptation may involve prompt engineering, grounding, agentic
|
489 |
+
orchestration or fine-tuning depending on the use case, baseline validation
|
490 |
+
requirements, and desired performance characteristics.
|
491 |
+
|
492 |
+
### Limitations
|
493 |
+
|
494 |
+
MedGemma is not intended to be used without appropriate validation, adaptation
|
495 |
+
and/or making meaningful modification by developers for their specific use case.
|
496 |
+
The outputs generated by MedGemma are not intended to directly inform clinical
|
497 |
+
diagnosis, patient management decisions, treatment recommendations, or any other
|
498 |
+
direct clinical practice applications. Performance benchmarks highlight baseline
|
499 |
+
capabilities on relevant benchmarks, but even for image and text domains that
|
500 |
+
constitute a substantial portion of training data, inaccurate model output is
|
501 |
+
possible. All outputs from MedGemma should be considered preliminary and require
|
502 |
+
independent verification, clinical correlation, and further investigation
|
503 |
+
through established research and development methodologies.
|
504 |
+
|
505 |
+
MedGemma's multimodal capabilities have been primarily evaluated on single-image
|
506 |
+
tasks. MedGemma has not been evaluated in use cases that involve comprehension
|
507 |
+
of multiple images.
|
508 |
+
|
509 |
+
MedGemma has not been evaluated or optimized for multi-turn applications.
|
510 |
+
|
511 |
+
MedGemma's training may make it more sensitive to the specific prompt used than
|
512 |
+
Gemma 3.
|
513 |
+
|
514 |
+
When adapting MedGemma developer should consider the following:
|
515 |
+
|
516 |
+
* **Bias in validation data:** As with any research, developers should ensure
|
517 |
+
that any downstream application is validated to understand performance using
|
518 |
+
data that is appropriately representative of the intended use setting for
|
519 |
+
the specific application (e.g., age, sex, gender, condition, imaging device,
|
520 |
+
etc).
|
521 |
+
* **Data contamination concerns**: When evaluating the generalization
|
522 |
+
capabilities of a large model like MedGemma in a medical context, there is a
|
523 |
+
risk of data contamination, where the model might have inadvertently seen
|
524 |
+
related medical information during its pre-training, potentially
|
525 |
+
overestimating its true ability to generalize to novel medical concepts.
|
526 |
+
Developers should validate MedGemma on datasets not publicly available or
|
527 |
+
otherwise made available to non-institutional researchers to mitigate this
|
528 |
+
risk.
|
config.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"Gemma3ForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_bias": false,
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"attn_logit_softcapping": null,
|
8 |
+
"bos_token_id": 2,
|
9 |
+
"cache_implementation": "hybrid",
|
10 |
+
"eos_token_id": 106,
|
11 |
+
"final_logit_softcapping": null,
|
12 |
+
"head_dim": 128,
|
13 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
14 |
+
"hidden_size": 5376,
|
15 |
+
"initializer_range": 0.02,
|
16 |
+
"intermediate_size": 21504,
|
17 |
+
"max_position_embeddings": 131072,
|
18 |
+
"model_type": "gemma3_text",
|
19 |
+
"num_attention_heads": 32,
|
20 |
+
"num_hidden_layers": 62,
|
21 |
+
"num_key_value_heads": 16,
|
22 |
+
"pad_token_id": 0,
|
23 |
+
"query_pre_attn_scalar": 168,
|
24 |
+
"rms_norm_eps": 1e-06,
|
25 |
+
"rope_local_base_freq": 10000,
|
26 |
+
"rope_scaling": {
|
27 |
+
"factor": 8.0,
|
28 |
+
"rope_type": "linear"
|
29 |
+
},
|
30 |
+
"rope_theta": 1000000,
|
31 |
+
"sliding_window": 1024,
|
32 |
+
"sliding_window_pattern": 6,
|
33 |
+
"torch_dtype": "bfloat16",
|
34 |
+
"transformers_version": "4.51.3",
|
35 |
+
"unsloth_fixed": true,
|
36 |
+
"use_cache": true,
|
37 |
+
"vocab_size": 262144
|
38 |
+
}
|
medgemma-27b-text-it-Q4_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:383b1c414d3f2f1a9c577a61e623d29a4ed4f7834f60b9e5412f5ff4e8aaf080
|
3 |
+
size 16546405376
|
medgemma-27b-text-it-UD-IQ1_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ce3c42b90f93741e080edf26f6cfe3313cba36f618a8d9f165ac62fdf6a5c29
|
3 |
+
size 6506101760
|
medgemma-27b-text-it-UD-Q2_K_XL.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:87eb60811b6d426421ed9d89ef60fa1dff72e4d54d5479e8f123f005bb0e7c0e
|
3 |
+
size 10680415232
|
medgemma-27b-text-it-UD-Q3_K_XL.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:28e62cbe89b1ae3442c51a7f6a37883c2bb3037db5f34e6bc4288f5394443d55
|
3 |
+
size 13704608768
|
medgemma-27b-text-it-UD-Q4_K_XL.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:665719f41bdb9b84e2e730d4e8be121044f80e973056d3127eb8a986ac808f89
|
3 |
+
size 16826043392
|
medgemma-27b-text-it-UD-Q5_K_XL.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22b8f15e0f880929e0c3bc442453e5270899f7985032d515383ac85232c1365f
|
3 |
+
size 19321195520
|