Advantage Function
Imagine choosing between two actions while knowing the situation is generally good. The useful question is not merely “Did I get reward?” but “Was this action better or worse than what I should have expected here?” The advantage function gives that comparison.
What it measuresFor a state s and action a, the advantage is written Aπ(s, a):
Aπ(s, a) = Qπ(s, a) − Vπ(s).
- Qπ(s, a) is the expected future return after taking action a in s, then following policy π.
- Vπ(s) is the expected return from that state under the policy’s usual action choices.
A positive advantage says the chosen action beat the state’s normal expectation; a negative one says it underperformed. An advantage near zero says it was about as good as expected. This relative signal is far more informative than raw reward: receiving 10 points is excellent in a state where 2 is expected, but disappointing where 20 is routine.
Why policy gradients use itIn REINFORCE and actor–critic methods, the policy is updated to make actions with positive advantage more likely and negative-advantage actions less likely. Subtracting V(s) acts as a baseline: it does not bias the true policy-gradient direction, but it greatly reduces the randomness of gradient estimates. Without it, a policy can overreact to returns caused mostly by luck, delayed events, or an unusually favorable starting state.
How it is estimated in practiceThe true values are unknown, so an agent learns a value network and computes estimates such as Gt − V(st), where Gt is the observed return. PPO commonly uses generalized advantage estimation (GAE), which balances noisy short-horizon temporal-difference errors against lower-variance but more biased estimates. A poor value estimate produces poor advantages: the policy then reinforces actions for the wrong reasons, which can destabilize training even when reward is increasing.
The advantage function, A(s,a), measures how much better or worse action a is than the policy’s typical action at state s: A(s,a)=Q(s,a)-V(s). Positive advantage reinforces an action; negative advantage suppresses it. In policy-gradient methods, it provides a lower-variance learning signal by separating an action’s relative merit from the state’s overall expected return.
Imagine practising basketball shots. Making a basket feels good, but what really helps you improve is noticing whether a particular shot was better or worse than you normally expect from that spot.
An advantage function gives an AI that same kind of comparison. After it takes an action, it asks: “Did this choice turn out better than my usual expectation in this situation, or worse?” A positive advantage means the action was an especially good choice; a negative one means it was disappointing.
This matters because rewards alone can be noisy. The advantage function helps the learner focus on choices that genuinely improved the outcome, rather than simply chasing every reward it happens to receive.