Reinforcement Learning

Machine Learning
Introduced by
Sutton, R. S. & Barto, A. G. (formalised); Bellman, R. (foundations)
Year
1950s–1998
Type
Sequential decision-making framework
Family
Deep learning / NLP / CV

What does it do?

Reinforcement Learning (RL) is a framework in which an agent learns to make sequential decisions by interacting with an environment, receiving scalar reward signals, and updating a policy to maximise cumulative future reward.

Unlike supervised learning, no labeled examples are provided; the agent discovers optimal behavior entirely through experience and delayed feedback. The problem is usually modelled as a Markov decision process (MDP), defined by states, actions, transition probabilities, a reward function and a discount factor gamma. The standard formulas and convergence results assume the Markov property, namely that the next state and reward depend only on the current state and action. Partially observable or non-stationary environments violate this assumption and call for extensions such as recurrent policies or belief-state methods.

The intuition behind the method

Imagine training a dog: you do not explain each action; you reward good behavior and let it figure out what to do. Reinforcement Learning works the same way. An agent tries actions in an environment, observes what happens, and receives a reward — positive for desired outcomes, negative for mistakes. Over many interactions it learns which actions in which situations tend to lead to the most reward, building a strategy — called a policy — without needing any pre-labeled dataset of correct answers.

History

Reinforcement Learning has roots in Bellman's dynamic programming (1957) and in animal learning psychology. Sutton and Barto formalised the modern framework in a textbook, unifying temporal-difference learning, Q-learning, and policy-gradient methods; the page dates this to 1998, while the cited edition is the 2018 second edition. Mnih et al. (2015) reported Deep Q-Networks, which combine deep convolutional networks with Q-learning. DQN reached human-level or better performance on a substantial subset of the Atari 2600 games tested, using a single architecture and set of hyperparameters across games, and this work helped start the deep reinforcement learning research direction. AlphaGo (2016) and later RLHF work on large language models further extended RL's reach.

When to use it

Choose reinforcement learning when the problem is a sequence of decisions in which each action changes later states, feedback arrives as a scalar reward that may be delayed, and no labelled examples of correct actions exist. Typical settings include game playing, robotic control, resource scheduling, recommendation sequencing, and fine-tuning language models from human feedback (RLHF). It is most practical when the environment can be simulated cheaply, so that the agent can interact many times. Do not use RL when the task is a one-step prediction or classification that supervised or self-supervised learning can solve, because RL is sample-inefficient and training is unstable. Avoid it when the reward is hard to specify, when interactions with the real system are costly or unsafe and no simulator exists, or when a fixed logged dataset is the only data available; in that last case offline RL is a related but more specialised approach that requires care. The distinction between on-policy and off-policy learning also matters here: on-policy methods (e.g. REINFORCE, PPO) learn from data generated by the current policy, whereas off-policy methods (e.g. DQN, SAC) can reuse past or replayed transitions, which usually makes them more sample-efficient but harder to stabilise.

Limitations and considerations

  • Learning depends on returns sampled from the agent's own interaction, which typically requires very many environment steps before the policy converges.
  • Results are sensitive to hyperparameters, reward scale, and random seeds, so training outcomes can vary widely between runs.
  • The agent optimises the reward exactly as specified; any mismatch between the reward and the intended goal is exploited, which is the reward-hacking failure mode.
  • Value and policy estimates are only reliable in states the agent has visited, so exploration determines what is learned; in physical systems, exploratory actions can be unsafe.
  • Generalisation to states or environments not encountered during training is not guaranteed.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Training signal comes from the reward returned by the environment, so no labeled dataset of correct actions is needed; this suits tasks where outcomes can be scored but optimal actions cannot be written down.
  • The discount factor gamma in the return G_t lets delayed consequences of an action be credited to earlier decisions, which is the core reason the method handles long-horizon sequential problems.
  • Combined with deep neural networks, the policy and value functions can take high-dimensional inputs such as pixels or text.
  • Reward models learned from human preference comparisons can be used to fine-tune a policy, which is how RLHF applies RL to language models.

Applications

  • Game playing, such as Atari and Go.
  • Robotics, including locomotion, manipulation, and dexterous hand control.
  • Aligning large language models with human preferences through RLHF.
  • Resource and network scheduling, and personalised recommendation where long-term user engagement matters.
  • Simulation-based training for autonomous driving and traffic signal control.

How it works

How it works

1

At each time step the agent observes the current state of the environment and chooses an action according to its current policy. The environment transitions to a new state and emits a scalar reward. This loop of observe-act-reward repeats, generating a trajectory of experience that is used to improve the policy.

2

The agent's objective is to maximise the discounted cumulative reward G_t, which sums all future rewards weighted by a discount factor gamma between 0 and 1. A gamma close to 1 makes the agent far-sighted; a small gamma makes it focus on immediate rewards. For continuing tasks with no fixed endpoint, gamma must be strictly below 1, since otherwise the infinite sum of rewards can diverge; gamma equal to 1 is only well defined when every episode terminates in finite time. Careful reward shaping is critical because the agent optimises whatever signal it receives.

Formula
G_t = \sum_{k=0}^{\infty} \gamma^k R_{t+k+1}
3

The policy pi maps states to actions (or action probabilities). It can be represented as a lookup table for small discrete problems, or as a deep neural network — a deep RL agent — for high-dimensional states such as images or text. The policy is what the agent learns and ultimately what is deployed.

Formula
\pi(a \mid s) = P(A_t = a \mid S_t = s)
4

Value functions estimate how good a state (or state-action pair) is under a given policy. The state-value V(s) is the expected cumulative reward from state s onward. Action-value functions Q(s, a) extend this to specific actions. These estimates guide policy improvement in methods such as Q-learning, SARSA, and actor-critic algorithms.

Formula
V^\pi(s) = \mathbb{E}_\pi\left[G_t \mid S_t = s\right]
5

The agent updates its policy using the collected experience. Value-based methods (e.g. DQN) derive the policy implicitly from Q-values, while policy-gradient methods (e.g. REINFORCE, PPO) directly adjust policy parameters to increase the probability of high-reward trajectories. Many modern algorithms combine the two in actor-critic architectures, where a learned value estimate guides updates to the policy.

Common pitfalls

  • Specifying a reward that is easy to optimise but misaligned with the true objective, so the policy scores well while failing the intended task.
  • Moving to real hardware before the policy has been tested in a simulator, which can cause costly or unsafe failures.
  • Choosing RL for a problem where supervised or imitation learning on available demonstrations would be far more sample-efficient.
  • Reporting a single training run; results vary across random seeds, so several runs should be reported.
  • Treating the training curve as evidence of convergence without evaluating the learned policy on separate held-out episodes.

Frequently asked questions

What distinguishes reinforcement learning from supervised learning?

Supervised learning requires labeled input-output pairs and learns a fixed mapping. RL requires no labels; instead the agent receives reward signals after actions and must discover what to do through trial and error, making it suitable for sequential decision problems where the correct action is not known in advance.

What is the difference between model-free and model-based RL?

Model-free RL (e.g. DQN, PPO) learns policies or value functions directly from experience without an explicit model of environment dynamics. Model-based RL learns or is given a transition model and uses it for planning. Model-based methods tend to be more sample-efficient but require an accurate model, which can be hard to learn.

How do I choose between a value-based and policy-gradient method?

Value-based methods like DQN are designed for discrete action spaces. Policy-gradient methods such as REINFORCE and PPO adjust the policy parameters directly, handle continuous action spaces naturally, and can learn stochastic policies. SAC is an off-policy actor-critic method built on soft Q-learning, so it is usually grouped with actor-critic methods rather than with pure policy-gradient methods. Actor-critic methods combine a learned value estimate with a policy. PPO and SAC are common starting points for continuous-control problems.

How many environment interactions does RL typically need?

RL is sample-hungry: the number of interactions needed depends strongly on the task and the algorithm, and complex tasks can require far more interaction than supervised learning needs for comparable data. This makes a fast simulator essential and rules out RL for many real-world problems where each interaction is expensive.

What is RLHF and why is it important?

Reinforcement Learning from Human Feedback trains a reward model from human preference comparisons and then fine-tunes a language model with RL to maximise that learned reward. It is a widely used technique for aligning large language models with human preferences.

Related methods

Sources

  1. Sutton, R. S. & Barto, A. G. (2018). Reinforcement Learning: An Introduction (2nd ed.). MIT Press.

    ISBN: 978-0-262-03924-6
  2. Mnih, V., Kavukcuoglu, K., Silver, D., et al. (2015). Human-level control through deep reinforcement learning. Nature, 518, 529–533.

    Open DOI reference