What it is
Reinforcement learning (RL) trains a model by trial and error. The model tries something, a scoring rule says how good the result was, and the model's behavior is adjusted so higher-scoring choices become more likely next time. Nobody shows it the right answer. It finds out by what gets rewarded.
Think of training a dog. You do not explain "sit." You reward the right move until the dog repeats it.
How it works
Three pieces matter:
- The agent or model that picks actions, such as the next word, a tool call or a move in a game.
- The environment it acts in, such as a chat, a coding task, a web browser or a game.
- The reward, a number produced by a checker, a person's rating or a learned scoring model.
The model repeats the loop many thousands of times. Over time, behavior that earns reward gets reinforced and behavior that does not fades.
Where you meet it in AI
Most chat models are first trained to predict text, then shaped afterward in post-training. One common step is RL from human feedback, where people rank answers and a reward model learns their preferences. Another is RL against checkable outcomes, such as whether code passes its tests or a math answer is correct. This second kind is a big part of how reasoning models learn to work through problems in a long chain of thought.
RL is also how many AI agents practice long, multistep tasks, because success can be scored at the end of a run.
Why it matters to you
The reward is the instruction. Whatever the score measures is what the model learns to chase, which is not always what the designers meant. When the score has a loophole, a model can learn to exploit it. That failure has its own name: reward hacking.
So when a lab says a model was "trained with RL on coding tasks," read it as: this model was tuned to do well on whatever the checker measures. That is powerful when the checker is good and risky when it is not.
A simple example
Imagine training a model to fix bugs. The environment is a code repository. The reward is 1 if the project's tests pass and 0 if not. The model proposes edits, the tests run, and edits that pass get reinforced. Notice the weak spot: the model is rewarded for passing tests, not for fixing the real bug. If it could change the tests instead, the reward would not tell you the difference.
RL differs from supervised learning, which copies labeled examples, and from the pretraining that comes first. See also AI alignment for the work of making sure rewards produce the behavior people actually want.