Domain Adversarial Reinforcement Learning

Bonnie Li, Vincent François-Lavet, Thang Doan, Joelle PineauarXiv 2021

Introduction

Deep Reinforcement Learning (RL) has demonstrated remarkable capabilities in simulated environments. However, these agents often exhibit significant "brittleness" when faced with visual variations. A common failure mode occurs when an agent, trained to perform a task against a specific background, fails completely when that background changes—even if the underlying physics and task dynamics remain identical. This phenomenon represents a failure of zero-shot generalization, where agents overfit to task-irrelevant visual features.

Overview of the Domain Adversarial Reinforcement Learning framework for zero-shot generalization.

The core challenge addressed in this work is the "Block MDP" problem. In these scenarios, the transition dynamics and reward functions are consistent across different environments, but the visual observations (the "context") vary. The goal of Domain Adversarial Reinforcement Learning (DARL) is to train an agent on a limited set of visual domains such that it can successfully navigate entirely unseen domains without further training.

Methodology: The DARL Architecture

The authors propose Domain Adversarial Reinforcement Learning (DARL), an approach that extends the Soft Actor-Critic (SAC) algorithm with an adversarial component designed to enforce representation invariance.

The DARL architecture featuring a Gradient Reversal Layer (GRL) and Domain Classifier.

The architecture consists of three primary components:

  1. The Encoder: This network maps high-dimensional pixel inputs (stacked frames) into a lower-dimensional latent representation, $z$.
  2. The Domain Classifier: This module attempts to predict the specific training environment (e.g., background ID) from the latent representation $z$.
  3. The Gradient Reversal Layer (GRL): This is the critical innovation. During the forward pass, the GRL acts as an identity transform. However, during backpropagation, it multiplies the gradient from the domain classifier by a negative constant ($-\lambda$).

This setup creates an adversarial "tug-of-war." While the domain classifier strives to identify the source domain, the encoder is incentivized to produce representations that make the classifier fail. This process effectively "scrubs" domain-specific information—such as background color or texture—from the latent space, preserving only the features necessary for task execution, such as agent position and target dynamics.

Experimental Setup and Datasets

The DARL framework was evaluated using the DeepMind Control Suite, focusing on four continuous control tasks: finger_spin, cheetah_run, walker_walk, and ball_in_cup_catch.

The experiments were structured to test robustness across different levels of visual complexity:

  • Training Set: Four environments, each featuring a unique, stationary background.
  • Testing Set (Stationary): Two entirely new stationary backgrounds not seen during training.
  • Testing Set (Non-Stationary): Six environments with dynamic distractors, utilizing natural video backgrounds from the Kinetics dataset. This represents a significant challenge, as the backgrounds are both dynamic and visually distinct from the static training images.

Key Insights and Performance

Invariance as a Regularizer

Unlike standard data augmentation techniques (e.g., RAD or DrQ) which simply increase the variety of training data, DARL explicitly penalizes the agent for retaining domain-specific information. By making it impossible for the agent to "know" which environment it is in, the model is forced to focus on the invariant foreground dynamics.

Latent Space Visualization

Analysis using t-SNE plots revealed that standard SAC agents cluster their internal representations by background. In contrast, DARL's representations are thoroughly mixed, confirming that the adversarial objective successfully produces a domain-invariant feature space.

Quantitative Results

DARL consistently outperformed state-of-the-art baselines. A notable result was observed in the cheetah_run task: when tested on the most difficult unseen domain, the performance of a standard SAC agent plummeted by 74.1%, whereas DARL's performance only decreased by 23.5%. Furthermore, DARL proved computationally efficient; because the GRL allows for single-pass updates, its execution time is comparable to standard SAC and significantly faster than alternative representation-learning methods like IDM.

Conclusion and Future Work

DARL demonstrates that adversarial learning is a powerful tool for improving the robustness of RL agents to visual distractors. However, the method currently relies on the assumption of shared dynamics (the Block MDP structure) and requires discrete labels for training domains.

Future research may explore scaling these adversarial techniques to continuous distributions of training environments or combining them with self-supervised learning metrics, such as bisimulation, to further enhance sample efficiency and robustness in increasingly complex, real-world scenarios.

Summary updated

BibTeX
@misc{li2021domain,
  author = {Bonnie Li and Vincent François-Lavet and Thang Doan and Joelle Pineau},
  title = {{Domain Adversarial Reinforcement Learning}},
  year = {2021},
  eprint = {2102.07097},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2102.07097},
}
Figure