Best practices guide for customizing Gemini models via Reinforcement Learning (RL)
Jiaqi Pan
Senior Software Engineer, Google
Kunal Jha
Senior Product Manager, Google
Reinforcement learning (RL) has been a keystone of modern LLM post-training, but it demands large training clusters and access to model internals that external customers can't have with proprietary models like Gemini. So here at Google Cloud, we packaged it into a managed RL fine-tuning service (RLFT service) — you bring prompts and a reward function; we handle the infrastructure and the proprietary model internals.
Now, you can adapt Gemini with the service — teaching the model from a reward signal you define, rather than from a fixed set of labeled answers. This unlocks a class of problems that supervised fine-tuning (SFT) struggles with: tasks that are hard to demonstrate but easy to score.
In this guide, we will walk through practical best practices for using RL fine-tuning service. We'll start with a short tour of the RL training loop, how to decide if and when to use RL, and introduce how to get the most value from this approach.
What is RLFT?
RLFT adapts Gemini from a reward signal you define rather than labeled answers. Instead of authoring a large set of gold examples, you write one program that scores a response and the service improves the model against it — unlocking tasks that are hard to demonstrate but easy to verify: you can't hand-write the ideal SQL for every schema, but you can run the query and check the result.


At each training step the service generates multiple candidate responses to your prompts, scores them with your reward, and improves the model so that higher-scoring responses become more likely while it stays close to the original Gemini. The reinforcement learning that makes this work is fully managed — you never configure it. The one thing you own, and the thing that most determines your results, is the reward.
Three properties define what RLFT can and can't do:
-
It learns from the model's own outputs: It refines what the model already produces rather than copying an external target, so it tends to disturb unrelated capabilities less than SFT.
-
It rewards outcomes, not paths: Any response that reaches a good result earns reward, which fits open-ended tasks with many valid solutions.
-
It amplifies existing competence: It makes occasional success reliable, but it can't teach a skill the model never demonstrates.
When to use RLFT


Prompting and SFT handle most adaptation; exhaust them first. RLFT earns its keep when you can grade a response but can't cheaply author it, when SFT has plateaued on the metric that matters (faithfulness, schema validity, tone), or when the task has many equally valid answers a single reference target would wrongly penalize.
SFT and RLFT are complementary, not competing:
-
Direct RLFT when the base model already succeeds part of the time — enough for the reward to tell better answers from worse ones.
-
Two-stage SFT → RLFT when you have SFT data or the base success rate is too low for RL to gain traction. Use SFT as a short, cheap warm start — kept light, since over-fitting the demonstrations leaves less room for RL to improve — then continue into RL via Continuous Tuning, which initializes RL from the SFT checkpoint.
Across early adopters, these patterns show where RLFT delivers the most value — each scoring an outcome the business cares about but could never cheaply demonstrate.
Use cases for RLFT
AI-powered NPCs in games
-
What: In-character, on-brand dialogue held across long, multilingual, multi-turn conversations.
-
Problem: Off-the-shelf models break immersion — wrong language, hallucinated items, ignored players, repetitive loops.
-
Objective and reward: A Gemini autorater (LLM-as-a-judge) scores each turn on persona, flow, and game-state syntax, penalizing format and language errors.
-
Results: Loops and language drift disappeared and state syntax held, making shippable in-game characters viable at scale.
Structured entity extraction
-
What: Pulling a set of items from unstructured documents, such as supplier invoices and shipping manifests, into structured records automatically.
-
Problem: The long tail where SFT plateaus — missing required fields (recall) or inventing ones that aren't there (precision).
-
Objective and reward: A rule-based precision/recall reward forces every field to be grounded in the source text, not imitated from one gold answer.
-
Results: Field-level accuracy rose on noisy real-world documents where tuning had stalled, turning a manual review step into an automated one.
Content moderation
-
What: Applying intricate policies and decision trees at scale.
-
Problem: Models hallucinate false positives or reward-hack with invalid formats to dodge evaluation.
-
Objective and reward: A Cloud Run reward pairs format validation with a deterministic grader to enforce multi-step policy adherence.
-
Results: The model handled complex exemption carve-outs, sharply cut false positives, and stopped reward hacking — reducing the human-escalation volume that makes moderation expensive.
Code measured by execution
-
What: SQL or API calls graded on whether they actually run against customer data.
-
Problem: SFT mimics one reference query and breaks on unseen proprietary schemas.
-
Objective & Reward: A code-execution reward runs the code in a secure sandbox and pays out only if it compiles, executes, and returns the correct result.
-
Results: The model produced first-attempt executable queries at closed-frontier quality and lower inference cost, letting non-technical users query proprietary data in natural language.
Presentation slide generation via HTML
-
What: Multi-slide decks authored as HTML/CSS.
-
Problem: Training on text alone is blind to visual quality — overflows, clipped elements, and inconsistent styling slip through unnoticed.
-
Objective & Reward: A code-execution reward renders the slides and scores visual design, layout integrity, structural completeness, and rubric adherence.
-
Results: The model emitted modular, well-styled decks with cohesive themes and no layout overflow.
Where to start?
-
A dataset. A diverse set of prompts with a held-out validation split is enough for a first run — confirm the loop converges and reward moves the right way, then scale. Keep train and eval strictly separated; a contaminated eval hides overfitting.
-
A reward function. Your task specification as code or configs, and the dominant driver of quality. A good reward correlates with human preference, is robust to malformed output (catch the failed parse and return a clearly negative score rather than crashing), and resists reward hacking — ensemble judges, penalize length, floor degenerate outputs, and prefer a verifiable check over a model's opinion. Validate it offline before launch.
The service handles the rest; start from the defaults, watch reward and eval curves in the console, and take the checkpoint where validation reward saturates rather than the last step.


Get started today
What will you build? The tools are ready and waiting.



