Glossary · Reinforcement learning
Reward shaping
Also called potential-based shaping, shaping reward
Adding extra reward terms to guide learning. Potential-based shaping does this in a way that provably doesn't change which policy is best.
A sparse reward like −1 for a fall is hard to learn from: the penalty may arrive seconds after the mistake. Reward shaping adds terms that give earlier, denser feedback. The risk is that the extra terms change what the best behaviour is, and the agent learns to chase them (see reward hacking).
Potential-based shaping
Ng, Harada and Russell (1999) showed a safe form. Choose any function of the state, a potential , that measures how promising a state is. Add
to the reward on each step, using the same discount as the task. Then the optimal policy is exactly the same as without shaping.
The reason: over an episode the shaping terms telescope. Each appears once with a plus and once with a minus, so the total added to the return from a state is just plus a vanishing tail. It depends on where you start, not on what you do, so it can’t make any behaviour better than another in the long run. What it does change is when the agent finds out: moving toward a better state pays immediately.
In this project
In the survive env, the −1 for a fall came 1–2 s after the mistake that caused it. We added potential-based shaping with
(each term weighted) and . It is about 0 in a calm stance, because all three penalties are zero there. Once it was added, the shove level climbed from 0.2 to 0.7 in 7.4 M steps.