Table of Contents

Class CreateTuningJobConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Fine-tuning job creation request - optional fields.

public record CreateTuningJobConfig : IEquatable<CreateTuningJobConfig>
Inheritance
CreateTuningJobConfig
Implements
Inherited Members

Properties

AdapterSize

Adapter size for tuning.

[JsonPropertyName("adapterSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AdapterSize? AdapterSize { get; set; }

Property Value

AdapterSize?

BaseTeacherModel

The base teacher model that is being distilled. Distillation only.

[JsonPropertyName("baseTeacherModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BaseTeacherModel { get; set; }

Property Value

string

BatchSize

The batch size hyperparameter for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform.

[JsonPropertyName("batchSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BatchSize { get; set; }

Property Value

int?

Beta

Weight for KL Divergence regularization, Preference Optimization tuning only.

[JsonPropertyName("beta")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Beta { get; set; }

Property Value

double?

CheckpointInterval

How often at steps to save checkpoints during training. Reinforcement tuning only.

[JsonPropertyName("checkpointInterval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? CheckpointInterval { get; set; }

Property Value

int?

CompositeRewardConfig

Composite reward function configuration for reinforcement tuning. Reinforcement tuning only.

[JsonPropertyName("compositeRewardConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public CompositeReinforcementTuningRewardConfig? CompositeRewardConfig { get; set; }

Property Value

CompositeReinforcementTuningRewardConfig

CustomBaseModel

Custom base model for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform.

[JsonPropertyName("customBaseModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CustomBaseModel { get; set; }

Property Value

string

Description

The description of the TuningJob

[JsonPropertyName("description")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Description { get; set; }

Property Value

string

EncryptionSpec

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

[JsonPropertyName("encryptionSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public EncryptionSpec? EncryptionSpec { get; set; }

Property Value

EncryptionSpec

EpochCount

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

[JsonPropertyName("epochCount")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? EpochCount { get; set; }

Property Value

int?

EvaluateInterval

How often at steps to evaluate the tuning job during training. Reinforcement tuning only.

[JsonPropertyName("evaluateInterval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? EvaluateInterval { get; set; }

Property Value

int?

ExportLastCheckpointOnly

If set to true, disable intermediate checkpoints and only the last checkpoint will be exported. Otherwise, enable intermediate checkpoints.

[JsonPropertyName("exportLastCheckpointOnly")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? ExportLastCheckpointOnly { get; set; }

Property Value

bool?

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

Labels

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.

[JsonPropertyName("labels")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string>? Labels { get; set; }

Property Value

Dictionary<string, string>

LearningRate

The learning rate for tuning. OSS models only. Mutually exclusive with learning_rate_multiplier.

[JsonPropertyName("learningRate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? LearningRate { get; set; }

Property Value

double?

LearningRateMultiplier

Multiplier for adjusting the default learning rate. 1P models only. Mutually exclusive with learning_rate.

[JsonPropertyName("learningRateMultiplier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? LearningRateMultiplier { get; set; }

Property Value

double?

MaxOutputTokens

The maximum number of tokens to generate per prompt. Reinforcement tuning only.

[JsonPropertyName("maxOutputTokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxOutputTokens { get; set; }

Property Value

int?

Method

The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION or REINFORCEMENT_TUNING). If not set, the default method (SFT) will be used.

[JsonPropertyName("method")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningMethod? Method { get; set; }

Property Value

TuningMethod?

OutputUri

The Google Cloud Storage location where the tuning job outputs are written.

[JsonPropertyName("outputUri")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? OutputUri { get; set; }

Property Value

string

PreTunedModelCheckpointId

The optional checkpoint id of the pre-tuned model to use for tuning, if applicable.

[JsonPropertyName("preTunedModelCheckpointId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? PreTunedModelCheckpointId { get; set; }

Property Value

string

RewardConfig

Reward function configuration for reinforcement tuning. Reinforcement tuning only.

[JsonPropertyName("rewardConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SingleReinforcementTuningRewardConfig? RewardConfig { get; set; }

Property Value

SingleReinforcementTuningRewardConfig

SamplesPerPrompt

Number of different responses to generate per prompt during tuning. Reinforcement tuning only.

[JsonPropertyName("samplesPerPrompt")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? SamplesPerPrompt { get; set; }

Property Value

int?

SftLossWeightMultiplier

Multiplier for adjusting the weight of the SFT loss. Distillation only.

[JsonPropertyName("sftLossWeightMultiplier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? SftLossWeightMultiplier { get; set; }

Property Value

double?

ThinkingLevel

Indicates the maximum thinking depth. Use with earlier models shall result in error. Reinforcement tuning only.

[JsonPropertyName("thinkingLevel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ReinforcementTuningThinkingLevel? ThinkingLevel { get; set; }

Property Value

ReinforcementTuningThinkingLevel?

TunedModelDisplayName

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

[JsonPropertyName("tunedModelDisplayName")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TunedModelDisplayName { get; set; }

Property Value

string

TunedTeacherModelSource

The resource name of the Tuned teacher model. Distillation only.

[JsonPropertyName("tunedTeacherModelSource")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TunedTeacherModelSource { get; set; }

Property Value

string

TuningMode

Tuning mode for tuning.

[JsonPropertyName("tuningMode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningMode? TuningMode { get; set; }

Property Value

TuningMode?

ValidationDataset

Validation dataset for tuning. The dataset must be formatted as a JSONL file.

[JsonPropertyName("validationDataset")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningValidationDataset? ValidationDataset { get; set; }

Property Value

TuningValidationDataset

ValidationDatasetUri

Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. If no validation dataset is provided, by default the API splits 25% of the training dataset or 50 examples, whichever is larger, as the validation dataset. Reinforcement tuning only.

[JsonPropertyName("validationDatasetUri")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ValidationDatasetUri { get; set; }

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a CreateTuningJobConfig object.

public static CreateTuningJobConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

CreateTuningJobConfig

The deserialized CreateTuningJobConfig object, or null if deserialization fails.