In this episode, we demystify how researchers teach AI models to behave helpfully and safely using Reinforcement Learning from Human Feedback (RLHF). We discuss why even very large models can generate undesired outputs and how RLHF addresses this by incorporating human preferences. You’ll learn how methods like InstructGPT were trained: first by gathering human-written demonstration responses, then by having humans rank model outputs to train a reward model, and finally using reinforcement learning (e.g. with PPO) to fine-tune the model so that it better aligns with what users want. We also talk about improvements like Constitutional AI and why aligning AI with human values is an ongoing challenge.
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Welcome back to the Deep Dive. We're glad to have you with us. Today we are tackling a subject that feels a bit like looking under the hood of a Ferrari, only to find out the engine is being driven by a very polite, very specific set of traffic laws. We're looking at the Practical AI Digest edition of our show, and the focus is squarely on the architecture that really changed everything. Instruct GPT. It's great to be here. And you know, that Ferrari analogy isn't too far off actually. We are talking about some serious high performance machinery. But the steering mechanism, the thing that makes it useful for
an actual driver, that's what we're dissecting today, specifically reinforcement learning from human feedback. Or you know, the famous acronym RLHF. Right, RLHF. And before we get into the nuts and bolts, and there are a lot of them today, we really need to set the stage with the problem because before instruct GPT, we had GPT 3 and well, GPT 3. Was this just technological marvel? It had a bit of a personality problem. We call this the misaligned genius paradox. Oh yeah, it's a paradox that anyone who used those early API's remembers vividly.
I mean, you have a model like GPT 3 that has read essentially the entire public Internet. It knows everything. But if you ask the original GPT 3 to write a recipe for chocolate cake, well, it might not actually give you a recipe. No, I remember this so clearly. You'd type that in and it might just complete the sentence that say something like write a recipe for chocolate cake and then eat it. Or it would just list ingredients with no instructions. Or worse, it might just start reciting a Wikipedia article about the history of cocoa beans. Which, to be fair, is
technically correct English. It's grammatically perfect, but it is totally useless if you're standing in your kitchen holding a whisk. So why did it do that? I mean, if it's so smart, why couldn't it understand the simple command? And that brings us to the absolute core concept you have to understand. It's this objective mismatch. This is the root tension in these large language models. You have to remember what pre training actually is. That massive phase where the model reads the Internet, it optimizes for one and only one specific thing, predicting the next token.
It's a completion engine. It is not by default an instruction following engine. OK, so when I type write a recipe, the model isn't thinking. Oh the user wants instructions. It's thinking based on all the text I've ever seen. What words usually come after this exact phrase? Precisely, and on the Internet, a phrase like write a recipe might be a header on a blog or a form title, so it just predicts the next likely text. The objective of predict the next word on a web page is fundamentally different from helpfully follow this user specific request. So the model wasn't broken, it
was just misunderstood. Or rather, it misunderstood us. It was misaligned. And that is the whole mission of today's deep dive. We're going to break down exactly how open AI solve this with instruct GPT. And here's the kicker, The thing that really shocked me when I went back through the papers, we aren't talking about making the models bigger. In fact, spoiler alert, we're going to see that a 1.3 billion parameter instruct GPT model, which is, you know, relatively tiny in this world, can actually outperform the massive 175 billion parameter GPT.
See. That is the part that blows my mind. It just disrupts that whole bigger is better narrative that we heard for years. It's not about size, it's about the training methodology. It is all about the objective function. We are going to dissect the methodology known as RLHF, and it breaks down into three very distinct steps. If you're an engineer building your own models, or you're just trying to understand how ChatGPT actually works, this is your road map. Step one is supervised fine tuning or SFT, Step 2 is training a reward model, and Step 3 is the actual reinforcement learning loop using PO. OK, let's unpack this
systematically. Step one, supervised fine tuning the warm up. The warm up is a really good way to put it, because before you can use reinforcement learning, which is a pretty complex optimization process, you need a model that at least vaguely understands what an instruction even looks like. You can't just start from a raw completion engine. You're facing what's basically a cold start problem. Right, because the model has never seen a prompt like explain quantum physics to a 5 year old followed by an actual good explanation.
It's only seen raw Internet text, so where do they get this initial training data? It didn't just exist naturally. They had to build it Open AI had to go out and hire about 40 contractors. And I want to emphasize this wasn't just some random crowdsourcing on Mechanical Turk. These people were screened. They looked for high performance, but also sensitivity to demographic groups and an ability to identify harmful content. They needed really high quality labelers because you know, garbage in, garbage out and what? Exactly. Were these 40 people writing all day?
They were creating the ground truth. They produced a data set of prompts and crucially, the desired outputs. They were working with three main types of data sources here. First, there were labeler written prompts. They just asked the contractors to come up with plain tasks. You know, open-ended questions, brainstorming lists. Tell me a story about a frog or list five ways to save money. OK, so just generating a bunch of basic tasks. Right then second they had few shot variations. This is where they give the model and instruction and a few examples of how to solve it, and
then ask the labelers to write the final perfect response. And what was the third source? The third source is fascinating because it came from the real world. They took actual prompts submitted to the early Open AIAPI, filtered for any personally identifiable information of course, and had the labelers write the perfect response to those real world queries. So a human looks at a prompt like list 5 ideas for birthday party and they actually sit down and write out a good list 1 bowling, 2 pizza and so on. Exactly. They're creating demonstrations. This is supervised learning in
its purest form. You feed the prompt and the human written answer into the model and you say copy this behavior. You are literally showing the model. When you see an instruction, you don't just complete the sentence, you answer the question. OK, let's get technical for a second. For the engineers listening who might want to replicate this or just understand the mechanics, what does this training route actually look like? So they took a pre trained GPT 3 model and fine-tuned it on this new demonstration data. They trained it for 16 epochs.
They used a cosine learning rate decay, which is pretty standard for stabilizing convergence as you get closer to the optimal weights, and they used a residual drop out of .2. Wait 16 epochs? That seems like a lot for fine tuning. Usually when you fine tune on a small data set like that, you really worry about overfitting right? Where the model just memorizes the training data and then can't generalize to new things. That is a fantastic point, and it leads to one of the most interesting nuances in the whole paper. They actually found that the model did overfit on the
validation loss after just one epoch. Hold on, so the validation loss, the main metric that tells you if the model is learning general patterns. It started getting worse after only one epoch, yes. In a traditional ML workflow, you would stop training immediately. You'd say, OK, we're overfitting the model is memorizing the test answers, cut it. But here is where it gets really, really interesting. Even though the validation loss was spiking the human preference scores, the actual rating of how good the answers were from a person continued to improve. That is so counterintuitive.
The math is screaming stop, but the product quality says keep going. Exactly. It suggests that the validation metrics we traditionally use for language modeling like perplexity, which measures how surprised the model is by text. They aren't perfectly correlated with what a human perceives as quality. So they just ignored the validation loss spike and kept training for all 16-8 box. Wow, living dangerously. I love it. So at the end of step one we have the SFT model. It's better than raw GPT 3 at following instructions, but it's still pretty limited by the fact
that it's just mimicking a small group of humans. Correct, it's the baseline policy. But stealing this is impossible. You just cannot hire humans to write a perfect paragraph for every possible query in the universe. It's way too slow and way too expensive. You hit a bottleneck really fast. Which brings us perfectly to Step 2, the reward model, or, as I like to call it, building the Critic. This is the real pivot point. The realization is that it's much, much faster for a human to rank outputs than to write them from scratch.
Look, if I ask you to write a sonnet about a toaster, that might take you 10 minutes of creative effort. If I show you 2 sonnets about toasters and just ask which one is better, you can probably decide in 10 seconds. So we switch from creation to curation. We move from writing to judging. How does the data collection work for this part? So the system presents a labeler with one single prompt and then K different model outputs. In the paper. K is usually somewhere between 4:00 and 9:00, so the model generates A9 different versions of an answer. So one question, 9 different answers generated by the model and the labeler just picks the
best one. Not just the best one, they rank them from best to worst one through 9. That seems straightforward enough, but how do you train a model on rankings? I mean, a neural network usually wants a target number like a score. It wants to know this is a 7 out of 10. This is where they get into a really clever efficiency hack. They train a reward model or RM to predict which output a human would prefer, but instead of running a forward pass for every single pair of answers which would be computationally heavy,
they treat all the comparisons from a single prompt as one batch. OK, walk me through that math. If I have 9 outputs, how many comparisons is that? It's a combinatorics problem. It's K choose 2. So if you have 9 outputs, that's 36 unique pairs. You know, output one versus output 2, one versus 3, two versus 3, and so on. If you process those separately, you'd be running the model 36 times. By doing it as a batch. They only run the forward pass once per completion, and then they calculate the loss for all 36 pairs at the same time. It's a. Huge compute saving. You're essentially getting 36
pieces of training data for the price of nine generations. A massive efficiency game, and for the loss function itself they use a cross entropy loss that's based on the log odds. Basically, the reward model outputs A scaler score, just a single number for each piece of text. The loss function then tries to maximize the gap between the score of the winning text and the losing text. So the reward model is learning to assign a high number to the text the human liked, and a low number to the text the human hated. Exactly. It becomes a numerical proxy for human taste.
It's an automated critic. Now I noticed a detail in the architecture choice here that I really want to flag. The main GPT 3 model is 175 billion parameters, but for the reward model they used the 6 billion parameter model. Why go so much smaller? Wouldn't a bigger brain make a better critic? You would think so, but they ran into some very practical issues. They found that training 175 B parameter reward models was just really unstable. It's hard to get them to converge reliably. Plus, you have to remember that in step three, we're going to be
using this reward model inside a loop. It needs to be fast. A 6B model was the sweet spot for stability and compute cost. It's the Goldilocks zone, big enough to understand the nuance of the text, but small enough to run efficiently over and over again. And one final technical note on the reward model before we move on. They normalize the output. They set the bias in the final layer such that the mean score of the original labeler demonstrations is 0. Why does that matter? It just acts as a baseline. It means positive scores are better than an average human
demonstration and negative scores are worse. It really helps with interpretability when you start the reinforcement learning. It gives you a kind of C level to measure against. OK, so to recap, we have our SFT model, the writer and our reward model, the critic. Now we can fight Step 3, reinforcement learning via PPO. Or collaborate depending on how you look at it. This is the optimization loop. We are taking that SFT model which we now call the policy and we want to fine tune its
parameters to maximize the score it gets from the reward model. This is the environment set up for the RL problem. Exactly. It's a banded environment. The model sees a random customer prompt, it generates a response, and then bam, the reward model gives it a score. There is no human involved in this loop anymore. It's just machine teaching machine. And the algorithm they use is PPO, Proximal Policy Optimization. We don't need to get into all the math here, but what is the intuition behind using PPO? Specifically, why not just standard gradient descent? PPO is great because it's stable in reinforcement learning.
If you update your policy too aggressively based on a single piece of feedback, you can actually collapse the model. It just starts doing bizarre things. PPO limits how much the policy can change in any single step. It forces the model to learn gradually, which prevents it from going off the rails because of one weird data point. This raises a really important question though. If the models only goal is to get a high score from the reward model, why doesn't it just cheat? That is the classic alignment problem. It's called reward hacking. If the reward model has some
weird blind spots, say it really, really likes the word fantastic, the policy might just learn to output fantastic, fantastic, fantastic over and over to get a high score. Or it might just output gibberish that just happens to trigger the right neurons in the reward model. Right, it's because student realizing the teacher gives A's for long essays so they just write pages of nonsense to get the grade. How do they stop the model from gaming the system? They introduced something called AKL penalty. This is an absolutely critical design choice. KLD Virgin that measures how
different 2 probability distributions are, right? Exactly. So while the RL model is training, they calculate the KL divergent between the new RL policy and the original SFT model. They then add this value as a penalty term to the reward. OK, let me see if I have this right. The model gets points for pleasing the reward model, but it loses points if it writes text that's too different from what the original SFT model. Would have written precisely. It's like a rubber band. The SFT model represents natural
human like English. The KL penalty anchors the RL model to that baseline. It says, look, you can optimize for the reward, but don't drift so far away that you stop sounding like a human. That is such a smart constraint. It forces the optimization to happen within the realm of coherent language. It prevents the model from turning into a gibberish spewing robot just to maximize the score. Absolutely. Without that KL penalty, the model would almost certainly drift into adversarial examples texts that looks like noise to us, but looks like pure gold to the reward model.
And for the engineers taking notes, what are the hyperparameters here? They set the PPO clip ratio to .2, which is fairly standard. They sampled rollouts at a temperature of 1, which helps ensure diversity during training, and they initialize the value function from the reward model itself. These are the specific dials they turn to make the whole system stable. OK, so we have this beautiful three-step loop, SFT to RM to PPO. Yeah, but it wasn't all smooth sailing. They hit a problem they called the alignment tax, and this is something that I think is so
important for people to understand about modern AI. Yes, the alignment tax. This is a fascinating trade off. What they found was as they trained the model to be super helpful to customers. You know, answering questions, writing lists, being polite. The model actually got stupider at standard NLP benchmarks. Stupider in what way? It started failing at things like Squad which is a question answering data set or DRP, a reading comprehension task or even basic translation tasks. The model started to forget the fundamental facts and logic it learned during pre training
because it was so hyper focused on this new chat style. It's like a student who crams so hard for the etiquette exam that they forget all their calculus. That is a perfect analogy. The alignment to the user instructions came at a tax to its general capabilities, and this is obviously bad. You don't want a helpful assistant that can't do math anymore or forgets how to translate French. So how do they fix it? This is where this PPO PTX thing comes in. Right, PPO PTX. It stands for PPO with a pre training mix. The solution was actually surprisingly elegant.
During the RL update step they didn't just update based on the reward model, they also mixed in gradients from the original pre training data. So they are actively reminding it of the basics while teaching it all the new skills. Exactly the objective function became maximize the reward from the critic plus maximize the log likelihood of the original pre training text. So they're balancing two goals at the same time. Be helpful to this user right now, but also don't forget how to predict the the next token in a Wikipedia article. And they use a coefficient gamma
to tune this balance. The result was that PPOPTX fixed the performance regression on benchmarks like Helleswag and Squad. And, crucially, it didn't hurt the human preference score. So they effectively evaded the tax. They got the alignment without losing the intelligence. Almost entirely yes. It's one of those rare have your cake and eat it 2 moments in machine learning engineering. It proves you can have a model that is both polite and smart if you are just careful about how you train it. All right, let's talk results.
Does all this complexity, this three-step process, the labeling, the PPO, the KL penalty, I mean, does it actually pay off? The headline metric is just undeniable. In head to head comparisons, labelers significantly preferred the outputs from the Instruct GPT model over the original GPT 3. But here's the real kicker, the size difference. You mentioned this earlier, but I just want to double click on it. Right, so they compared a 1.3 billion parameter instruct GPT model against the 175 billion parameter GPT 3, the one point 3B Model 1. That is just insane. A model more than 100 times
smaller was perceived as better by humans. Proves that alignment is more important than raw capacity for user satisfaction. I mean, a massive genius that ignores you or speaks in riddles is way less useful than a reasonably smart assistant that listens intently and just answers your question directly. What about specific metrics? We talked about hallucinations earlier where the model just makes stuff up. On closed domain tasks, where the model is supposed to use only the provided text to answer a question, instruct GQC hallucinated significantly less.
The rate went from 41% with GPT 3 down to 21% with Instruct GPT. That's a huge drop. That's cutting the lyre factor almost in half. It is so truthfulness improved, but there's a nuance with toxicity that I find really important, and it's a bit counterintuitive. This is the. Respectful versus obedient tension. Exactly. So when you instruct the model to be respectful, instruct GPT is much less toxic than GPT 3. It filters itself better, however, because it is so well trained to follow instructions if you explicitly order it to be toxic. Right and nasty consult about my neighbor.
Instruct GPT is actually better at being toxic than GPT 3. It complies. GPT 3 might wander off topic or write some generic sentence but instruct GPT says yes Sir here is the toxicity you ordered. That is such a double edged sword. It follows instructions for better or for worse. It's not necessarily good in a moral sense, it's just obedient. Correct. It reflects the data it was trained on and learned that following instructions is the prime directive, even if the instruction is nasty. This is a key distinction
between alignment and safety. It's aligned to your intent, even if your intent is bad. Now, one of the most surprising sections of the paper for me was about generalization. They call it a free lunch. And in ML, there's usually no such thing as a free lunch. Every game usually comes with a cost somewhere else, but here they found that the model improved on tasks it wasn't explicitly trained for during the RHF process. For example, non-english languages, the training data was 96% English, and yet Instruct GPT got better at following instructions in French, Spanish
and Japanese. Main code right? I saw that too. Yes. Summarizing code and answering questions about code. They didn't have a massive code instruction data set in that fine tuning mix. So how on earth did it get better at French and code if it wasn't studying them during the fine tuning? The hypothesis is that the model already knew French and code from the pre training phase. From reading the Internet, the RLHF process didn't teach at French, it taught it the concept of instruction. Following, it learned a generalized behavior pattern.
Identify the request, execute the request. It could then apply that pattern to its latent knowledge of French. That is just fascinating. So it learned the shape of being helpful and then applied it across its entire knowledge base. It suggests that alignment generalizes better than we might have thought. You don't necessarily need to align every single sub domain separately. You teach it the rules of the road once and it drives correctly on every highway. But we have to ground this. It's not perfect. The authors are very clear about the limitations. We shouldn't pretend this solved AGI or anything. Oh, absolutely.
Really not. It is still a statistical model. It still makes very simple mistakes. 1 funny behavior, they noted is hedging. This is the model acting too humble, Yeah. If you ask a simple question, it might give you this long winding answer saying well there are many perspectives on this instead of just answering the question. Why would it do that? Is it just being annoying? It's likely because the labelers favored epistemic humility. They rated cautious answers higher than confident but wrong answers. So the model learned that playing it safe, sounding like a
diplomatic bureaucrat is the best way to get a reward. It learned that if it sounds uncertain, it won't get punished for being wrong. That's pure game theory. In a way, yes, and it also struggles with false premises. If a user asks something like why is it important to eat socks after meditating, the model might try to invent a reason. Eating socks grounds your spiritual energy. Something like that. Exactly because it wants to be helpful, it assumes the user knows what they're talking about. It tries to rationalize the premise rather than correcting the user and saying hey, you
shouldn't eat socks. That is a dangerous trait in a product. It reinforces user misconceptions because it's trying so hard to be polite. It is. And finally, we have to talk about cultural bias. Who are these 40 labelers? We keep mentioning them, but their identity really matters here. The paper says they were mostly English speaking US and Southeast Asia based contractors. Right, so the model is aligned to their preferences. It's not aligned to universal human values, because those don't really exist. It's aligned to the specific values, norms and biases of
those 40 people and the open AI researchers who wrote the labeling guidelines for them. So if you're from a culture that values directness and the labelers valued politeness, the model might feel annoying or even fake to you. Exactly. Alignment is subjective. We are not aligning to truth in some cosmic sense. We are aligning to a specific data set of human feedback. The AI is a mirror of the people who graded its homework. So what does this all mean for the engineer or the builder who's listening right now? They want to implement this. What is the core lesson? The take away is crystal clear.
If you want a model to act as a product, as an assistant, you simply cannot rely on next token prediction alone. It is not enough. You need a signal for human preference. And the recipe is now established. The recipe is demonstration which is SFT, then ranking which is the RM, then optimization which is PPO. That is the pipeline that turned GPT 3 into ChatGPT and completely changed the industry. It is a standard operating procedure for modern LLMS. SFTRMPPO read it on a post it note.
It's the formula for modern AI. Before we sign off, I do want to leave you with a thought. We talked about the alignment tax and how they fixed it by mixing in old data. But it makes me wonder, does aiming for helpfulness inherently conflict with truthfulness in the long? Run. That is the big unanswered question facing the field right now. If users want comforting lies and labelers reward those comforting lies, the reward model will train the AI to lie. And as these models get smarter, you know, smarter than the labelers themselves, we'll will humans even be able to rank the
outputs correctly? If the AI writes a proof for a physics theorem that the labeler doesn't understand, does it just get a low score because it went over their head? That's the scalable oversight problem. Can dumb humans supervise smart AI? We might need a whole other deep dive just for that one. Indeed, we might. That's all for today's Practical AI Digest. Thanks for diving deep with us. Until next time.
An accurate prediction can still pick the wrong action. Uplift, double ML, causal forests, new causal foundation models, and experiments as ground truth.
Pretrained models now predict on your spreadsheet with no training. Where they beat tuned XGBoost, where they still lose, and what the licenses let you ship.
AI systems can reason through anything but cannot remember the solutions. Why catastrophic forgetting is now a production problem, not just a research one.