Invariance Through Latent Alignment

Takuma Yoneda, Ge Yang, Matthew R. Walter, Bradly C. Stadie

Introduction

Reinforcement Learning (RL) agents often excel in simulated environments but struggle when deployed in the real world. This "sim-to-real gap" is frequently driven by perceptual shifts—differences in lighting, backgrounds, or camera angles that the agent did not encounter during training. While techniques like domain randomization attempt to mitigate this by introducing variety during training, they require researchers to anticipate specific distractions in advance.

Figure 1: Data distribution shift between source and target domains, illustrating how augmented training data may still fail to cover the target deployment domain.

Invariance Through Latent Alignment (ILA) offers a different approach: unsupervised adaptation at deployment time. By aligning the distribution of latent features in a new environment to those seen during training, ILA enables robots to maintain performance without needing rewards or paired data from the target domain.

Methodology: Latent Alignment and Dynamics Consistency

The ILA framework treats a control policy as a combination of a visual encoder and a policy head. During adaptation, the policy head remains frozen, while the encoder is updated to produce features that match the source domain's distribution.

Figure 6: The ILA framework overview, showing feature collection in the source domain (left) and the dual-mechanism adaptation process in the target domain (right).

As shown in the framework diagram, the method relies on two core mechanisms:

  1. Adversarial Latent Alignment: A discriminator $D$ is trained to distinguish between latent features from the source buffer ($z_t^{src}$) and the target domain ($z_t^{tgt}$). The encoder $F$ is then optimized to "fool" the discriminator, forcing the target features into the manifold the policy head already understands.
  2. Dynamics Consistency: To ensure the aligned features remain physically meaningful, ILA employs forward ($C_{fwd}$) and inverse ($C_{inv}$) dynamics models. These models, pre-trained on source data, act as a regularizer by checking if the sequence of latent features in the target domain follows the expected "laws of physics."

Crucially, this adaptation can be performed using data collected from a simple random policy in the target environment, making it highly practical for real-world deployment where reward signals may be unavailable.

Experimental Results

The authors evaluated ILA across the DeepMind Control Suite (DMC), the Distracting Control Suite, and a physical UR-5 robot.

  • Robustness to Perceptual Noise: In the Distracting Control Suite, ILA demonstrated significantly higher resilience to extreme camera pose shifts and background changes compared to state-of-the-art data augmentation methods like SVEA and DrQ-v2, which saw performance plummet as distractions increased.
  • Sim-to-Real Transfer: On a physical UR-5 reaching task, a model trained only in simulation achieved a mere 15% success rate upon direct transfer. After unsupervised adaptation with ILA, the success rate improved to 90%.

Conclusion

ILA demonstrates that explicit distribution matching in the latent space is a powerful tool for bridging the sim-to-real gap. By anchoring adaptation to the agent's internal knowledge of physics and task structure rather than raw pixels, ILA provides a robust path for deploying RL agents in unpredictable, real-world environments without requiring prior knowledge of the specific distractions they will face.

Summary updated

BibTeX
@inproceedings{yoneda2022invariance,
  author = {Takuma Yoneda and Ge Yang and Matthew R. Walter and Bradly C. Stadie},
  title = {{Invariance Through Latent Alignment}},
  booktitle = {Robotics: Science and Systems},
  year = {2022},
  doi = {10.15607/rss.2022.xviii.064},
}
Figure