Migrate from legacy models

Rebase a model

You can rebase a legacy tuned model using the Google Cloud console or programmatically. This guide explains how to rebase, a process that updates a tuned model's base model to the latest version.

It's important to rebase a model because new and improved base models are released periodically. They are often trained on larger datasets, have better architecture, and include performance enhancements. Rebasing lets you take advantage of these improvements. Rebasing uses the recommended hyper parameters for the new base model to get optimal performance.

The bison models and gemini-1.0 models use a different dataset format than gemini-1.5 models. If you're upgrading from an older model version to gemini-1.5, you have two options:

  1. Continue using your existing dataset: Your older tuning dataset can still work with gemini-1.5, allowing for a seamless transition.
  2. Create a new dataset: For optimal performance with gemini-1.5, create a new dataset in your Cloud Storage bucket using the updated format.

REST

Before using any of the request data, make the following replacements:

  • LOCATION: The region where the tuning job runs. This is also the default region for where the tuned model is uploaded.
  • PROJECT_ID: Your project ID.
  • MODEL_ID: The name of your tuned model you want to rebase.
  • TUNING_JOB_ID: For legacy Gemini models using tuning_job.
  • PIPELINE_JOB_NAME: The legacy bison models tuning pipeline.

HTTP method and URL:

POST https://REGION-aiplatform.googleapis.com/ui/projects/PROJECT_ID/locations/REGION/tuningJobs:rebaseTunedModel

Request JSON body:

{
  "tunedModelRef": {
    "tuned_model": "projects/PROJECT_ID/locations/REGION/models/MODEL_ID"
  }
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://REGION-aiplatform.googleapis.com/ui/projects/PROJECT_ID/locations/REGION/tuningJobs:rebaseTunedModel"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://REGION-aiplatform.googleapis.com/ui/projects/PROJECT_ID/locations/REGION/tuningJobs:rebaseTunedModel" | Select-Object -Expand Content

You should receive a JSON response similar to the following.

Google Cloud console

Use these instructions to rebase a tuned model to a newer foundation model

  1. In the Vertex AI section of the Google Cloud console, go to tuning in the Vertex AI Studio page.

    Go to Vertex AI Studio

  2. From the list of tuned models, in the notification column, the models which are out of date or able to rebased have the Retune option.
  3. Select Retune.
  4. Choose a name for the retuned model.
  5. From the drop-down, select the new base model to use.
  6. Select the region that you want to use.
  7. Select the output directory location, the Cloud Storage location where the reformatted tuning datasets are stored.
  8. Update the tuning dataset location by uploading a new file to Cloud Storage or use an existing Cloud Storage path.
  9. Optional: Enable model validation and connect to the Cloud Storage validation dataset.
  10. Click Start tuning.

What's next