Maximum entropy reinforcement learning is a formulation of reinforcement learning in which the agent maximizes the expected cumulative reward plus the entropy of its policy, so that it seeks high returns while acting as randomly as the task permits. It is also called MaxEnt RL or entropy-regularized reinforcement learning, and it underlies widely used algorithms such as soft Q-learning and soft actor-critic.
The idea changes what counts as an optimal policy. A standard agent converges to a single best action in each state, whereas a MaxEnt agent keeps probability mass on every action that is nearly as good. This yields built-in exploration, robustness to disturbances and policies that capture several distinct ways of solving a task.
How the maximum entropy objective works
The MaxEnt objective adds an entropy bonus at every time step: the agent maximizes the expected sum of r(s, a) + α·H(π(·|s)), where H is the entropy of the action distribution in state s. The temperature parameter α sets the relative weight of entropy against reward. With α equal to zero, the objective reduces to the conventional reinforcement learning problem.
Because entropy is rewarded inside the return, the agent values future states where it will have many good options, not only immediate randomness. This differs from adding an entropy term to a policy gradient loss, which encourages randomness only in the current state. The table below lists the main elements of the formulation.
| Element | Definition | Role |
|---|---|---|
| Policy entropy | Expected negative log probability of actions | Measures how spread out the policy is |
| Temperature α | Weight on entropy relative to reward | Controls exploration versus exploitation |
| Soft Q-function | Return including future entropy bonuses | Evaluates actions under the new objective |
| Soft value function | Log-sum-exp of soft Q-values scaled by α | Replaces the hard maximum over actions |
| Boltzmann policy | π(a|s) proportional to exp(Q(s, a) / α) | Optimal policy shape for a given α |
Soft Bellman equations and the optimal policy
MaxEnt RL replaces the Bellman maximum with a soft maximum. The soft value of a state is V(s) = α·log Σ exp(Q(s, a) / α), and the soft Q-function satisfies Q(s, a) = r(s, a) + γ·E[V(s’)]. As α approaches zero, the log-sum-exp tends to the hard maximum and the familiar Bellman equation reappears.
The optimal policy is an energy-based distribution over actions, proportional to the exponential of the soft Q-value divided by α. Actions with nearly equal values receive nearly equal probability, while clearly worse actions become exponentially unlikely. Soft policy iteration, which alternates soft evaluation with a projection onto this distribution, is proven to converge in the tabular case.
The framework also connects reinforcement learning with probabilistic inference. Treating optimality as an observed variable in a graphical model leads to the same objective, a view often called control as inference. This link explains why MaxEnt methods appear in inverse reinforcement learning and in modeling human behavior.
Algorithms built on maximum entropy
Several important algorithms implement the MaxEnt objective, mostly as off-policy actor-critic methods for continuous control. They differ in how they represent the Boltzmann policy and how they set the temperature.
| Algorithm | Key idea | Typical use |
|---|---|---|
| Soft Q-learning | Learns soft Q-values and samples an energy-based policy | Multimodal continuous control |
| Soft actor-critic | Gaussian actor trained toward the Boltzmann policy | Robotics and simulated locomotion |
| SAC with automatic tuning | Adjusts α to match a target entropy | Default modern SAC setup |
| Discrete SAC | Exact expectation over a finite action set | Discrete-action benchmarks |
| Maximum entropy IRL | Infers rewards assuming entropy-maximizing experts | Learning rewards from demonstrations |
In soft actor-critic, automatic temperature tuning treats α as a Lagrange multiplier for a minimum entropy constraint, often set to the negative of the action dimension. This removes the most sensitive hyperparameter and is one reason SAC became a standard baseline for continuous control.
Comparison with conventional entropy regularization
MaxEnt RL is often confused with the entropy bonus used in on-policy methods such as A3C or proximal policy optimization. Both add entropy, but they optimize different objectives and behave differently in long-horizon tasks.
| Approach | Where entropy enters | Practical consequence |
|---|---|---|
| Maximum entropy RL | Inside the return at every step | Agent plans toward states with many options |
| Entropy bonus in PPO | Loss term on current-state entropy | Prevents premature collapse only locally |
| Epsilon-greedy | Fixed random action probability | Undirected exploration, ignores action values |
| Standard RL | No entropy term | Deterministic optimum, brittle under change |
Benefits, limitations and common mistakes
The main benefits are sample-efficient exploration, robustness to model errors and perturbations, and policies that fine-tune well because they retain alternative behaviors. Research has shown that MaxEnt policies are optimal for certain robust control objectives, which explains their stability when transferred from simulation to hardware.
- Wrong temperature scale: α must match the reward scale, so rescaling rewards without retuning α changes behavior.
- Evaluating the stochastic policy: at test time the mean action usually performs better than samples.
- Unbounded Gaussian actions: SAC needs a tanh squashing correction in the log-likelihood.
- Sparse rewards: entropy alone does not replace directed exploration when rewards are extremely rare.
The optimal MaxEnt policy is not optimal for the original reward when α is positive, so the method trades a small amount of return for robustness and exploration. Annealing α or using a target entropy keeps that cost small.
In simple terms
Most learning agents look for the one best move and then always make it. A maximum entropy agent asks a different question. It wants a high score, but it also wants to keep its options open.
Think of a hiker who knows several good trails to the summit. Instead of memorizing one path, the hiker stays comfortable with all of them. If a landslide blocks one trail, the hiker simply takes another. This flexibility makes learning faster and the final behavior more reliable.
A practical example
A robotics lab trains a quadruped robot to walk using soft actor-critic in a physics simulator. The agent controls 12 joints, so the lab sets the target entropy to minus 12 and lets α tune itself. Training uses about two million simulator steps on a single GPU, far fewer than an on-policy method needed in earlier trials.
When the policy is deployed on the real robot, it faces uneven floors and slightly different motor responses than in simulation. Because training kept several gait variations alive, the robot recovers from slips instead of falling. For deployment, the lab uses the mean action of the policy, which gives smoother motion while preserving the robustness learned during training.