Standard reinforcement learning assumes the reward is known. In many real tasks, specifying the correct reward is as difficult as solving the task itself.
A hand-written reward may measure a convenient proxy, omit rare constraints, assign the wrong relative weights, or reward an unintended shortcut. Reward learning changes the pipeline from
known reward⟶learn a policy
to
human behavior or judgments⟶learn rψ⟶learn a policy.
The supervision can be demonstrations, preferences, rankings, corrections, or success labels.
by copying what the expert did. Reward learning attempts to infer why that behavior was desirable.
This distinction matters when dynamics change. A copied action may no longer produce the same outcome, while a transferable reward can be optimized again under new transitions p:
πp∗=argπmaxEτ∼pπ,p[Rψ(τ)].
Transfer only works if the learned reward captures the relevant intent and generalizes to the new states.
The same behavior can be explained by many rewards:
one observed policy⟸many possible reward functions.
A demonstrated route may reflect destination seeking, obstacle avoidance, path following, low control effort, or an arbitrary reward defined only on visited states.
Inverse reinforcement learning therefore needs assumptions such as a restricted reward class, smoothness, sparsity, priors, feature representations, or a model of approximately optimal behavior. Its goal is usually not to identify a unique true reward, but to find one that explains the evidence and supports reliable downstream control.
Maximum-Entropy Inverse Reinforcement Learning
Let the learned reward be rψ(s,a) and the trajectory reward be
Conditioning on optimality produces the energy-based trajectory model
pψ(τ∣O1:T=1)=Zψ1p(τ)eRψ(τ),
where p(τ) assigns probability to physically feasible trajectories and
Zψ=∫p(τ)eRψ(τ)dτ
is the partition function.
High-reward trajectories are exponentially more likely, but lower-reward trajectories retain nonzero probability. This permits variable, imperfect, or multimodal expert behavior.
This cancellation lets us compute weights without knowing the transition model.
Normalize the weights:
wj=∑kwkwj.
Then
∇ψL=N1i∑∇ψRψ(τiE)−j∑wj∇ψRψ(τj).
Self-normalization removes the unknown partition function. It introduces finite-sample bias but is consistent as the sample count grows.
For numerical stability, compute
wj=∑kexp(ℓk−ℓmax)exp(ℓj−ℓmax),
where
ℓj=Rψ(τj)−t∑logπ(aj,t∣sj,t).
Importance sampling still requires support. If the proposal rarely visits trajectories favored by the learned reward, a few samples dominate. A useful diagnostic is
ESS=∑jwj21.
Small effective sample size indicates a high-variance reward update.
Guided Cost Learning
Guided cost learning alternates a reward model and a maximum-entropy policy. A cost cψ is equivalent to reward rψ=−cψ.
The reward update is
ψ←ψ+ηr[N1i∑∇ψRψ(τiE)−j∑wj∇ψRψ(τjπ)].
Holding the reward fixed, improve the policy with
θmaxEτ∼πθ[Rψ(τ)+t∑H(πθ(⋅∣st))].
Guided Cost LearningInitialize reward parameters ψ and policy parameters θ.Repeat:improve πθ for a few max-ent RL steps under rψ,τjπ∼πθ,ℓj←Rψ(τjπ)−t∑logπθ(aj,t∣sj,t),wj←softmax(ℓj),gψ←N1i∑∇ψRψ(τiE)−j∑wj∇ψRψ(τjπ),ψ←ψ+ηrgψ.
The policy is warm-started rather than solved from scratch after every reward change. It gradually tracks the evolving reward.
Adversarial Imitation Learning
Maximum-entropy IRL already resembles a two-player game:
the reward distinguishes expert from learner trajectories;
the policy changes to obtain greater learned reward.
This can be turned into adversarial imitation. Expert demonstrations are real data, policy trajectories are generated data, and a discriminator supplies the policy's learning signal.
Occupancy matching
A policy's discounted state-action occupancy measure is
ρπ(s,a)=(1−γ)t=0∑∞γtπPr(st=s,at=a).
Behavioral cloning matches actions on expert states:
πθ(a∣s)≈πE(a∣s)for demonstrated s.
Adversarial imitation instead matches the state-action distribution induced by the full rollout:
ρπθ(s,a)≈ρE(s,a).
This directly accounts for the fact that actions change future states.
GAIL
Let D(s,a) be the probability that a state-action pair came from the expert. Generative Adversarial Imitation Learning solves
Thus minimizing the policy side minimizes a divergence between expert and learner occupancy measures.
The policy may use discriminator-derived reward such as
r(s,a)=−log(1−D(s,a)).
Adversarial ImitationRepeat:collect learner rollouts with πθ,train D to separate expert and learner state-action pairs,r(s,a)←−log(1−D(s,a)),update πθ with reinforcement learning under r.
GAIL primarily learns a policy that matches expert occupancy. Its converged discriminator is relative to the learner and becomes 1/2 when the distributions match. It should not automatically be interpreted as a reusable task reward.
Maximum-entropy IRL tries to recover an explicit energy or reward model. GAIL bypasses explicit partition-function estimation and directly optimizes imitation performance.
What Inverse RL Recovers
Maximum-entropy IRL learns an explicit reward by increasing expert likelihood:
Guided cost learning approximates the model expectation with adaptive trajectory samples. GAIL bypasses explicit partition-function estimation and directly matches expert occupancy.
Neither route identifies a unique numerical reward without structural assumptions. Additive constants, positive scaling in hard optimal control, potential-based shaping, and unconstrained unvisited regions can preserve the observed behavior. The goal is therefore a reward or occupancy objective that explains demonstrations and supports the intended transfer—not recovery of a uniquely determined hidden scalar function.
When supervision arrives as comparisons rather than demonstrations, the observation model changes. That setting is developed in reward learning.