Reinforcement learning fine-tuning job

A reinforcement learning fine-tuning job for Gemini models is configured with three main building blocks: a tuning dataset, hyperparameters that control the training process, and one or more reward functions that score each model response. The service also exposes metrics and job status for monitoring.

For an end-to-end example of creating a tuning job, retrieving the tuned model, and running inference, see the Quick start.

Prepare the tuning dataset

A reinforcement learning fine-tuning job is driven by a training dataset and an optional validation dataset. Each dataset is a JSONL file stored in Cloud Storage. Every line is a single tuning example that contains a systemInstruction, contents (the prompt the model responds to during tuning), and a references map that carries any metadata your reward function needs to score the model's response (for example, a ground-truth answer, a rubric, or unit-test input).

Reinforcement learning fine-tuning supports multimodal prompts (text, image, audio, and video), subject to per-file and per-prompt limits.

For the full dataset schema, the modality-specific dataset limits, and an example of how to populate references for reward computation, see the Tuning dataset page.

Configure hyperparameters

Hyperparameters control how the model is updated during reinforcement learning fine-tuning, including the thinking level used during generation, batch size, samples per prompt, learning rate multiplier, epoch count, evaluation and checkpoint intervals, maximum output length, and the LoRA adapter size. The defaults work well for most workloads, but you can override any of them in the request body when you create a tuning job.

For default values, allowed ranges, dataset-size-dependent rules, and recommended combinations, see the Hyperparameters page.

Define reward functions

A reward function numerically scores each model response during tuning. The reward signal is what reinforcement learning optimizes against, so its quality directly determines tuning quality. All rewards are clipped to the range [-1, 1].

Reinforcement learning fine-tuning supports the following reward types:

  • String matching reward — Compares the model response (or a parsed substring of it) against a ground-truth value supplied in references.
  • Gemini-based autorater reward — Uses an LLM-as-a-judge to score each response, optionally with response parsing.
  • Cloud Run reward — Calls a user-managed Cloud Run service that returns a scalar reward, for fully customizable scoring logic.
  • Composite reward — Combines any of the above reward types with per-scorer weights.

Before you launch a tuning job, we strongly recommend validating your reward configuration with the ValidateReinforcementTuningReward API.

For detailed configuration schemas, code samples, IAM setup, and reward-design best practices, see the Reward functions page.

Monitor job status and metrics

Once a tuning job is launched, you can track its lifecycle state (such as JOB_STATE_PENDING, JOB_STATE_RUNNING, JOB_STATE_SUCCEEDED, JOB_STATE_FAILED, JOB_STATE_CANCELLING, JOB_STATE_CANCELLED) and inspect tuning progress in two ways:

  • Programmatically — Issue a GetTuningJob request to retrieve the job's state, tunedModel, error details, and metadata. See the Quick start for an example curl command.
  • Visually — Open the job's monitoring page in the Google Cloud console under Agent Platform > Model > Tuning, which shows the underlying tuning experiment with charts for the training and evaluation metrics emitted at each step (reward, generation length, reward latency, per-reward breakdowns for composite rewards, and so on).

Reinforcement learning fine-tuning also produces intermediate checkpoints at the frequency set by checkpointInterval, which you can deploy and evaluate independently before the job completes.

For the complete list of emitted metrics, per-reward-type metrics, how to interpret them, and how to access checkpoints, see the Metrics and monitoring page.

What's next