REST Resource: projects.locations.tuningJobs

Resource: TuningJob

Represents a TuningJob that runs with Google owned models.

Fields
name string

Output only. Identifier. Resource name of a TuningJob. Format: projects/{project}/locations/{location}/tuningJobs/{tuningJob}

tunedModelDisplayName string

Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters.

description string

Optional. The description of the TuningJob.

state enum (JobState)

Output only. The detailed state of the job.

createTime string (Timestamp format)

Output only. time when the TuningJob was created.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

startTime string (Timestamp format)

Output only. time when the TuningJob for the first time entered the JOB_STATE_RUNNING state.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

endTime string (Timestamp format)

Output only. time when the TuningJob entered any of the following JobStates: JOB_STATE_SUCCEEDED, JOB_STATE_FAILED, JOB_STATE_CANCELLED, JOB_STATE_EXPIRED.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

updateTime string (Timestamp format)

Output only. time when the TuningJob was most recently updated.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

error object (Status)

Output only. Only populated when job's state is JOB_STATE_FAILED or JOB_STATE_CANCELLED.

labels map (key: string, value: string)

Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint.

label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed.

See https://goo.gl/xmQnxf for more information and examples of labels.

experiment string

Output only. The Experiment associated with this TuningJob.

tunedModel object (TunedModel)

Output only. The tuned model resources assiociated with this TuningJob.

tuningDataStats object (TuningDataStats)

Output only. The tuning data statistics associated with this TuningJob.

pipelineJob string

Output only. The resource name of the PipelineJob associated with the TuningJob. Format: projects/{project}/locations/{location}/pipelineJobs/{pipelineJob}.

encryptionSpec object (EncryptionSpec)

Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key.

Union field source_model.

source_model can be only one of the following:

baseModel string

The base model that is being tuned, e.g., "gemini-1.0-pro-002".

Union field tuning_spec.

tuning_spec can be only one of the following:

supervisedTuningSpec object (SupervisedTuningSpec)

Tuning Spec for Supervised Fine Tuning.

distillationSpec object (DistillationSpec)

Tuning Spec for Distillation.

partnerModelTuningSpec object (PartnerModelTuningSpec)

Tuning Spec for open sourced and third party Partner models.

JSON representation
{
  "name": string,
  "tunedModelDisplayName": string,
  "description": string,
  "state": enum (JobState),
  "createTime": string,
  "startTime": string,
  "endTime": string,
  "updateTime": string,
  "error": {
    object (Status)
  },
  "labels": {
    string: string,
    ...
  },
  "experiment": string,
  "tunedModel": {
    object (TunedModel)
  },
  "tuningDataStats": {
    object (TuningDataStats)
  },
  "pipelineJob": string,
  "encryptionSpec": {
    object (EncryptionSpec)
  },

  // Union field source_model can be only one of the following:
  "baseModel": string
  // End of list of possible types for union field source_model.

  // Union field tuning_spec can be only one of the following:
  "supervisedTuningSpec": {
    object (SupervisedTuningSpec)
  },
  "distillationSpec": {
    object (DistillationSpec)
  },
  "partnerModelTuningSpec": {
    object (PartnerModelTuningSpec)
  }
  // End of list of possible types for union field tuning_spec.
}

SupervisedTuningSpec

Tuning Spec for Supervised Tuning for first party models.

Fields
trainingDatasetUri string

Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.

validationDatasetUri string

Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.

hyperParameters object (SupervisedHyperParameters)

Optional. Hyperparameters for SFT.

JSON representation
{
  "trainingDatasetUri": string,
  "validationDatasetUri": string,
  "hyperParameters": {
    object (SupervisedHyperParameters)
  }
}

SupervisedHyperParameters

Hyperparameters for SFT.

Fields
epochCount string (int64 format)

Optional. Number of complete passes the model makes over the entire training dataset during training.

learningRateMultiplier number

Optional. Multiplier for adjusting the default learning rate.

adapterSize enum (AdapterSize)

Optional. Adapter size for tuning.

JSON representation
{
  "epochCount": string,
  "learningRateMultiplier": number,
  "adapterSize": enum (AdapterSize)
}

AdapterSize

Supported adapter sizes for tuning.

Enums
ADAPTER_SIZE_UNSPECIFIED Adapter size is unspecified.
ADAPTER_SIZE_ONE Adapter size 1.
ADAPTER_SIZE_FOUR Adapter size 4.
ADAPTER_SIZE_EIGHT Adapter size 8.
ADAPTER_SIZE_SIXTEEN Adapter size 16.
ADAPTER_SIZE_THIRTY_TWO Adapter size 32.

DistillationSpec

Tuning Spec for Distillation.

Fields
trainingDatasetUri string

Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.

hyperParameters object (DistillationHyperParameters)

Optional. Hyperparameters for Distillation.

studentModel string

The student model that is being tuned, e.g., "google/gemma-2b-1.1-it".

pipelineRootDirectory string

Required. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts.

Union field teacher_model. The teacher model that is being distilled from, e.g., "gemini-1.0-pro-002". teacher_model can be only one of the following:
baseTeacherModel string

The base teacher model that is being distilled, e.g., "gemini-1.0-pro-002".

tunedTeacherModelSource string

The resource name of the Tuned teacher model. Format: projects/{project}/locations/{location}/models/{model}.

validationDatasetUri string

Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.

JSON representation
{
  "trainingDatasetUri": string,
  "hyperParameters": {
    object (DistillationHyperParameters)
  },
  "studentModel": string,
  "pipelineRootDirectory": string,

  // Union field teacher_model can be only one of the following:
  "baseTeacherModel": string,
  "tunedTeacherModelSource": string
  // End of list of possible types for union field teacher_model.
  "validationDatasetUri": string
}

DistillationHyperParameters

Hyperparameters for Distillation.

Fields
adapterSize enum (AdapterSize)

Optional. Adapter size for distillation.

epochCount string (int64 format)

Optional. Number of complete passes the model makes over the entire training dataset during training.

learningRateMultiplier number

Optional. Multiplier for adjusting the default learning rate.

JSON representation
{
  "adapterSize": enum (AdapterSize),
  "epochCount": string,
  "learningRateMultiplier": number
}

PartnerModelTuningSpec

Tuning spec for Partner models.

Fields
trainingDatasetUri string

Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.

validationDatasetUri string

Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.

hyperParameters map (key: string, value: value (Value format))

Hyperparameters for tuning. The accepted hyperParameters and their valid range of values will differ depending on the base model.

JSON representation
{
  "trainingDatasetUri": string,
  "validationDatasetUri": string,
  "hyperParameters": {
    string: value,
    ...
  }
}

TunedModel

The Model Registry Model and Online Prediction Endpoint assiociated with this TuningJob.

Fields
model string

Output only. The resource name of the TunedModel. Format: projects/{project}/locations/{location}/models/{model}.

endpoint string

Output only. A resource name of an Endpoint. Format: projects/{project}/locations/{location}/endpoints/{endpoint}.

JSON representation
{
  "model": string,
  "endpoint": string
}

TuningDataStats

The tuning data statistic values for TuningJob.

Fields

Union field tuning_data_stats.

tuning_data_stats can be only one of the following:

supervisedTuningDataStats object (SupervisedTuningDataStats)

The SFT Tuning data stats.

distillationDataStats object (DistillationDataStats)

Output only. Statistics for distillation.

JSON representation
{

  // Union field tuning_data_stats can be only one of the following:
  "supervisedTuningDataStats": {
    object (SupervisedTuningDataStats)
  },
  "distillationDataStats": {
    object (DistillationDataStats)
  }
  // End of list of possible types for union field tuning_data_stats.
}

SupervisedTuningDataStats

Tuning data statistics for Supervised Tuning.

Fields
tuningDatasetExampleCount string (int64 format)

Output only. Number of examples in the tuning dataset.

totalTuningCharacterCount string (int64 format)

Output only. Number of tuning characters in the tuning dataset.

totalBillableCharacterCount
(deprecated)
string (int64 format)

Output only. Number of billable characters in the tuning dataset.

totalBillableTokenCount string (int64 format)

Output only. Number of billable tokens in the tuning dataset.

tuningStepCount string (int64 format)

Output only. Number of tuning steps for this Tuning Job.

userInputTokenDistribution object (SupervisedTuningDatasetDistribution)

Output only. Dataset distributions for the user input tokens.

userOutputTokenDistribution object (SupervisedTuningDatasetDistribution)

Output only. Dataset distributions for the user output tokens.

userMessagePerExampleDistribution object (SupervisedTuningDatasetDistribution)

Output only. Dataset distributions for the messages per example.

userDatasetExamples[] object (Content)

Output only. Sample user messages in the training dataset uri.

JSON representation
{
  "tuningDatasetExampleCount": string,
  "totalTuningCharacterCount": string,
  "totalBillableCharacterCount": string,
  "totalBillableTokenCount": string,
  "tuningStepCount": string,
  "userInputTokenDistribution": {
    object (SupervisedTuningDatasetDistribution)
  },
  "userOutputTokenDistribution": {
    object (SupervisedTuningDatasetDistribution)
  },
  "userMessagePerExampleDistribution": {
    object (SupervisedTuningDatasetDistribution)
  },
  "userDatasetExamples": [
    {
      object (Content)
    }
  ]
}

SupervisedTuningDatasetDistribution

Dataset distribution for Supervised Tuning.

Fields
sum string (int64 format)

Output only. Sum of a given population of values.

billableSum string (int64 format)

Output only. Sum of a given population of values that are billable.

min number

Output only. The minimum of the population values.

max number

Output only. The maximum of the population values.

mean number

Output only. The arithmetic mean of the values in the population.

median number

Output only. The median of the values in the population.

p5 number

Output only. The 5th percentile of the values in the population.

p95 number

Output only. The 95th percentile of the values in the population.

buckets[] object (DatasetBucket)

Output only. Defines the histogram bucket.

JSON representation
{
  "sum": string,
  "billableSum": string,
  "min": number,
  "max": number,
  "mean": number,
  "median": number,
  "p5": number,
  "p95": number,
  "buckets": [
    {
      object (DatasetBucket)
    }
  ]
}

DatasetBucket

Dataset bucket used to create a histogram for the distribution given a population of values.

Fields
count number

Output only. Number of values in the bucket.

left number

Output only. left bound of the bucket.

right number

Output only. Right bound of the bucket.

JSON representation
{
  "count": number,
  "left": number,
  "right": number
}

DistillationDataStats

Statistics computed for datasets used for distillation.

Fields
trainingDatasetStats object (DatasetStats)

Output only. Statistics computed for the training dataset.

JSON representation
{
  "trainingDatasetStats": {
    object (DatasetStats)
  }
}

DatasetStats

Statistics computed over a tuning dataset.

Fields
tuningDatasetExampleCount string (int64 format)

Output only. Number of examples in the tuning dataset.

totalTuningCharacterCount string (int64 format)

Output only. Number of tuning characters in the tuning dataset.

totalBillableCharacterCount string (int64 format)

Output only. Number of billable characters in the tuning dataset.

tuningStepCount string (int64 format)

Output only. Number of tuning steps for this Tuning Job.

userInputTokenDistribution object (DatasetDistribution)

Output only. Dataset distributions for the user input tokens.

userMessagePerExampleDistribution object (DatasetDistribution)

Output only. Dataset distributions for the messages per example.

userDatasetExamples[] object (Content)

Output only. Sample user messages in the training dataset uri.

userOutputTokenDistribution object (DatasetDistribution)

Output only. Dataset distributions for the user output tokens.

JSON representation
{
  "tuningDatasetExampleCount": string,
  "totalTuningCharacterCount": string,
  "totalBillableCharacterCount": string,
  "tuningStepCount": string,
  "userInputTokenDistribution": {
    object (DatasetDistribution)
  },
  "userMessagePerExampleDistribution": {
    object (DatasetDistribution)
  },
  "userDatasetExamples": [
    {
      object (Content)
    }
  ],
  "userOutputTokenDistribution": {
    object (DatasetDistribution)
  }
}

DatasetDistribution

Distribution computed over a tuning dataset.

Fields
sum number

Output only. Sum of a given population of values.

min number

Output only. The minimum of the population values.

max number

Output only. The maximum of the population values.

mean number

Output only. The arithmetic mean of the values in the population.

median number

Output only. The median of the values in the population.

p5 number

Output only. The 5th percentile of the values in the population.

p95 number

Output only. The 95th percentile of the values in the population.

buckets[] object (DistributionBucket)

Output only. Defines the histogram bucket.

JSON representation
{
  "sum": number,
  "min": number,
  "max": number,
  "mean": number,
  "median": number,
  "p5": number,
  "p95": number,
  "buckets": [
    {
      object (DistributionBucket)
    }
  ]
}

DistributionBucket

Dataset bucket used to create a histogram for the distribution given a population of values.

Fields
count string (int64 format)

Output only. Number of values in the bucket.

left number

Output only. left bound of the bucket.

right number

Output only. Right bound of the bucket.

JSON representation
{
  "count": string,
  "left": number,
  "right": number
}

Methods

cancel

Cancels a TuningJob.

create

Creates a TuningJob.

get

Gets a TuningJob.

list

Lists TuningJobs in a Location.

rebaseTunedModel

Rebase a TunedModel.