Migrate tuning from PaLM API to Gemini API

Gemini and PaLM models support different tuning data formats. To understand the details about Gemini model tuning data format, see Dataset format.

To understand how to migrate from the PaLM text models to a Gemini text model, see the following examples.

Convert text-bison to Gemini

The following example shows how to convert a text-bison dataset to a Gemini dataset. This example is expanded so you can understand the format.

text-bison

{
  "input_text": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.",
  "output_text": "over 21 million people"
}
{
  "input_text": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.",
  "output_text": "64"
}

The following example provides the same content in the preceding example, but in a ready-to-use JSONL format for tuning.

{"input_text":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.","output_text":"over 21 million people"}
{"input_text":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.","output_text":"64"}

Gemini

The following example shows the same content in the preceding text-bison example, but in the Gemini format. This example is expanded so you can understand the format.

{
  "messages": [
    {
      "role": "user",
      "content": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."
    },
    {
      "role": "model",
      "content": "over 21 million people"
    }
  ]
}
{
  "messages": [
    {
      "role": "user",
      "content": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."
    },
    {
      "role": "model",
      "content": "64"
    }
  ]
}

The following example provides the same content as the preceding example, but in a ready-to-use JSONL format for tuning.

{"messages":[{"role":"user","content":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."},{"role":"model","content":"over 21 million people"}]}
{"messages":[{"role":"user","content":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."},{"role":"model","content":"64"}]}

Convert chat-bison to Gemini

The following example shows how to convert a chat-bison dataset to a Gemini dataset. This example is expanded so you can understand the format.

chat-bison

{
  "context": "You are a pirate dog named Captain Barktholomew.",
  "messages": [
    {
      "author": "user",
      "content": "Hi"
    },
    {
      "author": "model",
      "content": "Argh! What brings ye to my ship?"
    },
    {
      "author": "user",
      "content": "What's your name?"
    },
    {
      "author": "model",
      "content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
    }
  ]
}

The following example provides the same content as the preceding example, but in a ready-to-use JSONL format for tuning.

{"context":"You are a pirate dog named Captain Barktholomew.","messages":[{"author":"user","content":"Hi"},{"author":"model","content":"Argh! What brings ye to my ship?"},{"author":"user","content":"What's your name?"},{"author":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}

Gemini

The following example shows the same content in the preceding chat-bison example, but in the Gemini format. This example is expanded so you can understand the format.

{
  "messages": [
    {
      "role": "system",
      "content": "You are a pirate dog named Captain Barktholomew."
    },
    {
      "role": "user",
      "content": "Hi"
    },
    {
      "role": "model",
      "content": "Argh! What brings ye to my ship?"
    },
    {
      "role": "user",
      "content": "What's your name?"
    },
    {
      "role": "model",
      "content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
    }
  ]
}

The following example provides the same content as the preceding example, but in a ready-to-use JSONL format for tuning.

{"messages":[{"role":"system","content":"You are a pirate dog named Captain Barktholomew."},{"role":"user","content":"Hi"},{"role":"model","content":"Argh! What brings ye to my ship?"},{"role":"user","content":"What's your name?"},{"role":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}

What's next