Skip to main content
MahiDev — Learn. Build. Become AI-ready.

Lesson 65

A2C

Train an actor on the advantage, the gap between the return and a learned value, and average several workers in sync. One example is on this page.

Intermediate12 min
A2C MahiDev

What You Will Learn

  • Idea
  • Example
  • When to use it

Idea

Advantage Actor-Critic subtracts a baseline from the return. The advantage is how much better this action was than the critic's expected value. Synchronous A2C collects several workers, averages their updates, and then steps the shared model once.

Example

python
ret, value = 1.0, 0.4
advantage = ret - value
print(f"advantage: {advantage:.2f}")

Output:

text
advantage: 0.60

When to use it

  • Use it when a plain REINFORCE update swings too much from episode to episode.
  • An advantage near zero means the action was ordinary. The actor barely moves.
  • The workers wait for each other. A3C removes that wait.

Loading playground…