Reinforcement Learning

202502101753478
Once a model has been trained on internet data, it still doesn't know how to use its knowledge effectively.
Supervised fine-tuning teaches the model to imitate human responses.
Reinforcement learning (RL) helps the model improve through trial and error.
How Reinforcement Learning Works

rl-1
Reinforcement learning doesn't rely on datasets created by humans. Instead, it lets the model try different solutions to find the most effective one.
Example process:
We generated 15 solutions.
Only 4 of them got the correct answer.
Pick the best one (both correct and concise).
Train on it.
Repeat many times.
No humans are involved in this process. The model generates different solutions to the same problem—sometimes millions of them. It then compares those solutions, picks the ones that arrive at the correct answer, and trains on those winning solutions.
Both pretraining and post-training are very clearly defined, but the RL process is still an area of active research. Andrej also talks about this here. Companies like OpenAI do a lot of research on it but don't publish it. That's also why DeepSeek's release was such a big deal. Their paper discusses this in detail, openly explaining RL and fine-tuning for large language models and how it elicits many of their reasoning abilities.
An example from the DeepSeek paper shows that over time, the model can use more tokens to improve its reasoning.

rl-2
You can see the model hit that “aha” moment here—this isn't something you can explicitly teach it just by training on a dataset; the model has to discover it on its own through RL. The upside of this technique is that the model's reasoning keeps improving, but the downside is that it consumes more and more tokens.
One thing we can learn from the research paper on the Go grandmaster: RL actually helped the model surpass human peers in reasoning. The model isn't just trying to imitate humans; it keeps proposing its own strategies through trial and error to win games.

rl-3
A very distinctive phenomenon observed in the AlphaGo match was a move known as Move 37. This move wasn't in the training data, but the model won using its own strategy. The researchers estimated that the chance of a human playing this move was about 1/10,000. So you can see the model is capable of coming up with its own strategies.
RL still has many unexplored areas, and there's a lot of research underway in this direction. It's entirely possible that, given the opportunity, large language models could create a language of their own to express their thoughts and views, because they find it's the best way to express their ideas.
Learning in Unverifiable Domains: Reinforcement Learning from Human Feedback (RLHF)
In verifiable domains, it's easy to keep humans out of the RL process because large language models can act as judges of their own performance.
However, in unverifiable domains, we need to bring humans into the loop.
For example, for the prompt write a joke about a pelican, it's hard to find an automated way to judge the quality of the joke. Large language models can easily generate jokes but can't judge their quality at scale.
Also, including humans in a large-scale process isn't realistic. That's where RLHF comes in. You can learn more in this paper.

rlhf-1
To do RLHF at scale, you basically need to train a separate reward model, which can be a Transformer without extra layers. You have humans judge the ranking of its answers, then use those judgments to train the reward model until you're satisfied with the results. Once that's done, you can use the reward model to judge the quality of responses generated by large language models at scale.

rlhf-2
Advantages of RLHF
Enables reinforcement learning in unverifiable domains such as writing jokes or summaries.
Usually improves model performance by reducing hallucinations and making responses more human-like.
Leverages the “discriminator-generator gap”—it's easier for humans to evaluate answers than to generate them.
For example: “Write a poem” vs. “Which of these five poems is the best?”
Disadvantages of RLHF
The reward model is only a simulation of human preferences, not actual humans, which can be misleading.
RL can exploit system vulnerabilities and produce adversarial examples that take advantage of weaknesses in the reward model.
For example: after 1,000 updates, the model's “best joke about a pelican” may turn into complete gibberish (e.g., “the the the the the the the the” ).
This phenomenon is called adversarial machine learning. Because there are endless ways to exploit system vulnerabilities, filtering out bad responses isn't easy.
To prevent this, reward model training is usually limited to a few hundred iterations—beyond that, the model over-optimizes and performance degrades.