TL;DR
IMPALA (Importance Weighted Actor-Learner Architecture) is a distributed reinforcement learning agent from 2018. Many actors play the environment in parallel and send their experience to one central learner, which updates the policy on large batches on a GPU. Because that experience is a little out of date by the time the learner uses it, the paper adds V-trace, a corrected value target, and reports that one agent trained this way learns 30 tasks at once.
Builds on: V-trace, Actor-Critic Methods, Policy Gradient · Leads to: no lessons yet
Why it mattered
IMPALA showed that reinforcement learning could be run at the scale of data centres without losing learning quality. The paper reports a throughput of 250,000 frames per second on a distributed setup, which it describes as more than 30 times faster than a single-machine A3C agent. It also reports that the same agent, with one set of weights, learns the 30 DMLab tasks at once and the 57 Atari games at once. The paper's own comparison is with agents trained on one task at a time, which was the common setup in the work it cites.
The problem
Deep RL agents need a huge amount of experience. The paper notes that A3C-style agents can need as many as a billion frames and multiple days to master one domain, so training them on tens of domains at once is too slow to be practical.
A3C speeds things up by running many workers, each with its own copy of the network. Each worker computes gradients on its own experience and sends those gradients to a parameter server. This works on a CPU, but the workers are small and the gradient traffic grows with the model. Batched synchronous methods such as A2C use a GPU well, but every step waits for the slowest environment in the batch.
The paper's proposal is to let actors send experience rather than gradients, and to let one learner process large batches of whole trajectories on a GPU. This decoupling is fast, but it creates a problem. The actor generated its trajectory with an older policy, so the data is off-policy when the learner uses it. A value estimate that ignores this lag can drift. The paper's job is to fix the drift without giving back the speed.
How it works
The architecture runs as a loop with five stages. The diagram shows the flow of data and parameters.
flowchart LR A1[Actor 1] -->|trajectories and behaviour probabilities| Q[(Queue)] A2[Actor 2] -->|trajectories| Q AN[Actor N] -->|trajectories| Q Q --> L[Learner on GPU: batch of trajectories] L -->|V-trace targets and policy gradient| L L -->|latest parameters| A1 L -->|latest parameters| A2 L -->|latest parameters| AN
- Copy the policy. At the start of a trajectory, an actor copies the learner's latest parameters into its own local policy . Check: the actor's copy and the learner's policy are now equal, at this moment only.
- Act for n steps. The actor runs in its environment for steps and records the states, actions and rewards, the probabilities it used to pick each action, and the LSTM state at the start. Check: the record holds actions and probabilities.
- Send to the queue. The actor puts this trajectory on a queue and starts a new one. It sends observations and actions, not gradients, so it needs little bandwidth. Check: the learner never waits for a particular actor.
- Batch on the learner. The learner takes a batch of trajectories from many actors. It runs the current policy over every state in the batch in one large GPU operation. Check: the learner's may be several updates ahead of each , so the ratio is not 1 in general.
- Correct and update. For each step the learner forms truncated importance weights from , computes the V-trace target for each value, and updates the value function and the policy with the V-trace policy gradient. Check: when and agree, every weight is 1 and the update is the ordinary on-policy one.
The new idea is in stage 5. Importance weights are the standard tool for reusing data from another policy, but the raw ratio can be huge, and products of ratios over many steps explode. V-trace clips the weights and turns the value targets into a recursion that follows the trajectory backwards.
The math
The paper works in a discounted Markov decision process. A value function is the expected discounted sum of future rewards from state under policy , with discount factor . The goal of off-policy learning is to learn from trajectories generated by a different behaviour policy .
Step 1 in symbols: the truncated weights
Two truncated importance weights are defined for each step, with truncation levels :
The ratio says how much more (or less) likely the learner's policy is to take the action than the actor's policy was. The minimum caps it.
Step 2 in symbols: the temporal difference
With the current value estimate, the weighted temporal difference at step is
It is the usual one-step TD error, multiplied by .
Step 3 in symbols: the V-trace target
For an -step trajectory starting at , the target for is
The empty product, when , is 1. The same target can be computed backwards, one step at a time:
This recursion is what the learner uses, because it scans each trajectory once.
Step 4 in symbols: the updates
The value parameters move toward the target by the gradient of the squared error, . The policy parameters move along
The factor is an advantage estimate, and corrects for the policy lag. The paper also adds an entropy bonus to keep the policy from collapsing too early.
Why two truncation levels
The two levels do different jobs, and the paper states this as a theorem. The level decides which value function the algorithm converges to. That function belongs to a policy that lies between the behaviour policy and the target policy. If is infinite, the target is the value of itself. The level decides how fast the algorithm converges, because it controls how much the products of weights can vary. Raising does not change where the algorithm ends up.
Worked examples
Setting: a single step, . Take , , reward , discount , and a policy ratio . Use .
- The ratio is 0.5, and the cap is 1, so .
- The TD error is .
- With the sum has one term, .
- The target is .
Interpretation: the plain one-step Bellman target would be with the weight 1 on the TD error. The lagging policy down-weights the correction to half, so the target moves less far from the current estimate.
Setting: a trajectory that ends, so . Rewards are and . All current values are , , . The ratio is 2 at step and 0.5 at step .
- Step : and .
- Step : .
- TD error at : .
- TD error at : .
- The target at the last step is .
- Apply the recursion at : .
Check with the sum form: the term is , and the term is 0. Both give 0.5.
Interpretation: the reward that arrives one step later reaches the earlier state, discounted by , and it is passed through only as far as the earlier weight allows.
Setting: the paper says that one IMPALA learner on its optimised setup reaches 250,000 frames per second, and that with 8 learner GPUs the deep model runs at 210,000 frames per second, up from 30,000.
- Frames per day at 250,000 per second: seconds , or 21.6 billion. This is our arithmetic; the paper does not state a daily figure.
- Atari multi-task budget: 200 million frames per game times 57 games is million, or 11.4 billion. The paper gives the 200 million frames per game; the total is our multiplication.
- Speed-up from 8 learners: .
Try it: the paper says IMPALA with 1 learner reaches the performance that A3C approaches after 7.5 days in about 10 hours. How many times faster is that? Answer: 7.5 days is hours, and , so about 18 times faster in wall-clock time.
Common mistakes and tradeoffs
It is tempting to think V-trace is just importance sampling; in fact it is importance sampling with two changes that matter. Plain one-step importance sampling multiplies the advantage by the ratio and has no trace, so it cannot pass information back through the trajectory with a controlled weight. V-trace keeps the traces through the products , but truncates each so the products do not explode. The paper's Table 2 shows the gap widens in the replay setting, where the policy lag is larger: on four of five tasks V-trace beats 1-step importance sampling once replay is added.
It is tempting to think that the truncation level only trades speed for accuracy; in fact changes the answer. Choosing finite means the algorithm learns the value of a policy between and , not of . The paper chose from the values 1, 10 and 100, which is a bias-variance decision and not a free speed-up.
It is tempting to think that a higher median score means a better agent everywhere; in fact the Atari comparison is a median. In the paper's Table 2, 1-step importance sampling beats V-trace on one of the five DMLab tasks with replay (54.7 against 47.1). A median hides such per-game differences.
It is tempting to think that more actors always make learning faster; in fact the learner has to keep up, and the paper's gains come from batching trajectories on the GPU and from the decoupled queue. The actor side is cheap. A slow learner, or a large policy lag, undoes the benefit.
When to use this design: when experience is cheap to generate on many machines, when the model is large enough that one GPU is the bottleneck, and when one agent must cover many tasks. When not to use it: a single small environment on one machine, where a simple synchronous method is easier and has no lag to correct. Alternatives include A3C (asynchronous gradients), batched A2C (synchronous steps), and Retrace-based agents, which need a learned Q function that V-trace avoids.
History
Before 2018, scaling deep RL mostly meant asynchronous gradient methods. A3C, from Asynchronous Methods for Deep Reinforcement Learning, ran many CPU workers and sent gradients to a shared parameter server. Batched methods such as A2C used a GPU but waited for the slowest environment at every step. GA3C added dynamic batching for the GPU. Retrace gave an off-policy correction for multi-step returns, and its trace-cutting weights are the ones V-trace resembles, but Retrace is built on a learned action-value function.
The IMPALA paper, posted to arXiv in February 2018, combined a decoupled actor-learner design with a state-value correction. Its authors reported both the throughput numbers and the first multi-task results on DMLab-30 and on all 57 Atari games with a single agent. The abstract's claim is that the architecture scales to thousands of machines without sacrificing training stability or data efficiency.
Results
On the 30 DMLab tasks (Table 3 of the paper, mean capped human normalised score on the test tasks):
| Agent | Test score |
|---|---|
| A3C, deep | 23.8% |
| IMPALA, shallow | 37.1% |
| IMPALA-Experts, deep | 44.5% |
| IMPALA, deep | 46.5% |
| IMPALA, deep, PBT | 49.4% |
| IMPALA, deep, PBT, 8 learners | 49.1% |
The paper's best row is the deep IMPALA agent with population-based training (PBT), at 49.4%, against 23.8% for the deep A3C agent. As Figure 6 shows, the multi-task agent outperforms the per-task IMPALA experts throughout training, and Appendix B reports positive transfer on some tasks, such as language and laser tag. Only the two PBT rows reach 49.1% or higher; the other agents were tuned with a hyperparameter sweep. The multi-task agent does not know which task it is being trained or evaluated on.
On Atari-57 (Table 4, median human normalised return): A3C deep experts 117.9%, IMPALA deep experts 191.8%, and one IMPALA deep agent trained on all 57 games at once 59.7%. The paper notes that the multi-task agent is competitive with the shallow A3C expert baseline at 54.9%.
On the throughput side (Table 1), the paper reports a distributed IMPALA setup at 250K frames per second on 500 CPUs and one GPU, against 46K frames per second for a distributed A3C on 200 CPUs (both on task 1 of the throughput test).
The limits: these are the paper's own runs with its own hyperparameter sweeps. Atari scores are averages over 200 evaluation episodes, each started with a random number of no-op actions from 1 to 30. The V-trace ablation (Table 2) uses five DMLab tasks. The paper does not claim the design is best for every environment, and the single-task results are on five tasks, not the full suite.
Reading guide
- Section 1, Introduction and Figure 1: the architecture and the claim of 250K frames per second. Read with Asynchronous Methods for Deep Reinforcement Learning in mind.
- Section 2, Related Work: the lineage from A3C, GA3C and Retrace. Needs Actor-Critic Methods and Value Function.
- Section 3, IMPALA, including 3.1 Efficiency Optimisations: the actor-learner split and batching. Needs Convolutional Neural Network and Long Short-Term Memory for the model shape.
- Section 4, V-trace: the target, the fixed point, and the actor-critic algorithm. Needs Importance Sampling, Temporal-Difference Learning and Policy Gradient. Read Section 4.1 slowly.
- Section 5.1: the throughput table. Section 5.2: single-task and the V-trace ablation. Section 5.3: the multi-task results.
- Section 6, Conclusion and Appendix A: the proof that the operator has a unique fixed point. Needs Bellman Equation for the operator view.
Check yourself
QuestionRecall: why does IMPALA send trajectories instead of gradients from its actors?Show answer
QuestionComputation: with the importance ratio 2 and truncation level 1, what is rho_t, and what is it if the ratio is 0.25?Show answer
QuestionWhy: the paper says the level rho-bar changes the fixed point but the level c-bar does not. Why is that?Show answer
QuestionApplied: a team runs an actor-learner agent on one task and sees the learner's policy drift far from the actors' policy. Which knob should they inspect first, and why?Show answer
Sources
- Espeholt et al., "IMPALA: Scalable Distributed Deep-RL with Importance Weighted Actor-Learner Architectures", arXiv:1802.01561, 2018. https://arxiv.org/abs/1802.01561
- DOI record: https://doi.org/10.48550/arXiv.1802.01561