Back to Glossary

What is Reinforcement learning

Reinforcement learning (RL) is a way to train an agent to make a sequence of decisions by trial and error. Instead of learning from right/wrong labels (supervised learning), the agent interacts with an environment, gets rewards for good outcomes, and adapts its behavior to maximize long-term reward. Think of it as learning a strategy, called a policy for what to do in each situation so future results improve, not just the next step.

At each step the loop is simple: observe the current state, take an action, receive a reward and a new state, update the policy. Over many episodes the agent learns patterns that balance quick wins with moves that pay off later. This makes RL a natural fit for problems where actions influence what you’ll see next: ad bidding and budgeting, recommender slates, pricing, robotics control, scheduling, operations, and game-playing.

Four ideas matter most:

  1. Credit assignment: figuring out which actions actually caused a later outcome.
  2. Exploration vs exploitation: trying new actions to learn vs repeating known good ones.
  3. Value vs policy methods: learning “how good” a state/action is (Q-learning) vs directly learning the policy (policy gradients); actor–critic mixes both.
  4. Online, offline, and bandits: learning while acting, learning from logged data, or optimizing one-step choices when there’s no state.

In large-scale systems, RL often runs with guardrails: constraints on cost, safety, or fairness; simulators for safe training before hitting production; and evaluation against holdout traffic. For LLMs, teams use RL from human feedback (RLHF): human raters compare two answers, a reward model learns those preferences, and the agent (the model) is tuned to produce helpful, harmless, and honest responses. Those human ratings are a form of data labeling, and a small, verified gold set helps catch drift.

Example

A retailer wants to reduce returns without hurting sales. The agent chooses what to show in a post-purchase “order check” flow: confirm size, suggest fit tips, or recommend an exchange to a more suitable model. Rewards combine signals over 30 days—kept orders (positive), exchanges (neutral), and returns (negative). Early on the agent explores; over time it learns that certain SKUs, sizes, and review patterns benefit from a quick fit confirmation, which lowers returns while preserving conversion. Because actions affect future states (fewer returns change inventory and recommendations), RL outperforms one-step heuristics.