What is the difference between on-policy and off-policy learning, and why might you want to learn off-policy?

Reinforcement learning, On-policy and off-policy
Level L1 Beginner. Length Short. Nature Th Theoretical.

What's being asked

Whether you can separate the behaviour policy (which collects data) from the target policy (which is being evaluated or improved).

Key idea

On-policy methods learn about the same policy that produces the data. Off-policy methods learn about a target policy π from data generated by a different behaviour policy b. Because the data distribution then differs from π's, the update needs a correction, such as a max over actions (Q-learning) or importance sampling.

Steps

  1. Define the behaviour policy b as the policy the agent actually follows to act, and the target policy π as the policy whose value we want to learn.
  2. On-policy: b=π. Examples are SARSA, REINFORCE and A2C (advantage actor–critic). The target for SARSA uses the action actually taken next.
  3. Off-policy: b≠π. Q-learning learns the greedy policy while following an ε-greedy one. Its target uses max⁡a′Q(s′,a′), not the action taken.
  4. Give the benefits of off-policy learning. The agent can keep exploring while learning the greedy policy, reuse old data from a replay buffer, and learn from human demonstrations or other agents' logs.
  5. Give the cost: off-policy learning with function approximation can be unstable, and importance-sampling corrections can have very high variance.

Common mistakes

How long your answer should be

4–6 sentences.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: What is a Markov decision process, what are its components, and what objective does an agent optimise?
Next in Reinforcement learning: What is the difference between model-free and model-based reinforcement learning, and what is the main trade-off between them?