code q&a
Resources About
Question:

What is reinforcement learning?

Reinforcement learning is a way of training an AI by rewarding it when it does something right and penalizing it when it does something wrong, so it learns through trial and error. It’s often called RL and works a lot like how people learn. A teacher tells you “yes, that’s the right answer” or “no, it’s this other thing” and you do better on the next one. It’s also how you get better at a video game by playing it over and over.

The setup has a few basic pieces. The thing doing the learning is called the agent, which could be something like a character in a video game. The agent takes actions in its environment and gets a reward or a penalty based on how things turn out. It plays thousands or millions of rounds and slowly learns which actions lead to the most reward.

Reinforcement learning goes back way before LLMs. Andrew Barto and Richard Sutton started working out the core ideas in the early 1980s and later wrote the standard textbook on it. They won the 2024 Turing Award for that work. One of reinforcement learning’s most famous wins came when DeepMind’s AlphaGo beat Go champion Lee Sedol four games to one in 2016. AlphaGo got that good partly by playing against versions of itself over and over and learning from its mistakes.

Reinforcement learning is also a big part of how the AI models behind tools like ChatGPT get fine-tuned. OpenAI used a technique called reinforcement learning from human feedback, usually shortened to RLHF. People ranked the model’s answers and those rankings became the reward that pushed it toward being more helpful. Reasoning models, which think through a problem step by step before answering, are trained with reinforcement learning too. They get rewarded when they reach the correct answer on math and coding problems, so they learn to break hard problems into smaller steps and catch their own mistakes.

I remember hearing about it for the first time when I took Andrew Ng’s Coursera course on ML. It makes a lot of sense because it seems exactly like how humans learn. Almost everything we do besides our instincts comes from trial and error. AI models have instincts too, which come from their training data.

You might also like