Inferring Rewards from Behavior
Inverse reinforcement learning reverses the usual RL problem. Standard RL starts with a reward function and asks the agent to find behavior that maximizes it. Inverse RL starts with behavior and asks what reward function would make that behavior sensible.
We rarely articulate our reward functions. Why did a person brake early? Why do doctors choose treatment A over treatment B? Why does an expert pilot fly that trajectory? Behavior reveals preferences, priorities, and constraints. IRL asks: can we infer these?
Forward vs inverse
Which direction is the problem?
Standard RL starts with a reward and derives behavior. Inverse RL starts with behavior and infers the reward that could explain it.
Expert behavior π_E → inferred reward r
In the inverse direction, the reward is unknown. Expert trajectories are evidence, and IRL searches for a reward under which the expert's choices look near optimal.
In standard RL, the world gives us the reward. Given environment dynamics, a reward function , and discount factor , the agent computes or approximates an optimal policy:
This is the forward direction: reward behavior.
In IRL, the reward is unknown. Instead, we observe expert trajectories and search for a reward under which the expert looks approximately optimal:
The expert's actions should look optimal under the reward we recover. Conceptually, IRL tries to match intentions, or the principles that justify observed actions, rather than merely matching actions.
Behavior as evidence
Trace the demonstration, infer the motive
Tap adjacent cells to sketch what the expert did. Different reward hypotheses become more or less plausible as the path changes.
Steps
6
Wet cells
0
Goal reached
yes
The path-tracing activity shows the core inference problem. A short path to the goal might suggest a speed reward. A detour around the wet floor might suggest a safety reward. A stop near the charger might suggest battery management. The observed behavior is evidence, not proof. The same path can be compatible with several objectives.
A common maximum-entropy framing assigns higher probability to trajectories with higher reward while still allowing imperfect behavior.
Equation walkthrough
Trajectory probability under a reward
Click each term to see how MaxEnt IRL turns a reward function into probabilities over demonstrations.
Trajectory probability
how likely this path is under reward R
The model assigns a probability to an entire trajectory tau after choosing a candidate reward function R.
The trajectory is the observed sequence of states and actions. The inferred reward should make expert demonstrations more likely than alternatives, but the model should not assume the expert is a perfect optimizer in every state.
Why not just use behavior cloning? Behavioral cloning asks, "What action would the expert take here?" It can be simple and stable when the deployment distribution closely matches the demonstrations, but it is brittle outside the demo distribution, can replicate mistakes, has no understanding of why the behavior is good, and learns no reward model that can be re-optimized.
IRL asks, "What objective seems to explain the expert's choices?" If an expert avoids a cliff, behavior cloning learns something like "the expert pressed left here." IRL tries to infer "cliffs are costly." That inferred reward can then be optimized in new states, used to compare alternative policies, adapted to new dynamics, or inspected for alignment problems.
Why not just imitate?
Behavior cloning vs inverse RL
Pick a learning strategy and compare what it captures from demonstrations.
If the expert avoids a cliff, infer: cliffs are costly.
Useful because
Can generalize to unseen states
Can re-optimize with stronger RL methods
Can expose tradeoffs the expert seems to make
Watch out
Reward inference is ambiguous
Needs enough context to separate intent from constraints
Recovered rewards need validation
If we recover a useful reward, we can do more than replay the demonstrations. We can improve on an imperfect expert, transfer to new dynamics, plan under different constraints, examine what the inferred model values, and detect when the inferred reward is misaligned. This is one reason reward inference sits underneath many modern alignment strategies, including RLHF-style reward modeling.
Behavior Is Filtered Evidence
Demonstrations reflect objectives, but also constraints, habits, limited information, training, fatigue, and institutional rules. Treating every demonstrated action as direct evidence of preference can bake those limitations into the inferred reward.
When IRL Is Useful
Use inverse RL when rewards are difficult to write down, demonstrations are available, and the goal is to recover a transferable objective rather than imitate exact actions. It is especially relevant in robotics, driving, assistive agents, medicine, and alignment settings where human intent is richer than an explicit scalar reward.
Why can inferring a reward be more useful than simply matching expert behavior?