Deriving the trajectory gradient
For , assume environment transitions have no direct dependence on policy parameters. Differentiating trajectory log probability leaves policy score terms. Past rewards can be removed by conditional independence, giving
The outer is explicit. Other conventions absorb it into discounted occupancy; silently removing it while retaining the same objective changes the derivation.
Baselines and variance
For a fixed state, when the baseline is action-independent. A value baseline yields , although it is not necessarily optimal for every score-weighted variance criterion.
REINFORCE noise comes from long stochastic returns, policy scores, sparse success, and other agents. Reward-to-go removes irrelevant past rewards. Critics, GAE, and normalization further affect updates, with approximation error and finite-sample effects. Low value loss alone does not establish a good actor gradient.
Surrogates and PPO
On fixed old-policy data, a common surrogate is , with . PPO uses
Clipping limits beneficial surrogate incentives in selected directions. It is not a hard KL constraint or a guarantee of monotonic true-return improvement. Repeated optimization can make advantages and the old state distribution increasingly stale. Monitor KL, clip fraction, entropy, gradient scale, and independent evaluation return.
Connecting theory to measurements
Evaluate gradient accuracy, true-value prediction, and surrogate/return alignment separately. A method can improve one while worsening another.
Related reading: the original theorem, GAE, A Closer Look, and multi-agent gradients.