读见

训练自己的智能体模型已具备可行性,Modal 分享异步强化学习实践

原题Training Your Own Agent Models With RL Is Now Practical - Jason Mancuso, Modal

约 15 分钟原文英文已翻译

视频由 YouTube 提供

看前速览

3 个要点

Modal 的 Jason Mancuso 介绍团队如何复用现有智能体运行框架和评估信号,用稳定的异步强化学习训练自己的模型。

  1. 从现有部署提取训练任务

    先利用现有智能体运行框架和衡量改动是否有效的评估信号,从失败的生产记录中提取任务。

  2. 异步训练减少空闲,也引入训练与推理偏差

    推理和训练并行能提高 GPU 利用率,但采样可能使用旧权重或不同的运行环境。带掩码的重要性采样、分数中心化和 top-p 掩码重放分别处理不同偏差。

  3. 稀疏更新让分布式采样可行

    压缩相邻训练步骤之间的权重差,可减少向远端推理节点传输的数据。Modal 在实验中使用多种 GPU,并报告生成轨迹的成本降低 15%。

完整摘要

Jason Mancuso 从团队为什么要掌握智能体推理讲起,解释如何把生产交互记录和评估转化为强化学习的训练任务。异步生成轨迹能提高 GPU 利用率,也会引入过时样本和训练端、推理端的行为差异。Modal 将带掩码的重要性采样、分数中心化和 top-p 采样掩码重放结合起来。借助稀疏权重更新,训练端可留在同一个集群,推理端则分布到多个云和 GPU 型号。讲者称,这次实验在逐一优化各类 GPU 的推理部署之前,生成轨迹的成本已降低 15%。

章节

文字稿

查看原文

简要说明Brief Description

Jason Mancuso 解释了团队何时有理由训练自己的智能体模型,随后介绍 Modal 如何在分散的 GPU 集群上实现稳定的异步强化学习。Jason Mancuso explains when teams can justify training their own agent models, then walks through Modal’s approach to stable asynchronous reinforcement learning across a fragmented GPU fleet.

目录Table of Contents

  • 简介
    Intro
  • 模型并非静态后端
    Models aren't static backends
  • 团队为何进行微调
    Why teams fine-tune
  • 为什么选择强化学习(RL)而不是监督微调(SFT)
    Why RL instead of SFT
  • 你已经拥有所需的一切。
    You already have what you need
  • 强化学习的工作原理
    How reinforcement learning works
  • 异步强化学习与陈旧性
    Async RL and staleness
  • 一套稳定的强化学习方案
    A stable RL recipe
  • 为什么在 Modal 上进行强化学习有所不同
    Why RL on Modal is different
  • 稀疏权重更新
    Sparse weight updates
  • 为 rollout 混用不同类型的 GPU
    Mixing GPU types for rollouts
  • 部署成本降低 15%
    15% cheaper rollouts
  • 掌控你的技术栈
    Own your stack

简介Intro

我是 Jason,来自 Modal。今天我将谈谈如何在全球范围内扩展智能体强化学习。I'm Jason. I'm from Modal, and today I'm talking about scaling agent RL across the globe.

模型并非静态后端Models aren't static backends

但首先,我觉得很多 AI 工程师把模型看成某种静态后端,随着新模型推出,就把它们换掉。他们可能会测试模型、运行评估、做 A/B 测试,然后围绕最适合自身用例、成本最低且质量最高的模型重建整个工具链。但我在这次演讲中想提出的观点是:当你最终必须同时在智能体的经济效益和使用体验上展开竞争,并兼顾提供差异化价值这两个相互竞争的优先目标时,这实际上是一种注定会失败的策略。But first, I think a lot of AI engineers view models as kind of like static backends that they kind of swap out like as the new models come out. They'll maybe test the models, run evals, do A/B tests, and kind of like rebuild their harness around whatever model is cheapest, but also highest quality for their use cases. And the claim I want to make for this talk is that this is actually a losing strategy when you end up having to compete on like not only the agent economics, but also the experience of the agent and like these two competing priorities of like offering differentiated value.

团队为何进行微调Why teams fine-tune

我认为,这正是我们从做微调的客户那里听到的情况。我觉得微调最早兴起的领域,是那些部署了智能体、需要可靠服务等级目标(SLO)的用户。也就是说,他们需要可靠性方面的 SLO。要实现这一点,他们就需要掌控自己的推理服务。而开源模型开箱即用时,并不总是能支持他们的部署需求,同时还保持质量不下降。我认为,尤其是在这些部署日趋成熟之后,微调是掌控自己推理服务的唯一途径。更重要的是,它能让你在延迟、质量和成本这几个维度上整体不断提升。可以说,做了微调,你就能自己掌控这一切。And I think this is what we hear from our customers who do fine tuning. It's like the first area where I think fine tuning took off is people who had agent deployments who need reliable SLOs. Like they need reliability SLOs. If they need those, then they need to own their own inference. And the open source models out of the box were not always capable of supporting their deployments without, degrading in quality. And I think fine tuning, especially, after these deployments became more mature, I think was the only path to owning your own inference. But more importantly, kind of like pushing yourself up this curve in terms of latency, quality, and cost all together. Like if you do fine tuning, you like own all these yourself kind of.

不过还有其他用例。我觉得我们听到的一个挺有意思的用例是:有些专有数据集需要智能体实际进行推理、理解并据此采取行动,但这些数据集并未出现在任何预训练数据集中。因此,开箱即用的模型有时并不适用:人们会基于这些模型构建智能体,让它们处理这类数据,而 Claude 或 GPT 在这些任务上却完全行不通。所以,他们实际上别无选择,只能微调开源模型。最后,我觉得围绕微调正在形成一种新趋势:为了通过智能体打造差异化价值,越来越多的人决定对技术栈的各个层面进行垂直整合。这种做法在一些行业里最常见,因为这些行业的人们已经在围绕某种指标展开竞争,比如编程领域的「每美元所能获得的任务智能」。There were other use cases though. I think one we heard which was interesting was proprietary data sets that their agents actually needed to reason about and understand and take action on, but these data sets were like not present in any pre-training set. And so they're like out of the box, sometimes they would build agents on that had to deal with this type of data and Claude or GPT just like would not work at all for these tasks. And so they actually just had no other alternative but to fine tune open source models. And lastly, I think like there's an emerging attitude around fine tuning, which is in order to build differentiated value with agents, like more and more people are deciding to vertically integrate across all the different levels of the stack. These are this is most common in industries where people are already competing on like some metric of task intelligence per dollar like coding.

但我认为,随着这个行业逐渐成熟,我们应该会看到这种趋势不只出现在编程领域,而是继续扩展到其他领域。所以我觉得这就是为什么很多 AI 工程师还没有完全认可微调:新一代模型一推出,就比他们用上一代模型微调出来的任何模型都好。不过我认为,人们进行微调的原因有很多。从长远来看,我觉得这种做法只会越来越普遍。But I think what we should see as the industry matures outside of just coding is like we should see this trend kind of continue elsewhere. So I think that's that's why I think a lot of AI engineers have not really been fully bought in because the latest model comes out and it's better than any model they could fine tune from the last generation, but I think there's like a lot of different reasons people do fine tuning and in the long haul, I think yeah, this is only going to become more common.

为什么选择强化学习而非监督微调Why RL instead of SFT

所以你可能听说过强化学习(RL)或监督微调(SFT)中的微调。问题是,为什么这次要谈 RL,而不是 SFT?我想在这里传达的观点是,如果你在做 SFT,基本上就是在生产环境中用记录下来的轨迹进行训练。但问题在于,尤其是智能体,它们会根据运行的轮数呈现出这种分支结构。因此在生产环境中,如果你用某条特定轨迹进行训练,之后部署这个模型时,它可能会遇到会话中完全不同的分支,就像一棵包含各种可能会话的树。这相当糟糕。SFT 在这方面相当脆弱。所以,RL 之所以成为微调的主流范式,大致是因为模型在 RL 中会在训练阶段实际探索所有这些分支。So you may have heard of fine tuning in the context of RL or SFT and the question is why is this talk about RL and not SFT? I think the idea that I want to communicate here is that if you're if you're doing SFT, you're basically training on traces recorded during production. But the problem is that agents in particular have this like branching structure based on the number of turns that they run. So in production, if you train on this particular trace, later on when you deploy that model, it may see like a completely different branch in the kind of like session like the tree of possible sessions. And this is quite bad. SFT is quite brittle in this regard. So kind of like why RL has emerged as this like dominant paradigm of fine tuning is that in RL the model actually explores all of these branches during training time.

至少这算是一种期望;人们谈到强化学习(RL)在泛化方面表现更好时,通常指的就是这个。At least that's kind of the hope and when people talk about RL like generalizing better, that's often what they mean.

你已经拥有所需的一切You already have what you need

我认为人们觉得这种权衡很难处理,一个原因是他们觉得强化学习中的后训练和微调很困难。但我认为,我在这里真正想表达的是:如果你已经在生产环境中部署了智能体,那么你很可能已经具备了所需的条件。也就是说,如果你已经上线运行,就有一个部署在某处的智能体运行框架,而且希望你还做了某种评测。未必非得称之为“评测”:它可以是 A/B 测试,也可以是你为这个运行框架、这项部署进行变更管理的任何方式。但这两者结合起来,就能为你提供所需的工具,基本上可以搭建出一个你能视为环境的东西,也就是一个强化学习环境。生产环境中的轨迹之所以重要,是因为你需要从某处获取高质量的任务,以便在这个环境中训练。I think one reason why this tradeoff has been hard for people is that they view like post training and fine tuning in RL as difficult. But I think my claim here is actually that if you have an agent deployment in production, you probably already have the ingredients you need. So if you're in production, you have an agent harness that's deployed somewhere and hopefully you have evals of some kind. Maybe calling it evals is not necessarily required. It could be A/B tests, it could be basically any way you do change management for this harness, for this deployment. But those two together give you the tools you need to basically build out something that you can consider an environment, an RL environment. And why production traces are important for this is that you need to kind of get high quality tasks to train on in this environment from somewhere.

而通常最好的做法,是根据用户在实际生产环境中使用产品时留下的真实轨迹,合成生成这些任务。然后找出产品在哪些情况下会出错,从中挖掘示例,并围绕这些示例创建任务,这样微调才有机会改善产品在这些方面的表现。基本上,这就是进行强化学习所需要做的一切。 不过,接下来谈到它难的部分:即使你已经部署了一个智能体,也不代表你的团队就一定有能力开展强化学习——或者至少你可能会这么觉得。这大概是因为强化学习一向以难做著称。但我认为,过去一年左右,尤其是最近几个月,我们多少已经摸清了强化学习的科学原理。And the best place often to do that is to synthetically generate these tasks from actual live production traces of things that your users are doing with your product and yeah kind of forming finding examples where it's failing, mining those and creating tasks around them so that fine tuning actually gives you some chance of improving your product in those areas. And this is basically all you need to do RL. But then the next part about it being hard is that okay once just because you have an agent deployment doesn't mean that your team may be capable or maybe that's how you feel. And probably because RL has a reputation of just being difficult generally. But I think over the last couple of at least over the last year over the last several months like we have kind of figured out the science of RL.

这就是我今天要重点讨论的内容:一种我们非常成功的强化学习方案,我认为它简化并稳定了许多过去难以处理的问题。And that's what I'm going to basically talk about today is that a particular RL recipe that we've had a lot of success with that I think simplifies and stabilizes a lot of what was difficult before.

强化学习的工作原理How reinforcement learning works

不过,首先简单回顾一下强化学习是怎么运作的?它其实就是一个循环。具体来说,整个过程是这样的:你有一批推理 GPU 在运行采样器,也就是你正在训练的模型。然后,你会用这个模型在环境中,通过你的运行框架生成一批批轨迹。这些轨迹会被收集起来,送给训练器;训练器利用这些数据,通过梯度下降来更新模型。接着,你会把更新后的模型的新权重广播给所有采样器。随着时间推移,你生成的轨迹就会来自这个不断改进的模型。所以你其实就是在两者之间来回切换、不断迭代,模型也就这样逐渐变得更好。But first okay just to kind of recap how does reinforcement learning work? It's it's this loop. Mechanically this is what's happening. You have a bunch of inference GPUs that are running your sampler aka the model that you're training. And those rollouts you basically generate rollouts in your environment with your harness. Those rollouts get collected and fed to a trainer which is consuming all this data and updating the model with gradient descent. And then that updated model you broadcast those new weights to all the samplers and over time you the rollouts you're generating are from this like continuously improving model. So you're you're you're kind of like going back and forth between them and iterating and that's how the model improves.

异步强化学习与陈旧性Async RL and staleness

结果发现,RL 的数学原理倾向于采用顺序方式来完成这件事。也就是说,先进行 rollout,然后训练并更新模型,再把模型更新结果发回 rollout 端,这样生成的新 rollout 就会来自模型的新版本。但问题是,这会浪费大量闲置算力。虽然有办法让两项任务共享 GPU,但我认为,尤其是对于智能体来说,更好的做法是让两项任务持续并行、异步地进行。这样更好,因为你可以充分利用 GPU,提高利用率,避免浪费资金。但缺点是,你生成的 rollout 很可能来自模型的旧副本。这就是人们所说的异步 RL 中的陈旧性。So it turns out that like the math of RL prefers this to be done sequentially. So first you do your rollouts then you train and update your model then you take that model update send it back to your roll out side so that the new rollouts you generate are from that new version of the model. But the problem is that this wastes a ton of idle compute. There are ways to like share the GPUs between the two but I think especially with agents what's much better is that if you actually are continuously doing both in parallel, asynchronously. This is better because you can like pack your GPUs, get high utilization from them, and not waste money. But the downside is that your rollouts that you generated were very likely from an old copy of the model. And this is what people refer to as staleness in asynchronous RL.

基本上,这些 rollout 是由 V1 生成的。你现在训练的模型是 V3。如果模型自那以后已经变得更好了,这些 rollout 对 V3 还有用吗?这也是它不稳定的原因之一。它不稳定的另一个原因实际上纯粹出在系统层面。很多细节都可能造成差异,让训练器和采样器各自认为自己正在训练的内容并不相同。基本上,在整个技术栈的各个层面上,行为都可能存在一些细微差异。这意味着,在强化学习的数学原理中,我认为关键在于双方都以为自己在做同一件事:它们认为自己是在从相同的数据中学习,训练相同的分布。Basically rollouts were generated by V1. The current model that you're training is V3. Are those rollouts still useful for V3 if the model's gotten better since then? And this is like one of the reasons why it was unstable. Another reason why it was unstable is actually purely at the systems level. There's a lot of details that can show up as differences between what the trainer and samplers each think they are training. Basically at all these different levels of the stack, there can be these like small differences in behavior. And that means that like in the math of RL, I think the idea is that both sides of this think they're doing the same thing. They think they're learning from the same data, training like the same distribution.

但实际上情况略有不同。因此,我将在这里介绍的解决方案会综合考虑这些差异,并采用一组尽可能简单的修正措施来消除这种不匹配,同时不至于淹没训练循环中的信号。But actually it's like slightly different. And so the solution that I'll present here is accounting for these differences broadly with like kind of the simplest set of fixes that will correct for this mismatch without drowning out the signal of the training loop.

一套稳定的强化学习方案A stable RL recipe

那么,具体的配方是什么?如下。我们从 GRPO 开始。这是 DeepSeek 为 DeepSeek R1 引入的方法,自此之后,它已成为在语言模型上进行强化学习的一项基石。我们加入一种称为掩码重要性采样的方法,用来纠正逐 token 的不匹配。这种不匹配不仅来自我指出的那些系统层面因素,也来自模型的陈旧性。也就是说,如果模型的旧版本在这里采样了另一个 token,那么对应的 token 概率比可能会非常不同,而我们需要以某种方式纠正这种不匹配。我就不在这里过多讲解这些机制的具体运作方式了,但之后会提到它们。第二项是分数中心化。尽管我们在纠正逐 token 的不匹配,但训练过程中,仍然存在的不匹配会不断累积,并且会积累到权重本身之中。So yeah, what's the recipe? Here it is. We start from GRPO. This is what DeepSeek introduced for DeepSeek R1 and since then has become kind of a cornerstone of doing RL on language models. We add something called masked importance sampling. This is correcting for token-wise mismatch. And this mismatch is not just the mismatch from all the systems level stuff that I pointed out. It's also from the staleness as well. So if an old version of the model would have sampled a different token here, the corresponding token-probability ratio can be very different and then this is a mismatch that we want to correct for somehow. And I won't go too much into details here about how these mechanisms work, but I will reference them. And then the second is score centering. So even though we're correcting for each token-wise mismatch, what ends up happening is over the course of training whatever mismatch is still remaining accumulates and it kind of accumulates in the weights themselves.

就像模型的最新版本和预期相比略有不同,尽管我们已经对最明显的差异进行了修正。因此,这种分数居中方法基本上会在整个训练过程中消除这种漂移,而不只是针对每个 token 或每个步骤。它有点像是建立一个会随着漂移累积的项,然后将其消除。最后一点是结合掩码重放的 Top P 采样。Top P 是从语言模型中采样时使用的参数之一。它的意思是只考虑分布中概率质量排名靠前的 P 部分,P 通常取 0.98 或 0.95。也就是说,只考虑概率质量超过 95% 的那些 token。这样就能去掉一大批极少出现、可能质量很差的 token,让它们完全不会被采样到。Like the latest version of the model is slightly different than what it should be even though we've like corrected for the most obvious differences. And so this score centering approach is it basically removes this drift over the course of training not just at each token or at each step. It kind of like builds up a term that accumulates with the drift and removes it. And then the last thing is top P sampling with mask replay. So top P is one of the parameters used when you sample from a language model. Basically says only consider the top P of the distribution, P being like 0.98 0.95. Basically only the tokens that have probability mass greater than 95 or greater than 5%. And so it just removes a bunch of very rare likely bad tokens that can just never be sampled from.

因此,如果你的采样器决定只从这些 token 中采样,但训练器不巧采到了这些稀有 token 之一,那么如果不加以修正,这种概率质量不匹配可能会造成灾难性后果。所以我们对其进行修正。事实证明,从分数中心化的数学原理来看,如果像这样进行 top P 采样,我们用来进行分数中心化的技术实际上是精确的,而不是近似的;因为如果不使用 top P,它实际上只能近似地修正漂移。总之,采用这套方案后,效果会好得多,也稳定得多。这是我们在一个 Qwen 3.6 35B MoE 模型上进行的消融实验。该模型在代码环境上训练,并在[图注中的基准名称不明确]和 hard 51 子集上进行评估。And so if your sampler decides to only sample from these tokens, but your trainer decides unluckily to sample one of these rare tokens, this mass mismatch can be basically catastrophic if you don't correct for it. So we correct for it. It turns out actually in the math of score centering that if you're doing top P sampling like this, that actually the technique we use to do score centering is exact instead of approximate cuz if you don't do top P, it's actually only an approximate correction for drift. So all this is to say that with this recipe things get much better and much more stable. And this is an ablation that we did on a Qwen 3.6 35B MoE model. It's trained on the code environments with evals on [benchmark name unclear in the captions] and the hard 51 subset.

基本上,这展示的是对这些不同技术的消融实验:把它们组合起来后,训练比我们在这里测试过的任何替代方案都稳定得多。嗯,我觉得这些都挺好,但问题是,我们还能把这套方案推进到什么程度?它真的能规模化吗?Basically what this shows is an ablation of these different techniques, putting them all together showing like much more stable training, than any of the alternatives that we've tested here. So yeah, I think the that's all well and good, but I guess the question is like how far can we push this recipe? Does it actually scale?

Modal 上的强化学习为何与众不同Why RL on Modal is different

它适用于广泛的问题吗?在谈这个之前,我想先简单聊聊我们为什么关注 Modal 上的强化学习,以及在 Modal 上做强化学习有哪些不同之处。我想先稍微深入聊聊这个。首先,为什么特别要用 Modal 做智能体强化学习?我们提供训练服务。上周或者大概前一周,我们刚刚正式推出了集群。我们的推理服务也做得非常好,有大量的端点。我们在大规模运行大语言模型推理方面,已经解决了很多棘手的问题。而你所需要的环境,都可以在 Modal 沙箱中运行。所以,最直接地说,我们已经具备了各种基础设施层,或者说基础设施原语,你可以把它们组合起来,构建一套完整的生产级智能体强化学习训练系统。Does it work for broad problems? Before I talk about that, I think I want to talk briefly about why we care about RL at Modal and like some things about doing RL on Modal are different. I kind of want to just like get into that a little bit first. So yeah, first why Modal for agent RL in particular? Well, we do training. We just released clusters as GA last week I think or a week before. We also do inference really well. We have bunches of endpoints. We've We've done a lot of the hard work around doing LLM inference at scale. And the environments you need they run in Modal sandboxes. So like just naively we have all of the kind of infra primitive layers like or infra primitives that you'd want to be able to compose into like a full production agent RL training system.

难点在于,我们的容量模式与其他人非常不同。原因是我们汇集了许多不同供应商的大量算力。这里图中展示了三家,但实际上目前大概有 15 或 20 家。我们使用所有大型云服务商的服务,也使用不少新兴云服务商的服务。GPU 的健康状况和可靠性等问题也都由我们来处理。这种模式确实很好,也有利于提高可靠性,还能实现快速、灵活的调度,并帮助我们应对算力短缺。但它也会导致我们的算力池碎片化。因此,如果要调度大型训练集群,在这种跨多个供应商、多个区域的算力资源池中,实际上相当困难。The difficulty is that our capacity model's very different compared to other people. The reason for that is we aggregate tons of capacity across many different providers. Here there's three pictured, but in reality it's like 15 or 20 at this point. We run on all the hyperscalers, but we also run out a bunch of neoclouds. And we handle all of the kind of like GPU health and reliability concerns. But this is great, but it's great for reliability. It's great for kind of like fast and flexible scheduling. It gets us around compute shortages. But it also fragments our compute pool. So if you want to schedule large training clusters, it's actually quite difficult in this like multi-provider multi-region fleet.

我们设计成可以比较快地调度最多四个或八个节点的集群,但一旦超过这个规模,达到 16 或 32 个节点,情况就会变得非常棘手。要找到一整块连续的节点,往往需要很长时间。在 RL 中,这个问题尤其严重,因为通常——尤其是对于智能体 RL——每个训练 GPU 都要配两个推理 GPU。也就是说,集群中大约三分之二的资源实际上都闲置着,只用于推理。因此,如果你调度的集群最多有八个节点,训练端可能只会用到其中两三个节点,而大部分资源都只花在推理上。 ## 稀疏权重更新We've engineered it so that we can schedule clusters pretty quickly up to like four nodes or eight nodes, but once you get past that to 16 nodes or 32 nodes, it gets pretty painful. It takes a really long time to find like a contiguous block of all these nodes. And in RL this is particularly bad because in RL we generally have especially for agent RL, we have like two inference GPUs for every training GPU. So two thirds ish of your cluster is actually just stuck doing inference. So if you're scheduling an eight node cluster max you're probably only using two or three of those nodes for the trainer side and most of it's just spent doing inference. ## Sparse weight updates

把这些用于推理的 GPU 移出集群会很有帮助。我们认为可以这么做,其中一个原因是,在 RL 过程中,权重更新——也就是实际应用到模型上的梯度——最终会变得极其稀疏,这背后有两个原因。基本上,如果用 T+1 步的权重减去 T 步的权重,就会得到这个 delta。事实证明,虽然每一步的完整模型权重都非常稠密、规模也很大,但更新本身却极其稀疏,稀疏程度可达 100 倍甚至 1,000 倍。所以,你实际上可以直接用现成的压缩工具处理这些数据。结果是,需要从训练器传输到 rollout 引擎的数据量减少了 1,000 倍。It would help to move these inference GPUs out of the cluster. And one reason why that we think we can do this is because during RL the weight updates the actual like gradients that you're applying to your model end up being incredibly sparse and there's two reasons for that. But yeah essentially if you subtract the weights at step T from the weights at step T plus one you get this delta and it turns out that even though the full model weights at each step are very dense and very large the updates themselves are incredibly sparse. 100 X or 1,000 X as sparse. So you can actually just feed this to off the shelf compression and it turns out that the amount of data you need to communicate from the yeah from the trainer to the rollout engines goes down by a factor of 1,000.

这意味着你实际上可以把推理 GPU 部署在集群之外。就像我提到的 Qwen 3.6 那次运行,我们使用了训练集群。我想它是在 GCP 上;但推理 GPU 实际上分布在我们的整个 GPU 集群中,也涵盖了我们使用的各种超大规模云服务商和新兴云服务商。事实证明,采用这种稀疏增量压缩技术就能做到这一点。它效果很好,而且不会造成性能下降。This means that you can actually move your inference GPUs outside of the cluster. And so actually for the run that I mentioned of Qwen 3.6 we ran the training cluster. I think it landed somewhere in GCP but the inference GPUs actually ran all across our fleet and all the different hyperscalers and neoclouds that we run across. And it turns out with this like sparse delta compression technique you can do this. It works well and it does not introduce like bad performance..

为 rollout 混用不同类型的 GPUMixing GPU types for rollouts

不仅如此,我们实际上还将 rollout 集群分散在不同类型的 GPU 上。再说一次,这是因为我们使用的供应商各不相同,导致了碎片化;但同时,我们也有很多不同类型的 GPU,而不同客户想用的 GPU 也各不相同。如果能尽可能多地利用这些 GPU 来进行 RL 运行,那就太好了,而我们也确实这么做了。每一种 GPU 类型都可能进一步加剧不匹配。比如,trainer 运行在[字幕中无法辨认的 GPU 型号]上,而你的 rollout 运行在 H100 或 A100 上,那么在实现模型的内核和可执行的数学运算方面,硬件层面就会存在差异。这会让不匹配越来越严重,而按传统观点,这应该会导致训练运行变得不稳定。Not only that, we actually fragment our roll out fleet across different GPU types. So again, because the we have fragmentation due to all the different providers we run on, but we also have fragmentation because we have a lot of different GPUs that different customers want to use. It'd be really great if we could leverage as many of them as possible for our RL runs and that's that's what we've done.. Each of these GPU types they increase the mismatch potentially. So if the trainer is running on [GPU model unclear in the captions] but your rollouts are running in H100 or A100, there are hardware level differences in the kernels, the math you can run that implement the model and so this like increases more and more mismatch which traditionally should cause your training runs to destabilize..

这只是一个图表,展示了在我们这次训练过程中,每种 GPU 处理了多少请求。实际上,我提到的这个方案能够应对我们施加的这种程度的不匹配——我觉得这可以说是前所未有的。我认为这恰恰说明,过去一两年里,我们对 RL 科学的理解已经取得了多大进展。基本上,这张图表明,不匹配程度最高可达原来的四到五倍,但训练奖励、梯度范数等各项指标都能像同构情况下那样稳定地训练;所谓同构情况,基本上就是用 B200 进行训练,也用 B200 进行推理。This is just kind of like a graph to show how many requests are being processed by each GPU type in the run we did over the course of training. So actually the recipe that I mentioned is capable of handling this amount of mismatch that we throw at it, which yeah, I think is like kind of unprecedented. I think this just goes to show how much we've figured out the science of RL over the past year or two.. Basically this shows that you have up to like four or five times as much mismatch but the training reward and gradient norm everything is training as stably as it was in the homogeneous case which is basically running training on B200s and inference on B200s.

部署成本降低 15%15% cheaper rollouts

另外,这还带来了一个额外好处:我们这次完整训练运行所需的 rollout 成本实际上降低了 15%。这是因为高端 GPU(如 B300)的需求很大,所以价格普遍更高。但如果能用需求较少、价格更低的硬件来低成本运行 rollout,那么整个训练运行的成本就会显著降低。实际上,我们并没有针对每种 GPU 类型进行任何推理调优,只是为每种 GPU 使用了基本的开箱即用推理方案。如果你决定针对每种 GPU 类型分别优化部署,例如为模型采用不同程度的量化,成本很可能还能大幅降低。不过,这并不是这项工作的重点。And kind of a bonus like a side effect of this is that the rollouts that we run for this full training run are actually 15% cheaper. And that's because the demand for the high end GPUs like B300s means that the price is just generally higher. But if you can actually run your rollouts cheaply on cheaper hardware that there's less demand for, like the overall cost of doing this run is significantly lower. This is actually without any inference tuning for each GPU type. We're just doing like the basic off-the-shelf inference recipe for each GPU. If you actually decided to optimize each individual deployment for each GPU type with for example different levels of quantization in the model you could actually probably make this significantly more cheap. We just this is not the focus of this work but yeah.

哦,我可能也忘了提到这一点:在这种情况下,有时比如 H200,我们会有两个不同的 H200 资源池。这是因为我们会在 H200 上运行两种不同量化方式的模型。所以我们有一个 H200 池以 BF16 运行,这是最稳妥的方式;但另一个池以 FP8 运行。再说一次,我们所做的校正可以掩盖模型过度量化所引入的不匹配,我们仍然能从这些量化后的 rollout 中学习。 ## 掌控自己的技术栈Oh, I did also maybe I forgot to mention but in this case there are cases where like for example H200 we have two different pools of H200s. That's because we run two different quantizations of the model on H200s. So we have one H200 pool doing it at BF16 which is like the safest way to do it but we have another running at FP8 and again like the correction that we do can like drown out the mismatch that's introduced by even excessive quantization of the model and still learn from these quantized rollouts. ## Own your stack

所以,是的,我想表达的重点是,我们已经发布了这个东西。我们写了一篇博客文章,详细介绍了所有技术细节。很快我们就会开源它的源代码。它基于 Miles 和 SGLang,前者是强化学习框架,后者是推理引擎。我认为,关键在于:如果你想在一个有众多竞争者都在运行智能体技术栈的世界里保持竞争力,就需要在一定程度上自己掌握整个技术栈,或者至少在技术栈的每个领域都建立起专业能力。我觉得,过去很多工作通常止步于智能体框架,但实际上,在这个竞争异常激烈的行业里,对整个技术栈进行垂直整合极其重要。So yeah, I think the point I'm trying to make here is that like we've released this. There's a blog post that where we go into like all of the technical detail. We'll be releasing the source code for it very soon. It's based on Miles and SGLang, the reinforcement learning framework and the inference engine. And I think the takeaway is that I do believe that if you want to be competitive in a world where a bunch of different competitors are running agent stacks you do need to some degree own the full stack yourself or at least like build competency in every area of the stack. I think a lot of work traditionally ends at this agent harness but actually the vertical integration across all of this is just extremely important in a hyper competitive industry.

我们再次在编程等特定行业中看到了这一点,但我认为其他行业也有类似趋势,而且这种趋势只会不断扩大。我想当然,如果你在构建智能体部署方案,那么整个技术栈中的各个环节也都由你掌控;而在这些方面进行垂直整合,对于保持能力和竞争优势至关重要。是的,你应该拥有自己的智能体强化学习系统。现在这确实已经可行了,因为相关科学原理已经厘清,而且有非常好的工具和基础设施可以让你做到这一点。我就说这么多。谢谢。我们正在攻克一些棘手的问题。欢迎来我们的展位找我们聊聊。We see this again in certain industries like coding but I think we also see it in other industries and it's only going to keep growing I think. And of course like if you're building agent deployments you own everything up the stack as well and vertically integrating across all of this is important for maintaining kind of competency and competitive edge. Yeah, you should own your own agent in RL. And it's actually possible now because the science has been figured out and there are very good tools and very good infrastructure that lets you do that. That's all I got. So, thanks. We're We're working on hard problems. Come visit our booth and talk to us.

值得记下

  1. 这就是异步强化学习中所说的采样滞后。
  2. 权重更新本身极为稀疏。
  3. 在这次完整训练中,生成轨迹的成本降低了 15%。