LoopSR: Looping Sim-and-Real for Lifelong Policy Adaptation of Legged Robots

Peilin Wu, Weiji Xie, Jiahang Cao, Hang Lai, Weinan Zhang · DOI

Introduction

Reinforcement Learning (RL) has demonstrated significant potential in robotic locomotion, yet the transition from simulated training environments to real-world deployment—the "sim-to-real gap"—remains a critical challenge. Traditional approaches often rely on Domain Randomization (DR), where a robot is trained across a wide spectrum of simulated physical parameters (e.g., varying friction, mass, and terrain geometry) to foster robustness. However, this approach is subject to a "No Free Lunch" constraint: a policy optimized for a broad distribution of environments often lacks the peak performance required for specific, challenging terrains. A robot trained with wide DR might navigate a staircase safely but will likely lack the speed and efficiency of a policy specifically tuned for that environment's unique dimensions and surface properties.

Direct real-world training offers a potential solution but is fraught with difficulties. It is inherently slow, poses safety risks to the hardware, and lacks the "privileged information"—such as exact step heights or ground friction coefficients—that modern RL algorithms utilize to accelerate learning.

The LoopSR Framework

To address these limitations, we present LoopSR (Looping Sim-and-Real), a lifelong adaptation framework designed to bridge the sim-to-real gap by "looping" real-world experience back into simulation. Instead of attempting to make the real world conform to a generalized simulation, LoopSR uses minimal real-world data to identify the precise simulation parameters that constitute a "digital twin" of the current environment.

Overview of the LoopSR framework showing the interaction between real-world data collection and simulation parameter identification.

The framework operates in a two-stage pipeline. First, during a pretraining phase in simulation, the robot is exposed to diverse terrains while a Transformer-based trajectory encoder learns to map observation-action sequences into a compact latent space ($z$). Second, during deployment, the robot collects brief snippets of real-world trajectory data. This data is encoded to estimate environmental parameters, which are then used to update the simulation for "continual training," allowing the robot to fine-tune its policy in a safe, high-speed virtual environment.

Technical Architecture

The core of LoopSR lies in its ability to extract meaningful environmental representations from proprioceptive data. The architecture utilizes a Transformer-based encoder, $q_\theta$, to process sequences of observations ($o$) and actions ($a$).

Detailed architecture of the LoopSR encoder and multi-head decoders for parameter estimation.

To ensure the latent space $z$ is physically grounded, the system employs several auxiliary tasks:

  1. Reconstruction Loss ($L_{reconstruct}$): An autoencoder structure reconstructs future states, ensuring $z$ captures the underlying dynamics.
  2. Disentangled Decoding: Separate decoder heads ($p_r$ and $p_e$) predict robot-specific parameters (e.g., motor strength) and terrain-specific parameters (e.g., friction, height). This disentanglement prevents the model from conflating internal hardware degradation with external environmental changes.
  3. Contrastive Learning: This forces trajectories from similar terrains to cluster together in the latent space, improving the reliability of the representation.

Furthermore, LoopSR employs a hybrid estimation strategy. It combines direct prediction from the decoders with a retrieval-based method that searches a reference dataset for the most similar simulated trajectories. This dual approach provides a safety net for Out-of-Distribution (OOD) scenarios, preventing the policy from adapting to wildly incorrect parameter estimates.

Experimental Results

We evaluated LoopSR using a Unitree A1 quadruped robot across both high-fidelity simulations (IsaacGym) and diverse real-world terrains, including grass, concrete stairs, and slopes.

Simulation Performance

In sim-to-sim transfer tests, LoopSR achieved performance levels nearly identical to an "Expert" policy—one trained with full knowledge of the specific terrain. It significantly outperformed zero-shot methods like Rapid Motor Adaptation (RMA), which often struggle with the precision required for optimal locomotion on discrete obstacles.

Real-World Adaptation

On physical hardware, the "looping" mechanism proved highly effective. LoopSR reduced the time required to ascend a set of stairs by approximately 38% compared to the RMA baseline (4.33s vs 6.97s). In challenging "Pit" terrains, LoopSR maintained a 90% success rate, whereas the baseline DreamWaQ policy achieved 80% and RMA dropped to 60%. Notably, this adaptation is highly data-efficient, requiring only about 30 minutes of total real-world experience to achieve expert-level performance.

Discussion and Future Work

LoopSR demonstrates that treating the simulator as a controllable laboratory—rather than just a static training ground—enables robots to achieve high-performance adaptation with minimal real-world risk. However, the current implementation relies solely on proprioception, rendering the robot "blind" to upcoming obstacles until physical contact is made.

Future research will focus on integrating visual inputs (e.g., RGB-D cameras or LiDAR) into the latent representation. Additionally, we aim to enhance the fidelity of the "digital twin" by modeling more complex physical interactions, such as deformable or granular terrains, which are currently difficult to simulate accurately.

Summary updated

Abstract

Reinforcement Learning (RL) has shown its remarkable and generalizable capability in legged locomotion through sim-to-real transfer. However, while adaptive methods like domain randomization are expected to make policy more robust to diverse environments, such comprehensiveness potentially detracts from the policy's performance in any specific environment according to the No Free Lunch theorem, leading to a suboptimal solution once deployed in the real world. To address this issue, we propose a lifelong policy adaptation framework named LoopSR, which utilizes a transformer-based encoder to project real-world trajectories into a latent space, and accordingly reconstruct the real-world environments back in simulation for further improvement. Autoencoder architecture and contrastive learning methods are adopted to better extract the characteristics of real-world dynamics. The simulation parameters for continual training are derived by combining predicted parameters from the decoder with retrieved parameters from the simulation trajectory dataset. By leveraging the continual training, LoopSR achieves superior data efficiency compared with strong baselines, with only a limited amount of data to yield eminent performance in both sim-to-sim and sim-to-real experiments.
BibTeX
@inproceedings{wu2025loopsr,
  author = {Peilin Wu and Weiji Xie and Jiahang Cao and Hang Lai and Weinan Zhang},
  title = {{LoopSR: Looping Sim-and-Real for Lifelong Policy Adaptation of Legged Robots}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2025},
  doi = {10.1109/iros60139.2025.11246873},
}
Figure