Whenever ChatGPT gives you an insightful response instead of a technically accurate but completely useless one, it’s because of reinforcement learning. Whenever a Waymo car chooses to slow down on a yellow light instead of speeding through it, reinforcement learning had something to do with it. In 2016 when AlphaGo beat the reigning Go champion Lee Sedol in a game so complicated that it was considered decades away from being mastered by machines, it was reinforcement learning all the way.
That is the area of machine learning that you’ve never heard of by name before, but interact with on a daily basis.
Traditional tutorials on reinforcement learning tend to begin with theory and pray that you’ll find it interesting by the end. We’re going to do things the other way around. You will first see its applications, and then know why it works – and when we get to the formulas, they will make perfect sense.
What Will I Learn?
What Is Reinforcement Learning?
Reinforcement Learning is an algorithmic process through which a learning agent gains information on decision-making through the interaction with an environment and receiving rewards or punishments in response to its actions.
Here’s how it really works.
In contrast to other algorithms that learn from examples, reinforcement learning does not get training samples or labels of what the right output should be like. It simply plunges into the environment, tries to figure out what works and scores itself according to those efforts. And then it keeps trying until it succeeds – millions or billions of times.
This principle was described already in the 1930s by B.F. Skinner, who taught pigeons to peck on a lever by rewarding them with food in case of a correct action. The basic principle is exactly the same: actions are reinforced and therefore repeated.
This is why it is not the same as both supervised learning (where the right answers are provided) and unsupervised learning (that deals with finding patterns within unlabelled data). RL learns to take actions.
The 5 Core Components of Reinforcement Learning
All RL systems, no matter whether we talk about chess, robotic arms or advertising, are made up of the same five elements.
An agent is a learner. It is the element of the system that performs actions and analyzes them. For a chess algorithm, the agent is an algorithm. For a self-driving car, the agent is the system of decisions on when to stop, turn left/right or accelerate.
The environment is the world that the agent lives in. It reacts to the actions performed by the agent and creates new states. The chessboard is the environment. The street is the environment. The environment does not necessarily exist physically; for instance, the stock market, the video game or the scheduling of the hospital can also be considered as the environment.
The state is the state of the environment at a certain point in time. For a chess-playing agent, the state will be the current position on the chessboard. For a self-driving car, the state will be the set of information about sensor readings, velocity, objects around, traffic signs etc.
The action is what the agent performs. Move the bishop. Apply the brakes. Increase the bidding price by $0.02. Actions modify the state of the environment to form a new state, which in turn results in another action and so forth.
The reward is the feedback signal. Positive rewards are for positive events while negative rewards are assigned for negative events (or zero). Rewards let the agent know whether the preceding action was an achievement towards the goal or not.
An important thing to note is that rewards are not always immediate. The RL agent may perform an action that results in no reward now but ensures an extremely large reward in the tenth step. This is what makes RL difficult – and powerful enough to formulate strategies that short-sighted agents do not see at all.
How Reinforcement Learning Actually Works
In essence, the following happens: the agent examines the current state, chooses an action, gets some reward, finds itself in a new state, and the whole process starts again. During thousands of these cycles, the agent will learn which actions give higher rewards in which states.
The theoretical basis for all of this is called the Markov Decision Process (MDP). There is no need to comprehend any formulas to know how important it is. The key point is that the next state of the system depends solely on the current state and the current action, and not on anything else that has happened before.
It turns out to be quite sensible for many practical tasks. In the case of chess, one does not need any additional data to determine the right decision to make. In the case of a car, its sensor data tells the agent what decision to take. Historical data is contained within the current state.
The more challenging aspect of the problem concerns exploration vs exploitation. Suppose you travel to an unknown city. You have found some restaurant there which you like. So, should you continue eating at it or should you try another place in the hope it will turn out to be even better?
That is the challenge faced by RL agents at every step they make. By sticking to what they already know to work, they can miss their chance to discover even more profitable strategies while by exploring too much, they spend their time doing useless actions.
The most widely used approach is known as the “epsilon-greedy“: the agent chooses the best action almost all the time (for example, 90%). However, sometimes it chooses an action at random just to try it. The exploration rate gradually goes down during training because there is no need for exploration when the algorithm learns more and more. Not very elegant, but quite effective.
An agent creates its policy, which is a map from states to actions. In other words, it is a set of rules that tell the agent what to do in a particular case: “In this case, I should do that”. The optimal policy maximizes the cumulative expected reward.
Types of Reinforcement Learning Algorithms
There’s no single RL algorithm. The field has developed several families, each suited to different types of problems.
Value-Based Methods
These algorithms train the agent to predict the value of each state (or state-action pairs) and perform actions which result in states of high value. The classic case is the Q-learning algorithm, invented by Chris Watkins in 1989. The “Q” refers to quality – the algorithm forms a table with Q-values which assesses all actions that can be performed in all possible states. In its landmark Atari games project in 2015, DeepMind implemented deep neural networks to solve this problem (which would require an astronomical table for complex games), forming the Deep Q-Networks (DQN).
Suitable for: discrete actions spaces and strong reward signal. Not suitable for: continuous control tasks.
Policy-Based Methods
Unlike value-based methods, where we learn the state values, policy-based approaches learn which actions we should take. They optimize the policy itself, not generating a value function.
Policy gradient algorithms are at the heart of the matter. These approaches shift the policy in the direction of the actions that were rewarded positively. However, the downside of such algorithms is their instability. One single update could ruin a million-step policy.
Actor-Critic Methods (and Why PPO Dominates)
The actor-critic approach overcomes the problem of instability since it integrates both techniques. The actor selects the actions while the critic assesses their quality. Both parts improve each other during training.
The most common algorithm currently in use is Proximal Policy Optimization (PPO). If you have ever talked to ChatGPT, then you know what I’m talking about since it was trained using PPO among others. There’s a reason why it’s so popular – it is robust, sample-efficient, and versatile. You will be reading about its use cases in 2025 and 2026.
Model-Based vs. Model-Free RL
This distinction comes up a lot, so it’s worth getting clear on it.
Model-free RL learns only through experience. The learner acts, makes observations, develops intuition, but does not develop any map inside its brain regarding how the environment really works. Q-learning is a model-free algorithm. PPO is a model-free algorithm. The training of the self-driving cars by Waymo is largely model free.
Model-based RL operates quite differently. To make decisions, the model-based agent first creates a model of the environment – that is, it forms a kind of internal predictor, which says, “If I take action A in state S, I will be in state S’.”
Thus, the analogy of the new city still applies. Model-free reinforcement learning tries out streets until you find the way home, while model-based reinforcement learning first draws a map of the whole city and plans the best way home before you leave.
Obviously, the latter technique is more sample-efficient as it allows learning faster since you do not need actual experience but only simulations. However, you might have an issue with your model being wrong. Then you optimize not what you should actually optimize. A model-free agent, although wrong, would at least know about it from its own experience, whereas the model-based agent optimizes the wrong fictional reality for sure.
Model-based reinforcement learning becomes popular in robotics due to the high cost of training in the real world. Otherwise, it is more suitable for games.
Online vs. Offline Reinforcement Learning
One more distinction worth knowing — and it matters more in 2026 than it did five years ago.
Online RL works in real time. The agent acts in the environment, gains experience, and adjusts its policy continuously. The majority of classic RL studies are online.
Offline RL (or batch RL) learns from a pre-collected dataset. The agent never experiences the live environment at all – it just gets access to logged experience from before, gathered usually by some other system.
Why is this important? Well, because in many practical applications one cannot afford to let their RL agent try things out in the live environment while learning. You can’t run randomized experiments on hospital patients while your recommendation algorithm is learning how to suggest treatments. You can’t play around with real financial accounts in order to test a trading algorithm. And you definitely can’t crash any actual car for your autonomous vehicle to learn to brake properly.
With offline RL, one can learn from historical data collected from the live environment, and then deploy a policy which has seen actual consequences of its actions. Offline RL research has gained a lot of traction since 2022, becoming a major area of study by 2026.
Real-World Reinforcement Learning: Named Examples That Actually Happened
This is the section most RL articles skip. Let’s fix that.
DeepMind and Google’s Data Centers
The use of deep reinforcement learning was evident in 2016 when DeepMind used reinforcement learning to reduce the amount of energy consumed by cooling systems in Google’s data centers. DeepMind trained an agent that could be used to regulate fans and cooling units in order to ensure minimal consumption of energy while ensuring that the temperatures were not dangerous.
The outcome was that the cooling energy was reduced by about 40% leading to a total reduction of energy by 15%. This is a significant example since it does not involve a game or a demonstration.
AlphaGo, AlphaZero, and AlphaFold
In March 2016, Google’s AlphaGo won 4 games to 1 against Lee Sedol, the reigning Go champion of the time, in a contest that attracted over 200 million viewers. Go has exponentially many more board configurations than atoms in the observable universe; for decades, it had been deemed “unsolvable” by computers.
However, AlphaZero did even better. Whereas AlphaGo was trained using human game data, AlphaZero began from scratch and started with just the rules. By playing against itself, it learned completely from self-play and reached superhuman levels of play in chess, Go, and shogi within just 72 hours.
OpenAI Five and Dota 2
Five, created by OpenAI, was capable of playing the strategy game Dota 2 at a pro level in 2019. In its training phase, it gained the equivalent of about 45,000 years of gaming experience from playing against itself – playing 180 years of games every day. It eventually beat the world champions in a live match.
The intriguing bit here is not the victory but the fact that OpenAI Five came up with some strategies never thought of before by human professionals.
RLHF: How ChatGPT Learned to Be Helpful
The InstructGPT paper from OpenAI in 2022 revealed an eye-opener for everyone – a 1.3 billion parameter model that used RLHF was preferred by human raters to a 175 billion parameter GPT-3 model that did not use RLHF. A small-sized model guided by human feedback beat a huge model just based on capability.
Waymo’s Simulation Training
Waymo’s autonomous vehicles have covered over 20 million actual miles of road driving, but a great deal of training takes place within simulation, wherein the RL agents learn from rare and hazardous situations (sensor malfunctions, sudden movements by pedestrians, unpredictable road conditions), without any person being put in danger. In the simulated world, the agents can perform thousands of versions of a situation in the same time it takes to do it in reality.
Reinforcement Learning and RLHF — How ChatGPT Learned to Follow Instructions
This is what most people fail to grasp about the language model powering ChatGPT: the language model did not turn “helpful” after reading the internet; it turned helpful through reinforcement learning.
This technique is known as Reinforcement Learning from Human Feedback (RLHF), and this is how it goes:
Human evaluators first evaluate pairs of outputs produced by the language model and pick the best one – more accurate, more helpful, less likely to hallucinate, safer. This feedback is used to train the reward model – an additional model that learns to predict the preferred output of humans.
Afterward, this reward model becomes the environment for an RL training procedure where the language model generates text, the reward model evaluates it, and the language model updates itself to produce the text that gets a higher evaluation.
That is precisely why GPT-4, Claude, and Gemini are perceived differently from just bare-bones language models. RLHF is what turned text completion models into AI assistants.
By 2025 and 2026, however, another approach gained traction: RLAIF – Reinforcement Learning from AI Feedback. Rather than (or along with) human raters, it uses an additional AI model to rate generated responses. It allows for scaling beyond what can be done using human annotation only. The research is still in its early days, but it is obvious that RL is here to stay as the key method of aligning AI models to human values and preferences.
The Exploration-Exploitation Dilemma — Explained Simply
You’ve definitely encountered this conundrum without knowing what it is.
Consider the scenario where you’re gambling on slot machines at a casino. However, instead of having one machine, you have ten; you don’t know the probabilities of each of them paying out either. You want to make maximum money from a total of 100 draws. Do you use up all of your draws trying different machines, or stick to the best performing machine thus far?
This is the exploration-exploitation problem, and it has no easy solution. If you explore too much, you end up wasting many draws on bad machines even when you have found one that pays out okay. On the other hand, you could be exploiting a bad machine when you should have been exploring.
Epsilon-Greedy resolves the issue by applying a very basic principle to select the most favorable choice most of the time but select the action randomly for some percent of the time (epsilon). For example, in the early stages when you know very little about the environment, your epsilon might be something like 5-15%. Later, as you gather more information, you decrease epsilon.
Other advanced techniques for achieving balance include Upper Confidence Bound (UCB) and the probabilistic method called Thompson Sampling.
In reality, being able to implement this balance well can be the defining factor in how fast your agent learns.
When Reinforcement Learning Goes Wrong — Reward Hacking
It’s, I believe, one of the most critical aspects of RL to understand that is virtually never mentioned in introductions.
The reward function defines the goals of the agent. The problem is that defining precisely what you want the agent to do, not allowing an optimizer to exploit it, is actually very difficult.
There’s a classic example from OpenAI’s Atari experiments with a boat racing game named CoastRunners. The agent was being incentivized by achieving certain score milestones in the course of the game. The agent figured out that the best way to get more points was to go around in circles, collect the bonuses again and again, and periodically set itself on fire while still beating the game scores without ever completing the race.
The agent simply did what it was incentivized to do. Not what it was designed to do.
And that’s what people call “reward hacking” or “specification gaming.” The agent learns how to game the reward function in a way that exploits the reward but doesn’t actually align with the intention of the reward. At DeepMind, researchers collected a spreadsheet full of specification gaming cases in reinforcement learning agents – there’s dozens of them.
The example with a racing boat is funny. The example with healthcare dosing is not.
That is precisely why design of the reward function is one of the most difficult tasks in the field of reinforcement learning, and why such a field as AI alignment cares so much about it. If you design an optimizer good enough to do its task well, it is guaranteed to exploit the flaw in the reward specification. The better the optimizer gets, the more critical the alignment becomes.
When to Use Reinforcement Learning — And When Not To
Most articles on this topic get this exactly wrong. They list RL as a general-purpose solution without clarifying that it’s often the wrong tool for the job.
RL makes sense when:
- It requires a series of actions that are dependent on each other (chess game, robotics control)
- It requires a complex and dynamic environment – too many states in which the program should work that cannot be explicitly programmed
- It is possible to design a clear reward function to learn from
- It is possible to use a simulation environment for training without high losses
- It requires the system to develop its own strategies that were not considered by the designer – RL discovers hidden strategies
RL is the wrong choice when:
- You already have labeled data — using supervised learning will be faster, cheaper, and more interpretable
- The task is fixed — if the environment does not change and you know the optimal policy, then just use it
- It needs to be interpretable — it is known that RL policies are hard to interpret, and regulatory bodies ask for interpretations in healthcare and finance domains
- Fast deployment is needed — training RL algorithms is hard and takes a lot of time; deploying a well-trained policy is also costly in computational resources
- The reward cannot be clearly formulated — if you cannot state what is the “goodness” of the policy, then RL will optimize for something else
Real practitioners think about this trade-off seriously. There’s a temptation to apply RL to any problem that involves decisions — but the compute cost, training time, and interpretability challenges mean it’s only worth it when the problem genuinely needs it.
RL vs. Supervised vs. Unsupervised Learning — The Key Differences
| Reinforcement Learning | Supervised Learning | Unsupervised Learning | |
| How it learns | Trial and error; feedback via rewards | From labeled input-output pairs | From patterns in unlabeled data |
| Data needed | An environment to interact with (real or simulated) | Labeled dataset | Unlabeled dataset |
| Goal | Maximize cumulative reward | Minimize prediction error | Find hidden structure |
| Best for | Sequential decisions; strategy; control | Classification; regression; prediction | Clustering; dimensionality reduction; anomaly detection |
| Examples | Game AI, robotics, RLHF for LLMs | Image classification, spam detection | Customer segmentation, topic modeling |
Worth adding: self-supervised learning (sometimes confused with RL) trains a model to predict parts of its own input — like predicting the next word in a sentence. Large language models like GPT-4 are pre-trained with self-supervised learning, then fine-tuned with supervised learning, then aligned with RLHF. The three approaches aren’t competitors; in practice, they’re used together.
Tools and Frameworks for Reinforcement Learning in 2026
If you want to actually build something with RL, here’s what practitioners use.
OpenAI Gymnasium (formerly Gym) is the standard environment library. It gives you dozens of pre-built environments — Atari games, physics simulations, robotics tasks — all with a consistent API. If you’re learning RL, you’ll start here.
Stable Baselines3 is the most accessible RL algorithm library for Python. It implements PPO, SAC, TD3, and other modern algorithms with clean, well-documented interfaces. You can get a basic RL agent running in under 20 lines of code.
Ray RLlib scales to distributed training. When you need to train across many CPU/GPU cores, RLlib handles the parallelization. It’s what teams move to when a single machine isn’t enough.
PyTorch is the underlying framework most RL research uses in 2026. TensorFlow is still viable but has lost ground to PyTorch in the research community. If you’re writing RL code from scratch, PyTorch is where most tutorials and papers will point you.
Advantages and Disadvantages of Reinforcement Learning
Advantages:
- Learns how to solve problems too complex to hand-code — nobody programmed AlphaGo’s strategy, it learned it.
- Plans for the future instead of just the next move — making it uniquely well-suited for sequential decision problems.
- Doesn’t need any labeled data — only a reward signal, which is typically far cheaper to provide.
- Discovers strategies never thought of by humans — and often does a better job than human-designed solutions.
Disadvantages:
- Very sample inefficient – typically millions of samples are needed for training. Mitigated through simulation and model-based methods but remains a serious limitation
- Difficult to design the reward function – discussed above; a badly designed reward function results in an extremely optimized wrong agent
- Training processes that are too slow to iterate on, while supervised models can be retrained in hours, reinforcement learning algorithms may need days and weeks
- Lack of interpretability – there is no clear reason behind certain actions performed by the RL agents, which is extremely important in many environments
Frequently Asked Questions About Reinforcement Learning
Q1. What is the difference between reinforcement learning and deep reinforcement learning?
Ans. Reinforcement Learning is the general form of learning using rewards and actions. On the other hand, Deep Reinforcement Learning involves the use of deep neural networks as function approximators rather than lookup tables in which the agent learns a neural network that translates states into values or actions. The algorithms DQN, PPO, and SAC fall under the category of deep RL algorithms. The word “deep” is about the architecture of the neural network.
Q2. How does reinforcement learning relate to ChatGPT?
Ans. ChatGPT and other similar models rely on RLHF – or Reinforcement Learning from Human Feedback – to align the behavior of the model with human preferences. Following the pre-training phase on the text dataset, the reinforcement learning phase is carried out through a reward model, based on human evaluation, which dictates the responses of the model in response to prompts.
Q3. Is reinforcement learning supervised or unsupervised?
Ans. Neither. RL is a different type. Supervised learning needs training examples that have the right answer. Unsupervised learning detects any patterns in unlabelled data. RL uses interaction between the environment and a reward signal. There is no need for labeling or any kind of patterns in this case.
Q4. What is the exploration-exploitation trade-off?
Ans. This is the problem every RL agent encounters – whether to exploit the things that are already known or explore other possibilities that may be more useful? Too much exploitation can lead the agent into a local optimum while too much exploration means wasting time on bad actions. Methods like epsilon-greedy, UCB, and Thompson Sampling handle this efficiently.
Q5. What are the most widely used reinforcement learning algorithms today?
Ans. By 2026, PPO (Proximal Policy Optimization) will most likely be the most used algorithm in both research and production. SAC (Soft Actor-Critic) is well-suited for problems requiring continuous actions, such as robotics. DQN-based approaches are prevalent in gaming applications. RLHF training processes of LLMs frequently rely on PPO.
Q6. How long does reinforcement learning training take?
Ans. Extremely diverse. Training of an agent for a simple grid-world could take minutes on a standard laptop computer. Training of AlphaZero was done within around 70 hours using thousands of TPUs. The time taken for training of production LLM RLHF models ranges from days to weeks using GPU clusters. Sample efficiency is the biggest limitation.
What Comes After This
Problems that haven’t been cracked yet by RL are even more interesting.
Long horizon control where the delay between the action and the resulting outcome consists of thousands of steps is still too difficult for current methods. Sample efficiency is truly awful compared to how fast a human kid can learn things. Finally, the problem of reward specification where one needs to formulate their objectives accurately enough not to give undesired rewards to undesired outcomes is arguably the quintessence of developing safe AI systems.
The folks who work on such problems are not doing it in a bubble. The breakthroughs made by RL during the last decade — from video games, protein structure prediction, and language models alignment — came much faster than expected by almost everyone.
This decade is likely to do the same.