RL @ ECE-UofT - Lecture 11: Actor-Critic Approaches in RL
Overview
Ali Bereyhi builds actor-critic methods from policy gradients by pairing an actor with a critic that estimates the current policy's value, then derives A2C updates and explains how TRPO and PPO incorporate value learning and importance sampling. He then contrasts stochastic policies with deterministic policy gradients, showing how DDPG combines a deterministic actor, a Q-network, exploration noise, replay buffers, and target networks for continuous-action problems.
Key takeaways
- An actor-critic critic estimates the value of the current policy, so it must keep learning as actor parameters change; stale values produce advantages for the wrong policy.
- In one-step A2C, the TD residual, reward plus discounted next-state value minus current-state value, serves both as the policy advantage and as the critic's value-learning error.
- TRPO and PPO reuse older-policy trajectories by applying importance ratios, while PPO additionally clips policy-probability changes to limit updates and can yield zero gradient once clipping is active.
- A deterministic policy gradient updates a continuous-action actor by differentiating the critic's Q value with respect to its action input and chaining that derivative through the actor.
- Practical DDPG combines a deterministic actor and Q critic with replay-buffer sampling, action noise for exploration, clipped action bounds, and target copies for stable bootstrapping.
- Distributed actor-critic methods trade synchronization and update consistency: synchronous workers wait for the group, while asynchronous A3C workers can contribute without waiting.
Chapters
- Deep Q-learning uses off-policy updates and experience replay to reuse samples, with target networks and Double DQN helping stabilize training.
- A Q-network is most straightforward when actions are discrete and manageable in number; continuous actions make maximizing over actions difficult.
- Policy-gradient methods instead optimize a policy network, with baselines and trust-region methods addressing noisy or unstable updates.
- The actor selects actions through a policy network, while the critic estimates the value of the policy currently being used.
- The critic supplies advantage estimates needed to update the actor with the policy-gradient term involving the gradient of log probability.
- The lecture distinguishes practical actor-critic implementations from the broader policy-gradient family: REINFORCE can estimate returns with Monte Carlo without a critic.
- The advantage is defined as action value minus state value, comparing a chosen action with the policy's average outcome at that state.
- A one-step sample estimate is reward plus discounted next-state value minus current-state value.
- Multiplying this advantage estimate by the gradient of log policy gives the actor's sample update.
- The critic estimates the value of the current policy, not the optimal policy or a permanently fixed target.
- After actor parameters change, the value estimates must adapt; otherwise the advantage used for later actor updates describes an outdated policy.
- This coupling is why actor and critic learning are incorporated into a shared training loop.
- For each time step, the algorithm computes an advantage from the reward and values of the current and next states.
- It backpropagates through the policy to obtain the gradient of log probability, weights that gradient by the advantage, and accumulates across a trajectory.
- With a minibatch of trajectories, sample gradients are combined before updating the policy.
- Without a value network, a tabular estimator averages sampled returns for each state encountered in trajectories.
- A minibatch can estimate values by counting state occurrences and averaging the corresponding discounted returns.
- These estimates can be sparse and unreliable when states are rarely visited or the environment has a large state space.
- A new minibatch arrives after policy updates, so values collected under earlier policies do not automatically describe the current policy.
- Small batches may not provide enough visits to estimate all state values reliably, while very large batches are expensive.
- A learned value function generalizes from observed states and can provide a more useful starting point for subsequent updates.
- The critic is trained on states paired with sampled estimates of their values, using a squared-error loss.
- Gradient descent updates critic weights by backpropagating the difference between the network output and the estimated target.
- Bereyhi recommends a few critic-training iterations per batch so the function approximator can generalize beyond states seen directly.
- Advantage Actor-Critic, or A2C, keeps the policy-gradient structure but uses a value network to estimate the current and next state values.
- The critic is trained alongside the actor, using the same sampled trajectories and advantage information.
- A2C is presented as a common baseline that makes policy-gradient training practical in larger problems.
- Instead of waiting for full Monte Carlo returns, the critic can use a one-step TD target: immediate reward plus discounted next-state value.
- The TD residual is the same sampled quantity used as the policy advantage in this basic actor-critic setup.
- Multiplying that residual by the critic gradient updates the value network; multiplying it by the policy log-gradient updates the actor.
- A trajectory can be processed online, or multiple trajectories can be combined into a minibatch for a more reliable gradient.
- Actor and critic updates may use separate learning rates and can be performed together or in a nested schedule.
- Some environments benefit from several critic updates with the actor held fixed, giving value estimates time to catch up.
- A shared model can process state features once and branch into a policy head and a value head.
- For discrete actions, the policy head can end with a softmax over actions; the value head produces a scalar regression estimate.
- Sharing can help when policy and value representations overlap, but a single shared trunk may be insufficient when their needs differ.
- The shared network can be trained with a joint objective combining the policy loss and critic regression loss.
- A coefficient on the value loss acts as a hyperparameter balancing the actor and critic contributions to shared parameters.
- Backpropagation combines the advantage-weighted policy gradient with the value-network gradient in one update.
- TRPO can use a learned critic to produce advantages while retaining its trust-region policy update.
- Its policy step uses an estimated gradient and Fisher information structure, with conjugate gradient and backtracking used to satisfy the trust-region constraint.
- The critic has its own value-loss gradient and may use a separate learning rate.
- TRPO and PPO reuse trajectories sampled from an older policy while optimizing a newer one, so actor and critic estimates must account for the policy mismatch.
- Importance sampling reweights samples using the current policy probability divided by the behavior policy probability.
- The reweighted TD target or advantage is used to train the critic for the policy currently being optimized.
- One implementation strategy computes and stores old advantages when collecting a batch, then reweights them during later optimization epochs.
- The batch must retain the behavior-policy probabilities needed to form importance ratios.
- Bereyhi notes that practical libraries may omit a particular value-side reweighting detail as an approximation, with effects that can be hard to observe in simple tests.
- PPO uses a clipped surrogate objective to limit how much the new policy probability changes relative to the behavior policy.
- Positive advantages encourage increasing an action's probability, while negative advantages encourage decreasing it; clipping limits either change.
- The critic is trained on the collected batch, and repeated epochs stop being useful when clipping leaves the policy with little or no gradient.
- Distributed actors can explore different regions of a large environment and contribute more diverse trajectories than a single sampler.
- Their experience is combined to improve a global policy and value model, with gradients propagated through the shared model components.
- This setup can distribute computation across multiple workers or GPUs.
- Synchronous updates wait for participating actors before aggregating their samples and gradients, which can make a delayed worker hold up progress.
- Asynchronous updates let workers contribute when ready, reducing synchronization requirements but producing less uniform updates.
- A3C is the asynchronous actor-critic variant discussed as a way to scale policy-gradient training.
- Stochastic policies commonly represent continuous actions with a Gaussian distribution whose mean and variance are learned.
- A small nonzero variance can still produce jitter, which may be undesirable for precise tasks such as robotic manipulation or needle placement.
- A deterministic policy returns one action directly, making it attractive when stable, repeatable control is important.
- Gaussian policies are convenient because their mean and variance are easy to represent and sampling from them is computationally tractable.
- During training, a poorly tuned variance can produce risky or excessive actions in control applications.
- A deterministic actor maps a state directly to an action; bounded outputs can be enforced with activations such as tanh, followed by scaling.
- The deterministic actor, written as a state-to-action mapping, supplies the action used to approximate the maximum in the Q-learning target.
- A critic estimates Q for a state-action pair, allowing the method to learn without explicitly searching over infinitely many continuous actions.
- The approach retains a Q-learning-style value update while adding an actor update.
- The actor is trained to choose actions that increase the critic's estimated Q value.
- The actor gradient applies the chain rule: differentiate Q with respect to its action input, then multiply by the actor's action gradient with respect to its parameters.
- Backpropagation through the critic provides the action derivative while the actor network supplies the remaining gradient.
- The critic target uses the immediate reward plus discounted Q at the next state and the action selected by the deterministic actor.
- The critic is trained by minimizing the difference between its current-state Q prediction and this TD target.
- The actor is updated to raise Q, producing the deterministic policy-gradient approach.
- Deep Deterministic Policy Gradient, or DDPG, applies deep networks to both the deterministic actor and the Q critic.
- The basic update samples state-action transitions, trains the critic with a TD error, and updates the actor through the critic's action gradient.
- DDPG is presented as a common baseline for continuous-action control tasks.
- A deterministic actor needs explicit exploration during data collection; otherwise it can repeatedly choose the same actions and miss better behavior.
- A replay buffer reuses transitions and decorrelates minibatches, while a target network reduces instability from moving TD labels.
- Adding these mechanisms to deep deterministic policy gradients yields the practical DDPG training recipe.
- Exploration can be added to the actor's action with zero-mean Gaussian noise, scaled by a parameter that controls its magnitude.
- A larger noise scale encourages broader exploration early in training; reducing it later can refine a promising policy.
- If noisy actions exceed environment bounds, clip them to the valid action interval.
- The replay buffer stores state, action, reward, and next-state transitions collected while the actor explores.
- Training samples randomly selected transitions, which need not be consecutive, to reduce dependence on neighboring observations.
- The critic evaluates the sampled behavior action at the current state and uses the actor-selected action at the next state for its target.
- If the online critic also generates its own TD targets, each update can shift both the prediction and the target.
- DDPG uses target copies of the critic and actor to calculate next-state target values while online networks continue learning.
- After a chosen number of iterations, the target networks are refreshed from the updated online networks.
- The target actor selects the next-state action and the target critic evaluates it when forming the TD label.
- Keeping target parameters fixed for multiple updates limits rapid movement in the bootstrap target.
- Both actor and critic target copies are refreshed periodically as training proceeds.
Transcript excerpt
0:19 So shall we start? Hi everybody. So uh sorry for a few minutes late. uh uh so what we are going to do today we are going to uh it's pretty much I would say the last series lecture that you have so I try to give you a kind of overview on the next lecture a few things a few cool things that you can do with reinforcement learning but this one is pretty much the uh say last serious technical lecture that you got so By the way, I'm sorry for my voice. So, it says gone since last week. So, it's getting back. So, it's better than the Tuesday lecture, but it's still it's not perfect. Sorry for that. So, um what we want to do
1:08 today, we want to talk about the actritic methods. So, uh a good part of the course is not new lecture is not new because we essentially do whatever we have done before in PGMs, but this time we are going to replace it with value network. And the only thing left to know is that how we can update the value network along with the policy network because the value network is supposed to estimate the value of the policy itself. So we're going to talk about that one and uh after that we are going to talk about a few extra things that you could have in actor critic. For instance, the uh deterministic policy networks uh they are like a kind of special case of actor critics but we can't train them more efficiently and also we briefly talk
1:56 about uh soft actor critic. This is a kind of penalizing the whole you know your policy network by an entropy so that you make sure your training is
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Ali Bereyhi.