Abstract
Manipulating deformable objects like ropes and cloths is challenging due to high-dimensional state spaces and complex, non-linear dynamics. We present Contrastive Forward Modeling (CFM), a framework that jointly learns a latent visual representation and a forward dynamics model using contrastive learning. By optimizing an InfoNCE loss with an $L_2$-distance-based similarity function, CFM learns representations structured around physical properties rather than visual noise. When paired with Model Predictive Control (MPC), CFM enables robust, zero-shot sim-to-real transfer. Our results demonstrate that CFM significantly outperforms reconstruction-based baselines in both simulation and real-world robotic tasks.
Introduction
Robotic manipulation of rigid objects has advanced significantly, yet deformable objects remain a major hurdle. Unlike rigid bodies, deformable objects lack a canonical state representation (e.g., a 6D pose) and exhibit highly non-linear dynamics. While model-free reinforcement learning can address these tasks, it is often sample-inefficient. Model-based approaches offer better efficiency but struggle with high-dimensional visual observations. Planning in pixel space is often ineffective because pixel-wise differences do not necessarily correlate with physical state distances; two images of a rope might have zero overlapping pixels even if they are physically close to the same shape.
Methods
The core of our approach is Contrastive Forward Modeling (CFM). Instead of predicting future pixels—which often leads models to focus on irrelevant visual details like lighting or texture—CFM embeds images into a lower-dimensional latent space. It simultaneously learns a forward dynamics model $f_\phi$ that predicts the next latent state $\hat{Z}_{t+1}$ given the current state $Z_t$ and action $a_t$.
To avoid representation collapse, we employ an InfoNCE contrastive loss. The model is trained to minimize the distance between the predicted latent state and the actual next latent state (positive sample) while maximizing the distance from other random states in the batch (negative samples). Crucially, we utilize an $L_2$-distance-based similarity function, $\exp(-||z_1 - z_2||^2)$, which encourages the latent space to reflect physical proximity more effectively than standard log-bilinear functions. Once trained, a simple Model Predictive Control (MPC) strategy samples actions and executes the one that brings the predicted latent state closest to the goal embedding.
Results
Models were trained exclusively on simulated datasets of ropes (200,000 samples) and cloths (400,000 samples) using MuJoCo. Domain Randomization (DR) was applied to facilitate sim-to-real transfer. In simulation, CFM consistently outperformed baselines, particularly under heavy DR where reconstruction-based models like Autoencoders and PlaNet failed because they were forced to encode irrelevant features like lighting and texture.
On a physical PR2 robot, CFM achieved zero-shot transfer, successfully manipulating real ropes and cloths into target shapes. In a cloth flattening task, CFM achieved a goal-intersection score of 1001 pixels, significantly higher than the Joint Dynamics baseline (772 pixels) and Autoencoders (603 pixels). The system also showed remarkable generalization, such as successfully flattening a white cloth even when provided with a goal image of a blue cloth.
Conclusion
CFM demonstrates that contrastive learning is a powerful tool for learning predictive representations of deformable objects. By focusing on physical dynamics rather than visual reconstruction, the model filters out environmental noise and achieves superior robustness to domain shifts. Future work will explore more sophisticated planning algorithms, such as the Cross-Entropy Method, and learning closed-loop policies to handle more complex, multi-step manipulations.
Summary updated