Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

Which Rewards Explain Behavior?

Reward ambiguity, shaping invariance and what demonstrations can identify.

If an agent's behavior were all you could observe, how much of its reward could you ever learn? This lesson answers precisely: which transformations leave optimal behavior unchanged, why an entropy-regularized expert pins its reward down exactly up to potential shaping, how a second discount factor or environment removes even that, how the answer changes with the data source, and why, when the demonstrator's rationality is unknown, no simplicity prior can rescue the inference.

What you’ll learn

  • Characterize the transformations of a reward that preserve its optimal policies, including potential-based shaping and optimality-preserving transformations.
  • Prove that an entropy-regularized policy determines a state–action reward exactly up to potential shaping, and explain how two discount factors or two environments identify it up to a constant.
  • Compare how much of the reward different data sources identify (optimal, Boltzmann-rational and maximum-causal-entropy policies, trajectories, comparisons), and judge which ambiguity a downstream task can tolerate.
  • Explain the No Free Lunch argument for decomposing behavior into a planner and a reward, and its implications for reward learning and alignment.

What optimal behavior cannot reveal

Fix the states, actions, dynamics PP and discount γ\gamma, and ask which changes of a reward r(s,a,s′)r(s,a,s') leave the set of optimal policies unchanged. Observing an optimal expert, even perfectly and forever, can never distinguish rewards related by such a change. Three families stand out:

  • Positive scaling, r↦c rr\mapsto c\,r with c>0c > 0.
  • Potential-based shaping, r′(s,a,s′)=r(s,a,s′)+γΦ(s′)−Φ(s)r'(s,a,s') = r(s,a,s') + \gamma\Phi(s') - \Phi(s), which shifts every action value in state ss by −Φ(s)-\Phi(s) and so preserves the ranking of actions, under any dynamics.
  • Redistribution over next states: any change that keeps Es′∼P(⋅∣s,a)[r(s,a,s′)]\E_{s'\sim P(\cdot\mid s,a)}\big[r(s,a,s')\big] for every (s,a)(s,a) leaves every value unchanged. Skalse et al. (2023) call it S′S'-redistribution; it is trivial for rewards of the form r(s,a)r(s,a).

For a fixed environment, the class is much larger. An optimal policy reveals only which actions are optimal in each state. Skalse et al. (2023) show that a maximally supportive optimal policy, one that takes every optimal action with positive probability, determines the reward exactly up to optimality-preserving transformations: r′r' is one if some function Ψ:S→R\Psi:\mathcal S\to\R satisfies Es′[r′(s,a,s′)+γΨ(s′)]≤Ψ(s)\E_{s'}\big[r'(s,a,s') + \gamma\Psi(s')\big]\le\Psi(s) for all (s,a)(s,a), with equality exactly for the actions optimal under rr. Here Ψ\Psi plays the role of the new optimal value function; scaling and shaping are special cases, and the class also contains rewards with entirely different values and different rankings of the suboptimal actions. Observed only along its own trajectories, the expert reveals even less: in states it never visits, the reward is free, except that it must not make leaving the visited states attractive.

Check your understanding

Which change to a reward can alter which policies are optimal?

  1. Multiplying every reward by 3
  2. Adding γΦ(s′)−Φ(s)\gamma\Phi(s') - \Phi(s) for some potential Φ\Phi
  3. Adding the same bonus c(s)c(s) to every action's reward in state ss, with cc differing between states
  4. Moving reward between the possible next states of each (s,a)(s,a) while keeping its expected value
Show the answer

C. Adding the same bonus c(s)c(s) to every action's reward in state ss, with cc differing between states

A bonus c(s)c(s) for being in ss leaves the ranking of actions within ss unchanged at that step, but it makes ss more or less attractive to reach, so the best actions in the states that lead to ss can change. Shaping is special precisely because its terms telescope along every trajectory.

Entropy regularization: identified up to shaping

Optimal experts are uninformative because they reveal only an argmax. A stochastic expert reveals more. Suppose, as in maximum-causal-entropy IRL, that the expert is soft-optimal for a reward r(s,a)r(s,a) with inverse temperature β>0\beta > 0, in a finite MDP with known dynamics and discount: π(a∣s)=exp⁡(β(Q(s,a)−V(s)))\pi(a\mid s) = \exp\big(\beta(Q(s,a) - V(s))\big), where Q(s,a)=r(s,a)+γ Es′V(s′)Q(s,a) = r(s,a) + \gamma\,\E_{s'}V(s') and V(s)=β−1log⁡∑aeβQ(s,a)V(s) = \beta^{-1}\log\sum_a e^{\beta Q(s,a)}.

DerivationProof
  1. β−1log⁡πˉ(a∣s)=r(s,a)+γ Es′V(s′)−V(s)⟹r=rV\beta^{-1}\log\bar\pi(a\mid s) = r(s,a) + \gamma\,\E_{s'}V(s') - V(s)\quad\Longrightarrow\quad r = r_V

    Necessity. If rr has soft-optimal policy πˉ\bar\pi and soft value VV, take logarithms of πˉ=exp⁡(β(Q−V))\bar\pi = \exp\big(\beta(Q - V)\big) and substitute the definition of QQ:

  2. β−1log⁡∑aexp⁡(β(rv(s,a)+γ Es′v(s′)))=β−1log⁡∑aπˉ(a∣s) eβv(s)=v(s)\beta^{-1}\log\sum_a\exp\Big(\beta\big(r_v(s,a) + \gamma\,\E_{s'}v(s')\big)\Big) = \beta^{-1}\log\sum_a\bar\pi(a\mid s)\,e^{\beta v(s)} = v(s)

    Sufficiency. Fix vv and define rvr_v by the formula. Then rv(s,a)+γ Es′v(s′)=β−1log⁡πˉ(a∣s)+v(s)r_v(s,a) + \gamma\,\E_{s'}v(s') = \beta^{-1}\log\bar\pi(a\mid s) + v(s), and one soft backup returns vv itself:

  3. The soft Bellman operator is a γ\gamma-contraction, so its fixed point vv is the soft value of rvr_v, and the soft-greedy policy exp⁡(β(rv+γEv′−v))\exp\big(\beta(r_v + \gamma\E v' - v)\big) is πˉ\bar\pi. Two rewards with the same πˉ\bar\pi therefore differ by v1(s)−v2(s)−γ Es′[v1(s′)−v2(s′)]v_1(s) - v_2(s) - \gamma\,\E_{s'}[v_1(s') - v_2(s')]: a potential-based shaping term. ■\blacksquare

Predict before you look

A soft-optimal agent with β=1\beta = 1 makes a single choice that ends the episode, picking a1a_1 with probability 0.8 and a2a_2 with probability 0.2. What is r(a1)−r(a2)r(a_1) - r(a_2)?

Show the answer

1.39

With no future, r(a)=β−1log⁡πˉ(a)+vr(a) = \beta^{-1}\log\bar\pi(a) + v, so r(a1)−r(a2)=ln⁡(0.8/0.2)=ln⁡4≈1.39r(a_1) - r(a_2) = \ln(0.8/0.2) = \ln4\approx1.39, while the common level vv stays unknown. An optimal agent would only have revealed that a1a_1 is better; the soft-optimal one reveals by how much, provided β\beta and the soft-optimality model are right.

Shaping is harmless for reproducing the expert in its own environment, but a shaped reward can behave differently when the dynamics change, since Es′[v(s′)]\E_{s'}[v(s')] depends on them. Observing the same reward under more than one setting removes the ambiguity:

  • Two discounts or two environments (Cao, Cohen & Szpruch, 2021). If two soft-optimal agents share the reward but differ in discount factor or in transition probabilities, and the two problems satisfy a non-degeneracy condition they call value-distinguishing, then a reward consistent with both policies either does not exist or is unique up to an additive constant. In the one-dimensional linear–quadratic problems they analyze, varying the discount always suffices.
  • A finite horizon in a deterministic world (Kim, Garg, Shiragur & Ermon, 2021). With deterministic dynamics and a single start state, a MaxEnt expert's trajectory distribution pr(τ)∝er(τ)p_r(\tau)\propto e^{r(\tau)} is an energy-based model, so it determines every trajectory's total reward up to a constant. Whether that pins down the reward of each state–action pair depends on their domain graph, with state–action pairs as vertices and possible transitions as edges. If the graph is strongly connected, the pairwise rewards are identifiable up to a constant exactly when it is coverable (walks of one common length from a start vertex reach every vertex), which for such graphs means aperiodic, and then for every horizon of at least twice that covering length; for other graphs coverability is sufficient but not necessary. Cycles of coprime lengths are what make a graph aperiodic, and coverability supplies enough linearly independent trajectories to solve for every pair's reward.

Different data, different ambiguity

Skalse, Farrugia-Roberts, Russell, Abate and Gleave (2023) catalogued, for many data sources, exactly which reward transformations the data cannot detect in the infinite-data limit, assuming the data follow the stated model exactly.

Data sourceDetermines the reward up to
A policy's Q-function, the optimal Q-function, or the soft Q-functionS′S'-redistribution only
A Boltzmann-rational policy (π∝eβA⋆\pi\propto e^{\beta A^\star}) or a maximum-causal-entropy policyS′S'-redistribution and potential shaping
Trajectories sampled from such a policyThe same, plus arbitrary changes on unreachable transitions
A maximally supportive optimal policyOptimality-preserving transformations
Trajectories sampled from such an optimal policyOptimality-preserving transformations on the visited states; elsewhere almost anything
Exact returns of complete trajectories from the start statesShaping whose potential is 0 on the start states, plus changes on unreachable transitions
Boltzmann comparisons between all trajectory fragmentsChanges on impossible transitions only
Boltzmann comparisons between complete trajectories from the start statesShaping whose potential is one constant on the start states, plus changes on unreachable transitions
Infinite-data invariances of reward-learning data sources (Skalse et al., 2023). "Boltzmann comparisons" choose between two trajectories with probability σ(β(G1−G2))\sigma\big(\beta(G_1 - G_2)\big) of their returns, the model behind RLHF reward models.

Two lessons follow. First, noise is informative. Boltzmann-rational choices reveal reward differences, which is why Boltzmann comparisons of all trajectory fragments pin the reward down almost completely, while noiseless rankings of the same trajectories reveal only an ordering and leave far more freedom. But that information is only as good as the noise model: the cardinal content comes entirely from assuming that choice probabilities are a logistic function of reward differences, which real people need not satisfy.

Second, ambiguity matters only relative to a use. Skalse et al. compare a data source's invariances with a task's tolerance: a learned reward is safe for a task if every transformation the data cannot detect is one the task does not care about. Computing an optimal policy in the same environment tolerates every optimality-preserving transformation, so optimal demonstrations suffice for it. Transferring the reward to new dynamics tolerates potential shaping, which preserves optimal policies under any dynamics, but not S′S'-redistribution: by their Theorem 4.2, a data source invariant to it, which includes everything computed from a Q-function, leaves the reward essentially unconstrained wherever the new dynamics differ from the old. Averaging a shaping term over the training dynamics to get a reward of the form r(s,a)r(s,a), as in v(s)−γ Es′v(s′)v(s) - \gamma\,\E_{s'}v(s') above, is exactly such a redistribution, which is why AIRL restricts its reward term to functions of the state (Adversarial Imitation: GAIL & Distribution Matching). Ranking or evaluating suboptimal policies tolerates even less.

When rationality is unknown, Occam’s razor fails

Every result so far assumed a known model of the demonstrator: optimal, Boltzmann-rational with known β\beta, or soft-optimal. Armstrong and Mindermann (2018) dropped that assumption. They model a demonstrator as a planner pp, a map from rewards to policies, applied to a reward RR, and call a pair (p,R)(p,R) compatible with an observed policy π\pi if p(R)=πp(R) = \pi. Compatibility alone constrains nothing: for any π\pi and any RR, the planner that ignores its input and always returns π\pi is compatible.

DerivationThree decompositions of any policy (Armstrong & Mindermann, 2018, Lemma 6)
  1. pπ(0)=πp_\pi(0) = \pi

    The indifferent planner pπp_\pi returns π\pi whatever it is given, so the zero reward explains π\pi:

  2. pg(Rπ)=πp_g(R_\pi) = \pi

    The greedy planner picks the action with the highest immediate reward, pg(R)(s)=arg max⁡aR(s,a)p_g(R)(s) = \argmax_a R(s,a). With the indicator reward Rπ(s,a)=1{a=π(s)}R_\pi(s,a) = \mathbf 1\{a = \pi(s)\}, it reproduces π\pi:

  3. (−pg)(−Rπ)=pg(Rπ)=π(-p_g)(-R_\pi) = p_g(R_\pi) = \pi

    Define the negated planner (−p)(R)=p(−R)(-p)(R) = p(-R), an agent that minimizes whatever it is given. Then the opposite reward, with an anti-rational planner, explains π\pi equally well:

Each of these pairs is a short program built from π\pi and a few fixed operations, so its Kolmogorov complexity exceeds that of π\pi by at most a constant. A reasonable decomposition (p˙,R˙)(\dot p,\dot R), one that encodes the biases and limits of real people precisely, is typically more complex, so a simplicity prior favors a degenerate pair; and the mirror pair (−p˙,−R˙)(-\dot p,-\dot R), with the opposite reward, is about as simple as (p˙,R˙)(\dot p,\dot R) itself. They also note, citing Everitt et al., that for any policy some reward gives it at least half of the largest possible regret, so compatibility with a decomposition guarantees nothing about what maximizing its reward would do. Their conclusion: inferring preferences requires normative assumptions about how the demonstrator plans, and those cannot be deduced from behavior alone.

Key takeaways

  • Optimal behavior reveals only which actions are optimal: a maximally supportive optimal policy determines the reward up to optimality-preserving transformations, which include positive scaling and potential-based shaping, and trajectories reveal nothing about unvisited states.
  • A soft-optimal expert identifies its reward exactly up to potential shaping, r=β−1log⁡πˉ+v−γ Ev′r = \beta^{-1}\log\bar\pi + v - \gamma\,\E v'; two discounts or sufficiently different dynamics leave only a constant, and in deterministic finite-horizon MaxEnt models with a strongly connected domain graph, state–action rewards are identifiable up to a constant exactly when that graph is coverable (equivalently, aperiodic).
  • Data sources differ in what they leave undetermined (Skalse et al., 2023): Boltzmann or maximum-causal-entropy policies leave shaping, optimal policies leave optimality-preserving transformations, and Boltzmann comparisons of all fragments leave almost nothing. Noise carries cardinal information, but only under the assumed noise model, and ambiguity matters only relative to what the downstream task tolerates.
  • Without assumptions about how the demonstrator plans, behavior has degenerate and reward-reversed decompositions about as simple as the intended one (Armstrong & Mindermann, 2018): reward learning, RLHF included, rests on normative assumptions that data cannot supply.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

A soft-optimal expert's policy πˉ\bar\pi is known exactly, together with the dynamics, the discount and β\beta. Which rewards r(s,a)r(s,a) are consistent with it?

  1. Only β−1log⁡πˉ(a∣s)\beta^{-1}\log\bar\pi(a\mid s)
  2. Exactly the rewards β−1log⁡πˉ(a∣s)+v(s)−γ Es′v(s′)\beta^{-1}\log\bar\pi(a\mid s) + v(s) - \gamma\,\E_{s'}v(s') for an arbitrary function vv
  3. Every reward under which the most probable action is optimal
  4. A unique reward, since the policy is stochastic
Show the answer

B. Exactly the rewards β−1log⁡πˉ(a∣s)+v(s)−γ Es′v(s′)\beta^{-1}\log\bar\pi(a\mid s) + v(s) - \gamma\,\E_{s'}v(s') for an arbitrary function vv

Cao, Cohen and Szpruch's characterization: each choice of the soft value vv gives exactly one reward, and these rewards differ by potential shaping. The soft policy identifies more than an optimal policy (which reveals only the argmax) but not everything.

Question 2

Why can the same reward, observed through two soft-optimal agents with different discount factors, be identified up to a constant when one agent cannot pin it down?

  1. Because two agents provide twice as many demonstrations
  2. Because a lower discount makes the agent optimal rather than soft-optimal
  3. Because the shaping freedom v(s)−γ Es′v(s′)v(s) - \gamma\,\E_{s'}v(s') depends on γ\gamma, so one potential cannot explain both policies unless, under a non-degeneracy condition, only constants remain
  4. Because discount factors cancel out of the soft Bellman equation
Show the answer

C. Because the shaping freedom v(s)−γ Es′v(s′)v(s) - \gamma\,\E_{s'}v(s') depends on γ\gamma, so one potential cannot explain both policies unless, under a non-degeneracy condition, only constants remain

Each agent's policy fixes the reward up to its own shaping family, and the two families, built with different γ\gamma (or different dynamics), intersect only in constants when the problems are value-distinguishing. Observing behavior under varied conditions is the general recipe for identification.

Question 3

Why can Boltzmann-noisy comparisons of trajectories identify more of a reward than noiseless rankings of the same trajectories?

  1. Because how often the better trajectory wins depends on how much better it is, so the choice frequencies carry information about reward differences, not only their order
  2. Because noise lets the learner visit more states
  3. Because noisy labelers make fewer mistakes on average
  4. They cannot: noise only destroys information
Show the answer

A. Because how often the better trajectory wins depends on how much better it is, so the choice frequencies carry information about reward differences, not only their order

Under P(τ1≻τ2)=σ(β(G1−G2))P(\tau_1\succ\tau_2) = \sigma\big(\beta(G_1 - G_2)\big), each choice probability can be inverted into a return difference, which is cardinal information that a noiseless ranking never provides. The catch is that this inversion is only as valid as the logistic noise model.

Question 4

Armstrong and Mindermann show that the pair (−pg,−Rπ)(-p_g, -R_\pi), an anti-rational planner with the opposite reward, reproduces any deterministic policy π\pi. What does this, together with their complexity argument, imply?

  1. That inverse RL algorithms have a bug that better optimization would fix
  2. That behavior alone, even with a simplicity prior, cannot settle what an agent values; assumptions about how it plans are required
  3. That rewards are identifiable whenever the demonstrator is irrational
  4. That the greedy planner is the correct model of people
Show the answer

B. That behavior alone, even with a simplicity prior, cannot settle what an agent values; assumptions about how it plans are required

Degenerate and reward-reversed decompositions fit the data exactly and are about as simple as the intended one, so neither data nor Occam's razor can rule them out. Every practical method breaks the tie with a normative assumption, such as Boltzmann rationality with a known β\beta.

Further reading

  • A. Y. Ng, D. Harada & S. Russell, "Policy invariance under reward transformations: Theory and application to reward shaping," ICML (1999).
  • H. Cao, S. N. Cohen & Ł. Szpruch, "Identifiability in inverse reinforcement learning," NeurIPS (2021).
  • K. Kim, S. Garg, K. Shiragur & S. Ermon, "Reward identification in inverse reinforcement learning," ICML (2021).
  • J. Skalse, M. Farrugia-Roberts, S. Russell, A. Abate & A. Gleave, "Invariance in policy optimisation and partial identifiability in reward learning," ICML (2023).
  • S. Armstrong & S. Mindermann, "Occam's razor is insufficient to infer the preferences of irrational agents," NeurIPS (2018).