Prompt-based Visual Alignment for Zero-shot Policy Transfer

Haihan Gao, Rui Zhang, Qi Yi, Hantao Yao, Haochen Li, Jiaming Guo, Shaohui Peng, Yunkai Gao, QiCheng Wang, Xing Hu, Yuanbo Wen, Zihao Zhang, Zidong Du, Ling Li, Qi Guo, Yunji Chen

Introduction

Reinforcement Learning (RL) agents have demonstrated remarkable capabilities in controlled environments, yet they remain notoriously brittle when faced with domain shifts. An agent trained to navigate a vehicle in a clear, midday simulation often fails catastrophically when introduced to rain, sunset, or fog. This lack of robustness—known as overfitting to the training domain—is a primary barrier to deploying RL in real-world scenarios like autonomous driving.

To address this, researchers have developed Prompt-based Visual Alignment (PVA). This framework leverages the pre-trained semantic knowledge of Visual-Language Models (VLMs) to create a "semantic compass," allowing agents to generalize to completely unseen environments by aligning diverse visual domains into a unified representation space.

The Challenge of Visual Domain Shift

Traditional methods to improve generalization, such as domain randomization or data augmentation, often lack a semantic "ground truth." While they shuffle textures and colors, they do not explicitly teach the model that a car remains a car regardless of lighting or weather. Representation learning methods like Variational Autoencoders (VAEs) attempt to map different domains to a shared space but often struggle with complex scenes because they lack explicit semantic constraints. Furthermore, most existing solutions are data-hungry, requiring massive multi-domain datasets that are expensive and difficult to collect.

The PVA Framework

PVA introduces a novel approach by using VLMs (such as CLIP) as a semantic bridge. The framework operates in three distinct stages:

1. Prompt Tuning

Rather than using static text descriptions, PVA learns a sequence of optimized "tokens" or prompts that describe the visual input. These prompts are disentangled into three components:

  • Global Prompts: Capture task-level information (e.g., "driving a car").
  • Domain-Specific Prompts: Identify environmental factors (e.g., "rainy weather").
  • Instance-Conditional Prompts: Detail specific frame elements (e.g., the position of a specific vehicle).

2. Visual Alignment

A visual aligner, built on a UNet architecture, is trained to transform images from any source domain into a unified "target" domain. The aligner ensures that the VLM embedding of the transformed image matches the embedding of the target domain's prompt. To maintain image integrity, the system employs a combination of Global Match Loss, Patch Match Loss (to preserve local details), and Feature Loss (using a pre-trained VGG network).

3. Robust Policy Training

The RL agent is trained using these aligned, "cleaned" images. Because the aligner effectively strips away domain-specific noise—such as rain streaks or glare—while preserving essential semantic content, the resulting policy becomes significantly more robust to environmental changes.

Experimental Evaluation

The researchers evaluated PVA using the CARLA simulator, a high-fidelity environment for autonomous driving, and several MuJoCo tasks (Cartpole, Cheetah, Point-mass) with modified backgrounds.

In CARLA, the model was trained on "ClearNoon" and "HardRainNoon" domains and tested on unseen "zero-shot" domains, including "WetCloudySunset" and "SoftRainSunset."

Key Insights and Results

Superior Zero-shot Transfer

PVA significantly outperformed established baselines like LUSR, CURL, and DARLA. In the unseen "SoftRainSunset" domain, PVA achieved a performance score of 1789.2, nearly doubling the 1046 score achieved by the next best baseline (CURL).

Exceptional Data Efficiency

One of the most striking findings was PVA's efficiency. While baseline methods typically require upwards of 10,000 images per domain to achieve stability, PVA reached state-of-the-art performance using only 100 images from two domains. Even with this limited data, PVA maintained high performance (~2004 on ClearNoon), whereas baselines saw significant degradation.

Semantic Filtering

To ensure the model focuses on relevant information, the researchers implemented a threshold rejection technique. This discards image patches (like the sky) that do not align well with the text prompts, ensuring the agent prioritizes task-critical features like lane lines and obstacles.

Limitations and Future Directions

Despite its success, PVA has areas for improvement:

  • Computational Overhead: The training process is intensive; prompt tuning and visual alignment can take upwards of 12 hours on high-end hardware (A8000 GPU).
  • Prompt Sensitivity: The system is sensitive to prompt length. If prompts are too long, they become difficult to optimize, potentially degrading performance.
  • VLM Dependency: The framework's efficacy is tied to the underlying VLM. Biases or gaps in the pre-trained model's knowledge (e.g., CLIP) will be inherited by the visual aligner.

Future work aims to automate prompt length selection and explore the integration of more diverse multi-modal models to handle complex sensor inputs beyond standard RGB imagery.

Summary updated

BibTeX
@inproceedings{gao2024prompt,
  author = {Haihan Gao and Rui Zhang and Qi Yi and Hantao Yao and Haochen Li and Jiaming Guo and Shaohui Peng and Yunkai Gao and QiCheng Wang and Xing Hu and Yuanbo Wen and Zihao Zhang and Zidong Du and Ling Li and Qi Guo and Yunji Chen},
  title = {{Prompt-based Visual Alignment for Zero-shot Policy Transfer}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=PPoQz8K4GZ},
}
Figure