Self-Supervised Reinforcement Learning that Transfers using Random Features

Boyuan Chen, Chuning Zhu, Pulkit Agrawal, Kaiqing Zhang, Abhishek Gupta

Abstract

Reinforcement learning (RL) often faces a fundamental trade-off between the task-specific efficiency of model-free methods and the generalizable but error-prone nature of model-based approaches. This paper introduces RaMP (Random Features for Model-Free Planning), a framework that bridges this gap. By learning to predict the long-term accumulation of random features from unlabeled offline data, RaMP constructs a "Q-basis" that enables rapid adaptation to new reward functions via simple linear regression. This approach avoids the compounding errors inherent in autoregressive world models while maintaining the flexibility required for zero-shot and few-shot transfer learning.

Introduction

In traditional reinforcement learning, agents typically fall into two categories. Model-free RL (e.g., Q-learning) excels at high-dimensional tasks but couples the policy tightly to a specific reward function, necessitating retraining for every new goal. Conversely, model-based RL learns a transition model of the environment, allowing for transfer to new tasks through planning. However, these world models are notoriously difficult to train and suffer from compounding errors, where small inaccuracies in next-state predictions accumulate over long horizons, rendering long-term planning unreliable.

RaMP addresses the question: Can we disentangle environment dynamics from specific rewards without the brittle nature of explicit state-prediction models? By leveraging the theory of random features, RaMP provides a stable, model-free mechanism for reward-agnostic pre-training and rapid task adaptation.

Methodology

RaMP operates in two distinct phases: self-supervised pre-training and online adaptation.

1. Self-Supervised Pre-training

During the pre-training phase, the agent utilizes an unlabeled offline dataset. Rather than predicting the next state, the agent learns to predict the "discounted future sum" of a large set of $K$ random features, $\phi(s, a)$. These features are generated by fixed, random neural networks and serve as a universal basis for potential reward functions.

The agent trains $K$ model-free Q-functions, collectively referred to as the Q-basis. Each Q-function estimates the long-term value of its corresponding random feature. Because this process does not require reward labels, it is entirely self-supervised, allowing the agent to learn the underlying dynamics of the environment implicitly.

2. Online Adaptation and Planning

When presented with a new task and a specific reward function $R$, the agent adapts through a two-step process:

  • Reward Fitting: The agent performs a brief interaction with the environment to observe rewards. It then solves a Ridge regression problem to find weights $w$ such that $R \approx \sum w_k \phi_k(s, a)$.
  • Zero-Shot Q-function Assembly: Exploiting the linearity of RL with respect to rewards, the agent constructs a task-specific Q-function: $Q_{task} \approx \sum w_k \psi_k(s, a)$, where $\psi_k$ are the pre-trained Q-basis functions.
  • Planning: The agent employs Model Predictive Control (MPC) with random shooting to select actions that maximize this newly assembled Q-function.

Experimental Evaluation

The authors evaluated RaMP across a diverse suite of simulated environments, including robotic manipulation (Meta-World, D’Claw), locomotion (OpenAI Gym Hopper), and high-dimensional visual tasks.

Key Findings

  • Rapid Adaptation: In Meta-World and Hopper environments, RaMP adapted to novel rewards significantly faster than established baselines such as MBPO (model-based) and Successor Features (SF).
  • Out-of-Distribution Robustness: Unlike offline RL methods like CQL, which often fail when test goals deviate from training data, RaMP’s task-agnostic Q-basis allowed for steady performance across varying goals.
  • Reduced Approximation Error: Quantitative analysis demonstrated that RaMP’s multi-step Q-functions exhibited lower approximation errors compared to rollouts from standard feedforward dynamics models, particularly in chaotic or high-dimensional domains.
  • Visual Scalability: The method successfully scaled to 42,336-dimensional pixel observations, achieving performance competitive with state-of-the-art visual RL models like Dreamer.

Discussion and Insights

RaMP’s success stems from Implicit Dynamics Modeling. By learning the long-term sums (cumulants) of random features, the agent models environment evolution without the need to explicitly generate future states. This bypasses the compounding error problem that plagues traditional world models.

Furthermore, the use of Random Features (drawing from the theory of Random Kitchen Sinks) proves that a sufficiently large set of non-linear features can approximate a wide array of reward functions. This allows RaMP to achieve the primary benefit of model-based RL—the separation of "how the world works" from "what the goal is"—using the more stable machinery of model-free Q-value estimation.

Limitations

Despite its strengths, RaMP faces several challenges. The current reliance on Monte-Carlo estimation for the Q-basis can lead to high variance, which might be mitigated by future integration with actor-critic methods. Additionally, while the method scales to pixels, random features may occasionally capture low-level noise rather than semantic information; using pre-trained encoders could enhance performance in visual domains. Finally, the computational cost of maintaining a large ensemble of Q-functions (e.g., $K=2048$) remains a consideration for deployment.

Conclusion

RaMP provides a robust framework for self-supervised RL that combines the stability of model-free learning with the transferability of model-based planning. By shifting the focus from state prediction to feature-sum prediction, it offers a scalable path toward general-purpose agents capable of rapid adaptation in complex environments.

Summary updated

BibTeX
@inproceedings{chen2023self,
  author = {Boyuan Chen and Chuning Zhu and Pulkit Agrawal and Kaiqing Zhang and Abhishek Gupta},
  title = {{Self-Supervised Reinforcement Learning that Transfers using Random Features}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=uRewSnLJAa},
}
Figure