A two-armed bandit policy is with . The agent samples arm 1 and receives reward . Using the REINFORCE update with , what is the update (a) with baseline and (b) with ? What is the gradient of , and how do you show that the score function has zero mean?
Reinforcement learning, Policy gradients
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can compute for a softmax policy and see how a baseline reduces the size of updates without changing their expected direction.
Key idea
For a softmax policy, . Subtracting a baseline that does not depend on the action leaves the expected gradient unchanged, because .
Steps
- Write . Differentiating gives .
- At , . For the sampled arm 1, .
- (a) : .
- (b) : . The direction is the same, and the step is half as large.
- Zero mean of the score: . Therefore , so a constant baseline adds no bias.
- Explain the benefit. If every reward is positive, without a baseline every sampled action is pushed up, and the noise is large. A baseline near the average reward pushes up only the better-than-average actions.
Common mistakes
- Choosing a baseline that depends on the sampled action. That introduces bias.
- Treating the update as only . The softmax couples the parameters, so for also moves, in the opposite direction.
- Thinking a baseline makes the gradient estimate unbiased. It was already unbiased. The baseline reduces variance.
How long your answer should be
Half a page; 5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: A tabular value function is for states A, B, C. One episode goes A B C end with rewards . Use TD() with accumulating traces, , and , and update every state at every step. What is after the episode? How does this differ from TD(0)?
Next in Reinforcement learning: A trajectory of three steps has rewards and critic values . The episode ends after step 3, so the next value is . With and , what are the TD errors and the generalised advantage estimates ?