Context-Aware Policy Reuse

Siyuan Li, Fangda Gu, Guangxiang Zhu, Chongjie Zhang

TL;DR

Context-Aware Policy reuSe (CAPS) is a novel reinforcement learning framework that accelerates learning on new tasks by intelligently leveraging a library of multiple pre-existing source policies. By treating these policies as "options" and learning both which policy to use in a specific context and when to stop using it, CAPS provides a mathematically guaranteed path to the optimal target policy, significantly outperforming existing transfer learning methods.

What Problem Does This Paper Address?

Reinforcement learning (RL) is notoriously sample-inefficient, often requiring millions of interactions to learn a task from scratch. Transfer learning aims to solve this by reusing knowledge from previously learned "source" tasks. However, existing policy reuse methods face three major hurdles:

  1. Single-Policy Limitation: Many methods try to find the one "best" source policy to reuse, ignoring the fact that different source policies might be useful in different parts (contexts) of a new task.
  2. Lack of Optimality Guarantees: Reusing old policies can sometimes lead an agent to a sub-optimal solution if the source policies don't perfectly align with the new task's requirements.
  3. Inefficient Switching: Deciding which policy to use at every single time step is computationally expensive and can lead to jittery behavior.

Methods

The authors introduce CAPS, which formulates multi-policy reuse as an inter-option learning problem. Key components include:

  • Policy Library Augmentation: CAPS takes a set of source policies and augments them with "primitive policies" (simple, single-action policies). This ensures that even if the source policies are useless, the agent can still learn the optimal action for any state, guaranteeing convergence to the global optimum.
  • Context-Aware Selection: Instead of a global "best" policy, CAPS learns a source selection policy. This policy identifies which source (or primitive) policy is most appropriate for the current state (the context).
  • Call-and-Return Execution: CAPS uses a temporally extended model. Once a policy is selected, the agent follows it until a learned termination function triggers a switch. This allows for smoother, more efficient transfers.
  • Concurrent Q-Value Updates: To maximize data efficiency, CAPS updates the value estimates for all policies in the library that would have taken the same action as the one currently being executed.

Datasets

The authors evaluated CAPS in two distinct environments:

  1. Grid-based Navigation Domain: A custom grid world where an agent must navigate through rooms to reach a goal. Source tasks involve reaching different goal locations (G1-G4), while target tasks ($g$ and $g'$) require different paths.
  2. Pygame Learning Environment (PLE) - Monsterkong: A complex, high-dimensional navigation task with simulated gravity, ladders, and spikes. This served as a benchmark for deep RL integration, using convolutional neural networks to process raw pixel data.

Key Insights and Ideas

  • Decomposition via Knowledge: CAPS effectively decomposes a complex target task into sub-tasks based on existing knowledge. For example, in a navigation task, it might use a "go left" source policy to exit a room and then switch to a "go up" primitive policy to reach the final goal.
  • The Power of Termination: Learning when to stop is as important as learning what to start. By adaptively learning termination functions, CAPS avoids over-relying on source policies in regions where they are no longer helpful.
  • Robustness to Dissimilarity: Because CAPS includes primitive actions and learns context, it avoids "negative transfer"—a common pitfall where reusing a bad source policy actually makes learning slower than starting from scratch.
Figure 1: Source and target tasks in the map.

Key Results

  • Superior Speed and Performance: In grid-world experiments, CAPS reached the optimal reward significantly faster than state-of-the-art methods like PRQL and OPS-TL.
  • Multi-Policy Advantage: As shown in Figure 2, CAPS excels when multiple source policies are partially useful, whereas traditional methods that focus on a single best source struggle.
  • Deep RL Success: In the Monsterkong environment, CAPS converged to the optimal value in roughly 125 epochs, while standard DQN and other transfer methods were significantly slower or failed to reach the same level of performance.
  • Visualizing Context: The authors demonstrated that CAPS learns to switch policies logically. As seen in Figure 3, the agent uses different source policies (indicated by colored arrows) for different rooms and corridors, switching to primitive actions only when necessary.
Figure 2: Average discounted rewards of CAPS, PRQL, OPS-TL, OC and Q-learning on target task g.

Limitations and Future Work

While CAPS is powerful, the authors note a few areas for growth:

  • Action Space: The current formulation assumes a discrete action space.
  • State Mapping: It assumes source and target tasks share the same state-action space, though they mention this can be relaxed with a mapping function.
  • Lifelong Learning: Future work includes developing mechanisms to automatically decide when a brand-new policy is unique enough to be added to the library for future use.
  • Initiation Sets: The authors plan to explore learning "initiation sets"—specific regions where a policy is even allowed to be triggered—to further refine the selection process.

Summary updated

BibTeX
@inproceedings{li2019context,
  author = {Siyuan Li and Fangda Gu and Guangxiang Zhu and Chongjie Zhang},
  title = {{Context-Aware Policy Reuse}},
  booktitle = {AAMAS},
  year = {2019},
  url = {https://openreview.net/forum?id=-4Jx-rodr7},
}
Figure