Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Entropy-Regularized Dynamic Programming

Infinite-horizon dynamic programming selects actions with a hard maximum. That operator is nondifferentiable at ties and produces a deterministic greedy choice. Can a modified control objective produce both a smooth Bellman operator and a stochastic optimal policy? Convex regularization supplies the link.

While the standard Bellman optimality equations use the max operator to determine the best action, an alternative formulation known as the smooth or soft Bellman optimality equations replaces it with a smooth approximation of the maximum. The history of these equations runs across two communities that rarely read each other. They appear in the work of the structural econometrician John Rust on the replacement of bus engines Rust (1987), together with an inverse problem and an algorithm to solve it. Ng & Russell (2000), who are usually credited with introducing inverse reinforcement learning, cite Rust, but the connection was then largely lost. Ziebart et al. (2008) rediscovered the same equations as maximum entropy inverse reinforcement learning, named after the maximum entropy principle. Haarnoja et al. (2017) built on Ziebart to obtain soft Q-learning, and soft actor-critic Haarnoja et al. (2018), one of the most widely used deep RL algorithms for continuous control, followed a year later.

In the infinite-horizon setting, the smooth Bellman optimality equations take the form:

vβ⋆(s)=1βlog⁡∑a∈Asexp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)vβ⋆(j)))v^\star_\beta(s) = \frac{1}{\beta} \log \sum_{a \in \mathcal{A}_s} \exp\left(\beta\left(r(s, a) + \gamma \sum_{j \in \mathcal{S}} p(j | s, a) v^\star_\beta(j)\right)\right)

We write vβ⋆v^\star_\beta for this smooth value function, to keep it apart from the optimal value vγ∗v^*_\gamma of the hard Bellman equation.

Adopting an operator-theoretic perspective, we can define a nonlinear operator Lβ\mathrm{L}_\beta such that the smooth value function of an MDP is then the solution to the following fixed-point equation:

(Lβv)(s)=1βlog⁡∑a∈Asexp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)v(j)))(\mathrm{L}_\beta \mathbf{v})(s) = \frac{1}{\beta} \log \sum_{a \in \mathcal{A}_s} \exp\left(\beta\left(r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j)\right)\right)

As β→∞\beta \to \infty, Lβ\mathrm{L}_\beta converges to the standard Bellman operator L\Bellman. Furthermore, it can be shown that the smooth Bellman operator is a contraction mapping in the supremum norm, and therefore has a unique fixed point. However, as opposed to the usual “hard” setting, the fixed point of Lβ\mathrm{L}_\beta is associated with the value function of an optimal stochastic policy defined by the softmax distribution:

π(a∣s)=exp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)vβ⋆(j)))∑a′∈Asexp⁡(β(r(s,a′)+γ∑j∈Sp(j∣s,a′)vβ⋆(j)))\pi(a|s) = \frac{\exp\left(\beta\left(r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v^\star_\beta(j)\right)\right)}{\sum_{a' \in \mathcal{A}_s} \exp\left(\beta\left(r(s,a') + \gamma \sum_{j \in \mathcal{S}} p(j|s,a') v^\star_\beta(j)\right)\right)}

The terminology is confusing: the “softmax” policy above is the smooth counterpart of the argmax in the original optimality equation, not of the max: it is a soft-argmax. The smooth counterpart of the max is the log-sum-exp. The same policy is also called a Boltzmann or Gibbs policy. As the temperature 1/β1/\beta goes to zero, the softmax concentrates on the maximizing actions and we recover the greedy policy and the hard Bellman equation.

Stochastic Policies: Exploration and the Partition Function

Moving from the argmax to the softmax turns deterministic policies into stochastic ones, which is both useful and costly. It is useful because noise in the actions is a way to explore. In RL the agent usually gathers its own data, and if it always took the action it currently believes best it would never learn about the others. The problem is not specific to RL. An engineer identifying a model of a plant must also choose inputs that reveal the dynamics, and in system identification this is called exciting the system: a persistently exciting input is one rich enough for the parameters to be identifiable from the data.

It is costly when the action set is continuous. The softmax policy is then a density π(a∣s)∝exp⁡(βq(s,a))\pi(a \mid s) \propto \exp(\beta q(s,a)) whose normalizing constant, the partition function ∫exp⁡(βq(s,a)) da\int \exp(\beta q(s,a))\, da, is an integral with no closed form in general. The log-sum-exp value has the same problem, since it is the logarithm of that integral. This is the intractable partition function familiar from energy-based models and probabilistic graphical models. Numerical quadrature is an option in low dimension but is rarely used. Haarnoja et al. (2017) sampled from the softmax policy over continuous actions with amortized Stein variational gradient descent, which proved expensive; soft actor-critic Haarnoja et al. (2018) instead fits a tractable parametric policy to the softmax, an idea we return to in the chapters on fitted value methods and policy learning. The notation for continuous actions, and what changes when sums become integrals, is in Continuous Action and State Spaces.

The smooth formulation has two advantages. First, a smooth operator is easier to optimize through. Unlike γ\gamma, we view β\beta as a hyperparameter of our algorithm, which we can control to achieve the desired level of accuracy.

Second, we presented the equations pragmatically, by replacing the max with the log-sum-exp (a smooth maximum) and the argmax with the softmax (a smooth argmax). The same equations come out of two other starting points, and this chapter follows all three routes:

  1. Smoothing the operator. Replace every max by a log-sum-exp, as above. This is the route of the next subsection, and the justification is computational: a smooth operator has gradients everywhere.

  2. Noise on the rewards. Keep the hard Bellman equation, but suppose that each action’s reward is perturbed by independent Gumbel noise that the decision maker sees and the modeler does not. Integrating the noise out gives the log-sum-exp (Gumbel Noise on the Rewards). This is how Rust (1987) motivated the equations, following the discrete choice models of econometrics.

  3. Entropy regularization. Keep the rewards, but add a bonus proportional to the entropy of the policy in every state. The regularized Bellman equation is again the log-sum-exp equation (Regularized Markov Decision Processes). This is the reading behind maximum entropy RL and soft actor-critic.

Each route brings its own tools: smoothness gives differentiability, the noise model gives a likelihood for observed behavior, and the regularization view gives convex duality. A fourth reading, close to the third, starts from the energy-based models of supervised learning, where a softmax turns unnormalized scores into a distribution; this is essentially what Ziebart et al. (2008) did. It connects to probabilistic graphical models, where finding an optimal smooth policy becomes an inference problem. This is the idea of control as inference, whose converse, inference as control, is now used to derive samplers and amortized inference methods with RL Levine et al. (2018).

Smooth Value Iteration Algorithm

Before iterating Lβ\mathrm{L}_\beta, we should check that iterating it is the right thing to do, that is, that it is a contraction. It is, in the sup-norm and with the same factor γ\gamma as the hard Bellman operator. The proof uses the same three facts as for L\Bellman. The log-sum-exp is monotone, it commutes with adding a constant to all of its arguments, and Lβ\mathrm{L}_\beta maps a uniform shift c1c\mathbf{1} of vv into a shift γc1\gamma c\mathbf{1} of Lβv\mathrm{L}_\beta v. From v≤u+∥v−u∥∞1v \le u + \|v-u\|_\infty\mathbf{1} we get Lβv≤Lβu+γ∥v−u∥∞1\mathrm{L}_\beta v \le \mathrm{L}_\beta u + \gamma\|v-u\|_\infty\mathbf{1}, and exchanging uu and vv gives the contraction. A word of caution about the converse: failing to show that an operator is a contraction does not mean that its fixed point fails to exist or that no algorithm finds it. Contraction is a convenient sufficient condition, and other fixed-point theorems cover other cases.

Successive approximation applied to Lβ\mathrm{L}_\beta is smooth value iteration. It has the structure of value iteration, with a log-sum-exp wherever value iteration had a max and a softmax policy at the end where value iteration returned a greedy one.

Differences from standard value iteration:

What the stopping rule guarantees. Because Lβ\mathrm{L}_\beta is a γ\gamma-contraction, the a posteriori bound of the Banach fixed-point theorem applies unchanged, and the stopping test of line 9 guarantees ∥v−vβ⋆∥∞≤ε/2\|v - v^\star_\beta\|_\infty \le \varepsilon/2. The proof that value iteration returns an ε\varepsilon-optimal policy also carries over, with one change of meaning. The softmax policy satisfies Lπ,Ωv=Lβv\mathrm{L}_{\pi,\Omega} v = \mathrm{L}_\beta v for the entropy-regularized evaluation operator of Regularized Bellman Operators, with regularizer Ω(π(⋅∣s))=1β∑aπ(a∣s)log⁡π(a∣s)\Omega(\pi(\cdot|s)) = \frac{1}{\beta}\sum_a \pi(a|s)\log\pi(a|s), just as a greedy policy satisfies Lπv=Lv\mathrm{L}_\pi v = \Bellman v. Repeating the proof of Proposition 2 with these operators shows that the returned policy is ε\varepsilon-optimal for the entropy-regularized objective. How far is that from optimal for the original rewards? Since max⁡axa≤1βlog⁡∑aeβxa≤max⁡axa+log⁡∣A∣β\max_a x_a \le \frac{1}{\beta}\log\sum_a e^{\beta x_a} \le \max_a x_a + \frac{\log|\mathcal{A}|}{\beta}, where ∣A∣|\mathcal{A}| is the largest number of actions in any state, the two fixed points satisfy

vγ∗  ≤  vβ⋆  ≤  vγ∗+log⁡∣A∣β(1−γ)1,v^*_\gamma \;\le\; v^\star_\beta \;\le\; v^*_\gamma + \frac{\log |\mathcal{A}|}{\beta(1-\gamma)}\mathbf{1},

and the softmax policy returned by the algorithm loses at most ε+log⁡∣A∣β(1−γ)\varepsilon + \frac{\log|\mathcal{A}|}{\beta(1-\gamma)} against the optimal value of the unregularized MDP. The temperature therefore adds a bias that does not shrink with more iterations; it is the price of smoothness and of exploration.

Gumbel Noise on the Rewards

Why does adding independent Gumbel perturbations to action rewards produce a log-sum-exp value before the perturbation is observed?

We can obtain the smooth Bellman equation by considering a setting in which we have Gumbel noise added to the reward function. This derivation provides theoretical insight and also connects to practical modeling scenarios where rewards have random perturbations.

Step 1: Define the Augmented MDP with Gumbel Noise

At each time period and state ss, we draw an action-indexed shock vector:

ϵt(s)=(ϵt(s,a))a∈As,where ϵt(s,a) i.i.d.∼Gumbel(μϵ,1/β)\boldsymbol{\epsilon}_t(s) = \big(\epsilon_t(s,a)\big)_{a \in \mathcal{A}_s}, \quad \text{where } \epsilon_t(s,a) \text{ i.i.d.} \sim \mathrm{Gumbel}(\mu_\epsilon, 1/\beta)

These shocks are independent across time periods, states, and actions, and are independent of the MDP transition dynamics p(⋅∣s,a)p(\cdot | s, a).

The Gumbel distribution with location parameter μ\mu and scale parameter 1/β1/\beta has probability density function:

f(x;μ,1/β)=βexp⁡(−β(x−μ)−exp⁡(−β(x−μ)))f(x; \mu, 1/\beta) = \beta\exp\left(-\beta(x-\mu)-\exp(-\beta(x-\mu))\right)

To generate a Gumbel-distributed random variable, we can use inverse transform sampling: X=μ−1βlog⁡(−log⁡(U))X = \mu - \frac{1}{\beta} \log(-\log(U)) where UU is uniform on (0,1)(0,1).

We now define an augmented MDP with:

The transition factorizes because the next shock vector ϵ′\boldsymbol{\epsilon}' is drawn independently of the current state and action (conditional independence).

Step 2: The Hard Bellman Equation on the Augmented State Space

The Bellman optimality equation for the augmented MDP is:

v~(s,ϵ)=max⁡a∈As{r(s,a)+ϵ(a)+γEs′,ϵ′[v~(s′,ϵ′)∣s,a]}\tilde{v}(s, \boldsymbol{\epsilon}) = \max_{a \in \mathcal{A}_s} \left\{ r(s,a) + \epsilon(a) + \gamma \mathbb{E}_{s', \boldsymbol{\epsilon}'}\left[\tilde{v}(s', \boldsymbol{\epsilon}') \mid s, a\right] \right\}

Here the expectation is over the next augmented state (s′,ϵ′)(s', \boldsymbol{\epsilon}'), which includes both the next state s′∼p(⋅∣s,a)s' \sim p(\cdot | s, a) and the next shock vector ϵ′∼p(⋅)\boldsymbol{\epsilon}' \sim p(\cdot).

This is a perfectly well-defined Bellman equation, and an optimal stationary policy exists:

π(s,ϵ)∈argmax⁡a∈As{r(s,a)+ϵ(a)+γEs′,ϵ′[v~(s′,ϵ′)∣s,a]}\pi(s, \boldsymbol{\epsilon}) \in \operatorname{argmax}_{a \in \mathcal{A}_s} \left\{ r(s,a) + \epsilon(a) + \gamma \mathbb{E}_{s', \boldsymbol{\epsilon}'}\left[\tilde{v}(s', \boldsymbol{\epsilon}') \mid s, a\right] \right\}

However, this equation is computationally intractable because:

We never solve this equation directly. Instead, we use it as a mathematical device to derive the smooth Bellman equation.

Step 3: Define the Ex-Ante (Inclusive) Value Function

The idea here is to consider the expected value before observing the current shocks. We define what some authors in econometrics call the inclusive value or ex-ante value:

v(s):=Eϵ[v~(s,ϵ)]v(s) := \mathbb{E}_{\boldsymbol{\epsilon}}\big[\tilde{v}(s, \boldsymbol{\epsilon})\big]

This is the value of being in state ss before we observe the current-period shock vector ϵ\boldsymbol{\epsilon}.

Step 4: Separate the Deterministic and Random Components

Now we take the expectation of the augmented Bellman equation with respect to the current shocks only (everything that does not depend on the current ϵ\boldsymbol{\epsilon} can be pulled out).

First, note that by the law of iterated expectations and independence of shocks across time:

Eϵ′[v~(s′,ϵ′)]=v(s′)\mathbb{E}_{\boldsymbol{\epsilon}'}\big[\tilde{v}(s', \boldsymbol{\epsilon}')\big] = v(s')

This follows from our definition of vv and the fact that the next shock is independent of everything else.

Now define the deterministic part of the right-hand side:

xa(s):=r(s,a)+γ∑j∈Sp(j∣s,a)v(j)x_a(s) := r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j)

This is the expected return from taking action aa in state ss without the shock. Using this notation, the augmented Bellman equation becomes:

v~(s,ϵ)=max⁡a∈As{xa(s)+ϵ(a)}\tilde{v}(s, \boldsymbol{\epsilon}) = \max_{a \in \mathcal{A}_s} \left\{ x_a(s) + \epsilon(a) \right\}

Taking the expectation over ϵ\boldsymbol{\epsilon} on both sides:

v(s)=Eϵ[max⁡a∈As{xa(s)+ϵ(a)}]v(s) = \mathbb{E}_{\boldsymbol{\epsilon}}\left[\max_{a \in \mathcal{A}_s} \left\{ x_a(s) + \epsilon(a) \right\}\right]

Step 5: Apply the Gumbel Random Utility Identity

We now invoke a result from extreme value theory:

Applying this identity to our problem (with mean-zero shocks):

v(s)=Eϵ[max⁡a∈As{xa(s)+ϵ(a)}]=1βlog⁡∑a∈Asexp⁡(βxa(s))v(s) = \mathbb{E}_{\boldsymbol{\epsilon}}\left[\max_{a \in \mathcal{A}_s} \{x_a(s) + \epsilon(a)\}\right] = \frac{1}{\beta} \log \sum_{a \in \mathcal{A}_s} \exp(\beta x_a(s))

Substituting the definition of xa(s)x_a(s):

v(s)=1βlog⁡∑a∈Asexp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)v(j)))v(s) = \frac{1}{\beta} \log \sum_{a \in \mathcal{A}_s} \exp\left(\beta\left(r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j)\right)\right)

We have arrived at the smooth Bellman equation.

The closed form is what singles out the Gumbel distribution. For other shock distributions, the expected maximum E[max⁡i{xi+ϵi}]\mathbb{E}[\max_i \{x_i + \epsilon_i\}] is still a smooth function of the xix_i, but it rarely has a closed form. With Gaussian shocks, for example, it has none beyond two actions, and computing it requires integrating over the continuous noise, which is the computation the construction was meant to avoid. The lemma also states the underlying reason: the maximum of independent Gumbel variables with a common scale is again Gumbel, so the family is closed under the operation that the Bellman equation applies at every step.

Step 6: Summary of the Derivation

To recap the logical flow:

  1. We constructed an augmented MDP with state (s,ϵ)(s, \boldsymbol{\epsilon}) where shocks perturb rewards

  2. We wrote the standard Bellman equation for this augmented MDP (hard max, but over an uncountable state space)

  3. We defined the ex-ante value v(s)=Eϵ[v~(s,ϵ)]v(s) = \mathbb{E}_{\boldsymbol{\epsilon}}[\tilde{v}(s, \boldsymbol{\epsilon})] to eliminate the continuous shock component

  4. We separated deterministic and random terms: v~(s,ϵ)=max⁡a{xa(s)+ϵ(a)}\tilde{v}(s, \boldsymbol{\epsilon}) = \max_a \{x_a(s) + \epsilon(a)\}

  5. We applied the Gumbel identity to evaluate Eϵ[max⁡a{⋯ }]\mathbb{E}_{\boldsymbol{\epsilon}}[\max_a \{\cdots\}] in closed form as a log-sum-exp

The augmented MDP with shocks exists only as a mathematical device. We never approximate v~\tilde{v}, never discretize ϵ\boldsymbol{\epsilon}, and never enumerate the augmented state space. The only computational object we work with is v(s)v(s) on the original (finite) state space, which satisfies the smooth Bellman equation.

Deriving the Optimal Smooth Policy

Now that we have derived the smooth value function, we can also obtain the corresponding optimal policy. The question is: what policy should we follow in the original MDP (without explicitly conditioning on shocks)?

In the augmented MDP, the optimal policy is deterministic but depends on the shock realization:

π(s,ϵ)∈argmax⁡a∈As{r(s,a)+ϵ(a)+γ∑j∈Sp(j∣s,a)v(j)}\pi(s, \boldsymbol{\epsilon}) \in \operatorname{argmax}_{a \in \mathcal{A}_s} \left\{ r(s,a) + \epsilon(a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j) \right\}

However, we want a policy for the original state space ss (not the augmented state). We obtain this by marginalizing over the current shocks, essentially asking: “what is the probability that action aa is optimal when we average over all possible shock realizations?”

Define an indicator function:

Ia(ϵ)={1if a∈argmax⁡a′∈As{xa′(s)+ϵ(a′)}0otherwiseI_a(\boldsymbol{\epsilon}) = \begin{cases} 1 & \text{if } a \in \operatorname{argmax}_{a' \in \mathcal{A}_s} \left\{ x_{a'}(s) + \epsilon(a') \right\} \\ 0 & \text{otherwise} \end{cases}

where xa(s)=r(s,a)+γ∑j∈Sp(j∣s,a)v(j)x_a(s) = r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v(j) as before.

The ex-ante probability that action aa is optimal at state ss is:

π(a∣s)=Eϵ[Ia(ϵ)]=Pϵ(a∈argmax⁡a′{xa′(s)+ϵ(a′)})\pi(a|s) = \mathbb{E}_{\boldsymbol{\epsilon}}[I_a(\boldsymbol{\epsilon})] = \mathbb{P}_{\boldsymbol{\epsilon}}\left(a \in \operatorname{argmax}_{a'} \left\{ x_{a'}(s) + \epsilon(a') \right\}\right)

This is the probability that action aa achieves the maximum when utilities are perturbed by Gumbel noise.

Applying this result to our problem:

π(a∣s)=exp⁡(βxa(s))∑a′∈Asexp⁡(βxa′(s))=exp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)v(j)))∑a′∈Asexp⁡(β(r(s,a′)+γ∑j∈Sp(j∣s,a′)v(j)))\pi(a|s) = \frac{\exp\left(\beta x_a(s)\right)}{\sum_{a' \in \mathcal{A}_s} \exp\left(\beta x_{a'}(s)\right)} = \frac{\exp\left(\beta\left(r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a)v(j)\right)\right)}{\sum_{a' \in \mathcal{A}_s} \exp\left(\beta\left(r(s,a') + \gamma \sum_{j \in \mathcal{S}} p(j|s,a')v(j)\right)\right)}

This is the softmax policy or Gibbs/Boltzmann policy with inverse temperature β\beta.

Properties:

This completes the derivation: the smooth Bellman equation yields a value function v(s)v(s), and the corresponding optimal policy is the softmax over Q-values.

The Original and Augmented MDPs Side by Side

The derivation moves between two decision problems. The first is the original MDP solved with the smooth Bellman equation, or equivalently with an entropy bonus (Regularized Markov Decision Processes). The second is the augmented MDP, in which the decision maker solves a hard Bellman equation but sees a fresh shock on every action’s reward. The table puts them next to each other. We write q(s,a)=r(s,a)+γ∑jp(j∣s,a) vβ⋆(j)q(s,a) = r(s,a) + \gamma\sum_{j} p(j\mid s,a)\, v^\star_\beta(j), which is the xa(s)x_a(s) of the derivation.

Original MDP, smooth Bellman equationAugmented MDP, Gumbel shocks
States∈Ss \in \mathcal{S}(s,ϵ)∈S×R∣As∣(s, \boldsymbol{\epsilon}) \in \mathcal{S} \times \mathbb{R}^{\lvert\mathcal{A}_s\rvert}
Noiseonly the transitions p(j∣s,a)p(j \mid s,a)the transitions, plus a fresh i.i.d. Gumbel vector ϵt\boldsymbol{\epsilon}_t each period
Reward of action aar(s,a)r(s,a), plus the bonus β−1H(π(⋅∣s))\beta^{-1} H(\pi(\cdot \mid s))r(s,a)+ϵ(a)r(s,a) + \epsilon(a)
Transitionp(j∣s,a)p(j \mid s,a)p(j∣s,a) g(ϵ′)p(j \mid s,a)\, g(\boldsymbol{\epsilon}'), with gg the Gumbel density
Bellman equationv=Lβvv = \mathrm{L}_\beta v, a log-sum-expv~(s,ϵ)=max⁡a{q(s,a)+ϵ(a)}\tilde v(s,\boldsymbol{\epsilon}) = \max_a \{q(s,a) + \epsilon(a)\}, a hard max
Optimal policystochastic, πβ(a∣s)∝exp⁡(βq(s,a))\pi_\beta(a \mid s) \propto \exp(\beta q(s,a))deterministic, σ(s,ϵ)=argmax⁡a{q(s,a)+ϵ(a)}\sigma(s,\boldsymbol{\epsilon}) = \operatorname{argmax}_a \{q(s,a) + \epsilon(a)\}
Valuevβ⋆(s)v^\star_\beta(s)v~(s,ϵ)\tilde v(s,\boldsymbol{\epsilon}), with Eϵ[v~(s,ϵ)]=vβ⋆(s)\mathbb{E}_{\boldsymbol{\epsilon}}[\tilde v(s,\boldsymbol{\epsilon})] = v^\star_\beta(s)
Who sees whatthe agent and the modeler both see ssthe agent sees ss and ϵ\boldsymbol{\epsilon}; the modeler sees only ss

Figure 1 draws both problems as graphical models, one time slice after another.

Two graphical models side by side. Left, states s_t and actions a_t, with an arrow from each state to its action and arrows from the state and action to the next state. Right, the same graph with an extra dashed node epsilon_t above each state, an arrow from epsilon_t to a_t, and a_t drawn as a double circle. Dotted boxes group s_t with epsilon_t.

Figure 1:(a) The original MDP under the softmax policy. The action ata_t is a random child of sts_t with conditional distribution πβ(⋅∣st)\pi_\beta(\cdot \mid s_t). (b) The augmented MDP. A shock vector ϵt\boldsymbol{\epsilon}_t (dashed) is drawn independently each period, and the augmented state is (st,ϵt)(s_t, \boldsymbol{\epsilon}_t) (dotted boxes). The action is a deterministic function of the augmented state (double circle). The shock has no arrow into st+1s_{t+1} or ϵt+1\boldsymbol{\epsilon}_{t+1}. Integrating ϵt\boldsymbol{\epsilon}_t out of each slice of (b) gives (a).

The figure shows why the construction works. In panel (b), ϵt\boldsymbol{\epsilon}_t has a single child, the action ata_t, and the action is a deterministic function of (st,ϵt)(s_t, \boldsymbol{\epsilon}_t). Integrating the shock out of slice tt therefore changes only the conditional distribution of ata_t:

P(at=a∣st)=∫1{a=σ(st,ϵ)} g(ϵ) dϵ=πβ(a∣st),\mathbb{P}(a_t = a \mid s_t) = \int \mathbb{1}\{a = \sigma(s_t, \boldsymbol{\epsilon})\}\, g(\boldsymbol{\epsilon})\, d\boldsymbol{\epsilon} = \pi_\beta(a \mid s_t),

by Lemma 2. Doing this in every slice turns graph (b) into graph (a): the two models give the same distribution over state-action trajectories (s0,a0,s1,a1,…)(s_0, a_0, s_1, a_1, \ldots). The missing arrows matter. If ϵt\boldsymbol{\epsilon}_t also influenced st+1s_{t+1}, or if the shocks were correlated over time, integrating them out would leave a dependence on the past, and the marginal process would no longer be an MDP in ss. Rust (1987) states this as a conditional independence assumption, and his estimator relies on it.

The rewards are not equal path by path. The augmented agent collects r(st,at)+ϵt(at)r(s_t,a_t) + \epsilon_t(a_t), while the original MDP pays r(st,at)r(s_t,a_t) and the entropy bonus. They are equal on average. Conditional on which action wins, the winning value max⁡a{q(s,a)+ϵ(a)}\max_a\{q(s,a)+\epsilon(a)\} has the same distribution whatever the winner is, a property of the Gumbel distribution. Its mean is 1βlog⁡∑a′exp⁡(βq(s,a′))\frac{1}{\beta}\log\sum_{a'} \exp(\beta q(s,a')) by Lemma 1, so

E[ϵ(a) ∣ σ(s,ϵ)=a]=1βlog⁡∑a′eβq(s,a′)−q(s,a)=−1βlog⁡πβ(a∣s).\mathbb{E}\big[\epsilon(a) \,\big|\, \sigma(s,\boldsymbol{\epsilon}) = a\big] = \frac{1}{\beta}\log\sum_{a'} e^{\beta q(s,a')} - q(s,a) = -\frac{1}{\beta}\log \pi_\beta(a \mid s).

The shock that the agent collects on the action it picks is, on average, −1βlog⁡πβ(a∣s)-\frac{1}{\beta}\log\pi_\beta(a\mid s). Averaging over a∼πβ(⋅∣s)a \sim \pi_\beta(\cdot\mid s) gives 1βH(πβ(⋅∣s))\frac{1}{\beta}H(\pi_\beta(\cdot \mid s)), the entropy bonus. The per-action penalty −αlog⁡π(a∣s)-\alpha \log \pi(a \mid s) that appears later in the regularized formulation is this expected shock, with α=1/β\alpha = 1/\beta. A rarely chosen action is chosen only when its shock is large, and the entropy bonus is the average of those large shocks.

Checking the Equivalence Numerically

The augmented MDP is a device for theory: it explains where the log-sum-exp comes from and gives a likelihood for observed choices, but nobody solves it to compute a policy. On a small problem we can still solve it by brute force and check that it gives the same answer as the original MDP. The cell below draws a random MDP with 5 states and 3 actions, sets γ=0.9\gamma = 0.9 and β=2\beta = 2, and computes the solution in three ways.

  1. Original MDP. Smooth value iteration with the log-sum-exp, then the softmax policy.

  2. Original MDP, regularized reading. The value of that softmax policy with its entropy bonus, from the linear system (I−γPπ)v=rπ+β−1Hπ(\mathbf{I}-\gamma\mathbf{P}_\pi)\mathbf{v} = \mathbf{r}_\pi + \beta^{-1}\mathbf{H}_\pi.

  3. Augmented MDP. Value iteration with the hard max on the ex-ante value, v(s)←Eϵ[max⁡a{r(s,a)+γ∑jp(j∣s,a)v(j)+ϵ(a)}]v(s) \leftarrow \mathbb{E}_{\boldsymbol{\epsilon}}[\max_a\{r(s,a)+\gamma\sum_j p(j\mid s,a)v(j)+\epsilon(a)\}], with the expectation replaced by an average over 50,000 Gumbel draws and no log-sum-exp anywhere. We then simulate 20,000 episodes in which the agent sees fresh shocks at every step, takes the deterministic action argmax⁡a{q(s,a)+ϵ(a)}\operatorname{argmax}_a\{q(s,a)+\epsilon(a)\}, and collects r+ϵ(a)r + \epsilon(a).

import numpy as np

rng = np.random.default_rng(0)
n_states, n_actions, gamma, beta = 5, 3, 0.9, 2.0
P = rng.dirichlet(0.5 * np.ones(n_states), size=(n_states, n_actions))  # P[s, a, j]
r = rng.normal(size=(n_states, n_actions))
loc, scale = -np.euler_gamma / beta, 1 / beta  # mean-zero Gumbel shocks


def smooth_max(q):
    """(1/beta) log sum_a exp(beta q), computed stably along the last axis."""
    m = q.max(axis=-1)
    return m + np.log(np.exp(beta * (q - m[..., None])).sum(axis=-1)) / beta


# Original MDP: smooth value iteration, then the softmax policy.
v = np.zeros(n_states)
for _ in range(500):
    v = smooth_max(r + gamma * P @ v)
q = r + gamma * P @ v
pi = np.exp(beta * (q - v[:, None]))
entropy = -(pi * np.log(pi)).sum(axis=1)

# Original MDP, regularized reading: evaluate pi with its entropy bonus,
# (I - gamma P_pi) v = r_pi + H_pi / beta.
P_pi = np.einsum("sa,saj->sj", pi, P)
v_reg = np.linalg.solve(np.eye(n_states) - gamma * P_pi, (pi * r).sum(axis=1) + entropy / beta)

# Augmented MDP: hard Bellman equation, ex-ante value. The expectation over the
# current shocks is an average over n_draws fixed Gumbel draws; no log-sum-exp.
n_draws = 50_000
shocks = rng.gumbel(loc, scale, size=(n_draws, n_states, n_actions))
v_aug = np.zeros(n_states)
for _ in range(150):
    v_aug = (r + gamma * P @ v_aug + shocks).max(axis=2).mean(axis=0)
q_aug = r + gamma * P @ v_aug

# Simulate the augmented MDP: the agent sees fresh shocks every step and takes
# the deterministic action argmax_a q_aug(s, a) + eps(a).
n_episodes, horizon = 20_000, 150
s = np.zeros(n_episodes, dtype=int)
returns = np.zeros(n_episodes)
visits = np.zeros((n_states, n_actions))
shock_total = np.zeros((n_states, n_actions))
cdf = P.cumsum(axis=2)
for t in range(horizon):
    eps = rng.gumbel(loc, scale, size=(n_episodes, n_actions))
    a = (q_aug[s] + eps).argmax(axis=1)
    eps_a = eps[np.arange(n_episodes), a]
    returns += gamma**t * (r[s, a] + eps_a)
    np.add.at(visits, (s, a), 1)
    np.add.at(shock_total, (s, a), eps_a)
    s = (rng.random(n_episodes)[:, None] > cdf[s, a]).sum(axis=1)
freq = visits / visits.sum(axis=1, keepdims=True)
mean_shock = shock_total / visits

fmt = lambda x: " ".join(f"{y:6.3f}" for y in x)
lines = [
    "Values v(s)",
    f"  original, smooth value iteration        {fmt(v)}",
    f"  original, entropy-regularized eval      {fmt(v_reg)}",
    f"  augmented, hard max over Gumbel draws   {fmt(v_aug)}",
    f"  augmented, simulated return from s=0    {returns.mean():6.3f} +/- {2 * returns.std() / np.sqrt(n_episodes):.3f}",
    "",
    "Policy: softmax pi(a|s) vs. action frequencies of the augmented agent",
    "  s |  softmax pi(.|s)      |  frequency in augmented MDP",
]
lines += [f"  {i} | {fmt(pi[i])} | {fmt(freq[i])}" for i in range(n_states)]
lines += [
    "",
    "Shocks: -log pi(a|s)/beta vs. mean shock eps(a) when a is chosen",
    "  s |  -log pi(.|s)/beta    |  mean chosen shock",
]
lines += [f"  {i} | {fmt(-np.log(pi[i]) / beta)} | {fmt(mean_shock[i])}" for i in range(n_states)]
lines += [
    "",
    f"  entropy bonus H/beta per state     {fmt(entropy / beta)}",
    f"  mean chosen shock per state        {fmt(shock_total.sum(1) / visits.sum(1))}",
]
print("\n".join(lines))
Values v(s)
  original, smooth value iteration        10.098 11.741 11.022 10.392 11.100
  original, entropy-regularized eval      10.098 11.741 11.022 10.392 11.100
  augmented, hard max over Gumbel draws   10.094 11.735 11.015 10.390 11.095
  augmented, simulated return from s=0    10.116 +/- 0.026

Policy: softmax pi(a|s) vs. action frequencies of the augmented agent
  s |  softmax pi(.|s)      |  frequency in augmented MDP
  0 |  0.373  0.589  0.038 |  0.374  0.588  0.038
  1 |  0.707  0.112  0.181 |  0.707  0.112  0.181
  2 |  0.091  0.747  0.162 |  0.091  0.746  0.163
  3 |  0.600  0.365  0.035 |  0.600  0.365  0.035
  4 |  0.879  0.001  0.120 |  0.880  0.001  0.119

Shocks: -log pi(a|s)/beta vs. mean shock eps(a) when a is chosen
  s |  -log pi(.|s)/beta    |  mean chosen shock
  0 |  0.493  0.265  1.636 |  0.492  0.266  1.629
  1 |  0.173  1.095  0.856 |  0.173  1.097  0.853
  2 |  1.196  0.146  0.911 |  1.195  0.147  0.912
  3 |  0.256  0.504  1.669 |  0.257  0.507  1.674
  4 |  0.064  3.508  1.061 |  0.065  3.529  1.060

  entropy bonus H/beta per state      0.402  0.400  0.366  0.396  0.187
  mean chosen shock per state         0.402  0.399  0.367  0.398  0.187

The three value functions agree up to Monte Carlo error, which stays below 0.01 on values near 10, and the simulated return of the augmented agent from state 0 matches vβ⋆(0)v^\star_\beta(0) within its confidence interval. The augmented agent never randomizes, yet the frequencies of its actions reproduce the softmax probabilities to the third decimal. The last two blocks check the shock identity: the mean shock on a chosen action matches −β−1log⁡πβ(a∣s)-\beta^{-1}\log\pi_\beta(a\mid s), and its average per state matches the entropy bonus. The cost explains why the Gumbel route stays theoretical. One brute-force sweep evaluates 50,000×5×350{,}000 \times 5 \times 3 maxima, where the log-sum-exp needs 5×35 \times 3 exponentials, and the brute-force answer is still off in the third digit.

Regularized Markov Decision Processes

Which convex penalty on action distributions generates a desired smooth maximum through conjugate duality?

Regularized MDPs Geist et al. (2019) provide another perspective on how the smooth Bellman equations come to be. This framework offers a more general approach in which we seek to find optimal policies under the infinite horizon criterion while also accounting for a regularizer that influences the kind of policies we try to obtain.

The framework does not fix the regularizer. Any strongly convex function Ω\Omega on the probability simplex yields a regularized Bellman operator, a contraction argument and an optimal policy, in the same way that the L2 penalty is only one of many regularizers in supervised learning. Different choices give different smooth maxima. A Tsallis entropy, for instance, gives policies that assign zero probability to sufficiently poor actions Lee et al. (2018). In practice the negative Shannon entropy is by far the most common choice: its conjugate and its optimal policy have closed forms, and it coincides with the Gumbel model of the previous section.

Let’s set up some necessary notation. First, recall that the policy evaluation operator for a stationary policy with decision rule π\pi is defined as:

Lπv=rπ+γPπv\BellmanPi \mathbf{v} = \mathbf{r}_\pi + \gamma \mathbf{P}_\pi \mathbf{v}

where rπ\mathbf{r}_\pi is the expected reward vector under policy π\pi, γ\gamma is the discount factor, and Pπ\mathbf{P}_\pi is the state transition probability matrix under π\pi. A complementary object to the value function is the q-function (or Q-factor) representation:

qγπ(s,a)=r(s,a)+γ∑j∈Sp(j∣s,a)vγπ(j)vγπ(s)=∑a∈Asπ(a∣s)qγπ(s,a)\begin{align*} q_\gamma^{\pi}(s, a) &= r(s, a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v_\gamma^{\pi}(j) \\ v_\gamma^{\pi}(s) &= \sum_{a \in \mathcal{A}_s} \pi(a | s) q_\gamma^{\pi}(s, a) \end{align*}

The policy evaluation operator can then be written in terms of the q-function as:

[Lπv](s)=⟨π(⋅∣s),q(s,⋅)⟩[\BellmanPi v](s) = \langle \pi(\cdot | s), q(s, \cdot) \rangle

Legendre-Fenchel Transform

The workhorse behind the theory of regularized MDPs is the Legendre-Fenchel transform, also known as the convex conjugate. For a strongly convex function Ω:Δ(As)→R\Omega: \Delta(\mathcal{A}_s) \rightarrow \mathbb{R}, its Legendre-Fenchel transform Ω∗:RAs→R\Omega^*: \mathbb{R}^{\mathcal{A}_s} \rightarrow \mathbb{R} is defined as:

Ω∗(q(s,⋅))=max⁡π(⋅∣s)∈Δ(As)⟨π(⋅∣s),q(s,⋅)⟩−Ω(π(⋅∣s))\Omega^*(q(s, \cdot)) = \max_{\pi(\cdot|s) \in \Delta(\mathcal{A}_s)} \langle \pi(\cdot | s), q(s, \cdot) \rangle - \Omega(\pi(\cdot | s))

An important property of this transform is that it has a unique maximizing argument, given by the gradient of Ω∗\Omega^*:

∇Ω∗(q(s,⋅))=arg⁡max⁡π⟨π(⋅∣s),q(s,⋅)⟩−Ω(π(⋅∣s))\nabla \Omega^*(q(s, \cdot)) = \arg\max_\pi \langle \pi(\cdot | s), q(s, \cdot) \rangle - \Omega(\pi(\cdot | s))

The gradient is also Lipschitz: if Ω\Omega is κ\kappa-strongly convex, a change of qq moves the maximizing policy by at most 1/κ1/\kappa times as much. A more strongly convex regularizer therefore makes the policy less sensitive to errors in qq. An important example of a regularizer is the negative entropy, which gives rise to the smooth Bellman equations as we are about to see. Scaled by the temperature 1/β1/\beta, it is (1/β)(1/\beta)-strongly convex, so the softmax policy moves by at most β\beta times the change in qq (measuring qq in the sup norm and policies in the ℓ1\ell_1 norm).

Regularized Bellman Operators

How do the regularizer and its convex conjugate alter Bellman evaluation, policy improvement, and their contraction properties?

With these concepts in place, we can now define the regularized Bellman operators:

  1. Regularized Policy Evaluation Operator (Lπ,Ω)(\mathrm{L}_{\pi,\Omega}):

    [Lπ,Ωv](s)=⟨q(s,⋅),π(⋅∣s)⟩−Ω(π(⋅∣s))[\mathrm{L}_{\pi,\Omega} v](s) = \langle q(s,\cdot), \pi(\cdot | s) \rangle - \Omega(\pi(\cdot | s))
  2. Regularized Bellman Optimality Operator (LΩ)(\mathrm{L}_\Omega):

    [LΩv](s)=[max⁡πLπ,Ωv](s)=Ω∗(q(s,⋅))[\mathrm{L}_\Omega v](s) = [\max_\pi \mathrm{L}_{\pi,\Omega} v ](s) = \Omega^*(q(s, \cdot))

It can be shown that the addition of a regularizer in these regularized operators still preserves the contraction properties, and therefore the existence of a solution to the optimality equations and the convergence of successive approximation.

The regularized value function of a stationary policy with decision rule π\pi, denoted by vπ,Ωv_{\pi,\Omega}, is the unique fixed point of the operator equation:

find v such that v=Lπ,Ωv\text{find $v$ such that } \enspace v = \mathrm{L}_{\pi,\Omega} v

Under the usual assumptions on the discount factor and the boundedness of the reward, the value of a policy can also be found in closed form by solving for v\mathbf{v} in the linear system of equations:

(I−γPπ)v=rπ−Ωπ(\mathbf{I} - \gamma \mathbf{P}_\pi) \mathbf{v} = \mathbf{r}_\pi - \boldsymbol{\Omega}_\pi

where [Ωπ](s)=Ω(π(⋅∣s))[\boldsymbol{\Omega}_\pi](s) = \Omega(\pi(\cdot|s)) is the vector of regularization terms at each state.

The associated state-action value function qπ,Ωq_{\pi,\Omega} is given by:

qπ,Ω(s,a)=r(s,a)+∑j∈Sγp(j∣s,a)vπ,Ω(j)vπ,Ω(s)=∑a∈Asπ(a∣s)qπ,Ω(s,a)−Ω(π(⋅∣s))\begin{align*} q_{\pi,\Omega}(s, a) &= r(s, a) + \sum_{j \in \mathcal{S}} \gamma p(j|s,a) v_{\pi,\Omega}(j) \\ v_{\pi,\Omega}(s) &= \sum_{a \in \mathcal{A}_s} \pi(a | s) q_{\pi,\Omega}(s, a) - \Omega(\pi(\cdot | s)) \end{align*}

The regularized optimal value function vΩ∗v^*_\Omega is then the unique fixed point of LΩ\mathrm{L}_\Omega in the fixed point equation:

find v such that v=LΩv\text{find $v$ such that } v = \mathrm{L}_\Omega v

The associated state-action value function qΩ∗q^*_\Omega is given by:

qΩ∗(s,a)=r(s,a)+∑j∈Sγp(j∣s,a)vΩ∗(j)vΩ∗(s)=Ω∗(qΩ∗(s,⋅))\begin{align*} q^*_\Omega(s, a) &= r(s, a) + \sum_{j \in \mathcal{S}} \gamma p(j|s,a) v^*_\Omega(j) \\ v^*_\Omega(s) &= \Omega^*(q^*_\Omega(s, \cdot))\end{align*}

An important result in the theory of regularized MDPs is that there exists a unique optimal regularized policy. Specifically, if πΩ∗\pi^*_\Omega is a conserving decision rule (i.e., πΩ∗=arg⁡max⁡πLπ,ΩvΩ∗\pi^*_\Omega = \arg\max_\pi \mathrm{L}_{\pi,\Omega} v^*_\Omega), then the randomized stationary policy π=const(πΩ∗)\boldsymbol{\pi} = \mathrm{const}(\pi^*_\Omega) is the unique optimal regularized policy.

In practice, once we have found vΩ∗v^*_\Omega, we can derive the optimal decision rule by taking the gradient of the convex conjugate evaluated at the optimal action-value function:

π∗(⋅∣s)=∇Ω∗(qΩ∗(s,⋅))\pi^*(\cdot | s) = \nabla \Omega^*(q^*_\Omega(s, \cdot))

Recovering the Smooth Bellman Equations

Under this framework, we can recover the smooth Bellman equations by choosing Ω\Omega to be the negative entropy scaled by the temperature 1/β1/\beta, and obtain the softmax policy as the gradient of the convex conjugate. Let’s show this explicitly:

  1. Using the scaled negative entropy regularizer:

    Ω(π(⋅∣s))=1β∑a∈Asπ(a∣s)log⁡π(a∣s)\Omega(\pi(\cdot|s)) = \frac{1}{\beta}\sum_{a \in \mathcal{A}_s} \pi(a|s) \log \pi(a|s)
  2. The convex conjugate:

    Ω∗(q(s,⋅))=1βlog⁡∑a∈Asexp⁡(βq(s,a))\Omega^*(q(s, \cdot)) = \frac{1}{\beta}\log \sum_{a \in \mathcal{A}_s} \exp \big(\beta q(s,a)\big)
  3. Now, let’s write out the regularized Bellman optimality equation:

    vΩ∗(s)=Ω∗(qΩ∗(s,⋅))v^*_\Omega(s) = \Omega^*(q^*_\Omega(s, \cdot))
  4. Substituting the expressions for Ω∗\Omega^* and qΩ∗q^*_\Omega:

    vΩ∗(s)=1βlog⁡∑a∈Asexp⁡(β(r(s,a)+γ∑j∈Sp(j∣s,a)vΩ∗(j)))v^*_\Omega(s) = \frac{1}{\beta}\log \sum_{a \in \mathcal{A}_s} \exp \left(\beta\Big(r(s, a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a) v^*_\Omega(j)\Big)\right)

This matches the form of the smooth Bellman equation we derived earlier, with the log-sum-exp operation replacing the max operation of the standard Bellman equation. With β=1\beta = 1, the unscaled negative entropy gives the same equation at unit temperature.

Furthermore, the optimal policy is given by the gradient of Ω∗\Omega^*:

π∗(a∣s)=∇Ω∗(qΩ∗(s,⋅))a=exp⁡(βqΩ∗(s,a))∑a′∈Asexp⁡(βqΩ∗(s,a′))\pi^*(a|s) = \nabla \Omega^*(q^*_\Omega(s, \cdot))_a = \frac{\exp(\beta q^*_\Omega(s,a))}{\sum_{a' \in \mathcal{A}_s} \exp(\beta q^*_\Omega(s,a'))}

This is the familiar softmax policy we encountered in the smooth MDP setting.

Smooth Policy Iteration Algorithm

One identity links the log-sum-exp to the regularized evaluation operator. Let πq(⋅∣s)\pi_q(\cdot \mid s) be the softmax of βq(s,⋅)\beta q(s,\cdot). Then

1βlog⁡∑aexp⁡(βq(s,a))=∑aπq(a∣s) q(s,a)+1βH(πq(⋅∣s)),\frac{1}{\beta}\log\sum_{a} \exp\big(\beta q(s,a)\big) = \sum_a \pi_q(a \mid s)\, q(s,a) + \frac{1}{\beta} H\big(\pi_q(\cdot \mid s)\big),

which one checks by substituting log⁡πq(a∣s)=βq(s,a)−log⁡∑a′exp⁡(βq(s,a′))\log \pi_q(a \mid s) = \beta q(s,a) - \log\sum_{a'} \exp(\beta q(s,a')) into the entropy. Line 6 of Algorithm 1 can therefore be written as “form the softmax policy, then add its expected qq and its entropy bonus”. Algorithms stated that way are sometimes called entropy-regularized value iteration, but they are smooth value iteration with the log-sum-exp expanded. Policy iteration is different: it evaluates each policy completely before improving it.

Properties of smooth policy iteration:

  1. Entropy-regularized evaluation. Line 3 is the linear system for the regularized value vπ,Ωv_{\pi,\Omega} of Regularized Bellman Operators, with the entropy vector Hπ\mathbf{H}_\pi on the right-hand side. Replacing the exact solve by a few sweeps of v←rπ+1βHπ+γPπvv \leftarrow \mathbf{r}_\pi + \frac{1}{\beta}\mathbf{H}_\pi + \gamma\mathbf{P}_\pi v gives the smooth version of Algorithm 4.

  2. Stochastic improvement. Line 7 uses the softmax instead of the argmax. As β→∞\beta \to \infty the method recovers standard policy iteration, and lower β\beta gives policies with more entropy. As in the hard case, the improvement does not need to be applied in every state for the method to make progress. The policy-iteration loops hidden inside actor-critic methods make use of this.

  3. What the stopping rule guarantees. The residual in line 5 is nonnegative, because vv is the regularized value of π\pi and the softmax maximizes the regularized one-step objective, so Lβv≥Lπ,Ωv=v\mathrm{L}_\beta v \ge \mathrm{L}_{\pi,\Omega} v = v. For any vv, the triangle inequality and the contraction property give ∥v−vβ⋆∥∞≤∥v−Lβv∥∞+γ∥v−vβ⋆∥∞\|v - v^\star_\beta\|_\infty \le \|v - \mathrm{L}_\beta v\|_\infty + \gamma\|v - v^\star_\beta\|_\infty, so

    ∥v−vβ⋆∥∞≤∥Lβv−v∥∞1−γ.\|v - v^\star_\beta\|_\infty \le \frac{\|\mathrm{L}_\beta v - v\|_\infty}{1-\gamma}.

    This is the a posteriori bound of Theorem 3 written for one step of Lβ\mathrm{L}_\beta from vv. Since vv is the exact regularized value of the current π\pi, the test of line 6 guarantees that π\pi itself is within ε\varepsilon of the optimal regularized value in every state. A test on the change of the policy, such as ∥π−πold∥<ε\|\pi - \pi_{\text{old}}\| < \varepsilon, would give no such guarantee.

  4. Convergence. The algorithm converges to the unique optimal regularized value function and policy. Unlike standard policy iteration, it does not terminate after finitely many iterations: the softmax policies form a continuum and the iterates approach the optimum without reaching it, which is why the loop stops on a tolerance. The convergence is fast, since each iteration is a Newton step (Smooth Policy Iteration Is Newton’s Method).

Smooth Policy Iteration Is Newton’s Method

The link between policy iteration and the Newton-Kantorovich method (Newton-Kantorovich and Policy Iteration) is easier to see here than in the hard case, because Lβ\mathrm{L}_\beta is differentiable everywhere and there are no ties to worry about. The derivative of the log-sum-exp with respect to its arguments is the softmax, so the Fréchet derivative of Lβ\mathrm{L}_\beta at vv is

Lβ′(v)=γPπv,πv(a∣s)=exp⁡(βqv(s,a))∑a′exp⁡(βqv(s,a′)),qv(s,a)=r(s,a)+γ∑jp(j∣s,a)v(j),\mathrm{L}_\beta'(v) = \gamma \mathbf{P}_{\pi_v}, \qquad \pi_v(a \mid s) = \frac{\exp(\beta q_v(s,a))}{\sum_{a'}\exp(\beta q_v(s,a'))}, \quad q_v(s,a) = r(s,a) + \gamma\sum_j p(j\mid s,a) v(j),

the transition matrix of the softmax policy. A Newton step on v−Lβv=0v - \mathrm{L}_\beta v = 0 solves

(I−γPπv) vnew=Lβv−γPπvv.(\mathbf{I} - \gamma\mathbf{P}_{\pi_v})\, v_{\text{new}} = \mathrm{L}_\beta v - \gamma\mathbf{P}_{\pi_v} v.

At the softmax policy the log-sum-exp equals the expected qq plus the entropy bonus, Lβv=rπv+γPπvv+1βHπv\mathrm{L}_\beta v = \mathbf{r}_{\pi_v} + \gamma\mathbf{P}_{\pi_v} v + \frac{1}{\beta}\mathbf{H}_{\pi_v}. The right-hand side is therefore rπv+1βHπv\mathbf{r}_{\pi_v} + \frac{1}{\beta}\mathbf{H}_{\pi_v}, and the Newton step is exactly the entropy-regularized evaluation of the softmax policy. Smooth policy iteration is the Newton-Kantorovich method applied to the smooth Bellman equation, without the semismooth machinery that the hard max requires.

The contrast also has a history. Puterman & Brumelle (1979) established the correspondence between policy iteration and Newton’s method for the hard Bellman equation, whose operator has no derivative where actions tie, before generalized derivatives for nonsmooth operators had become standard tools. The semismooth reading of Newton-Kantorovich and Policy Iteration was worked out much later Gargiani et al. (2022). For the smooth operator, the classical Newton-Kantorovich theory applies as is.

Rust (1987) solved his smooth Bellman equation this way. He did not call it policy iteration. He recognized an operator equation, a root-finding problem in a function space, and applied Newton-Kantorovich to it, after a few rounds of successive approximation to get close enough for Newton’s method to converge quickly.

Equivalence Between Smooth Bellman Equations and Entropy-Regularized MDPs

We have now seen three ways to arrive at the smooth Bellman equation: as a smoothed maximum, from Gumbel noise on the rewards, and as the optimality equation of a regularized MDP. The third one can be written as an optimization problem over policies, the form used by maximum entropy RL. With entropy weight α=1/β\alpha = 1/\beta, the entropy-regularized MDP is

max⁡π  Eπ[∑t=0∞γt(r(st,at)+αH(π(⋅∣st)))],H(π(⋅∣s))=−∑aπ(a∣s)log⁡π(a∣s).\max_\pi\; \mathbb{E}_\pi \left[ \sum_{t=0}^\infty \gamma^t \Big( r(s_t, a_t) + \alpha H\big(\pi(\cdot|s_t)\big) \Big) \right], \qquad H(\pi(\cdot|s)) = -\sum_a \pi(a|s) \log \pi(a|s).

Since H(π(⋅∣s))=Ea∼π(⋅∣s)[−log⁡π(a∣s)]H(\pi(\cdot|s)) = \mathbb{E}_{a \sim \pi(\cdot|s)}[-\log \pi(a|s)], the entropy bonus in state ss is the average of a per-action term, and the objective equals

Eπ[∑t=0∞γt(r(st,at)−αlog⁡π(at∣st))].\mathbb{E}_\pi \left[ \sum_{t=0}^\infty \gamma^t \big( r(s_t, a_t) - \alpha \log \pi(a_t|s_t) \big) \right].

Entropy regularization therefore amounts to paying −αlog⁡π(a∣s)-\alpha\log\pi(a|s) for taking action aa, a cost that is high for actions the policy rarely takes. Unlike the Gumbel shocks of Rust’s model, this is a deterministic transformation of the reward. This is the form that sample-based methods such as soft actor-critic estimate, since it only needs the probability of the action that was taken.

The two forms are equal in expectation but give different estimators. The first computes the entropy of π(⋅∣st)\pi(\cdot|s_t) exactly at every visited state, a sum or an integral over all actions. The second evaluates −αlog⁡π(at∣st)-\alpha\log\pi(a_t|s_t) only at the sampled action. It is unbiased and cheaper, but noisier, because the randomness of ata_t now enters the penalty as well as the reward. Replacing a sampled quantity by its conditional expectation given the state is a variance reduction technique known in the simulation literature as conditional Monte Carlo. In the augmented MDP of The Original and Augmented MDPs Side by Side, the same quantity is the expected shock on the chosen action.

The Bellman optimality equation of this problem maximizes, in each state, over the distribution π(⋅∣s)\pi(\cdot|s):

v(s)=max⁡π(⋅∣s)∈Δ(As)∑aπ(a∣s)(q(s,a)−αlog⁡π(a∣s)),q(s,a)=r(s,a)+γ∑j∈Sp(j∣s,a) v(j).v(s) = \max_{\pi(\cdot|s) \in \Delta(\mathcal{A}_s)} \sum_a \pi(a|s) \big( q(s,a) - \alpha \log \pi(a|s) \big), \qquad q(s,a) = r(s,a) + \gamma \sum_{j \in \mathcal{S}} p(j|s,a)\, v(j).

The inner problem is the convex conjugate of the scaled negative entropy, which we computed in “Recovering the Smooth Bellman Equations”. That reading came later. In reinforcement learning, around 2017 Haarnoja et al. (2017)Nachum et al. (2017)Schulman et al. (2017), the maximizer was found by hand: maximize ∑aπ(a∣s)(q(s,a)−αlog⁡π(a∣s))\sum_a \pi(a|s)\big(q(s,a) - \alpha\log\pi(a|s)\big) subject to ∑aπ(a∣s)=1\sum_a \pi(a|s) = 1 with a Lagrange multiplier λ\lambda. Setting the derivative with respect to π(a∣s)\pi(a|s) to zero gives q(s,a)−αlog⁡π(a∣s)−α−λ=0q(s,a) - \alpha\log\pi(a|s) - \alpha - \lambda = 0, so π(a∣s)∝exp⁡(q(s,a)/α)\pi(a|s) \propto \exp(q(s,a)/\alpha), and normalizing gives the softmax policy and the log-sum-exp value. The framework of regularized MDPs Geist et al. (2019) gives the same result without computation once the conjugate of the entropy is known. A direct check is also short, and it shows where the softmax policy comes from. Let πq\pi_q be the softmax policy of qq at temperature α\alpha,

πq(a∣s)=exp⁡(q(s,a)/α)∑a′exp⁡(q(s,a′)/α),\pi_q(a|s) = \frac{\exp\big(q(s,a)/\alpha\big)}{\sum_{a'} \exp\big(q(s,a')/\alpha\big)},

which is the softmax of βq(s,⋅)\beta q(s,\cdot) from the start of the chapter, since β=1/α\beta = 1/\alpha. Taking the logarithm and multiplying by α\alpha expresses qq through πq\pi_q:

q(s,a)=αlog⁡∑a′exp⁡(q(s,a′)/α)+αlog⁡πq(a∣s).q(s,a) = \alpha \log\sum_{a'} \exp\big(q(s,a')/\alpha\big) + \alpha \log \pi_q(a|s).

Substituting this into the per-action term gives

q(s,a)−αlog⁡π(a∣s)=αlog⁡∑a′exp⁡(q(s,a′)/α)−αlog⁡π(a∣s)πq(a∣s).q(s,a) - \alpha \log \pi(a|s) = \alpha \log\sum_{a'} \exp\big(q(s,a')/\alpha\big) - \alpha \log \frac{\pi(a|s)}{\pi_q(a|s)}.

The first term on the right does not depend on aa. Now average both sides over a∼π(⋅∣s)a \sim \pi(\cdot|s). The first term is unchanged, because the probabilities π(a∣s)\pi(a|s) sum to one. The average of the second term is, by definition, the Kullback-Leibler (KL) divergence between π\pi and πq\pi_q,

KL(π(⋅∣s) ∥ πq(⋅∣s))=∑aπ(a∣s)log⁡π(a∣s)πq(a∣s),\mathrm{KL}\big(\pi(\cdot|s) \,\big\|\, \pi_q(\cdot|s)\big) = \sum_a \pi(a|s) \log \frac{\pi(a|s)}{\pi_q(a|s)},

with the convention that actions with π(a∣s)=0\pi(a|s) = 0 contribute zero. The ratio is always defined, since πq(a∣s)>0\pi_q(a|s) > 0 for every action. For any distribution π\pi we therefore get

∑aπ(a∣s)(q(s,a)−αlog⁡π(a∣s))=αlog⁡∑aexp⁡(q(s,a)/α)−α KL(π(⋅∣s) ∥ πq(⋅∣s)).\sum_a \pi(a|s) \big( q(s,a) - \alpha \log \pi(a|s) \big) = \alpha \log\sum_a \exp\big(q(s,a)/\alpha\big) - \alpha\, \mathrm{KL}\big(\pi(\cdot|s) \,\big\|\, \pi_q(\cdot|s)\big).

Only the KL term depends on π\pi, so maximizing the left side over π\pi is the same as making the KL divergence as small as possible. The KL divergence is never negative: by Jensen’s inequality applied to the concave log⁡\log, −KL=∑aπ(a∣s)log⁡πq(a∣s)π(a∣s)≤log⁡∑a: π(a∣s)>0πq(a∣s)≤log⁡1=0-\mathrm{KL} = \sum_a \pi(a|s) \log \frac{\pi_q(a|s)}{\pi(a|s)} \le \log \sum_{a:\,\pi(a|s)>0} \pi_q(a|s) \le \log 1 = 0. Both inequalities are equalities only when π=πq\pi = \pi_q. The maximum is therefore attained by the softmax policy πq\pi_q, and its value is αlog⁡∑aexp⁡(q(s,a)/α)=1βlog⁡∑aexp⁡(βq(s,a))\alpha \log\sum_a \exp(q(s,a)/\alpha) = \frac{1}{\beta}\log\sum_a \exp(\beta q(s,a)), the right-hand side of the smooth Bellman equation. So the value function that solves the smooth Bellman equation is the optimal value of the entropy-regularized MDP, and the softmax policy is its optimal policy. The two descriptions differ only in how they present the problem: as smoothing the Bellman operator, or as trading off reward against policy entropy. Maximum entropy RL algorithms such as soft actor-critic use both, the smooth operator for its differentiability and the regularized objective to explain why the policy should stay stochastic.

The KL form is also what makes soft actor-critic Haarnoja et al. (2018) work with continuous actions. Over a continuous action set, πq\pi_q has an intractable normalizing constant, but that constant does not depend on π\pi, so minimizing KL(π ∥ πq)\mathrm{KL}(\pi \,\|\, \pi_q) over a tractable family, Gaussian policies for instance, needs only qq and samples from π\pi. This is variational inference, the same device used to train variational autoencoders: a simple distribution is fitted to one that can be evaluated only up to a constant.

Continuous Action and State Spaces

What changes in the smooth Bellman equation when the sums over actions become integrals?

So far the action sets were finite. In control problems the action is usually a vector a∈As⊆Rma \in \mathcal{A}_s \subseteq \mathbb{R}^m, a torque, a dose, a flow rate, and the state is often continuous too. The smooth Bellman equation carries over once we fix a reference measure μ\mu on the actions. For a finite set, μ\mu is the counting measure and integrals against it are sums. For a box or another bounded subset of Rm\mathbb{R}^m, it is usually the Lebesgue measure dada. It can also be a probability measure, a prior policy π0(da∣s)\pi_0(da \mid s). Continuous states only need the transition kernel to be written as a measure, p(ds′∣s,a)p(ds' \mid s,a). The table translates the notation of this chapter.

ObjectFinite S\mathcal{S} and As\mathcal{A}_sContinuous S\mathcal{S} and As⊆Rm\mathcal{A}_s \subseteq \mathbb{R}^m
Expected next value∑j∈Sp(j∣s,a) v(j)\sum_{j \in \mathcal{S}} p(j \mid s,a)\, v(j)∫Sv(s′) p(ds′∣s,a)\int_{\mathcal{S}} v(s')\, p(ds' \mid s,a)
Decision ruleprobability vector π(⋅∣s)∈Δ(As)\pi(\cdot \mid s) \in \Delta(\mathcal{A}_s)density π(⋅∣s)\pi(\cdot \mid s) with respect to μ\mu, ∫Asπ(a∣s) μ(da)=1\int_{\mathcal{A}_s} \pi(a \mid s)\, \mu(da) = 1
Policy average∑aπ(a∣s) q(s,a)\sum_a \pi(a \mid s)\, q(s,a)∫Asπ(a∣s) q(s,a) μ(da)\int_{\mathcal{A}_s} \pi(a \mid s)\, q(s,a)\, \mu(da)
EntropyH(π)=−∑aπ(a)log⁡π(a)≥0H(\pi) = -\sum_a \pi(a)\log\pi(a) \ge 0hμ(π)=−∫π(a)log⁡π(a) μ(da)h_\mu(\pi) = -\int \pi(a)\log\pi(a)\, \mu(da), of either sign
Smooth maximum1βlog⁡∑aeβq(s,a)\frac{1}{\beta}\log\sum_a e^{\beta q(s,a)}1βlog⁡∫Aseβq(s,a) μ(da)\frac{1}{\beta}\log\int_{\mathcal{A}_s} e^{\beta q(s,a)}\, \mu(da)
Optimal decision rulesoftmax over As\mathcal{A}_sGibbs density πβ(a∣s)=exp⁡(β(q(s,a)−v(s)))\pi_\beta(a \mid s) = \exp\big(\beta(q(s,a) - v(s))\big)
Bias against the hard maxbetween 0 and log⁡∣A∣β\frac{\log\lvert\mathcal{A}\rvert}{\beta} per stepat most log⁡μ(As)β\frac{\log \mu(\mathcal{A}_s)}{\beta}, but possibly negative; see below

With this notation, the smooth Bellman equation reads

vβ⋆(s)=1βlog⁡∫Asexp⁡(β q(s,a)) μ(da),q(s,a)=r(s,a)+γ∫Svβ⋆(s′) p(ds′∣s,a),v^\star_\beta(s) = \frac{1}{\beta}\log\int_{\mathcal{A}_s} \exp\big(\beta\, q(s,a)\big)\, \mu(da), \qquad q(s,a) = r(s,a) + \gamma \int_{\mathcal{S}} v^\star_\beta(s')\, p(ds' \mid s,a),

and the optimal decision rule is the Gibbs density πβ(a∣s)=exp⁡(β(q(s,a)−vβ⋆(s)))\pi_\beta(a \mid s) = \exp\big(\beta(q(s,a) - v^\star_\beta(s))\big), which integrates to one against μ\mu because vβ⋆(s)v^\star_\beta(s) is the log-normalizer. The contraction argument of the smooth value iteration section uses only monotonicity and the constant shift, and both hold for the integral. The operator is therefore a γ\gamma-contraction in the sup norm, provided the integral is finite. With bounded rewards, it is finite when μ(As)<∞\mu(\mathcal{A}_s) < \infty, for example a box of actions under the Lebesgue measure or any prior policy.

The variational form. The regularized reading also carries over. For any density ν\nu with respect to μ\mu, write Z(s)=∫eβq(s,a)μ(da)Z(s) = \int e^{\beta q(s,a)}\mu(da). Then

∫ν(a) q(s,a) μ(da)−1β∫ν(a)log⁡ν(a) μ(da)=1βlog⁡Z(s)−1β KL(ν ∥ πβ(⋅∣s)),\int \nu(a)\, q(s,a)\, \mu(da) - \frac{1}{\beta}\int \nu(a) \log \nu(a)\, \mu(da) = \frac{1}{\beta}\log Z(s) - \frac{1}{\beta}\, \mathrm{KL}\big(\nu \,\big\|\, \pi_\beta(\cdot \mid s)\big),

as one checks by substituting log⁡πβ=βq−log⁡Z\log \pi_\beta = \beta q - \log Z. The left side is the regularized objective of Regularized Bellman Operators with Ω(ν)=1β∫νlog⁡ν dμ\Omega(\nu) = \frac{1}{\beta}\int \nu\log\nu\, d\mu. Since the KL divergence is nonnegative and vanishes only at ν=πβ\nu = \pi_\beta, the maximum over ν\nu is the log-integral and the maximizer is the Gibbs density. This is the continuous version of the Legendre-Fenchel pair (negative entropy, log-sum-exp), and in statistical physics it is called the Gibbs variational principle.

The reference measure matters. With a finite action set, relabeling the actions changes nothing. With continuous actions, the entropy depends on μ\mu, and that dependence shows up in three ways.

How far from the hard maximum. The finite-action bound max⁡aq≤1βlog⁡∑aeβq≤max⁡aq+log⁡∣A∣β\max_a q \le \frac{1}{\beta}\log\sum_a e^{\beta q} \le \max_a q + \frac{\log\lvert\mathcal{A}\rvert}{\beta} keeps only its upper half: 1βlog⁡∫eβq dμ≤sup⁡aq(s,a)+log⁡μ(As)β\frac{1}{\beta}\log\int e^{\beta q}\,d\mu \le \sup_a q(s,a) + \frac{\log \mu(\mathcal{A}_s)}{\beta}, which gives vβ⋆≤vγ∗+log⁡μ(A)β(1−γ)v^\star_\beta \le v^*_\gamma + \frac{\log \mu(\mathcal{A})}{\beta(1-\gamma)} when μ(As)≤μ(A)\mu(\mathcal{A}_s) \le \mu(\mathcal{A}) for all ss. The lower bound fails, because a set of actions of small volume contributes little to the integral even if it contains the maximizer. The right tool is Laplace’s method. If q(s,⋅)q(s,\cdot) is twice differentiable with a unique maximizer a⋆(s)a^\star(s) in the interior of As\mathcal{A}_s, and H(s)=−∇a2q(s,a⋆(s))\mathbf{H}(s) = -\nabla_a^2 q(s, a^\star(s)) is positive definite, then under the Lebesgue measure

1βlog⁡∫Aseβq(s,a) da=q(s,a⋆(s))+m2βlog⁡2πβ−12βlog⁡det⁡H(s)+o(1/β).\frac{1}{\beta}\log\int_{\mathcal{A}_s} e^{\beta q(s,a)}\, da = q(s,a^\star(s)) + \frac{m}{2\beta}\log\frac{2\pi}{\beta} - \frac{1}{2\beta}\log\det \mathbf{H}(s) + o(1/\beta).

The gap to the hard maximum shrinks like mlog⁡β2β\frac{m\log\beta}{2\beta}, slightly slower than the 1/β1/\beta rate of the finite case, and the Gibbs density concentrates around a⋆(s)a^\star(s) like a Gaussian with covariance (βH(s))−1(\beta\mathbf{H}(s))^{-1}.

Quadratic qq and linear-quadratic control. If q(s,a)=q0(s)−12(a−aˉ(s))⊤H(s)(a−aˉ(s))q(s,a) = q_0(s) - \frac{1}{2}(a - \bar a(s))^\top \mathbf{H}(s)(a - \bar a(s)) is exactly quadratic in aa with H(s)≻0\mathbf{H}(s) \succ 0, Laplace’s formula is exact. The Gibbs policy is the Gaussian N(aˉ(s),(βH(s))−1)\mathcal{N}\big(\bar a(s), (\beta\mathbf{H}(s))^{-1}\big) and vβ⋆(s)=q0(s)+12βlog⁡det⁡(2π(βH(s))−1)v^\star_\beta(s) = q_0(s) + \frac{1}{2\beta}\log\det\big(2\pi(\beta\mathbf{H}(s))^{-1}\big). Linear-quadratic problems are of this kind. With dynamics x′=Ax+Bu+wx' = Ax + Bu + w and reward −12x⊤Qx−12u⊤Ru-\frac{1}{2}x^\top Q x - \frac{1}{2}u^\top R u, a quadratic value −12x⊤Px+c-\frac{1}{2}x^\top P x + c makes qq quadratic in uu with H=R+γB⊤PB\mathbf{H} = R + \gamma B^\top P B, which does not depend on xx. The log-determinant term is then a constant, so PP solves the same discounted Riccati equation as without regularization. The entropy-regularized LQR policy is Gaussian, with mean the usual linear feedback −γ(R+γB⊤PB)−1B⊤PA x-\gamma(R + \gamma B^\top P B)^{-1} B^\top P A\, x and covariance (β(R+γB⊤PB))−1\big(\beta(R + \gamma B^\top P B)\big)^{-1}. The regularization adds exploration noise around the LQR controller, more of it along the directions where the cost is flat, and does not change the gain.

Gumbel shocks over a continuum. The augmented-MDP construction needs one shock per action. Over a continuum of actions we cannot attach independent shocks to every point, since the supremum of uncountably many independent Gumbel variables is infinite. The replacement is a Gumbel process Maddison et al. (2014): a random function GG on As\mathcal{A}_s such that, for every measurable set BB, the maximum max⁡a∈BG(a)\max_{a \in B} G(a) is Gumbel with location log⁡μ(B)\log\mu(B) and unit scale, independently over disjoint sets. For such a process, max⁡a{βq(s,a)+G(a)}\max_a\{\beta q(s,a) + G(a)\} is Gumbel with location log⁡∫eβq(s,a)μ(da)\log\int e^{\beta q(s,a)}\mu(da), and its argmax has the Gibbs density. With ϵt=Gt/β\epsilon_t = G_t/\beta the derivation of Gumbel Noise on the Rewards goes through with a random function in place of a random vector, and Figure 1 still describes the model. It is even less a computational object than in the finite case. Maddison et al. (2014) use it to build an exact sampler, A* sampling, but the algorithms for continuous control, soft actor-critic among them, work with the Gibbs density directly and approximate it with a parametric policy.

Rust’s Bus Engines and Inverse Reinforcement Learning

What can we learn about a decision maker’s goals from records of what they did?

Rust’s 1987 paper is worth reading for three reasons: it contains the smooth Bellman equation, it poses what is now called inverse reinforcement learning, and it solves that problem with a bilevel method that relies on implicit differentiation, a tool that became popular in machine learning three decades later for hyperparameter optimization.

The problem. Harold Zurcher was the superintendent of maintenance at the Madison Metropolitan bus company. Rust had his maintenance records: for each bus, the odometer reading each month, and the months in which Zurcher replaced the engine. Replacing an engine is expensive, while keeping an old engine running costs more and more as the mileage grows. The question was how Zurcher decided when to replace. Rust is a structural econometrician. Structural econometrics does not stop at predicting behavior; it posits a mechanism that generates it, here a decision maker solving an MDP, and fits the parameters of that mechanism to data. The fitted mechanism can then answer questions the data alone cannot, such as how behavior would change if the price of an engine changed.

The model. The state ss is the mileage since the last replacement, discretized into bins. Each month there are two actions, keep (a=0a=0) or replace (a=1a=1). Keeping costs c(s;θ)c(s;\theta), increasing in ss; replacing costs a fixed amount RCRC and resets the mileage. With parameters θ\theta collecting RCRC and those of cc, the reward is rθ(s,0)=−c(s;θ)r_\theta(s,0) = -c(s;\theta) and rθ(s,1)=−RC−c(0;θ)r_\theta(s,1) = -RC - c(0;\theta), and the mileage transitions are estimated directly from the odometer data. The data contradict any deterministic policy: two buses with the same mileage are sometimes treated differently. Rust’s answer was the Gumbel model of Gumbel Noise on the Rewards. Zurcher sees, in addition to ss, a shock ϵ(a)\epsilon(a) for each action that the econometrician does not see, and acts optimally given both. Integrating out the shocks gives the smooth Bellman equation and the softmax choice probabilities

vθ=Lβ,θ vθ,πθ(a∣s)=exp⁡(βqθ(s,a))∑a′exp⁡(βqθ(s,a′)).v_\theta = \mathrm{L}_{\beta,\theta}\, v_\theta, \qquad \pi_\theta(a \mid s) = \frac{\exp(\beta q_\theta(s,a))}{\sum_{a'}\exp(\beta q_\theta(s,a'))}.

This is the second, deeper reason Rust used these equations. Besides being smooth, they follow from the random-utility models of McFadden (1974), the standard statistical basis of discrete choice in econometrics, in the same way that least squares follows from assuming Gaussian noise. In machine learning terms, McFadden’s conditional logit is multiclass logistic regression with a structural interpretation.

The estimator. Given observed pairs (st,at)(s_t, a_t), maximize the log-likelihood ℓ(θ)=∑tlog⁡πθ(at∣st)\ell(\theta) = \sum_t \log \pi_\theta(a_t \mid s_t). Every evaluation of ℓ\ell requires solving the smooth Bellman equation for the current θ\theta, so the problem is bilevel: an outer maximization over θ\theta around an inner fixed-point problem. Rust called his algorithm the nested fixed point (NFXP) algorithm. The gradient of ℓ\ell needs ∂vθ/∂θ\partial v_\theta / \partial\theta, which the implicit function theorem provides without differentiating through the iterations of the inner solver. Differentiating vθ=Lβ,θvθv_\theta = \mathrm{L}_{\beta,\theta} v_\theta and using the derivative of Lβ\mathrm{L}_\beta from Smooth Policy Iteration Is Newton’s Method,

∂vθ∂θ=(I−γPπθ)−1 ∂rπθ∂θ,∂rπθ∂θ(s)=∑aπθ(a∣s) ∂rθ(s,a)∂θ.\frac{\partial v_\theta}{\partial \theta} = (\mathbf{I} - \gamma\mathbf{P}_{\pi_\theta})^{-1}\, \frac{\partial \mathbf{r}_{\pi_\theta}}{\partial\theta}, \qquad \frac{\partial \mathbf{r}_{\pi_\theta}}{\partial\theta}(s) = \sum_a \pi_\theta(a\mid s)\, \frac{\partial r_\theta(s,a)}{\partial \theta}.

The matrix to invert is the one of policy evaluation, already factored by the Newton steps of the inner solver. For rewards linear in the parameters, rθ(s,a)=θ⊤ϕ(s,a)r_\theta(s,a) = \theta^\top\phi(s,a), this derivative is the vector of expected discounted feature counts under the softmax policy, the quantity that Ziebart et al. (2008) matches to the empirical feature counts. The score of one observation is then

∇θlog⁡πθ(a∣s)=β(∇θqθ(s,a)−∑a′πθ(a′∣s) ∇θqθ(s,a′)),∇θqθ(s,a)=∇θrθ(s,a)+γ∑jp(j∣s,a) ∂vθ∂θ(j).\nabla_\theta \log\pi_\theta(a\mid s) = \beta\Big(\nabla_\theta q_\theta(s,a) - \sum_{a'}\pi_\theta(a'\mid s)\,\nabla_\theta q_\theta(s,a')\Big), \qquad \nabla_\theta q_\theta(s,a) = \nabla_\theta r_\theta(s,a) + \gamma\sum_j p(j\mid s,a)\,\frac{\partial v_\theta}{\partial \theta}(j).

A network that contains a Bellman equation. Compare the estimator with behavioral cloning, which fits a policy to the same pairs (st,at)(s_t, a_t) by maximum likelihood. With discrete actions, behavioral cloning is a classification problem: the state enters a network (an MLP, a transformer, any architecture), the network outputs a distribution over actions, and backpropagation minimizes the cross-entropy loss. Rust’s estimator has the same data and the same loss. Only the network differs. The parameters θ\theta define the reward rθr_\theta, the reward enters the smooth Bellman operator, the operator is applied until it reaches its fixed point vθv_\theta, and the output is the softmax of the resulting qθq_\theta. The hypothesis that the decision maker solves an MDP is built into the architecture as an inductive bias, in the way that convolutions build translation structure into an image model.

Figure 2 draws the two estimators side by side.

Two computation graphs. Top, behavioral cloning: the state enters a generic network that outputs a policy, which enters a cross-entropy loss together with the observed action; a gradient arrow runs back from the loss to the network. Bottom, Rust's estimator: theta enters a reward box, then a chain of Bellman-operator boxes framed as repeated until the fixed point, then the value v_theta, a softmax, and the same loss. Two gradient routes run back from v_theta: a dashed one through every Bellman box, labeled unrolled, and a single curved arrow to theta, labeled implicit, with the formula for the derivative of v_theta.

Figure 2:(a) Behavioral cloning fits a generic network to state-action pairs, and backpropagation runs through a fixed number of layers. (b) Rust’s estimator uses the same data and loss, but its network maps the reward parameters θ\theta through the Bellman operator, applied until vθ=Lβ,θvθv_\theta = \mathrm{L}_{\beta,\theta} v_\theta, to the softmax policy. The gradient can return to θ\theta through every Bellman layer (dashed, unrolled) or in one step by the implicit function theorem (solid), which holds only at the fixed point.

Such a network has, in effect, infinitely many layers, one per application of the Bellman operator, and there are two ways to differentiate through it. The first truncates the inner solver after KK iterations and backpropagates through all of them, as backpropagation through time does for a recurrent network. This is called unrolled differentiation. Its memory grows with KK, and the gradient inherits the truncation error. The second uses only the condition that defines the fixed point. Write it as F(v,θ)=Lβ,θv−v=0F(v, \theta) = \mathrm{L}_{\beta,\theta} v - v = 0. If ∂F/∂v\partial F/\partial v is invertible at a solution, the implicit function theorem gives a differentiable map θ↦vθ\theta \mapsto v_\theta near that solution, with

∂vθ∂θ=−(∂F∂v)−1∂F∂θ.\frac{\partial v_\theta}{\partial \theta} = -\left(\frac{\partial F}{\partial v}\right)^{-1} \frac{\partial F}{\partial \theta}.

Here ∂F/∂v=γPπθ−I\partial F/\partial v = \gamma\mathbf{P}_{\pi_\theta} - \mathbf{I}, which is invertible for γ<1\gamma < 1, and ∂F/∂θ=∂rπθ/∂θ\partial F/\partial\theta = \partial\mathbf{r}_{\pi_\theta}/\partial\theta, which gives the formula used by NFXP. The formula holds at the fixed point and nowhere else. This is why NFXP solves the inner problem to high accuracy at every outer step, so that each evaluation of the likelihood costs a full solve, and why Rust invested in a fast inner solver: successive approximation, which converges from any starting point, followed by Newton-Kantorovich steps, which converge quadratically once close to the solution.

The constrained formulation. The bilevel problem can also be written as a single constrained problem: maximize ℓ\ell jointly over θ\theta and vv, subject to v=Lβ,θvv = \mathrm{L}_{\beta,\theta} v. Su & Judd (2012) proposed this formulation, known as mathematical programming with equilibrium constraints (MPEC), as an alternative to NFXP. A general-purpose constrained solver handles the Bellman equations, which then need to hold only at convergence rather than at every outer step. The price is a larger optimization problem, with one unknown per state in addition to θ\theta.

The setup rests on strong assumptions, and naming them explains why inverse RL is hard in general.

Inverse RL after Rust. Ng & Russell (2000) introduced inverse RL to machine learning, with rewards linear in features and a characterization of the rewards under which an observed policy is optimal. Generative adversarial imitation learning (GAIL) Ho & Ermon (2016) matches the distribution of state-action pairs with the help of an adversarial discriminator. The discriminator is sometimes read as a reward, but nothing requires it to be consistent with a Bellman equation, and the method is closer to behavioral cloning than to Rust’s estimator. Upside-down RL Schmidhuber (2019) and decision transformers Chen et al. (2021) go further in that direction: a sequence model trained on trajectories is conditioned on a desired return and asked to produce actions that achieve it. These methods imitate behavior without recovering a reward. Behavioral cloning also matters in robotics, where demonstrations collected by moving the robot by hand provide an initialization that RL then fine-tunes.

Recovering a reward remains useful when the goal is to explain behavior rather than to reproduce it. Route choice in transportation is an example. The recursive logit model Fosgerau et al. (2013) applies the Gumbel construction to a traveler moving link by link through a road network, and the estimated reward tells a planner which features of a route people value besides travel time.

Summary and Outlook

Entropy regularization replaces hard action selection with a smooth conjugate operator and produces a stochastic optimal policy. Gumbel perturbations, log-sum-exp Bellman updates, and regularized policy iteration describe the same construction from probabilistic, variational, and algorithmic viewpoints. Drawn as graphical models, the original MDP and the Gumbel-augmented MDP differ by one shock node per time step, and integrating it out recovers the softmax policy; the expected shock on the chosen action is the entropy bonus. The same equations hold for continuous actions once a reference measure is fixed, with integrals in place of sums and a Gibbs density in place of the softmax, and the choice of that measure becomes part of the model. Smooth policy iteration is Newton’s method on the smooth Bellman equation, and Rust’s nested fixed-point estimator uses the same derivative to recover reward parameters from observed behavior.

The same log-sum-exp form appears over whole trajectories in continuous time. Path-integral stochastic control examines systems driven by Gaussian disturbances whose Hamilton--Jacobi--Bellman equation becomes linear under a logarithmic transformation, so that optimal feedback can be estimated from weighted trajectories.

Smoothness changes the operator but does not remove the need to represent its unknown value function. How can an infinite-dimensional functional equation be reduced to finitely many coefficients and test conditions? Parametric value functions develops the general approximation machinery.

Self-checks

Solution to Exercise 1

Its probability concentrates on the maximizing action, so the soft policy approaches the ordinary greedy deterministic policy.

Solution to Exercise 2

Log-sum-exp is differentiable and blends information from all actions. A hard maximum is nondifferentiable at ties and passes local gradient information only through selected maximizers.

Solution to Exercise 3

From the shocks on the actions it picks. Given that action aa wins, its shock has mean −1βlog⁡πβ(a∣s)-\frac{1}{\beta}\log\pi_\beta(a\mid s), which is large for actions that rarely win. Averaging over the winning action gives 1βH(πβ(⋅∣s))\frac{1}{\beta}H(\pi_\beta(\cdot\mid s)), the entropy bonus.

Solution to Exercise 4

Dividing the action by 1000 subtracts log⁡1000\log 1000 from the differential entropy of every density, so every value shifts by the constant −log⁡1000β(1−γ)-\frac{\log 1000}{\beta(1-\gamma)} and the policy, mapped back to newton-metres, is unchanged. A logarithmic change of variables is nonlinear: the Lebesgue measure in the new variable is a different measure on torques, so the regularizer and the optimal policy both change.

References
  1. Rust, J. (1987). Optimal Replacement of GMC Bus Engines: An Empirical Model of Harold Zurcher. Econometrica, 55(5), 999–1033.
  2. Ng, A. Y., & Russell, S. J. (2000). Algorithms for Inverse Reinforcement Learning. Proceedings of the 17th International Conference on Machine Learning, 663–670.
  3. Ziebart, B. D., Maas, A. L., Bagnell, J. A., & Dey, A. K. (2008). Maximum Entropy Inverse Reinforcement Learning. Proceedings of the 23rd AAAI Conference on Artificial Intelligence, 1433–1438.
  4. Haarnoja, T., Tang, H., Abbeel, P., & Levine, S. (2017). Reinforcement Learning with Deep Energy-Based Policies. Proceedings of the 34th International Conference on Machine Learning, 70, 1352–1361.
  5. Haarnoja, T., Zhou, A., Abbeel, P., & Levine, S. (2018). Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. Proceedings of the 35th International Conference on Machine Learning (ICML), 1861–1870.
  6. Levine, S., Kumar, A., Tucker, G., & Fu, J. (2018). Reinforcement Learning as a Framework for Control: A Survey. arXiv Preprint arXiv:1806.04222.
  7. Geist, M., Scherrer, B., & Pietquin, O. (2019). A Theory of Regularized Markov Decision Processes. In K. Chaudhuri & R. Salakhutdinov (Eds.), Proceedings of the 36th International Conference on Machine Learning (Vol. 97, pp. 2160–2169). PMLR. https://proceedings.mlr.press/v97/geist19a.html
  8. Lee, K., Choi, S., & Oh, S. (2018). Sparse Markov Decision Processes with Causal Sparse Tsallis Entropy Regularization for Reinforcement Learning. IEEE Robotics and Automation Letters, 3(3), 1466–1473.
  9. Puterman, M. L., & Brumelle, S. L. (1979). On the Convergence of Policy Iteration in Stationary Dynamic Programming. Mathematics of Operations Research, 4(1), 60–69.
  10. Gargiani, M., Zanelli, A., Liao-McPherson, D., Summers, T. H., & Lygeros, J. (2022). Dynamic Programming Through the Lens of Semismooth Newton-Type Methods. IEEE Control Systems Letters, 6, 2996–3001. 10.1109/LCSYS.2022.3181213
  11. Nachum, O., Norouzi, M., Xu, K., & Schuurmans, D. (2017). Bridging the Gap Between Value and Policy Based Reinforcement Learning. Advances in Neural Information Processing Systems, 30, 2775–2785.
  12. Schulman, J., Chen, X., & Abbeel, P. (2017). Equivalence Between Policy Gradients and Soft Q-Learning. arXiv Preprint arXiv:1704.06440.
  13. Geist, M., Scherrer, B., & Pietquin, O. (2019). A Theory of Regularized Markov Decision Processes. Proceedings of the 36th International Conference on Machine Learning, 97.
  14. Maddison, C. J., Tarlow, D., & Minka, T. (2014). A* Sampling. Advances in Neural Information Processing Systems 27.
  15. McFadden, D. (1974). Conditional Logit Analysis of Qualitative Choice Behavior. In P. Zarembka (Ed.), Frontiers in Econometrics (pp. 105–142). Academic Press.