TL;DR
A deterministic policy outputs one action for each state, instead of a distribution over actions. Its gradient is the gradient of a learned action-value function with respect to the action, multiplied by the gradient of the policy's output with respect to its parameters. This avoids the sum over actions that makes the stochastic version noisy.
Where you'll see it: continuous-control agents such as robot arm controllers, where the action is a vector of motor torques and a deterministic actor with a learned critic (DDPG) is a common approach.
Intuition
Suppose you are tuning the throttle of a car to reach a target speed. A stochastic policy says "use a throttle near 40 percent, with some spread". To improve it, you can try a few throttle values, see which did better, and move toward those. That works, but each try is noisy, and you need many of them to see which way to go.
A deterministic policy says "use 40 percent". If you already have a critic that predicts the return for each throttle value, you can ask it directly: if I raise the throttle a little, does the predicted return go up or down? The answer is a slope, the derivative of the critic with respect to the action. You then nudge the policy in the direction that increases that slope-weighted return. No sampling of nearby throttle values is needed, because the critic gives you the direction.
This is the appeal of the method. Stochastic policy gradients have to estimate how the return changes by sampling actions and seeing what happens. The deterministic version replaces that sampling with a derivative that the critic provides. The derivative is smooth, so the estimate has far less noise, at the price of needing a differentiable critic and continuous actions.
flowchart LR S[State s] --> A["Actor: a = mu_theta(s)"] A --> C["Critic: Q(s, a)"] C --> G["Action gradient: dQ/da"] G --> U["Chain rule: push through mu_theta"] U --> T[Update theta] T --> A
The math
Use the notation from Policy Gradient. A deterministic policy maps each state to one action, with parameters . The discount factor is . Write for the discounted distribution over states visited when following , and for the expected discounted return after taking action in state and then following .
The objective is the expected return from the start distribution,
where is the value of under .
The deterministic policy gradient theorem
Under mild smoothness assumptions on , and the transition model,
Here is the Jacobian of the policy's output with respect to its parameters, a matrix of size (action dimension) by (parameter count). The term is the gradient of the critic with respect to the action, a vector of the action's size.
The notation is a Jacobian, so the product with is the Chain Rule at work. The derivation starts from . Differentiate with respect to . The chain rule gives one term through the action, . There is a second term through the next state, because depends on the value of the next state. Expanding that term recursively over future states, and collecting the discounting, gives the formula above, with as the weighting over states.
Notice what is absent. There is no integral over actions, and no factor. The gradient never differentiates a probability. That is why no action sampling is needed, and the second worked example shows how noisy the sampled alternative is.
Connection to the stochastic gradient
The stochastic policy gradient uses . If the policy is a Gaussian with mean and variance , and the variance shrinks to zero, the expected stochastic gradient approaches the deterministic one. Silver and colleagues proved this limit, so the deterministic version can be seen as the zero-noise case of the stochastic one.
Learning Q
In practice is not known. It is learned by a critic with parameters , using the usual temporal-difference target . The actor and the critic are updated in turn. The actor uses the critic's action-gradient, and the critic is trained to match the returns the actor produces. This pairing is the Actor-Critic Methods structure applied to a deterministic actor.
Worked examples
Take a single state , and let the episode end after one action, so . Let the policy be linear, , so the action is and . Let the critic be , which is highest at the target action .
- The action gradient of the critic is .
- Start at , so . Then .
- Apply the theorem: .
- Check by direct differentiation: , so . At this is . The two agree.
- Take a gradient step with learning rate : . The new action is , which is closer to the target 6.
- The optimum is at , where , and the gradient is zero there.
Interpretation: the critic's slope tells the actor which way to move the action, and the policy's Jacobian turns that into a parameter update. No action was sampled.
Keep the same state, policy and critic, and now make the policy stochastic: with . At the mean action is , and the distance to the target is . The score-function estimate of the gradient, with respect to , is one sample of . Write with . Since and ,
- The mean of uses , and . So . This matches the deterministic gradient.
- For the variance, expand . Using and , the expectation inside is .
- So , and the variance is .
- With , the variance is , so the standard deviation is about .
- With , the variance is about , so the standard deviation is about , roughly twenty times the mean.
Interpretation: both estimators have mean 16, but the stochastic one needs many samples before its average settles near 16, and the spread grows as the policy gets sharper. The deterministic gradient is exact for this critic, with no sampling at all. These numbers are analytic, from the formulas above, not from a simulation.
Tradeoffs and failure modes
The method is strong when actions are continuous and the critic is good. It has costs that the stochastic version does not.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Discrete actions | The action gradient does not exist, since there is no smooth action space | Stochastic policy gradient or Q-learning |
| No exploration | A deterministic policy only tries one action per state, so it may never find better ones | Add noise to the action during training, which makes learning off-policy |
| Critic errors | The actor follows the critic's slope, so a wrong slope pushes the action the wrong way | Target networks and a replay buffer to stabilise the critic |
| Sharp or flat critic | A very flat critic gives a near-zero gradient, and a sharp one gives huge steps | Gradient clipping, smaller learning rates |
| Need a probability over actions | The policy outputs no distribution | Stochastic policy with the score-function estimator |
Because the actor follows the critic, the method is only as good as the critic's action-gradient. Errors in the critic's slope cause the actor to drift. Practical systems therefore slow the actor down relative to the critic and keep a lagged copy of the critic for the targets.
History
The stochastic policy gradient came first. Sutton and colleagues wrote down the policy gradient theorem with function approximation in 2000, and later work refined it. Silver, Lever, Heess, Degris, Wierstra and Riedmiller introduced the deterministic policy gradient at ICML in 2014, proving the theorem above and showing that the deterministic form is the limit of the stochastic one. Lillicrap and colleagues applied it in 2015 with deep networks for both actor and critic, along with a replay buffer and target networks, to continuous-control tasks. That combination is usually called DDPG. The DDPG paper reports solving more than 20 simulated physics tasks with one algorithm, network architecture and set of hyperparameters, and learning from raw pixels on many of them.
Check yourself
QuestionWhy does the deterministic policy gradient need the critic to be differentiable with respect to the action?Show answer
The formula multiplies the policy's Jacobian by , the critic's gradient with respect to the action. If the critic is not differentiable in the action, that term does not exist and the update cannot be computed. This is also why the method is limited to continuous actions: a discrete action has no smooth direction to move in.
QuestionUsing the one-step example, if the critic is and the policy is with , what is the deterministic gradient at ?Show answer
At the action is . The critic's gradient is . The policy's Jacobian is . The product is . Since , at this gives , which agrees.
QuestionWhy does a deterministic policy need extra exploration to learn well?Show answer
A deterministic policy picks the same action in each state, so it only ever observes returns for that action. It cannot discover that another action is better, because it never tries one. Adding noise to the action during training gives it nearby actions to compare against. That noise makes learning off-policy relative to the deterministic target, which is one reason replay buffers are used in these methods.
QuestionApplied: you are training a robot arm with a deterministic actor and a learned critic. The arm's actions are joint torques. The critic's predicted best torque keeps moving in a jerky way between updates. What would you check first?Show answer
Check the critic's training first. The actor follows the critic's action-gradient, so a noisy or unstable critic makes the actor jump. Look at the target network update rate and whether the critic's loss is stable. Then check the actor's learning rate relative to the critic's, and whether gradients are clipped. Reducing the actor's step size or slowing the critic's target update is a common fix when the actor is moving faster than the critic can settle.
Sources
- Silver et al., Deterministic Policy Gradient Algorithms (ICML 2014): https://proceedings.mlr.press/v32/silver14.html
- Lillicrap et al., Continuous control with deep reinforcement learning (2015): https://arxiv.org/abs/1509.02971
- Policy gradient method, Wikipedia: https://en.wikipedia.org/wiki/Policy_gradient_method