Manuscript Offprint

arXiv:2609.01215

REFACTOR-VLA: Unsupervised Library Learning of Typed Motor Programs

Riyaaz Shaik, Chandru Venkataraman

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Most current vision-language-action (VLA) models—such as OpenVLA, π0\pi_0, RT-2, and RDT-1B—are “monolithic.” This means they generate raw motor commands or very short sequences of actions, without organizing behaviors into reusable, well-defined abstractions. As a result, these models perform poorly on long-horizon (multi-step) tasks, and it’s difficult to interpret what they have learned.

Existing approaches for discovering skills often avoid the core problem of deciding when two action sequences are “behaviorally equivalent.” For example, AtomicVLA and AtomSkill group action sequences by clustering their contrastive embeddings. In contrast, BLADE and LRLL rely on a large language model (LLM) to judge whether two sequences are equivalent, but these LLMs are not calibrated to the robot’s own dynamics.

We introduce REFACTOR-VLA, a system that learns reusable skills using a “wake/sleep” architecture. In the sleep phase, the system clusters segments of motor programs using a Behavioral-Equivalence Kernel (BEK). This BEK is based on the outcomes of rolling out actions in a learned latent world model, MϕM_\phi. In the wake phase, the system generates typed lambda terms (simple, structured programs) from a vocabulary inspired by the Hindley–Milner type system. These lambda terms are then used by a library-conditioned rectified-flow action decoder to produce actions. Only abstractions that pass both a Minimum Description Length (MDL) criterion and a return-preservation gate are accepted as skills.

To train REFACTOR-VLA, we use a three-phase schedule:

  • Phase A (World-model warmup): The latent world model MϕM_\phi is trained.

  • Phase B (Wake-phase policy optimization): The policy that uses the library of skills is optimized.

  • Phase C (Sleep-phase skill discovery): The system clusters action fragments into reusable skills.

We evaluated REFACTOR-VLA on the full LIBERO benchmark suite. Our results show two main findings. First, simply increasing the size of the world model—from 188 million to 430 million parameters—worsened performance on 4 out of 4 benchmark suites, disproving the idea that just making the world model bigger always helps. Second, changing the training objective makes a big difference: adding an auxiliary supervised contrastive loss (specifically, InfoNCE loss) during the world-model warmup (Phase A) greatly improved the quality of skill clustering in the sleep phase (Phase C). We measured this using Normalized Mutual Information (NMI) under n=3n = 3 multi-seeding:

  • Object suite: 0.462±0.0210.462 \pm 0.021

  • Spatial suite: 0.867±0.0250.867 \pm 0.025

  • Goal suite: 0.915±0.0130.915 \pm 0.013

  • LIBERO-10 suite: 0.754±0.0100.754 \pm 0.010

Preprint.

With this improved training, REFACTOR-VLA outperformed the strongest published baseline on all 4 LIBERO suites, improving the mean score by Δ=+0.184\Delta = +0.184. This shows that the choice of training objective is more important than just increasing model size. In a cross-provider analysis with n=12n = 12, the 95% bootstrap confidence interval for the mean pairwise NMI was [0.683, 0.729] with a mean of xˉ=0.705\bar{x} = 0.705. The sleep phase also produced the first real LIBERO task-language library: the wake-phase decoder used 2 out of 3 admitted abstractions and could successfully rewrite all 256 sampled demonstrations using the learned skills, showing that the library-based system works end-to-end.

1 Introduction

Acquiring diverse, generalizable robotic skills is key to scaling manipulation to complex, long-horizon tasks [21, 32, 39]. In large state spaces with sparse rewards, flat reinforcement or direct imitation learning is impractical because policy search and temporal credit assignment are intractable at fast, low-level sampling frequencies [21, 27]. As humans break complex tasks into simpler subproblems [21], a high-level policy that coordinates previously learned skills can avoid low-level detail [21, 27, 35].

We frame this as a statistical density-estimation problem: an unsupervised multilayer network that organizes a hierarchy of internal representations from raw robotic inputs via self-supervision [16]. Following the classical wake-sleep framework [16, 11], optimization alternates two phases. The wake phase uses bottom-up recognition connections to condition low-level control policies on sensory inputs [16, 27]. The sleep phase uses top-down generative connections to produce fantasized representations, which are compressed and stored in a minimum-description-length library [16, 11, 3].

Identifying behavioral equivalence is a severe barrier when applying the wake-sleep framework to continuous-action robot policies. In discrete, symbolic domains, syntactic anti-unification over token identities can define a skill library [11, 3]. However, physical robot demonstrations seldom share identical action trajectories [27]. Current skill-discovery methods avoid dynamics-aware equivalence. AtomicVLA [35] uses a Gumbel-gated Mixture-of-Experts (SG-MoE) to route continuous actions to experts. AtomSkill [39] segments demonstrations into variable-length skills at gripper-state keyframes and uses a vision-language model (VLM) for semantic annotation and temporal contrastive clustering. BLADE [23] and LRLL [32] use ungrounded LLMs to synthesize symbolic pre/post-conditions or to refactor policy code. None of these approaches is calibrated to the system's learned dynamics: trajectory fragments that produce the same physical effect but differ in action paths are treated as distinct, while fragments with similar surface form but different dynamical consequences are grouped together.

To establish a mathematically rigorous foundation for behavioral equivalence, we use state-level bisimulation metrics in Markov Decision Processes (MDPs) [6, 4, 34]. These metrics measure the long-term behavioral similarity of states based on expected rewards and transition probabilities; states that are close under these metrics have similar expected returns under temporally abstract actions (options) [6, 31]. We extend this idea from single states to continuous trajectory fragments using a learned latent world model MϕM_{\phi} [15]. We introduce a Behavioral-Equivalence Kernel (BEK) Dϕ(τ,τ′)D_{\phi}(\tau, \tau') that quantifies the divergence between trajectory fragments when placed at the same initial state. If two fragments produce indistinguishable expected returns and identical kk-step latent rollout distributions, then Dϕ(τ,τ′)D_{\phi}(\tau, \tau') is small, regardless of the specific primitive action tokens used.

We introduce REFACTOR-VLA, a unified framework that combines the systems-level strengths of VLA models with the formal guarantees of wake-sleep library learning. In the sleep phase (Phase C), we cluster trajectory fragments using our BEK and distill these into a Siamese fragment encoder kχk_{\chi} [34]. We then use top-down syntactic anti-unification [3] to extract common grammatical sub-structures and compile them into typed-lambda programs. We admit abstractions only if they satisfy joint minimum description length (MDL) and return-preservation criteria, which ensures that policy refactoring bounds performance loss [6]. In the wake phase (Phase B), these abstractions are encoded by a Typed Program Emitter (TPE) under Hindley–Milner constraints [25], coordinating a library-conditioned rectified-flow action decoder (LCAD) [24].

Evaluating REFACTOR-VLA on the full LIBERO benchmark suite [22] reveals a critical, counter-intuitive twin lever. Increasing MϕM_{\phi} from 188M to 430M parameters causes a drop in NMI on

4-of-4 suites, contradicting the "capacity hypothesis" that larger world models always improve skill representations. Instead, the training objective acts as the decisive factor: adding an auxiliary supervised contrastive InfoNCE loss [17, 8] during world-model warmup (Phase A) encourages task-discriminative directions in the latent space. This change recovers up to 98.5% of the supervised upper bound and produces a robust 4-of-4 head-to-head NMI win with a mean improvement of Δ=+0.184\Delta = +0.184, outperforming the strongest published baselines [35, 39] under n=3n = 3 multi-seeding. With cross-provider seed convergence (n=12n = 12), the 95% bootstrap confidence interval is [0.683, 0.729]. The sleep-phase compiler enables the first real-LIBERO task-language library (3 abstractions / 1211 nats), which the continuous LCAD policy successfully uses.

Contributions. (1) BEK formulation: a fragment-level divergence DϕD_\phi over MϕM_\phi-rollout value differences and kk-step Wasserstein distances, used as a clustering kernel in the sleep phase, with an NMI concentration rate (Theorem 1). (2) Typed-lambda emitter and library-conditioned action decoder (LCAD): a Hindley–Milner-shaped vocabulary over Σ={Twist,Wrench,GripperPhase,Pose,Lang}\Sigma = \{\text{Twist}, \text{Wrench}, \text{GripperPhase}, \text{Pose}, \text{Lang}\}, parsed by a grammatical compiler, with a rectified-flow LCAD that conditions on active library entries. (3) Wake/sleep loop with MDL-gated admission: candidate abstractions are admitted only if they satisfy joint BEK soundness, return-preservation (ε=0.05\varepsilon = 0.05, Kv=32K_v = 32), and MDL-gain (>4> 4 nats) conditions, with library-conditioned wake-phase parsing connected end-to-end. (4) End-to-end empirical validation: the full LIBERO matrix (4-suite), a synthetic recursive-pour benchmark, a 4-baseline reproduction, and 7 of 12 preregistered ablations. Using a supervised contrastive-style (SupCon) InfoNCE Phase A auxiliary objective at 188M parameters, BEK outperforms the strongest published baseline in all 4 cases at n=3n = 3 multi-seed (mean Δ=+0.184\Delta = +0.184). The cross-provider evaluation (n=12n = 12 pairs) yields a percentile-bootstrap 95% CI of [0.683, 0.729] (xˉ=0.705\bar{x} = 0.705). The sleep phase finds the first structured task-language library (3 abstractions / 1211 nats on the Lang slot of Σ\Sigma), with 2 abstractions used by the LCAD on libero_object.

References (36)