最新资讯
dev.to 如何在专用 GPU 服务器上用 OpenAI 兼容 API 部署 LLM dev.to 审计 153 份 Claude Code 与 Codex 会话记录:User-Agent 与 URL 中的邮箱泄露 dev.to 你的 Agent Harness 应具备的 17 项能力 dev.to 离线 AI 记忆中 0.8 余弦阈值为何失效 dev.to Kimi K3.1 Pro 开放权重:自托管 2.8T 模型前的开发者清单 dev.to 如何通过工具调用引导模型以提升 Harness 质量 dev.to AI Agent 审计轨迹不等于对话记录 dev.to 精简 MCP server 工具数量:更少工具、更小影响面,双重收益 dev.to 为什么 git checkout 无法撤销 AI 编码 agent 的改动? wechat AI短剧门槛降降降!实测即梦短剧工作室:剧本分镜预演一条龙,伙伴计划长期护航 dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围
多元动态
登录 注册
大模型 cloud.google.com · @Google Cloud Blog

通过强化学习定制 Gemini 模型的最佳实践指南

原文 我的收藏

Google Cloud 官方博客介绍其托管式强化学习微调服务(RLFT):用户提供提示词和奖励函数,Google 负责基础设施和 Gemini 专有模型内部细节。文章说明 RLFT 从模型自身输出中学习、奖励结果而非路径、只能放大模型已有能力,因此适合“难以示范但易于打分”的任务,例如可执行验证的 SQL。文中建议先尝试提示工程和 SFT,当 SFT 在关键指标上停滞或任务存在多种等价正确答案时再使用 RLFT,并给出直接 RLFT 与 SFT→RLFT 两阶段策略的选择依据。

AI推荐理由 Google Cloud 官方博客系统讲解托管式 RL 微调服务(RLFT)的适用场景与最佳实践,明确提出 RLFT 从奖励信号学习、奖励结果而非路径、只能放大已有能力等边界,并给出 SFT 与 RLFT 的取舍和两阶段组合建议,对做模型定制的开发者有实际参考价值。局限是文章为方法论指南,未披露具体训练成本、吞吐或效果对比数据。

80

正文

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. Documentation: Reinforcement Learning Fine-Tuning

来源报道 · 2 篇 · 以下链接均前往原始媒体

opmlrss::Google Cloud Blog 通过强化学习定制 Gemini 模型的最佳实践指南 09-26 · 原文发布
← 返回精选动态 原文

更多内容