Policy

The Agent's Strategy

The policy is the mapping from states to actions — what the agent does in every situation. Optimizing the policy is the ultimate goal of RL. All RL algorithms are different approaches to finding the best policy.

Deterministic vs Stochastic

Deterministic Policy

Maps each state to one specific action: π(s) = a. Simple and direct. Can be exploited by adversaries who learn the pattern. Less suitable for games requiring unpredictability.

Stochastic Policy

Maps each state to a probability distribution: π(a|s). Samples from this distribution to act. Natural for exploration. Necessary when facing adversaries — unpredictable by definition. Used in most modern deep RL algorithms.

On-Policy vs Off-Policy Learning

1

On-policy — Learn only from data collected by the current policy. Simpler, more stable. As the policy improves, old data is discarded. Less sample-efficient. PPO is the dominant on-policy algorithm.

2

Off-policy — Learn from data collected by any policy, stored in a replay buffer and reused. More sample-efficient. Harder to implement (requires correcting for distribution mismatch). DQN and SAC are off-policy.

Policy as a Neural Network

Deep RL policy representation

The policy is a neural network: state input → softmax over discrete actions, or mean/variance of a Gaussian for continuous actions. The network weights θ are the policy parameters. Training updates θ via gradient ascent on expected cumulative reward — the policy gradient theorem provides the mathematical foundation.

Need Help?

Ask the AI assistant about RL policies, deterministic vs stochastic policies, on-policy vs off-policy learning, or how PPO works.