An AI player takes a step toward the finish flag, slips sideways, and falls into a hole. Nobody gives it a corrected route. It starts again, tries another sequence, and uses the outcomes to change which moves it favors.
Reinforcement learning is a way to train a decision-making system using rewards from its interactions with an environment. The learner, called an agent, aims to improve its strategy over time. The important question is not simply whether one move looks good. It is whether a sequence of moves produces a better outcome.
A small grid game makes the idea easier to follow. We will use that example to separate the reward, the strategy, and the learning process—three things that often get mixed together.
Start with the game, not the algorithm
In Gymnasium’s Frozen Lake environment, a player crosses a grid from a starting tile to a goal while avoiding holes. The available actions are left, down, right, and up. On the slippery version, the player can move sideways instead of in the direction requested.
Its default scoring is deliberately sparse: reaching the goal gives a reward of 1; reaching a hole or an ordinary frozen tile gives 0. Falling into a hole ends the episode. So failure does not need a negative score to matter—it can remove the chance to collect the goal reward.

This is a useful distinction. A reward is a number supplied by the task. It is not praise, understanding, or an explanation of the correct answer. The training algorithm has to turn experience with those numbers into a better way of choosing actions.
The six terms that make the loop understandable
| Term | Meaning in the grid game |
|---|---|
| Agent | The program choosing moves |
| Environment | The lake, movement rules, holes, and finish tile |
| Observation | The position information available to the player |
| Action | A requested move, such as right |
| Reward | The score returned after the move |
| Policy | The strategy for choosing an action from the available information |
A policy can be as simple as a lookup table or as complex as a neural network. It may select a particular move or assign probabilities to several moves. It is the behavior rule the agent uses, rather than the lake itself or the score it receives.
For another description of these components, Google Cloud’s reinforcement learning overview explains the interaction between the learner, its actions, and feedback from the environment.

Why the best move may give no immediate reward
Imagine two routes from the same starting square. One heads toward the goal but passes close to a hole. The other begins by moving away from the goal, then follows a safer edge. A rule that rewards only getting closer can favor the risky route.
Reinforcement learning instead considers a return: accumulated rewards over a sequence of interactions, often with a discount that gives less weight to rewards further in the future. In a task with a reward only at the finish, earlier actions can still be useful because they make reaching that finish more likely.
There is a difficult assignment problem here. If a successful trip has six moves, which of those moves deserve credit? A learning method needs a way to connect later outcomes to earlier choices. One lucky success also does not prove that every move in the sequence was a reliable choice.
An agent must try things before it knows what works
Suppose the first route that succeeds is long and awkward. Always repeating that route would use the agent’s current knowledge, but it could prevent discovery of a shorter or safer alternative. This is the exploration–exploitation trade-off.
- Exploration: choose actions partly to learn what happens.
- Exploitation: choose actions that currently appear to have the best expected outcome.
An epsilon-greedy strategy is one simple solution. Some decisions use a random action; the remaining decisions use the best current estimate. The amount of randomness can be reduced during training. It is a design choice, not a rule that every RL system must follow.
Gymnasium’s training-an-agent tutorial illustrates this with tabular Q-learning. A Q-table stores an estimate for each state–action pair. New experience changes an estimate using the reward and an estimate of what can be earned next.
What changes when the agent “learns”?
Consider a move that previously looked promising. After it repeatedly leads into a dead end, a value-based learner can reduce its estimate for that choice. A different move can gain value when it opens a route to later success. Those changing estimates affect the policy’s future choices.
Other methods adjust a policy more directly. Actor–critic approaches combine a policy component with a component that estimates value. These are different ways to organize learning; reinforcement learning is the broader problem setting, not the name of a single algorithm.
Deep reinforcement learning uses neural networks within that process—for example, to estimate values from a large observation such as a game image. “Deep” describes the model, while “reinforcement” describes how the decision-making task is framed. Our deep learning explanation covers the model side.
Rewards can teach the wrong lesson
Now change our imaginary game so the agent gets a point every time it touches a checkpoint. If it can step off that checkpoint and return forever, it might collect points without finishing. That behavior fits the score, even though it misses the designer’s intended goal.
This hypothetical illustrates reward misspecification: the measured objective does not fully represent the outcome people want. Adding more reward terms can help, but each term can create another trade-off or loophole. A high training score should therefore be treated as evidence about the specified task, not automatic proof of useful behavior.
- Check the actual outcome: did the player finish, or just collect points?
- Inspect failures as well as successful runs.
- Test changed starting conditions and repeated trials.
- Keep real-world exploration within safety and permission limits; simulation results do not establish deployment safety.
How this differs from learning from labeled examples
In a supervised photo-classification task, a training example might pair a picture with the label “cat.” In the grid game, feedback does not supply the correct move for every square. Actions affect what the agent sees next, and useful feedback may arrive only at the end.
Unsupervised learning looks for structure in data without those example labels. RL adds the problem of choosing actions to improve outcomes over time. These approaches can be combined in a larger system; they are not mutually exclusive product categories. See our supervised vs unsupervised learning guide for the data-label distinction.
When is reinforcement learning a sensible approach?
It is worth considering when a problem involves repeated decisions, those decisions change later possibilities, and the team can define and evaluate a useful reward. Games offer a clear teaching setting because the rules, actions, and success conditions are explicit.
For a practical project, start by asking whether interaction is affordable and whether mistakes are acceptable. A simple rule-based controller or supervised model can be more appropriate when correct examples already exist or trial and error would be expensive. RL is not an automatic upgrade for every prediction task.
Before trusting a reported result, ask what environment was used, how success was measured, how much training interaction was required, and what happened outside the training conditions. A demonstration can be impressive while answering only a narrow version of the real problem.
Questions readers often ask
Is reinforcement learning supervised or unsupervised?
It is usually discussed as a separate learning setting. Its distinguishing feature is learning a decision strategy from reward-bearing interaction, rather than fitting a set of correct labels or only discovering structure in a dataset.
Does an RL agent keep learning after deployment?
Not necessarily. A trained policy can be used without updating it. Continuing to learn during use requires an explicit design and evaluation process; the presence of feedback alone does not mean the model’s parameters change.
Does reinforcement learning require a neural network?
No. Small tasks can use tables of values. Neural networks become useful when representing the policy or value function with a table is impractical. Using a neural network does not remove the need to choose rewards and test behavior carefully.
The question to keep asking: what exactly does the agent get rewarded for? Understanding that signal often explains both the behavior it learns and the ways it can disappoint the people who designed it.




















