Deriving Soft Bellman Equations From the Entropy-Regularized Objective
You add an entropy bonus to your objective, and the whole value structure shifts under your feet. The max in the Bellman backup becomes a log-sum-exp. The…

Key topics
You add an entropy bonus to your objective, and the whole value structure shifts under your feet. The max in the Bellman backup becomes a log-sum-exp. The greedy policy becomes a softmax. The temperature stops acting like a learning-rate knob and starts acting like a price. None of that is a bug in your implementation. It is what happens when entropy moves inside the return instead of sitting beside it.
This article derives that shift. I assume you already have the standard Bellman expectation and optimality relationships and the likelihood-ratio policy-gradient estimator in hand. Here I derive only the delta: where the entropy term enters the objective, how it propagates into the value definitions, why the optimality backup becomes a log-sum-exp, and what the temperature actually means.
Why the Entropy Term Cannot Stay Outside the Value Function
The weak model most people carry is this: entropy is an exploration bonus. You keep your value functions exactly as they were, and you add a bonus gradient term to the policy update. The bonus nudges the policy toward diversity early in training, then fades as the policy converges.
That model works for exactly one job — keeping a policy from collapsing onto a premature deterministic solution while the critic is still wrong. It fails the moment you ask what the optimal policy looks like under the augmented objective. If entropy is part of the return, then the value of a state must already account for the entropy the policy will collect in the future. You cannot compute a value that ignores a term that appears in every future step's return.
So the reframe: entropy regularization changes the return definition, and therefore changes the Bellman operator itself. The value functions are not unchanged. They are redefined.
Here is the notation I will use throughout. State , action , transition kernel , reward , discount , policy , and temperature . The temperature is a scalar weight on the entropy term. It is not a property of the environment.
Writing the Entropy-Regularized Objective
The augmented per-step return adds a temperature-weighted entropy term to the reward:
where is the Shannon entropy of the policy at state . The full objective maximizes the expected discounted sum of over trajectories.
The general form replaces Shannon entropy with the KL divergence to a reference policy :
Shannon entropy is the special case where is uniform. The general form matters for derivations because it keeps the reference policy explicit, and because it is the form that survives when you want a policy to stay near a prior rather than spread uniformly.
State the assumptions before the algebra, because they are load-bearing:
- Finite action space. The closed-form log-sum-exp and Boltzmann policy below require a finite . Continuous actions lose the closed form.
- Finite return. Either episodic or discounted, so the sum of rewards and entropies is finite.
- Differentiable, strictly positive policy. A policy that assigns zero probability to an action makes unbounded, and the derivation breaks.
Common mistake: Treating the temperature as a property of the environment. It is a scalar you choose, and it sets the exchange rate between reward and stochasticity. Change it and you change the optimal policy, not just the learning dynamics.
Deriving the Soft Value Functions
Start from the entropy-augmented return and take the expectation under the policy. The soft state value is:
The soft action value is the same expectation conditioned on the first action:
Notice what is absent from : the entropy term at the current step. The action is already chosen, so the current-step entropy does not depend on it. This is the single most common place readers expect a term that is not there. The entropy term attaches at the successor state, not the current action.
The relationship between soft and soft follows from the definition of the expectation:
That is an expectation of minus temperature times log-policy — not a plain expectation of . Compare it to the standard relationship and you can see exactly which term was inserted and where.
A backup diagram makes the placement concrete. Draw the reward node and the successor value node as usual. Attach the entropy node at the successor state, hanging off the policy that selects the next action — not off the current action.
Knowledge check
Check your understanding
Answer this question before you continue.
Deriving the Soft Bellman Equations
Substitute the soft definition into the soft definition and expand one step. You get the soft Bellman expectation equation:
Now maximize the right-hand side over the policy. This is the key algebraic move. You are maximizing an expectation of minus temperature times log-policy over the probability simplex:
The solution is a Boltzmann distribution:
and the resulting value is temperature times log-sum-exp:
This is the soft Bellman optimality equation. The max operator is gone, replaced by a smooth, differentiable approximation that reduces to the hard max as .
The soft Bellman backup is a contraction under the same discounting conditions as the standard operator, which is what makes soft policy iteration well-defined. The proof follows the same structure as the standard contraction argument, with the entropy term bounded because the policy is bounded.
A Two-Action Worked Example
Take a state with two actions and , . Set .
The soft value is:
The Boltzmann policy is:
The hard-max value is . The soft value is higher — — because the entropy term rewards keeping the second action alive. Now shrink the temperature to :
The gap closes. The policy concentrates: . As , the soft equations recover the standard Bellman equations, and the Boltzmann policy recovers the greedy argmax.
Knowledge check
Check your understanding
Answer this question before you continue.
Reading the Temperature as a Mathematical Object
The temperature scales the entropy term relative to reward. It sets the exchange rate between expected reward and policy stochasticity. Two limits define its behavior:
- : the Boltzmann policy concentrates on the argmax, and the soft equations recover the standard Bellman equations.
- : the policy flattens toward uniform, and reward stops mattering.
The temperature is also the dual variable of a constrained problem. Maximize reward subject to an entropy floor, and the Lagrangian produces the same objective with a temperature determined by the constraint. That is why automatic temperature tuning is a dual ascent step — you are solving for the multiplier that satisfies the constraint, not guessing a hyperparameter.
Note: The temperature is not a learning rate. It changes the optimum, not the step size toward the optimum. A learning rate controls how fast you move; the temperature controls where you are moving to.
The failure modes are symmetric. A fixed temperature that is too high makes the optimal policy deliberately suboptimal in reward terms — it will leave reward on the table to stay stochastic. A temperature that is too low reintroduces the deterministic collapse the entropy term was meant to prevent.
Knowledge check
Check your understanding
Answer this question before you continue.
When Stochasticity Is Rewarded, Not Just Used
Exploration stochasticity is a means to gather data. It vanishes at convergence. Optimality stochasticity is part of the objective. It persists at convergence.
The soft optimal policy is stochastic even when the environment is deterministic and the reward is deterministic, because the entropy term is inside the return. This is the practical payoff of the derivation: the stochasticity is not a training artifact you anneal away. It is the answer.
When this is genuinely useful:
- Multi-modal action distributions where several actions are near-equally good, and committing to one mode is arbitrary.
- Robustness to perturbation, where a policy that spreads probability across near-optimal actions degrades more gracefully.
- Settings where a deterministic policy would overcommit to one mode before the critic has resolved the others.
When it is the wrong tool:
- Tasks with a single correct action where any deviation is costly. The entropy term will trade reward for diversity you do not want.
- Fixed temperature without regard to reward scale. A temperature tuned for one reward scale is wrong for another.
| Standard Bellman | Soft Bellman | |
|---|---|---|
| Backup operator | ||
| Optimal policy | Deterministic argmax | Boltzmann distribution |
| Value definition | ||
| Temperature role | None | Exchange rate between reward and entropy |
Knowledge check
Check your understanding
Answer this question before you continue.
From the Derivation to the Algorithm
The soft Bellman backup is the target the critic regresses toward. That is why entropy-regularized critics use a log-policy term in the target rather than a plain reward plus discounted value. The Boltzmann policy from the optimality derivation is the form the actor is pushed toward, which is why entropy-regularized actors are stochastic by construction.
I will stop at the equations here. The learning loop that turns these into an algorithm, and the continuous-control experiment that exercises them, are separate steps.
To verify the derivation against output rather than trusting it, implement the two-action example in a few lines:
import numpy as np
Q = np.array([2.0, 0.0])
alpha = 1.0
V_soft = alpha * np.log(np.sum(np.exp(Q / alpha)))
pi_soft = np.exp(Q / alpha) / np.sum(np.exp(Q / alpha))
V_hard = np.max(Q)
print(f"soft V: {V_soft:.4f}, hard V: {V_hard:.4f}")
print(f"policy: {pi_soft}")
Run it. Change alpha to 0.1 and watch the soft value converge to the hard value and the policy concentrate. The numbers should match the hand calculation above. If they do not, the derivation or the code has a bug — and finding which one is the point.
The test for whether stochasticity belongs in your objective is simple: does it survive at convergence? If it vanishes, it was exploration. If it persists, it was part of the return. Run the soft backup numerically against the standard one on a small problem, and let the gap between them tell you which regime you are in.
Knowledge check
Final check
Finish the article by checking the ideas you just learned.
References
Build a stronger RL mental model
Use structured resources to connect equations, algorithms, and observable agent behavior.


