This page provides prerequisites and detailed instructions for fine-tuning
Gemini on image data using supervised learning. Fine-tuning lets you adapt base Gemini models for specialized tasks.
Here are some image use cases: To learn more about image sample requirements, see the Image understanding page. The To see the generic format example, see
Dataset example for Gemini. The following is an example of an image dataset. You can use the following sample datasets to learn how to tune a
Gemini model. To use these datasets, specify the URIs in the
applicable parameters when creating a text model supervised fine-tuning job. To use the sample tuning dataset, specify its location as follows: To use the sample validation dataset, specify its location as follows:Use cases
Limitations
Dataset format
fileUri
for your dataset can be the URI for a file in a Cloud Storage
bucket, or it can be a publicly available HTTP or HTTPS URL.{
"contents": [
{
"role": "user",
"parts": [
{
"fileData": {
"mimeType": "image/jpeg",
"fileUri": "gs://cloud-samples-data/ai-platform/generative_ai/gemini-2_0/image/longcap100/100.jpeg"
}
},
{
"text": "Describe this image in detail that captures the essence of it."
}
]
},
{
"role": "model",
"parts": [
{
"text": "A man stands on a road, wearing a blue denim jacket, tan pants, and white sneakers. He has his hands in his pockets and is wearing a white t-shirt under his jacket. The man's pants are cuffed, and his shoes are white. The road is dark grey, and the leaves are green. The man is standing in the shade, and the light is shining on the ground."
}
]
}
]
}
Sample datasets
"training_dataset_uri": "gs://cloud-samples-data/ai-platform/generative_ai/gemini-2_0/text/sft_train_data.jsonl",
"validation_dataset_uri": "gs://cloud-samples-data/ai-platform/generative_ai/gemini-2_0/text/sft_validation_data.jsonl",
What's next
Image tuning
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-21 UTC.