Pixel Code Policy: Discovering Simple Visuomotor Programs from Demonstrations

TL;DR A coding agent turns 50 demonstrations per task into a plain-code visuomotor policy that uses no neural network at run time. It averages 84.7% success over 15 real-robot tasks, against 41.7% for a fine-tuned π0.5, at under 19 ms per call on a CPU.
What they do
Large neural visuomotor policies can be slow to run, and their actions are often hard to interpret. Pixel Code Policy asks whether a coding agent can instead write the policy as a program. Given 50 expert demonstrations and one task-agnostic prompt, the agent produces closed-loop code that maps RGB images and robot state to dense motions without any neural network at inference time.
How it works
- Perceive. The program measures only the image features each motion needs, using classical vision such as color segmentation, template matching, PCA and optical flow.
- Move. For each stage the agent fits dense end-effector motion by ridge regression, weighted blending of demonstrations, or rigid retargeting. Each call outputs 16 targets, executed at 15 Hz on the real robots.
- Plan. Stage logic checks outcomes, keeps memory of earlier observations, and can retry a failed step.
- Cross-demonstration validation. The agent fits on some demonstrations, tests on the held-out ones, and revises the code offline, with no robot or simulator. The best of three candidate programs is chosen by validation trials.
Results
- 15 real tasks on ALOHA, YAM and xArm setups, 20 trials each: 84.7% average success, against 41.7% for fine-tuned π0.5. Precision tasks: 81% against 24%; memory tasks: 91% against 34%.
- RoboTwin 2.0, all 50 tasks: 78.24%, against 70.66% for π0.5, 55.24% for DP3, 29.74% for ACT and 28.04% for DP. It beats π0.5 on 28 tasks and ties on four.
- Each call takes under 19 ms on a CPU; RoboTwin programs have a median of 320 lines.
- Failure feedback raises Pour Milk & Move Cup from 65% to 80% and Knot Tying from 0% to 55%.
Limitations
The paper has no limitations section. It depends on dozens of demonstrations: Small-pin Insertion succeeds 0%, 50% and 95% of the time with 1, 10 and 50. Generating a program averages 3.8 hours and 112 million tokens on the ALOHA tasks, and Knot Tying fails without feedback. Programs are written per task, and changed lighting or object color requires a code revision.
Figures




Abstract
Learning from demonstrations has enabled robots to perform complex, contact-rich manipulation, largely through neural visuomotor policies. But are neural networks absolutely necessary at inference time? Recent agentic approaches offer alternatives: online agents reason flexibly but incur high inference latency, while code-based approaches often rely on predefined perception and control interfaces. We introduce Pixel Code Policy, an imitation learning framework that uses coding agents to discover surprisingly simple visuomotor programs from dozens of expert demonstrations. The agent autonomously generates programs that identify robust, task-relevant visual features in RGB images, fits the corresponding fine-grained robot motions, and organizes both with task logic and internal state into a pure-code policy. The resulting policies perform precise insertion, deformable-object manipulation, dual-arm coordination, long-horizon execution, and memory-guided interaction, taking less than 19 ms per call on a CPU, without any use of neural networks at inference time. On 15 real-world tasks and all 50 tasks of the RoboTwin 2.0 benchmark, they achieve higher average success than the compared neural policies. Because they are explicit code, the policies can also be analyzed in detail and adapted to new conditions with a single demonstration or a text instruction. Together, these results highlight the potential of agent-discovered programs as a new basis for robot imitation learning, one that is fast, interpretable, and easy to adapt.
Summaries are written automatically from each paper's text. Figures and videos come from the paper and its project page; all credit goes to the authors.
