Table of Contents

Class PreferenceOptimizationHyperParameters

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

Hyperparameters for Preference Optimization. This data type is not supported in Gemini API.

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

Properties

AdapterSize

Optional. Adapter size for preference optimization.

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

Property Value

AdapterSize?

Beta

Optional. Weight for KL Divergence regularization.

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

Property Value

double?

EpochCount

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

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

Property Value

long?

LearningRateMultiplier

Optional. Multiplier for adjusting the default learning rate.

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

Property Value

double?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a PreferenceOptimizationHyperParameters object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

PreferenceOptimizationHyperParameters

The deserialized PreferenceOptimizationHyperParameters object, or null if deserialization fails.