REST Resource: tunedModels

Resource: TunedModel

A fine-tuned model created using ModelService.CreateTunedModel.

JSON representation
{
  "name": string,
  "displayName": string,
  "description": string,
  "state": enum (State),
  "createTime": string,
  "updateTime": string,
  "tuningTask": {
    object (TuningTask)
  },

  // Union field source_model can be only one of the following:
  "tunedModelSource": {
    object (TunedModelSource)
  },
  "baseModel": string
  // End of list of possible types for union field source_model.
  "temperature": number,
  "topP": number,
  "topK": integer
}
Fields
name

string

Output only. The tuned model name. A unique name will be generated on create. Example: tunedModels/az2mb0bpw6i If displayName is set on create, the id portion of the name will be set by concatenating the words of the displayName with hyphens and adding a random portion for uniqueness. Example: displayName = "Sentence Translator" name = "tunedModels/sentence-translator-u3b7m"

displayName

string

Optional. The name to display for this model in user interfaces. The display name must be up to 40 characters including spaces.

description

string

Optional. A short description of this model.

state

enum (State)

Output only. The state of the tuned model.

createTime

string (Timestamp format)

Output only. The timestamp when this model 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".

updateTime

string (Timestamp format)

Output only. The timestamp when this model was 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".

tuningTask

object (TuningTask)

Required. The tuning task that creates the tuned model.

Union field source_model. The model used as the starting point for tuning. source_model can be only one of the following:
tunedModelSource

object (TunedModelSource)

Optional. TunedModel to use as the starting point for training the new model.

baseModel

string

Immutable. The name of the Model to tune. Example: models/text-bison-001

temperature

number

Optional. Controls the randomness of the output.

Values can range over [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied, while a value closer to 0.0 will typically result in less surprising responses from the model.

This value specifies default to be the one used by the base model while creating the model.

topP

number

Optional. For Nucleus sampling.

Nucleus sampling considers the smallest set of tokens whose probability sum is at least topP.

This value specifies default to be the one used by the base model while creating the model.

topK

integer

Optional. For Top-k sampling.

Top-k sampling considers the set of topK most probable tokens. This value specifies default to be used by the backend while making the call to the model.

This value specifies default to be the one used by the base model while creating the model.

TunedModelSource

Tuned model as a source for training a new model.

JSON representation
{
  "tunedModel": string,
  "baseModel": string
}
Fields
tunedModel

string

Immutable. The name of the TunedModel to use as the starting point for training the new model. Example: tunedModels/my-tuned-model

baseModel

string

Output only. The name of the base Model this TunedModel was tuned from. Example: models/text-bison-001

State

The state of the tuned model.

Enums
STATE_UNSPECIFIED The default value. This value is unused.
CREATING The model is being created.
ACTIVE The model is ready to be used.
FAILED The model failed to be created.

TuningTask

Tuning tasks that create tuned models.

JSON representation
{
  "startTime": string,
  "completeTime": string,
  "snapshots": [
    {
      object (TuningSnapshot)
    }
  ],
  "trainingData": {
    object (Dataset)
  },
  "hyperparameters": {
    object (Hyperparameters)
  }
}
Fields
startTime

string (Timestamp format)

Output only. The timestamp when tuning this model started.

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".

completeTime

string (Timestamp format)

Output only. The timestamp when tuning this model completed.

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".

snapshots[]

object (TuningSnapshot)

Output only. Metrics collected during tuning.

trainingData

object (Dataset)

Required. Input only. Immutable. The model training data.

hyperparameters

object (Hyperparameters)

Immutable. Hyperparameters controlling the tuning process. If not provided, default values will be used.

TuningSnapshot

Record for a single tuning step.

JSON representation
{
  "step": integer,
  "epoch": integer,
  "meanLoss": number,
  "computeTime": string
}
Fields
step

integer

Output only. The tuning step.

epoch

integer

Output only. The epoch this step was part of.

meanLoss

number

Output only. The mean loss of the training examples for this step.

computeTime

string (Timestamp format)

Output only. The timestamp when this metric was computed.

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".

Dataset

Dataset for training or validation.

JSON representation
{

  // Union field dataset can be only one of the following:
  "examples": {
    object (TuningExamples)
  }
  // End of list of possible types for union field dataset.
}
Fields
Union field dataset. Inline data or a reference to the data. dataset can be only one of the following:
examples

object (TuningExamples)

Optional. Inline examples.

TuningExamples

A set of tuning examples. Can be training or validation data.

JSON representation
{
  "examples": [
    {
      object (TuningExample)
    }
  ]
}
Fields
examples[]

object (TuningExample)

Required. The examples. Example input can be for text or discuss, but all examples in a set must be of the same type.

TuningExample

A single example for tuning.

JSON representation
{
  "output": string,

  // Union field model_input can be only one of the following:
  "textInput": string
  // End of list of possible types for union field model_input.
}
Fields
output

string

Required. The expected model output.

Union field model_input. The input to the model for this example. model_input can be only one of the following:
textInput

string

Optional. Text model input.

Hyperparameters

Hyperparameters controlling the tuning process. Read more at https://ai.google.dev/docs/model_tuning_guidance

JSON representation
{

  // Union field learning_rate_option can be only one of the following:
  "learningRate": number,
  "learningRateMultiplier": number
  // End of list of possible types for union field learning_rate_option.
  "epochCount": integer,
  "batchSize": integer
}
Fields
Union field learning_rate_option. Options for specifying learning rate during tuning. learning_rate_option can be only one of the following:
learningRate

number

Optional. Immutable. The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples.

learningRateMultiplier

number

Optional. Immutable. The learning rate multiplier is used to calculate a final learningRate based on the default (recommended) value. Actual learning rate := learningRateMultiplier * default learning rate Default learning rate is dependent on base model and dataset size. If not set, a default of 1.0 will be used.

epochCount

integer

Immutable. The number of training epochs. An epoch is one pass through the training data. If not set, a default of 5 will be used.

batchSize

integer

Immutable. The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples.

Methods

create

Creates a tuned model.

delete

Deletes a tuned model.

generateContent

Generates a response from the model given an input GenerateContentRequest.

generateText

Generates a response from the model given an input message.

get

Gets information about a specific TunedModel.

list

Lists tuned models owned by the user.

patch

Updates a tuned model.

transferOwnership

Transfers ownership of the tuned model.