Code as Policies

Translates natural-language robot commands into hierarchical Python policy code that calls deterministic perception and motion-control primitives.

Read the paper

The loop

  1. Proposes

    A code-generation LLM recursively synthesizes Python policy functions and helper routines from a user instruction.

  2. Judged by

    A sandboxed Python interpreter, NumPy/Shapely spatial geometry calculators, and low-level robot impedance controllers execute the policy.

  3. Steers

    Closed-loop visual and geometric state queries inside the generated control loops adjust robot trajectories online.

Headline result

Executed spatial-geometric manipulation, drawing, and tabletop rearrangement tasks on physical Franka Panda and UR5e robot arms without task-specific training.

What this does not prove

Assumes that the perception primitives (object detectors and pose estimators) accurately ground the variable names referenced in the generated code.

How it generalizes the harness

The LLM compiles instructions into executable geometric control code whose loops and spatial math run deterministically on the robot.

Classification

Classification of Code as Policies
What it proposesProgram
Generative modelCodex / PaLM code-generation model
Algorithmic authorityShapely computational geometry library and classical robot motion controller
FeedbackTest results
What gets updatedPrompt context
When it runsAt inference time
ValidityEmpirical (measured)
EvidenceExperiments reported
LineageOriginal system