transcribe

Understanding Reinforcement Learning with Prime Intellect and Unsloth | Nemotron Labs

NVIDIA Developer · 1h 5m · transcribed Sep 2026
More from NVIDIA Developer Business
𝕏 Share ▶ YouTube 📥 PDF 🤖 .md

Transcript

1:04 Welcome everyone to the NVIDIA developer livestream. I'm Shashank Verma and today we're diving into reinforcement learning for language models. What it is, when you should use it or when you should not, and how to actually get started. Now reinforcement learning is one of the more, you know, most important stages in scaling intelligence in today's, you know, frontier, both open source and closed source models. You know, all the way from the chat GPT moment where models became really good that you could, you know, converse with them, both single turn as well as multi-turn capabilities. And all the way to, you know, Deep Seek moment with Deep Seek R1, our own NVIDIA NeMo Tron 3 family of models, Prime Intellects Intellect 3 models, and the recent successes of Qwen with, you know, scaling up intelligence gains with post-training RL. Many of these models had one or more stages of reinforcement learning as part of building them, right? But for most practitioners, RL still feels like kind of like a black box. And the question we hear very often is simply, does this apply to my problem? How do I, you know, get started with it?

2:11 So today we have two incredible guests with us who are making RL practical and accessible. The first of them is Daniel Han, the co-founder of Unsloth AI, a name that almost all of you would have heard. And Will Brown, the research lead at Prime Intellect. Daniel, quick intro. What does Unsloth do and why are you as excited about RL? Yeah, thanks for inviting me. You know, super excited to be here. You know, very excited to be talking about reinforcement learning.

2:42 Yeah, so Unsloth, you know, we make it very easy and very accessible for people to run and train language models. So definitely check us out on Hugging Face. You know, try the NeMo Tron models. We have like Deep Seek and we have like some reinforcement learning notebooks with NVIDIA NeMo RL as well. So check that stuff out. For reinforcement learning, you know, it's the next stage of training. So like, you know, we have, you know, we went through many, many phases.

3:05 Pre-training the pre-training phase, you know, the supervised fine-tuning phase. But now we're like, you know, we need to do more reinforcement learning. It's kind of like the trick that we can do to scale GPUs and compute to like massive scales. And so the goal of reinforcement learning is, you know, we can use this to, you know, solve every single task of all of humanity, you know, solve every single, you know, task, you know, business task, you know, actual task, robotics, everything. And then you might reach AGI. And so like that's kind of the reason why reinforcement learning is very important. cuz it is a it is a way that we might be able to reach AGI.

3:40 So yes, reinforcement learning is very cool. Well, yeah, absolutely. And Will, what do you have to say? What what what is Prime Intellect doing and why RL? Yeah, for sure. I'm Will. Hi, nice to meet everybody. Thanks for having me here. So Prime Intellect, we're building open source research infrastructure and tooling and a platform built on top of our compute platform to just make research easier. I think it's research can be hard and for us hard is complicated and I think both Daniel and I are very like aligned on this mission of just like we want more people to be poking at this stuff and understanding it and getting their hands dirty.

4:19 And especially like nowadays, a lot of this with RL is, to me it's really exciting because it gives us a very different way of achieving goals by not needing to have data necessarily, but more about needing to know what we want to be able to specify it. And really it's, in my mind, it's also this a very similar practice to building evals. And so Prime Intellect, like we think of evals and environments as very much two sides of the same coin. So we have our environments hub platform, which also doubles as an evals platform. And so I think that has been kind of a way that I've thought about it a lot and I think it's a useful way of at least getting into the headspace of what you're doing when you're doing reinforcement learning is you're really evaluating what you care about. And then RL is what lets you improve on those evaluations.

5:04 Great. So we're going to walk through RL from the grounds up today. We're going to discuss some fundamentals, you know, with the two incredible experts that we have today. You know, what it is, when to use it, the key algorithms that are most prominently used today. What are environments and some real-world constraints around, you know, doing the training with reinforcement learning and scaling up that training to build, you know, modern models. Before we dive in though, like just remember that this is a conversation. This is not a lecture. So drop your questions in the chat as we go. If something is if something is unclear or you want us to go deeper into any specific topic, let us know in real time. And our team behind the scenes, you know, we've got Rebecca, we've got Zach and Sailendran.

5:53 Amongst us, we'll try to answer that question as soon as possible. And some of those questions we'll also try to pull them up and have our experts, you know, take a stab at it. All right. So the first item in in today's sort of panel discussion is an introduction to RL, what it is and why now. So so Daniel, for anyone who's done fine-tuning but has not touched reinforcement learning yet, what is reinforcement learning for LLMs in, you know, simple terms?

6:24 Yeah, that's a great question. So for folks who have done like fine-tuning, supervised fine-tuning SFT, in the olden days, you would need to collect a very large data set of like input and output. So like, you know, you could you might ask like a question, you know, what is 2 + 2? And the answer is four. And then another one is like, you know, create a Python function for the Fibonacci sequence or something. And then you have like some code.

6:48 And you have like, you know, 1 million examples of this. And then what you would do is you would ask the language model to, you know, given the question, make the answer. And that is called fine-tuning or supervised fine-tuning. The trick of reinforcement learning is now you don't actually need you don't actually need all of this ginormous data. Instead, what you need is you need you need an environment, right? You need some sort of like simulated system or some sort of like real real environment where it can like essentially you put question in it and then it will produce an answer.

7:23 And then the trick is you can verify whether this answer is right or wrong. And then if it's right, you then reward the model and say, oh okay, you know, this is a good answer, do this more. If it's a wrong answer, you then penalize the model and say this is very bad. So for example, a good example is like, you know, you ask the model, what is 2 + 2? Right, you know the answer is four.

7:45 But at the very beginning of training, it might say like, you know, 10, 20, you know, dog, cat, I don't know, some random whatever gibberish. But then over time, you know, you keep running reinforcement learning, you keep running it, running it, running it. And eventually you get the answer four. And then, you know, four, you reward it dramatically. And then over time, reinforcement learning will converge to the correct answer. And it's not like you don't just do like one question, right? You know, not not just like what is 2 + 2. You have many, many, many, many generations of questions.

8:18 And these questions are what you put into the reinforcement learning algorithm. And magically, you know, it can you can scale to many GPUs, you can do lots, you know, long training runs. It works very well. Yeah, that's kind of like a high-level overview of reinforcement learning. Those are great overviews, especially with the with the example in there. And and and to you, Will, right? What has changed in the last 18 months or so, right? Especially since the Deep Seek moment that has, you know, made RL go from something that was niche to something that every serious team, research team should be or even sort of practitioner should be investing in.

8:56 Sure. Yeah, so I I think in my mind the turning point kind of came from this realization that chain of thought and reasoning was going to be the way to improve model capabilities for hard problems. And I think part of this is that on one hand it's a way of spending more computation to get better answers, but it also makes the SFT problem harder because the data is not readily available in that format if you don't have a model that's creating it. Because humans, when humans are like, let's say the question is, here's a an article, write me a summary of the article. I think this is the sort of thing where maybe we can just have some humans do it and we can collect these labels of like 10,000 human-written summaries and we can do SFT on this. But these humans are not writing long chains of thought before. The chain of thought is happening in the human's head. They're maybe taking some notes on a scratchpad. But then they're writing down just the output final answer. And I think this for me was something that made it a little clearer that we needed to have something else beyond just SFT on human data because we don't necessarily have the chain of thought data in that same way.

9:57 We maybe can have some as like a seed. In parallel, we saw another thing happening with the deep seed moment where the chain of thought, it turns out, emerges from doing RL. And so, you can it turn because it turns out that doing chain of thought reasoning is more useful. RL is about searching for strategies and trying things out, like Daniel said he was saying. And one thing you can try out, if the model is let's say prompted to think for a little bit, to think for a little bit. But the old models wouldn't think for that long.

10:27 Now they think for much longer, and this is a a strategy that emerges from training them with reinforcement learning. And so, this doesn't mean like SFT is dead, but it means that if you're trying to have a reasoning model, the version of SFT that makes the most sense is usually going to be distilling from a larger model or filtering data, rejection sampling, where you're trying to take a model that you already have that can do this, but maybe it doesn't do it all the time or it's too large a model to serve, and you're compressing pressing this data down into a smaller model.

10:58 and in many cases, you can also do RL directly on smaller models, but if you're already at the largest model you have and you want to make it better, if the the biggest model isn't enough, RL is the the technique that is most effective for kind of advancing the frontier of capabilities. And this is kind of how the the large models nowadays are trained is you have to explore the strategy space around what the model can currently do, find things that are better and worse, and this is where your reward function comes in. Your reward function is about identifying which completions were better than others, and then you upweight those and downweight the others, and that's kind of what the RL objective is doing iteratively.

11:39 I think that was a great response. Thanks, Will. And so, from Nvidia side, right, you know, post-training scaling in terms of you know, multiple RL stages. It was not like a monolithic stage, multiple RL stages. You know, Nemotron 3 has become sort of our proof point. It was trained with multi-environment RL, you know, and and you know, some of the biggest intelligence gains that we've seen so far in our own models were through, you know, reinforcement learning stages on top of existing SFT stages. So, one thing to note is that oftentimes SFT and RL, you know, are not sort of one or the other. They're actually complementary, and and you know, people oftentimes do both, right, especially serious model builders.

12:24 So, a quick poll in the chat. Have you tried RL training before or you know, is this your first time hearing about it? Let us know so we can calibrate this discussion around it. And and keep the comments coming. Like we'll we'll take more of these questions, you know, towards the end, but also sort of interspersed throughout this discussion as well. And let's move the discussion towards, you know, deeper into the comparison between supervised fine-tuning and reinforcement learning. Now that you touched upon it, Will.

12:57 Right. So, Daniel. A question that I that you know, we get a lot of the times from developers is that, you know, I have a problem, this is a use case I'm trying to get better accuracy at with the model. I've done some benchmarking, but I'm not sure whether I should use reinforcement learning or supervised fine-tuning, right? And and Will did mention it a little bit about how it helps, you know, RL scaling helps explore reasoning paths.

13:23 But for more, you know, task-specific fine-tuning, right? How do you help someone make that call? Yes, that is a very like it's a very common question that people always ask, you know, what you know, should you do reinforcement learning or should you do like normal fine-tuning? and it depends on the amount of data that you have. So, for example, for supervised fine-tuning, if you do have a very large data set, you know, with questions and answers, you probably should start doing fine-tuning fast, you know, supervised fine-tuning.

13:54 But the trick is you can then go to reinforcement learning. You know, you don't you don't need to like, you know, remove the data set that you just had. you can reuse the data set for, you know, reinforcement learning. As Will said, the trick of reinforcement learning is you can actually create the chain of thought automatically, right? You could you have the answer, you have the question, but the chain of thought is like, you know, it's it's not there.

14:18 and the trick of reinforcement learning is during reinforcement learning, this whole process is made automatically. you know, through TRPO, through, you know, PPO, whatever algorithm you like. and that is the fundamental trick of of reinforcement learning. it allows you So, now what you can do is you don't even need data anymore. you can just have one question. Like I'll give you an example, you know, create a algorithm, you know, create some sort of algorithm to make matrix multiplication faster on Nvidia GPUs. Something like that, right?

14:48 Create CUDA kernels to do this. You just need this one question, just one, and then you can do reinforcement learning on this. and then it will create the kernels for you. you know, you have to verify if it's correct or wrong. but yeah, something like that. Like, you know, you have if you want to increase accuracy of your models, you should do reinforcement learning. but at the very beginning stages, if you have like some data set, maybe try fine-tuning fast, you know, see if it works, and then move over to reinforcement learning.

15:17 another good trick is there is something called SFT warm-up or priming, where the trick is you firstly do supervised fine-tuning, and then you use the model that you have to do reinforcement learning. and this allows you to like, you know, converge faster to you know, to to have like a higher reward. yeah, that that's like a Yeah, so I would say like do supervised fine-tuning fast, and then do reinforcement learning next if you want more accuracy. yeah.

15:44 Mhm. Yeah, great. That Yeah. Oh, yeah, yeah, yeah. And I I I think also one thing that I think I see I wish I'd heard more people discussing, but I think once I kind of thought about it this way, it really clicked for me, is RL, especially in the case RL doesn't have to be zero or one rewards. It often is for correct right and wrong answers. It can be you can have format rewards or other things and penalties, but if we're thinking of zero or one rewards, RL really is going to be the most effective if you're in this like medium difficulty regime, where your questions will always you're not going to get them all right all the time, you're not going to get them wrong all the time, but for most questions, you do see some variance in the the quality of the answers. And so, like in some cases, like being close to 50% is like a really good spot to be for like your baseline accuracy. And so, if this is one of these reasons why I think doing the SFT is really helpful at the start is let's say your model starts like performing very poorly on some environment, then you want to do whatever you can to like uplift it to have a better baseline accuracy so that you can start getting the gains of exploration and trial and error. and kind of climb up result because RL is only going to learn when you have this variance, this advantage.

16:59 otherwise, it's essentially not doing anything. and so, I think getting And this is also a way I think that's really useful to think about calibrating your parameters of your Like I think people always ask like what should my group size be? And I think it's a The way to think about it is you want to make sure that you're getting variance. If your problem is only going to be right one out of a hundred times, you probably need a really big group size. If your problem is usually right half the time, you can get away with a much smaller group size, and you can kind of think of these as like coupled.

17:33 And so, I think that's also a way to think about like is RL going to work is run a baseline eval. Like if Running a baseline eval is kind of like doing step zero of an RL run before doing any training. And it's the same way that you would run any other kind of eval or benchmark. Like GSM8K very much has a train set and a test set. It has a It was kind of saturated now, but it for a long time was like a very popular eval, but it was also that you could use for RL very directly.

18:01 And and you know, one of the questions that we hear often, and there's one in the chat by Berlin Blue, is is about, you know, the using RL, whether is it a good idea to sort of change all the weights or, you know, techniques like LoRA are still applicable? I'm just going to call out the exact question. Is there recommendation on when to do RL, change model weights, and when to use adapters like LoRA? Is there >> They mentioned like like you should should do LoRA fast as a trial. Like, you know, definitely it will work very well. Definitely read So, Thinking Machines has a blog post called LoRA Was it LoRA and Regret? but there was a paper something about that. maybe I Did I say it right? but yeah, there was a discussion Learn Fast, Forget Fast is the other There's a a few papers, but yeah.

18:52 Yeah, one of them, yes. They showed that if you do LoRA on rank one, so if you just do rank one LoRA, it does work. It works actually very well. But the trick is you need to select the parameters correctly. For example, you need to increase the learning rate times 10. you need to select the LoRA alpha correctly. We actually collaborated with them on that as well. so, like definitely check that blog post out. So, LoRA does work. It allows you to do efficient reinforcement learning by you know, reducing your memory requirements by a lot. but then, you know, if you if you do want to go to the next stage, you know, then you should focus on, you know, how do we do full fine-tuning, how do we do like, you know, much larger runs for reinforcement learning. but LoRA is a very good priming example.

19:34 Like, you know, you need to If LoRA doesn't really work, most likely full fine-tuning is not going to work. Most likely, you know, somewhere in your reward function, something's wrong. You know, your environment, something is incorrect. so, definitely try LoRA fast, and then move over to like larger training runs. yeah. Yeah, totally agree. Yeah. Go on, please. I think the way that I think about it is like if you're training essentially on like one environment or one domain, Laura's definitely going to be fine. The case where you want to do the full fine-tuning is more like you're training a like a frontier model, like for example, like when or something that is like a very general large scope and you're doing a very large amount of RL.

20:13 So like Cursors composer model, that is at the regime where it does make sense for them to do full fine-tuning because they're doing so many rollouts. There is it's a very general purpose coding model for like the Cursors environment. and they want to have a lot of new information flow into the model from doing a very large amount of rollouts. for most domain-specific applications, as you know, said if you kind of get your learning rate calibrated appropriately, you're going to do just fine with LoRA.

20:46 And Yeah, I mean, so from from what I'm hearing and and what I understand as well, you know, the paradigm of LoRA it it it transcends beyond simple supervised fine-tuning. It goes to the RL as well. So the the right approach maybe to just do initial experiments with LoRA, right? And then you know, to scale out your runs and and you know, get the the full end of the accuracy do full weights fine-tuning. So I think I I actually would say that in many cases you don't you it's not like LoRA is just a warm-up. In many cases LoRA is all you need.

21:23 and I think it's it's not even about top-line accuracy. It's a more about the generality of the problem. So one thing that people have observed when you people are doing RL is that the weights don't actually change very much. So in most gradient steps of SFT, most parameters will change over the course especially for over the course of a whole run. This is surprisingly not true for RL. Most parameters will just not actually change. and so the the total diff to the model over the course of an RL training run, even if you are doing full fine-tuning, is very like low rank already.

21:59 has been observed empirically. And and so this is kind of a a good motivator for like you actually don't need to always do full fine-tuning. Yeah, and and you know, you guys mentioned about you know, forgetting. Right? And we have a question in the chat from Ritu Verma about the fact that supervised learning is generally more is going to show up very soon. It's called you know, the the the the question is like this. Supervised learning is generally more stable and predictable when moving to RL for agents, what are the most effective ways to ensure the model doesn't suffer from catastrophic forgetting?

22:36 May I learn some new task but loses the general reasoning ability. do we do we have any thoughts around that? We actually get this question a lot. so we do have some guides on this. there are two tricks that we generally tell people to employ. the first one is when you do reinforcement learning or even when you do like you know, supervised fine-tuning, you should get like you know, public data sets. for example, like Nvidia has some you know, cool public data sets on their hugging face page. You know, you should get some from hugging face and then combine it with your data set that you're using.

23:09 you might need to like calibrate the mixing ratio like you know, is it you know, 60% your own data plus 40% you know, whatever the public data is. And the goal is with this mixture, you can counteract you know, like forgetting of like you know, general knowledge. the other trick that you can employ is like you know, when you finish reinforcement learning or fine-tuning, you literally get the weights and you just add it to the original model and divide it by two. and then you kind of have like a random mixture of both models. this allows you to have like you know, this kind this actually does work and it's surprisingly well. you know, it might not just be like you know, you know, 50% you know, of each model. You can be like 70% 30% something like that some ratio. but in general, if you want to like not forget, these are the two general ways you can like you know, use. Oh obviously, you can like calibrate the learning rate, you know, look on evaluation of like you know, other benchmarks, you know, during the training run, you know, if if general benchmarks seem to be doing bad, maybe something's going off, you know, maybe like stop the training run, investigate what's going on.

24:14 Yeah, maybe maybe Will has more insights on this. yeah. Yeah, no, I think those are like great tricks. I think something that I think about is so I think RL generally is less prone to this forgetting problem, but there's a related problem that does occur, which is more about rigidity of style. And so I think for example, one mode of failure I've seen with this a lot is if you train a model on math for RL and you always have it answer in like boxed, it'll it does it'll still do just fine on other stuff that it knew from pre-training, but it'll use that format in places it maybe shouldn't. or for example, if you tell a model that was trained to always think to not think, it's always going to think.

24:56 it's not and it's going to be very kind of it's going to act very weird if you try to force it to not think by closing the thinking lock. and so I think general diversity of your environments, of your objectives, of your formats, helps for this kind of collapse problem because if the model like only has to do one format, it'll just do that one format. If it has to do 10 formats or respond to a variety of things together, it is less prone to collapse to one or the other. and so it is going to maintain a little more generality for more out of distribution tasks.

25:34 And this is kind of just like a I don't know, rule of thumb, but I think also is similar to the idea just like folding more data into your mixture. but I I think it's also the sort of thing where I know in supervised fine-tuning I sometimes see people like get really eager to like have a really high learning rate because they see that their loss goes down faster. but this doesn't actually make the model more general. It just means you're fitting your data in sample better.

25:59 and so especially that can be a trade-off with out of distribution. I think one thing that is nice about RL is that your reward is I think easier to interpret than your loss because it's it is directly your accuracy usually rather than some like token perplexity level measure. And so I I think it's I don't know, just helpful to think about evals as a a way of like as well as the divert like covering multiple evals in your either your offline or online evaluations as well as like the environments you're you're training on.

26:36 Yeah, and and that kind of speaks to the importance of multi environment training, right? scaled up multi-environment training to avoid sort of catastrophic forgetting along one or more of you know, existing benchmarks that you were existingly good at. Right? so let's let's move on to talk a little bit more about the algorithm, right? And and and the paradigm of RLVR, right? We mentioned you know, earlier GRPO and some of our viewers may not be as familiar with GRPO, right? This is also a question we receive often is like what is GRPO? They've heard about RLHF, right? From from the ChatGPT moment.

27:10 There was a very influential blog at the time that was published. so what do you guys mind speaking to a little bit more about what is GRPO in simple words and the paradigm of RLVR? Do you want to say it or you can? Go Yeah, yeah, please go on. Go go on. Sure. Sure. Yeah, so like I think with any sort of RL, whether it's RLHF or PPO or even DPO, the real goal of all these algorithms is to have us be able to estimate the advantage of an answer, meaning the relative comparison versus some other baseline and improve the likelihood of the like more advantageous answers relative to the others. and so the the main way when people talk about RL nowadays as well as in RLHF, often you'll hear people talk about online or offline RL. I think online RL is really what people are talking about with GRPO and bunch of the RLHF, but DPO being the offline. But what this really means is you're doing sampling. You're exploring. You're having the model be given a question and generate multiple answers to this question.

28:20 you're evaluating these with your reward function. and this could be a preference model trained on human data. So reward models, reward functions, all of these things are kind of interchangeable depending on what the goal is, but it's really just that you have some oracle that you can plug in a question and answer and get back a score that tells you how good it is. And if you're doing DPO, the correct answer labels are assuming you've already done this with some other function effect essentially.

28:47 but once you have this set of good and bad answers for a question, you're taking some step to the model that has an objective function that is upweighting the better answers and downweighting the worse answers. In DPO, it's just assuming you've already picked these without the sampling step offline and that you have a one's a one, one's a zero. In GRPO, you are doing the sampling online. There's all sorts of different ways people play with like the normalization with the standard deviation term in GRPO or different like PPO style of clipping terms. And I think those are like implementation details more so than core concepts.

29:24 I think generically, you should just think about sampling, getting answers with scores and using those advantages to upweight or downweight likelihoods of answers with a often a constraint on the model not changing too much overall. It's going to have like This might not be right, but I think so was I think was invented invented by OpenAI and then they used PPO as the algorithm to do RLHF. People probably should verify if I said this right, but I'm pretty I'm most likely sure that's what happened. and then PPO so GRPO was invented by DeepSeek you know, in their paper. and then essentially it's just a more efficient way of PPO.

30:09 you delete the reward model, you delete the value model, you delete like many components of PPO. You just get rid of them. and then they, you know, iterated one step further. You know, it's not just GRPO. You do the next step is RLRVR. and then, you know, RLRVR stands for reinforcement learning with verifiable rewards. The trick is you replace the reward model, which was which used to be a like a neural network or like some sort of AR model to predict rewards. You get rid of that. and then instead you just have an environment. and then this environment says, you know, is your answer correct or is it wrong? You know, or like some sort of score. You know, is it plus 10? Is it minus 10? and so it like the trick is we now do generation. You know, we call the model many as we all said, you know, we generate many many many many many many responses. and then we use this environment or like many environments to evaluate, you know, if it's good, if it's bad, if it's good or it's bad.

31:06 yeah, so like GRPO I I I think previous question like, you know, GRPO is just a more efficient way of RLHF or like PPO. yeah. Yeah. I think that's I think there's a lot of things that kind of got changed around at the same time when the field was evolving that I I I actually don't even know when people say PPO they mean multiple different things. some people mean when they say PPO they mean the clipping term. When some people say clip PPO they mean reward model.

31:33 When some people say PPO they mean the value model. but I think it was really a paradigm that moved all these things together. and so now I think like I just call it RL nowadays. It's like whether or not it's a reward function or a reward model. The it all dates back to policy gradient, which is the reinforce algorithm from the 90s, which is just the idea of sampling and estimating advantages and taking a gradient step for the policy reward objective, with respect to those samples. And so all these algorithms are kind of in this same family with different implementation details.

32:16 Yeah, and and talking about sort of designing reward, we do get a lot of questions around reward. I think there are a few in chat as well. but before we get into that, right? let's formally sort of discuss a little bit about what environments actually are, right? How does the GRPO algorithm work? and and, you know, maximizing the advantage and and the and the reward essentially. And and so, to that extent, right? you know, will do do mind you know starting us off with you know, how do you think about what an environment is?

32:48 Sure. Yeah, so I think of an environment as a collection of tasks where a task might be an input question, as well as a way of evaluating the correctness or completion quality for some task, potentially in something like a harness. although I think for now we can set the harness question aside if we're thinking about like you can think of like the setup of prompt in a chat template with some completion then parsing for an answer as a very minimal harness.

33:19 and then it could also have tools and get more complicated with like cloud code style coding agent harnesses, but for the simple harness, it's just a way of executing a completion from a model given some input. And an environment just is this bundle of things that allows you to plug in a model and get back a score for a task that you give it. and so if you're doing coding, this might look like unit tests. If you're doing math, it might look like the math verify library from Hugging Face being used to to check whether answer is right. If you're doing something that's more semantic or kind of a fuzzy semantic matching problem, it might look like using an LLM as a judge. If you have if it's a like more holistic preference score of like training a like a nice answer, you might use a reward model trained on human labels from like upvote downvote on pairs of completions for a certain type of answer. Those are all different ways of having a reward model or reward function that assigns some score. It could also be like explicit metrics like format correctness. And so I think often times it's useful to like kind of at especially if you have multiple you care about. Like not just one answer. you want correctness, but also you have these bonuses you want to care about as well in terms of like the answer shouldn't be too long. The answer should follow these formatting rules. It should not use emojis. It should not use em dashes. These are all sorts of things that you can like reward for and like have these composite reward functions.

34:46 >> >> it's more of an art than a science in terms of how do you stack these up. but it's the sort of thing we're kind of playing around with your reward functions, especially when you're going beyond like very easy to verify tasks is one of your ways of improving and changing behavior. And and Daniel, from, you know, working with practitioners every day around you know, using environments, what do you think confuses people the most about environments? are there any gotchas?

35:13 Are there any best practices this is for getting started with environments? Yeah, that's a great question. so I feel like for during reinforcement learning like, you know, as we all said like, you know, there's environments and there's reward functions. generally like how I like to think about it is you need to disaggregate both of them, because the environment like for example, this is like, you know, pretend you're trying to make like a language model. Like you take a screenshot of like a game and your goal is to play the game, right? So like every single time you would take a screenshot to like say, you know, what is the next step? Is it move up? Is it move left? You know, is it move down or move, you know, whatever. or like, you know, jump or something.

35:52 and you know, that is the environment. The environment is the simulation of the game. so like, you know, how do you actually, you know, you know, do the task? You know, how do you how do you actually execute the next action? and so like, you know, this is the actual game. And then your job is to actually make the reward functions. You know, how do we actually say this action was good or bad? You know, is it, you know, do plus five? Do you minus five?

36:15 You know, is it like, you know, what is the end state of the game? You know, how much do you want to reward every single step? and so I feel like the biggest issue that I see, you know, we always see people struggle on actually the reward function step. so biggest issue is people don't know, you know, what should they write for the reward function? You know, should they should they just do like, you know, for example, the game example, should it just be win or lose? You know, as like just one reward function. and so like these are the problems that people always face like, you know, should we make five reward functions? Do we make like 10? should we like, you know, how do we like weight each of them separately? How do we do like, you know, how do we like make one reward function start off and then stop weighting that very importantly and over time, you know, some other reward function is more important. and so like there's there's always like these questions of like, you know, is this reward function better than this one? You know, how do we actually verify if the reward function is good or bad? and then my take is like, you know, just do the easiest example. You know, if it's win or lose, you know, just use that. and then, you know, don't don't overthink about the reward function. you know, don't, you know, don't try to like, you know, confuse the reward, you know, reinforcement learning algorithm by like, you know, making too many. that's probably not a good idea. you would rather have like, you know, 10 environments, each of them with one reward function.

37:34 the trick is if you do have many reward functions, you can make the reinforcement learning algorithm converge faster. that's kind of the goal of reinforcement learning. And you can kind of like, you know, mold the algorithm to move to your, you know, to your specific requirements. for example, you can add like, you know, don't say this specific word. You know, if you say this word, penalize it. You know, like some safety alignment methodologies. Or, you know, don't do this. You know, don't, you know, if you're doing self-driving cars, you know, don't kill humans. and then you add that as a reward you know, function or something like that. and so you can use reward, you know, if you design these systems, you can make it complicated. just don't overcomplicate the process.

38:18 and then yes, everyone should be fine. yeah. Yeah, makes a lot of sense. I I think of that in terms of like partial credit where it's like you this is an area where you can create problems in terms of reward hacking if you give like too much partial credit for the wrong things. And so one way I like to think about it is like one is if your model can already do the right format most of the time, and can already get the correct answer some of the time, then having a single reward that is both format and correctness combined actually works pretty well because you're already doing it well enough that having the strictness combined with your primary reward is going to be good. If you're starting in a problem where the model is going to fail much of the time, then it is helpful to notice the patterns it fails in and give relatively small rewards for avoiding those. And so one example I use a lot that I think I see a lot of people like use throughout the ecosystem is Wordle as a a game to like play from TextArena to be able to like train a model to like solve the game Wordle. And this is one where like a lot of small models will actually struggle quite a bit and will not complete the game successfully. And but it is also also is a game where there is a pretty structured way of coming up with like partial credit rewards where it's like if it guesses if all of its guesses are valid, if all of its guesses are like coherent and maybe it gets some of the letters right in the wrong position like the green and yellow things in Wordle. Those are natural sources of partial credit because they're very much on the path towards correctness.

39:49 You just need to make sure that the the weights are small enough such that like it doesn't get stuck there and that it has enough of a reason to kind of want the full reward. So you don't want your partial credit and your primary credit to be fighting each other. You want them to be kind of like stepping stones towards the full reward. I was going to mention like you know we all touched on reward hacking.

40:10 That is probably one of the biggest problems of reinforcement learning. Like you know like essentially if you tell you know if you tell the algorithm, you know, make a faster algorithm. And then the reinforcement learning algorithm might follow your reward function, but then over time it can cheat. Right? It can like edit your global variables. It can like you know make like if you're trying to make a fast matrix multiplication algorithm or something, it will just make the matrix, you know, all the numbers just zero.

40:34 It'll zero everything out and then the you know answer is just zero. And then you can like you know edit the timer. You know, if you're trying to tell it to like make a faster algorithm, it will just edit the timer to make it faster. Or like delete some you know certain variables and stuff like that. So I I guess like reward hacking is a very big problem that you know you people do need to watch out for.

40:53 And then you know you need you need to somehow like you know isolate the environment. You need to like you know look out for these things. You know, penalize the model if you see these things happening. And you need to like somehow isolate everything as much as possible. And if you do see something going haywire, you know, you know, you know, at least like you know rewind you know to a better state. You know, always every single time during reinforcement learning don't just let it run. You know, you should always stop at every single like you know 100 steps. You know, investigate look manually you know what is a rollout. You know, does it look like it's you know corrupt?

41:28 And then if it looks like it's like cheating, you know, reward hacking, you know, immediately stop the run and like you know investigate you know why is this happening. Yeah. Yeah, and I I think this is also an area where LM judges can be really useful. Especially if you have like certain classes of reward hacks that you're worried about then you can just like I think is it going to always work if you just ask an LM judge is it reward hacking?

41:50 Probably not. But I think if you have these classes of problems where you have a set of things that are very much like in the spirit of the scope of the task as well as enumerating the types of things that are like definitely not okay that you know can come up in let's say coding problems. LMs are very good classifiers. And so if it's easy for a human to look at a rollout and classify as is this reward hacking or not, then LM judges also can do this reasonably well. And this is a constraint you can put into your training runs to detect and mitigate reward hacking.

42:26 Yeah, talking of environments and and you know reward function design. Right? As with our QN, you know, you've got some incredible frameworks that can help you get started with with building environments and then think about environments. Right? I mean Prime Intellect has this you know framework called as verifiers. And and on the Nemo side of things at Nvidia, right? We have something called as Nemo gym, which not only you know both of these not only have a collection of ready-to-use environments, but also you know provide you all the necessary tooling and sort of all the boilerplate needed to get started really quick building environments.

43:03 Will or Daniel, would you like to add anything more? How how can people get started building? Yeah, and I I think also just there's also a lot of other I think cool things in the ecosystem too. And then on top you guys work with Open end. We have an integration there as well. Harbor is also very popular from the terminal bench guys. And so I think there's a lot of like different approaches you can take towards designing an environment. And so I think you could check all of them out, look at them and kind of see what is interesting to you, what is the right fit for your application.

43:32 >> >> but I think ultimately it's getting like I think it's useful to start thinking about evals. I think environments in my mind are very much associated with RL nowadays, but are not just an RL thing. They're a very general and useful abstraction. and in many ways the like easiest way to kind of think of examples of them is like the benchmarks that people report when models are released. So like SweetBench, TauBench, AMIE. These are all environments.

44:03 they're just environments that we use for evaluation rather than training. And so I think getting in the practice of defining your tasks as evaluations where you have tasks and graders and partners. these are all the components of evaluations as well as the components of environments. And so in many cases this is just thinking what is the actual problem you want to deploy? What's the agent you want to build without training just on top of some API model. Think about what it looks like and think about how you would start evaluating whether it's good or bad.

44:38 Is it doing well? How would we even choose which model to use? Would you use GPT or Gemini or Sonic or some other model or some open source model? And that practice of getting to the point where you can answer those questions also prepares you to do RL as well as like distillation or prompt optimization. All of these things are kind of using the same setup of thinking about tasks and measuring quality of an answer. And that's really the way that you build environments.

45:11 I was going to add like you know we do have so from if you go to like you know all of our repos, you know, verifiers, onslaught, Nemo gym, Nemo RL. We actually have some notebooks on onslaught's page like you know if you go to you can you load them in Google Colab for free to like try to use Nemo RL, Open end, you know, try some from verifiers, you know, all the environments and you can try this for free. And you know do a reinforcement learning run. You can also use these notebooks, you know, on your local you know GPUs. You know, if you have some RTX GPUs, they work very well on them. You only need So reinforcement learning the trick is you don't actually need a lot of compute.

45:47 You can run this on your local computer you know with 8 GB you know 8 GB you know VRAM or even like you know 24 GB you know any single GPU. The more VRAM the faster you will get. But you know if you do have like a low end GPU, it will work. So that you know check out you know we have some notebooks on our onslaught GitHub page. They're all for free to use. Yeah, try them out. Yeah.

46:12 Yeah, and and you know Will you mentioned how evals and environments are closely related. We have a question in the chat that is asking you know almost exactly that from AXDR SH. Sorry if I'm butchering butchering that name. I don't know how to pronounce it. How are evals and environments two sides of the same coin? I mean I think they're essentially literally the same thing. It's like you have a train set and a test set. In traditional machine learning it's like what's the difference between your training and your test set? It's like well the point is that they're the same.

46:45 It's that but it's that you're going to train on one and measure with the other. And this is essentially the same idea carried over to environments and evals. Is that they might be slightly different distributions. They might be multiple samples from the same distribution where you kind of have tasks that you're going to have as your holdout, you're going to have in your in your train set. But the point is that the the shape of them is like the same.

47:12 One is going to translate to the other hopefully. And just I think the all the best practices that come up in thinking about evals carry over very directly to environments. And so like when like people are building evals often times like like what a lot of the like large labs will like will like buy environments from companies. Then they'll also like release benchmarks and they're the same thing. They're like just multiple versions of the the same thing where the goal is to be able to measure or directly train on of outputs and answers.

47:53 And then Daniel, do you have anything to add on top of that? I think Will's correct. Like you know I I feel like like you know environments and evaluation you know evals they're mostly similar. You know, you you can see them as similar. You know, as Will was saying you know all of these benchmarks you know MMLU, you know, AMIE all of them. They can be treated as actual environments. And so like you know you have the correct answer, you have the question within these environment you know these questions, these you know large data sets.

48:24 And this can be your environment. And so like you can treat reinforcement learning as trying to like you know Yes, you might be like trying to like your goal is to increase you know your accuracy on these evals. But also it kind of means that you're trying to increase accuracy on these environments. So yeah, they are kind of like the same thing. Yes. Yeah, and you know it's interesting to think because you know a lot of the guidance that when when you know people ask questions, you know, there's customers or individual developers about the process of profiling rewards, right?

48:57 Like you you start with the model, you kind of understand how your task is doing. And of course you need some data and then there's the component of task generation. Right? And we'll talk about that in just a little bit. Right? So you kind of profile your rewards and then that's where it's kind of very simple similar to the the the the idea of benchmarking or evaluating your model. Right? And then and sort of when you add the training engine on top of that essentially now it's what we've called what we've what what we've been calling reinforcement learning.

49:27 Right? So there's environment, there is the training engine aspect of it. Right? And and both of them together are are powering this machine. essentially. And you know, talking about you know, data, right? you know, not everybody has ready access to, let's say, the data. They have sort of an idea of what they want to improve the model on, right? But they haven't really, you know, collected any logs from production, maybe, or or they don't have like readily available data sets.

49:57 do you have any recommendations on how you can approach this problem of, you know, lack of maybe prompts or inputs to the system, right? that you can use for evaluating as well as training. Yeah. I think you you want some source. It doesn't have to be a structured source of prompts, but I think one thing I like as an example is suppose you want to do a training agent for question and answer for retrieval with search over like a mini deep research. all you really need is documents. If you have documents, then you can start building up a deep research agent for those documents because you can sample a document and you can prompt models to generate question answer pairs grounded in a specific document or small group of documents that can fully fit in context.

50:42 and then you might need to tweak the prompts a bit and measure by doing a basic eval whether these question answer pairs are good if you have the answer in context, but you can kind of do sampling approaches to like I'm going to sample a document then I'm going to generate five questions from this document and now I have a lot of questions. and the environment doesn't know which document comes with which question. You have to search the documents to find this out and you can have tools that are using embeddings or other types of retrieval where the model can then search around the documents.

51:14 and so I think you want to be anchoring in something, but it as long as you have some sort of like artifact that captures the knowledge that you care about in some form, the goal is to decompose this into questions and answers or tasks that like correspond to the sorts of things you want the model to do. And like you want to look at your data, you want to like play around with it, you want to sample and make sure that the questions look reasonable. but I think synthetic methods grounded in like concrete documents or artifacts are a very useful way to do this.

51:49 Just going to add like, you know, go to Hugging Face and like, you know, search on, you know, Nvidia has some cool data sets, you know, there are some open source ones. Definitely use like open source. Try to use as much open source data sets as possible. so like if you don't have data, it's okay, you know, try to like find like a similar data set to your problem. and you know, the other trick of reinforcement learning is, you know, I think we previously discussed like, you know, you don't need data, actually.

52:16 but the trick now is you just need, you know, for I'll get like like this may be not be a this is not a good example, but pretend you're trying to like predict the weather. this is not a good example, but like just think about it like, you know, you're trying to predict the weather. You're not, you know, I don't know how to do Navier-Stokes or like some sort of complicated physics simulation, but you know, your computer can. your language model can.

52:36 and the trick is the weather data is on the internet, right? You have the prediction of tomorrow's weather. and then the trick is reinforcement learning can now make the entire prediction like, you know, pipeline, right? It will it can like say, "Oh, okay, maybe I should do Navier-Stokes here or like maybe I should predict this or that or something like that." You know, do some sort of complicated process in between. and the trick is now the problem comes to, you know, comes to like, you know, all the audience, right? What do you want the reinforcement learning algorithm to do?

53:06 You know, what is what is your goal? You know, what do you what, you know, what is your reward function that you want to maximize? You know, what is your reward? You know, do you want to increase profit? Do you want to like, you know, predict the weather? You know, do what what is your goal? and then the question now is, okay, you have this goal, how do you create the environment? and in my view, like, you know, if you want to make this easier for folks, just, you know, call ChatGPT, you know, call call Claude or something, you know, call some open source models. Create the environment as like a first step, you know, like a very good priming example, and then now you have like, you know, the reward function and the environment, and then just run reinforcement learning on it. so in general, like, you know, I think the biggest problem is like, you know, people need to have like a, you know, what do you want to do?

53:52 and then build backwards from there. You know, build the environment, you know, collect data sets from Hugging Face. and just like bootstrap somehow, and yeah. The that's a great answer, Daniel. And and speaking of, you know, getting started, right? Eventually people sort of, you know, hopefully figure out how to build this environment, right? And then at point they want to make sure that they they they they can sort of maximize the gains from training and scale that training up, right? And and you know, this then becomes kind of like an infrastructure challenge more than sort of an a challenge at the algorithmic layer, right? With GRPO because these these algorithms like there are minor tweaks on the on the base GRPO algorithm, the the ones that are latest coming out today. And one of the challenges that I've I've seen a lot of people or I've heard a lot of you know, researchers talking about are the challenges with infrastructure and scaling that infrastructure. The first was making it accessible on consumer GPUs that people could get started. The second one is scaling. so will you know, based on your experience, you know, probably building models as large as Intellect 3 >> >> and and others, do you have any thoughts around scaling, Arel?

55:06 Yeah, so I think one paradigm that's become very prominent over the past year for making the scaling easier is disaggregating your training and your inference and doing what people call async RL where you kind of have training and inference running in parallel where your inference can then scale out to many, many GPUs with like a lot of different replicas and then your trainer can be it's you still have to do the training scaling problem, but it's now a very similar infrastructure problem to scaling large inference and scaling like large pre-training or SFT, which neither are easy on their own, but they're kind of more well-trodden territory as well as just sharing weights from one to the other and doing the orchestration around like running agents at scale.

55:49 but it kind of decomposes scaling RL into more familiar problems that we kind of have other infrastructure for and then we kind of connect them together. and so this I'd say is what we found especially when you have this when you're doing really long rollouts, some will finish sooner than others and I think the the async regime has also been very useful for being able to kind of like overlap different things. They don't need to all finish at the same time. You can have some rollouts keep going while the training is happening and you're doing more rollouts the next batch and there's kind of this cascade from doing sampling and rollouts into training as as soon as you can. but then you're not blocking by waiting for either step to finish.

56:31 and so I'd say that is one big way. Also just like infra, like building like getting your parallelisms right and validating that things work if like GPUs fail. Like at some point you have like you need to deal with like fault tolerance. which is like really relevant when you're training on like, I don't know, hundreds of thousands of GPUs. but usually is less the case when you're training on like 64 or fewer GPUs. >> >> and also just like thinking about what can go wrong in the environment. Like I think dealing with >> >> not even GPU infra errors, but just like sandbox infra errors and timeouts and all of these sorts of things that come up when you're trying to like scale like software in general because like environments are just software. Like they're applications that an agent is doing something in, but scaling software on its own is like a a challenge.

57:28 Daniel, do you have anything to add there? Yeah, I was going to add like as a final thought like, you know, in like, you know, they like to I don't know if you will keep hearing me say this, but like reinforcement learning is kind of like luck is all you need or a better way to put it is like patience is all you need. all you need to do is wait and wait and wait and wait and wait.

57:47 and your reinforcement learning algorithm, if the probability of the reward functions is not zero, right? If it's like 0.0001, it will succeed. you just need to wait. And the trick is if you want to wait less, just buy more GPUs, you know, buy more, you know, more hardware, more hardware, more hardware and you know, your waiting time will be compressed. and that is why, you know, all the large labs are trying to buy more GPUs, you know, they're trying to do more, you know, the reason why they're trying to buy more GPUs is to reach, you know, high accuracy faster, right? They don't need to buy more GPUs, right? You don't need to, but you're going to wait 100 years, 10,000 years, you know, no one wants to wait that long. And so the trick of scaling is you you can wait less. and that is the biggest trick of reinforcement learning. It can scale very well with more hardware. and the more hardware, you know, the faster you'll reach your desired accuracy.

58:40 yeah. That that's well summarized, Daniel. And and you know, thanks for the sort of the the great points there, Arel. I think we need to wrap up this conversation. We're almost at the end of the hour. And and and you know, we'll continue answering some of the questions in in Discord after that. So we do have a Discord and and and and so there are a few, you know, last conclu- conclusion slides. Zach, if you want to pull them over to sort of round up this presentation.

59:13 this is the AI team as you're probably aware. next slide, please, Zach. and we do have some learning paths on how to get started. it sort of how to build an AI agent as well as how to build agentic AI rag, you know, reinforcement learning is a critical component in these and you know, even before you get started should probably you know, use some of the agents before you actually go and build these or you know, fine tune these right. So we have some learning paths.

59:40 You can find the links here on the slide. You know, next slide, please. Zach. And you know, talking about NVIDIA NeMo Trai NeMo Trai is our you know, our you know, open source model as well as data sets and recipes to build those models. There's a GitHub there with all the resources where you can get started as a developer repository. It contains cookbooks, use case examples, not only to deploy and fine tune these models, but also you know, some more you know, agentic examples how to build agents with these.

60:12 So you can find them on the GitHub right over there. Next slide, please. And then like I mentioned before, we have a Discord channel. We're going to try to answer we actually piled up many many questions that we weren't able to answer. You know, the discussion could probably continue for several more hours but we have to end. We'll continue answering those questions in the Discord. Right? You can find them here at discord.gg/nvidia-developer. The channel is hashtag NeMo Trai models.

60:39 Next slide, please. And now you can also email your questions directly or any concerns that you have at community@nvidia.com and we'll try to answer them as soon as possible. And and then there is a NeMo Trai model reasoning challenge on that is going on on Kaggle right now and you know, you can scan the QR code to get started. There are some very exciting prizes. You know, you know, if you if you if you win this challenge, but then even generally like as a as a learning opportunity, it's always worth it to go there and and look around what's it about.

61:18 Next slide, please. Zach. Oh, this was the last one. Well, thanks for the you know, exciting and and interesting discussion Will and Daniel. Like it it's always great to learn from you know, thought leaders in the space such as such as yourselves and you know, you're prominent community voices and it was great to hear some of the more you know, you know, fundamentals around reinforcement learning from from you guys and your perspectives around that. And and do you have any like closing thoughts to to end this conversation?

61:56 Will and Will. Yeah, I'm thinking about last words would be think about what you want your model to do. Think about what you like I think training is great but the goal of training is to have a model that you can do something with and I think it's useful to start by writing down what you actually want, what your actual deployment setting would be or the question you want to answer if you're doing this for research and then kind of walk back from that into spaces of different training methods and approaches.

62:31 And I don't know, I think environments are very useful way to think about not just RL but also evals and synthetic data and prompt optimization. Like many things can be environments. Well said. Daniel. I think like I mean as a call to action, I would like people to work work more on reward hacking. You know, how do we detect if reward hacking is happening? How do we like counteract it? You know, how do we like you know, stop that from happening?

63:05 Definitely check out like you know, all of our GitHubs. There's a lot of guides. You know, that is a very good starting place for people to learn. And there's many many many tips and tricks. You know, how do we like you know, make reinforcement learning more efficient? You know, definitely you know, there's a lot of guides on that. But yeah, like my main call to action is you know, you know, for for people listening, you know, please focus you know, on like you know, try to you know, try to investigate you know, what is reward hacking? How do we stop it?

63:32 You know, my view this is probably going to be this is probably going to be one of the biggest issues of reinforcement learning. And probably makes you know, AI labs you know, they can't sleep on this problem. You know, can you scale reinforcement learning to large scales? But then you know, you never know. Maybe if reward hacking will overtake everything. So Yeah. So we need better hello world examples where reward hacking is a problem. I think this is a like what are some intentionally brittle like code environments where reward hacking is like not obvious but it's possible. And I think it feels like the examples currently that a lot of people have either only show up at like really crazy scale or they're like so toy that they're like kind of not actually very useful to think about. And I think having a better collection of examples that are in the sweet spot that you can run it on a small model and you can see reward hacking show up later in your training run, that would be really valuable for the research community to be able to investigate.

64:34 Well, thank you Daniel and thank you Will. That was a great conversation. And for everyone watching, you know, you'll find a few links in the in the chat over there to as as you know, the call to action and getting started for you know, NeMo RL, NeMo Gym. There's some foundational material on on getting started with environments that we have created. Unsloth has some pretty great collab notebooks that you should definitely check out and then Prime Intellect.

64:58 Right? Got a bunch of great libraries to help with building environments and also training with them. Yeah, we have some guides on our site as well in our docs and training platform that has free access to do training runs. Yeah. Well, thanks all for joining. See you in the next stream. Bye. Thanks a lot.

© transcribe · For agents Built with care and craft by Gokul Rajaram