Command Palette
Search for a command to run...
PyRUA-Dex: Learning Programmatic Policies for Dexterous Bimanual Manipulation with Coding Agents
PyRUA-Dex: Learning Programmatic Policies for Dexterous Bimanual Manipulation with Coding Agents
Abstract
Learning for dexterous manipulation is limited by the scarcity of high-quality demonstrations: retargeting from human video is imprecise, teleoperation gives no force feedback to the operator, and exoskeleton-based collection is hard to scale up. We present PyRUA-Dex, a framework that enables coding agents to develop dexterous manipulation through programmatic policy, without the need of demonstrations. The programmatic policy is developed in two stages: during exploration, multiple agents explore in parallel for task skills and ways to compose them, and a distilling agent condenses the successful attempts into a task library and one program. During refinement, this program is improved through randomized layouts for enhanced robustness and execution eficiency. In simulated environments, PyRUA-Dex achieves SOTA on Bench2Dex with a score of 72.9 and reaches 81.0% success on DexJoCo under full randomization, ahead of every trained policy on both benchmarks. In real world experiments on a bimanual platform with two 22-DoF hands, PyRUA-Dex learns to play piano, write calligraphy, and other tasks eficiently: learning a new piece from sheet music takes as little as 30 minutes. These results suggest that PyRUA-Dex is an efective framework for developing dexterous manipulation policies with coding agents in the absence of high quality dexterous manipulation demonstrations.
One-sentence Summary
Researchers from Peking University, National University of Singapore, NVIDIA, and other institutions propose PyRUA-Dex, a demonstration-free framework in which coding agents explore and distill programmatic policies in two stages and then refine them under randomized layouts, achieving state-of-the-art simulated manipulation scores of 72.9 on Bench2Dex and 81.0% success on DexJoCo while efficiently learning real-world bimanual tasks such as piano and calligraphy.
Key Contributions
- PyRUA-Dex is a demonstration-free framework in which coding agents develop dexterous manipulation policies as general Python programs for multi-fingered hands. A two-stage process uses parallel exploration and a distilling agent to build a task library and a single program, then refines that program over randomized layouts for robustness and execution efficiency.
- On Bench2Dex, PyRUA-Dex achieves a state-of-the-art score of 72.9, and on DexJoCo it reaches 81.0% success under full randomization, ahead of every trained policy on both benchmarks.
- In real-world experiments on a bimanual platform with two 22-DoF hands, PyRUA-Dex learns tasks such as piano playing and calligraphy, learning a new piano piece from sheet music in as little as 30 minutes.
Introduction
Dexterous manipulation is currently dominated by imitation learning, vision-language-action models, and world-action models trained on teleoperated episodes. However, high-quality multi-fingered demonstrations are scarce: retargeting is imprecise, teleoperation lacks force feedback, exoskeleton collection is hard to scale, and policies trained on such data remain fragile across new hands and perturbed layouts. Prior coding-agent approaches can produce interpretable programmatic policies, but they usually write a program once or search in a small domain-specific language, and online agents incur large per-episode token and step costs. The authors introduce PyRUA-Dex, an agent-driven framework that develops dexterous manipulation programs without demonstrations, using parallel exploration in simulation followed by stage-wise robustness refinement over randomized layouts. The resulting frozen Python code runs at control rate with no trained model or online language model, achieving state-of-the-art scores on Bench2Dex and DexJoCo and transferring to a real bimanual platform.
Method
The authors introduce PyRUA-Dex, a framework that learns one programmatic policy per task in simulation and deploys it as a frozen program. The learning process is divided into two distinct stages, both executed by general coding agents equipped with a shell, a dedicated simulator instance, and a shared library of perception and control primitives known as the codebox.
As shown in the figure below:
The overall pipeline takes sensor inputs such as RGB cameras, joint positions, and fingertip touch, along with task instructions and the primitive library, to produce a frozen program capable of operating in both simulation and the real world.
In terms of policy representation, every program follows a staged structure consisting of a setup function for scene measurement and a sequence of stage functions fk. Each function fk operates sequentially within the episode step budget, starting from the state left by the previous function. If a function fails, it does not abort the episode. Instead, subsequent functions check their prerequisites, and the runner retries the failed functions as long as steps remain. To handle the complexity of dexterous hands, the codebox models each hand as fingers and a thumb with joints grouped by function. It exposes high-level hand primitives for shaping, grasping, and checking contact, while arm primitives manage frame movements and collision checks. Every primitive returns an outcome with a reason, enabling the program to verify each step.
The problem formulation defines the policy πτ as a mapping from observation history to joint-position targets. A task is evaluated over layouts ξ∼Dτ and measured by K ordered stages. The stage success rate rk(πτ) represents the fraction of layouts reaching stage k among those that reached stage k−1:
rk(πτ)=Eξ[ρk−1(ξ)]Eξ[ρk(ξ)],k=1,…,KThe overall success rate factorizes along the chain of stages:
SR(πτ)=s(πτ)k=1∏Krk(πτ)This factorization motivates the two-stage learning process. Exploration is required to ensure every stage success rate is positive, while refinement focuses on the least reliable stage, as the largest gain in success rate comes from improving the bottleneck.
Stage 1 focuses on exploration to discover a program that completes the task. The authors deploy eight agents in parallel, each assigned to a specific unsolved stage on a dedicated training layout. Agents utilize state resets to retry a stage multiple times without repeating preceding stages. All attempts are written to a shared memory, allowing a dedicated agent to curate progress so that a stage solved by one agent becomes the starting point for others. At the end of exploration, each agent writes a program reproducing its achievements. These programs are evaluated on fresh layouts, and a distilling agent reads the evaluation records to construct a task library. It selects the best program or composes a new one by taking the most reliable stage function from each agent, replacing the current program only if it performs no worse on validation layouts.
Stage 2 shifts to refinement, where a single agent improves the reliability of the program on unseen layouts. Before editing, the program undergoes a stage-wise failure analysis on 32 fresh training layouts to identify the bottleneck stage. The agent then focuses on this bottleneck, opening failing layouts interactively and repairing the stage function with state resets. To maintain efficiency, partial rollouts execute the program only up to the stage under refinement. After every 160 training layouts, the current version is evaluated at the benchmark step budget on fresh and held-out layouts. The agent stops when the task completes on most held-out layouts or the stage success rates plateau. A distilling agent selects the version with the best held-out record, which replaces the exploration program if it meets the validation criteria.
For sim-to-real transfer, the authors build a simulation from the real platform calibration and reconstructed objects. Both learning stages run in this simulation, and the robot executes only the frozen programs. Refinement alternates with real-world execution. Discrepancies revealed by the robot are written back into the simulation as updated physical parameters or task rules, allowing the next refinement round to adapt to the real environment.
Experiment
The evaluation covers two simulated benchmarks, Bench2Dex and DexJoCo, and a real bimanual platform; coding agents first explore programs and then refine them with environment feedback. The simulation experiments show refined programs are more reliable than trained policies and online agents, with refinement repairing bottleneck stages rather than requiring full re-exploration, and the method generalizing across benchmarks with different hands and simulators. Real-world experiments use a calibrated simulation and real-robot feedback to transfer the same pipeline, successfully completing multiple bimanual tasks and enabling a shared piano skill to adapt quickly to new pieces.
PyRUA-Dex sets the best overall result on the 26-task benchmark, exceeding every trained policy in success and stage completion while remaining far more consistent across perturbation channels. Trained policies such as π0.5 and GR00T N1.7 lead among demonstration-based methods in four-channel mean success, but all trained policies lose substantial performance on perturbed channels, especially equivariance. The program-based approach wins on 15 of 26 tasks, with the largest margins on tasks requiring precision and order, though trained policies remain stronger on 11 tasks. PyRUA-Dex achieves the highest score, success rate, and stage completion, and its success varies by only 4.1 points across the four channels, with equivariance as its best channel. Every trained policy loses most on perturbed channels; GR00T N1.7 drops from 39.4 percent with no perturbation to 13.2 percent on equivariance. PyRUA-Dex exceeds the best trained policy on 15 of 26 tasks, with the widest margins on bimanual piano melody, ball sorting, and baking-tray preparation. Among trained policies, π0.5 and GR00T N1.7 have the highest four-channel mean success, while Diffusion Policy has the lowest.
PyRUA-Dex outperforms all trained policies on DexJoCo in both the object-randomized and fully randomized settings, and its frozen programs also exceed the online agent at the benchmark step budget while needing no tokens per episode. It loses less success than trained policies under full randomization, and refinement provides larger gains for object randomization than for full randomization. The results indicate the approach generalizes to a different simulator and hand using only success feedback. PyRUA-Dex exceeds the strongest trained policy in both randomization settings and leads on every DexJoCo task. A single PyRUA-Dex program serves both settings with a smaller drop under full randomization than trained policies, which were trained separately per setting. At the standard step budget, the frozen program outperforms the online agent while using no tokens per episode, and the agent needs twice the budget to match it.
Iterative refinement with real-robot feedback improved validation success across six real-robot tasks from about three-fifths to nearly seven-eighths of possible layouts. Gains were largest for manipulation tasks that started with low exploration success, while piano tasks reached near-ceiling performance after several rounds. The learned piano skill also transferred across new pieces, reducing iteration time to under an hour. Total validation success rose from 119 to 168 of 192 possible layouts across all tasks. Difficult tasks showed the strongest relative gains, with stacking three cubes improving from 6 to 30 layouts and writing from 3 to 14. A shared piano skill allowed new pieces to be produced after 30 minutes to an hour of iteration.
The experiments evaluate PyRUA-Dex in three settings: a 26-task benchmark with perturbation channels, DexJoCo transfer to a different simulator and hand, and iterative real-robot refinement. The program-based method consistently outperforms trained policies, particularly under perturbations and on tasks requiring precision and order, while also generalizing across simulation environments and improving substantially with real-robot feedback. Overall, the results demonstrate strong robustness, cross-platform generalization, and practical task acquisition through refinement.