This guide shows you how to prepare data for supervised fine-tuning of a Gemini model for image tasks. This page covers the following topics: Fine-tuning lets you adapt base Gemini models for specialized tasks. Common use cases for image tuning include: When you tune an image model, the following limitations apply: To learn more about image sample requirements, see the Image understanding page. Your dataset must be in JSON Lines (JSONL) format, where each line is a single training example. The For the general dataset structure, see Dataset example for Gemini. The following example shows 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 you create a supervised fine-tuning job. Training dataset: Validation dataset:
Use cases
Limitations
Dataset format
<abbr data-title="A Uniform Resource Identifier that points to the location of a file, typically in a cloud storage bucket or at a public URL.">fileUri</abbr>
for your image can be a URI for a file in a Cloud Storage bucket or 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-18 UTC.