Reinforcement learning (RL) is a machine learning approach in which an agent learns a behavior policy by interacting with an environment: it takes actions, observes the resulting state, and receives a reward signal indicating how good or bad the outcome was, without being told the correct action directly. Over many interactions, the agent adjusts its policy to favor actions that lead to higher cumulative reward.

RL is distinguished from supervised learning by this trial-and-reward structure rather than learning from a fixed set of labeled examples. It is used to train agents for games and robotics, and, more recently, to shape the behavior of large language models after their initial training.