CLASS: Contrastive Learning via Action Sequence Supervision for Robot Manipulation

Sung-Wook Lee, Xuhui Kang, Brandon Yang, Yen-Ling KuoarXiv 2025

TL;DR

The paper introduces CLASS (Contrastive Learning via Action Sequence Supervision), a novel framework that pre-trains robust visual representations for robot manipulation by aligning image observations with future action similarities. By structuring the latent space around behavior rather than raw visual features, CLASS enables imitation learning policies to generalize exceptionally well under severe visual shifts, such as changing camera viewpoints and object colors.

What Problem Does This Paper Address?

Behavior Cloning (BC) has driven massive progress in robotic manipulation, but it suffers from a major Achilles' heel: it tends to overfit to the exact visual conditions of the training data. When trained on heterogeneous datasets—where camera poses shift or object appearances vary—expressive models like Diffusion Policy often memorize individual state-action pairs instead of capturing the underlying task structure. As a result, even minor visual perturbations can cause a policy's performance to plummet.

To build robots that operate reliably in the real world, we need representation learning methods that can ignore task-irrelevant visual distractors (like camera movement or background color changes) and focus strictly on the features that dictate the next best action.

Figure 1: Comparison between Behavior Cloning (BC) and Contrastive Learning via Action Sequence Supervision (CLASS). (A) With homogeneous demonstrations with consistent visual conditions, BC learns a compact representation with high transferability. (B) With heterogeneous demonstrations such as varying viewpoints, BC overfits to individual state-action pairs and gen- eralizes poorly. (C) CLASS addresses this by attracting states with similar action sequences and repelling those with dissimilar ones, with a soft supervised contrastive learning objective to learn more robust and composable representations.

Methods

CLASS addresses this generalization gap through a two-stage supervised contrastive learning approach:

  1. Action Sequence Similarity via DTW: Instead of relying on time-contrastive objectives (which assume temporal alignment), the authors use Dynamic Time Warping (DTW) to measure the distance between future action sequences ($A_t$) across different demonstration episodes. Pairs of observations with future action trajectories below a certain quantile threshold are designated as positive pairs.
  2. Soft Contrastive Learning: Standard contrastive learning uses binary labels (positive or negative). CLASS introduces a Soft InfoNCE loss where positive pairs are continuously weighted based on their actual DTW similarity score ($w_{ij} = 1 - \text{CDF}(\text{DTW}(i, j))$). This "soft pull" ensures that states leading to highly identical future trajectories are clustered tightly together, while states with only vaguely similar trajectories are given weaker alignment signals.

The learned encoder can be evaluated in two ways:

  • Non-Parametric (Retrieval-Based): No policy head is trained. At inference, the robot retrieves the $k$-nearest neighbor states from the dataset using cosine similarity in the latent space and executes an ensembled average of their action sequences.
  • Parametric (Fine-Tuning): The pre-trained encoder weights are frozen or fine-tuned alongside a standard policy head (like an MLP or Diffusion Policy) using standard BC objectives.
Figure 2: Training pipeline. The inner block corre- sponds to contrastive representation learning as pre- training. The outer block performs policy fine-tuning with proprioception and the vision representation. Modules with the same colors indicate shared weights.

Datasets

The authors rigorously evaluated CLASS across both simulated and real-world environments:

  • Simulation Benchmarks (5 tasks): Square (robomimic), Three-Stack (MimicGen), Aloha-Transfer (bi-manual joint control), LIBERO-Object (multi-task benchmark), and Push-T.
  • Real-World Tasks (3 tasks): Two-Stack (equivariant block stacking), Mug-Hang (precise placement), and Toaster-Load (high-precision insertion).

To test robustness against visual shifts, they introduced heterogeneous variations during data collection, including randomized static cameras (Rand-Cam), continuously moving cameras (Dyn-Cam), and randomized object/background colors (Rand-Color).

Heterogeneous data collection setups used to evaluate visual generalization.

Key Insights and Ideas

  • Behaviorally Grounded Latent Spaces: Traditional visual self-supervision (like ImageNet pre-training or BYOL) optimizes for visual reconstruction or instance discrimination. CLASS proves that structuring the latent space based on what the robot does next creates a much more transferable representation for control tasks.
  • The Power of "Soft" Supervision: Graded similarity matters. Replacing the soft DTW weights with uniform weights (hard contrastive learning) caused a significant drop in performance. Graded signals prevent the model from collapsing distinct but related behavioral states into the same exact representation.
  • Retrieval-Based Control is Viable: Remarkably, the non-parametric retrieval method using CLASS representations achieved success rates competitive with fully parametric policies, demonstrating how well the latent space organizes task dynamics.

Key Results

  • Robustness to Visual Shifts: Under dynamic camera and random object color setups in simulation, Diffusion Policy pre-trained with CLASS achieved an average success rate of 85%, whereas standard baseline methods (including R3M, TCN, and DynaMo) failed to perform competitively, topping out at a 57% average success rate.
  • Simulation Performance: Across all static and dynamic simulation settings, CLASS combined with Diffusion Policy achieved a 91% average success rate, outperforming the best baseline (77%).
  • Real-Robot Validation: In real-world experiments with a Franka robot experiencing random camera repositioning, CLASS-DP outperformed ImageNet-pre-trained Diffusion Policy by 37% in the non-parametric setting and 55% in the parametric setting for final task completion.

Limitations and Future Work

  • Computational Complexity: Pre-computing pairwise DTW distances scales quadratically ($O(N^2)$) with the number of data points, which poses a bottleneck for massive datasets. The authors suggest an online, batch-based DTW estimation strategy as a potential remedy.
  • Suboptimal Demonstrations: The current framework assumes clean, expert demonstrations. It remains unclear how noisy or failed trajectories would impact the DTW-based positive pair selection.
  • Modality Constraints: CLASS is currently limited to visual inputs and position/joint action spaces; extending it to include tactile feedback or force-torque inputs represents an open research direction.

Summary updated

BibTeX
@misc{lee2025class,
  author = {Sung-Wook Lee and Xuhui Kang and Brandon Yang and Yen-Ling Kuo},
  title = {{CLASS: Contrastive Learning via Action Sequence Supervision for Robot Manipulation}},
  year = {2025},
  eprint = {2508.01600},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.01600},
}
Figure