How can we efficiently leverage coding agents for dexterous manipulation?

Tao Pang @

1X

Is the next release of Astra / Fable going to solve these challenges?

Agents operate robots with tools 

  • Forward kinematics
  • Inverse kinematics
  • Collision detection
  • Collision-free motion planning
  • etc.

Understanding the hardness of these challenges leads to more capable agents.

🤔

Opus 5.5
high

A simple experiment to measure agent performance

A simple experiment to measure agent performance

🤔

A Simple yet Interesting Task

  • Fixed initial configuration 
  • 200 random goal orientations \(\leq\) 60 degrees
    • 50 for training (agents can see)
    • 150 for validation (agents can't see)
  • Write a python script as a policy that reaches the goals (Code as Policy).
  • Emulate zero-shot / few-shot scenarios
    • Limited environment interaction
    • Both exploration and validation happen in high fixedly simulation (Drake)

1X

Opus 5.5
high

🤔

1X

Opus 5.5
high

A Simple yet Interesting Task

  • Fixed intitial configuration 
  • 200 random goal orientations \(\leq\) 60 degrees
    • 50 for training (agents can see)
    • 150 for validation (agents can't see)
  • Code as Policy.
  • Zero-shot / Few-shot execution

💵

$10 for tokens

A simple experiment to measure agent performance

🤔

1X

Opus 5.5
high

# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

# and more functions

💵

$10 for tokens

A simple experiment to measure agent performance

A Simple yet Interesting Task

  • Fixed intitial configuration 
  • 200 random goal orientations \(\leq\) 60 degrees
    • 50 for training (agents can see)
    • 150 for validation (agents can't see)
  • Code as Policy.
  • Zero-shot / Few-shot execution

🤔

1X

Opus 5.5
high

# Prompt
- Take the tools
- Do the task
# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

# and more functions

💵

$10 for tokens

A simple experiment to measure agent performance

A Simple yet Interesting Task

  • Fixed intitial configuration 
  • 200 random goal orientations \(\leq\) 60 degrees
    • 50 for training (agents can see)
    • 150 for validation (agents can't see)
  • Code as Policy.
  • Zero-shot / Few-shot execution

🤔

1X

Opus 5.5
high

# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

# and more functions
# Prompt
- Take the tools
- Do the task

💵

$10 for tokens

A simple experiment to measure agent performance

A Simple yet Interesting Task

  • Fixed intitial configuration 
  • 200 random goal orientations \(\leq\) 60 degrees
    • 50 for training (agents can see)
    • 150 for validation (agents can't see)
  • Code as Policy.
  • Zero-shot / Few-shot execution

Results

1X

"Training Loss"

# Prompt
- Take the tools
- Do the task

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

Opus 5.5
high

# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

Evaluation Runs

Results

# Prompt
- Take the tools
- Do the task

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

Opus 5.5
high

# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

"Training Loss"

Opus 5.5
high

💵

$10 for tokens

💵

$10 for tokens

# New Tools
# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass
# Prompt
- Take the tools
- Do the task this way: ...

Results

# Prompt
- Take the tools
- Do the task

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

Opus 5.5
high

# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass

"Training Loss"

Opus 5.5
high

💵

$10 for tokens

💵

$10 for tokens

# New Tools
# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass
# Prompt
- Take the tools
- Do the task this way: ...

$2

Results

# Prompt
- Take the tools
- Do the task

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

💵

$10 for tokens

Opus 5.5
high

Opus 5.5
high

💵

$10 for tokens

💵

$10 for tokens

# Tools: linear control, grasp planning 
def solve_linear_mpc(...):
	return argmin x.T @ Q @ x + u.T @ R @ u 
           s.t. x = A @ x_prev + B @ u
# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass
# Tools: Fingertip 
def calc_intertip_positions(...):
	pass

def solve_fintertip_ik(...):
    pass

def step_fintertips(...):
  	pass
# Prompt
- Take the tools
- Do the task by tuning linear control 

"Training Loss"

$2

Results, on the test set

  • $10
  • Fingertip tools
  • $10
  • Fingertip tools
  • Linear control tools

On the test set,

  • at convergence,       beats       in median (p = 0.016) and worst (p = 0.016) errors.
  • at $2,       also beats       in median (p = 0.008) and worst (p = 0.032) errors.     

1X

But why is linear control a good idea for contact-rich manipulation?

 

Isn't gradient of contact dynamics famously bad?

Hybrid contact dynamics

q_{x_+} = f(q_x, u)

Dynamics:

u_x
u_y
q_x
q_{x_+} = f(q_x, u)

Dynamics:

u_x
u_y
q_x
u_x
u_y
q_{x_+}

Sticking

Sliding Left

Sliding Right

Separation

Contact modes:

Hybrid contact dynamics

u_x
u_y
q_{x_+}

Sticking

Sliding Left

Sliding Right

Separation

How can we move the box to the right?

Contact modes:

u_x
u_y
q_x
q_{x_\text{goal}}
\begin{aligned} \min_{u} &\|q_{x_+} - {\color{blue} q_{x_\text{goal}}}\|^2 + \|u\|^2 \\ \text{s.t. }& q_{x_+} = f(q_x, u) \end{aligned}

Dynamics

Distance to goal

Effort

u_x
u_y
q_{x_+}

Sticking

Sliding Left

Sliding Right

Separation

How can we move the box to the right?

Contact modes:

u_x
u_y
q_x
u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}
q_{x_\text{goal}}
\begin{aligned} \min_{u} &\|q_{x_+} - {\color{blue} q_{x_\text{goal}}}\|^2 + \|u\|^2 \\ \text{s.t. }& q_{x_+} = f(q_x, u) \end{aligned}

Dynamics

Distance to goal

Effort

u_x
u_y
q_{x_+}

Sticking

Sliding Left

Sliding Right

Separation

How can we move the box to the right?

Contact modes:

u_x
u_y
q_x
u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}
q_{x_\text{goal}}
\begin{aligned} \min_{u} &\|q_{x_+} - {\color{blue} q_{x_\text{goal}}}\|^2 + \|u\|^2 \\ \text{s.t. }& q_{x_+} = f(q_x, u) \end{aligned}

Dynamics

Distance to goal

Effort

Particularly bad if we start here!

Can we search for the best contact mode?

u_x
u_y
q_x
u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}

Contact modes:

[HR2016]

q_{x_\text{goal}}
\begin{aligned} \min_{u} &\|q_{x_+} - {\color{blue} q_{x_\text{goal}}}\|^2 + \|u\|^2 \\ \text{s.t. }& q_{x_+} = f(q_x, u) \end{aligned}

Dynamics

Distance to goal

Effort

Sticking

Sliding Right

Sliding Left

Separation

Contact mode Transitions

(for longer-horizon problems)

Pitfalls of Mode Enumeration

System

Number of Modes

4^{1}
  1. No Contact

  2. Sticking Contact

  3. Sliding Left

  4. Sliding Right

Number of collision pairs

Pitfalls of Mode Enumeration

System

Number of Modes

4^{1}
  1. No Contact

  2. Sticking Contact

  3. Sliding Left

  4. Sliding Right

Number of

pairs of spheres

4^\binom{39}{2}=4^{741}

Number of collision spheres

Number of collision pairs

Pitfalls of Mode Enumeration

System

Number of Modes

4^{1}
  1. No Contact

  2. Sticking Contact

  3. Sliding Left

  4. Sliding Right

Number of

pairs of spheres

4^\binom{39}{2}=4^{741}

Number of collision spheres

Number of collision pairs

Over a horizon of 1!

How does RL deal with contact modes?

We believe RL handles contact modes with stochasticity.

\begin{aligned} &\mathbb{E}_{u \sim \pi_\theta} \left[ \nabla_\theta \log \pi_\theta(u|s) r\right]\\ \approxeq &\frac{1}{N}\sum_{i=0}^{N-1} \nabla_\theta \log \pi_\theta(u_i|s) r_i \end{aligned}

Policy Gradient

[OpenAI2018]

[Nvidia2022]

How does RL deal with contact modes?

RL considers a stochastic policy.

u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y
u_0
u_i \sim \mathcal{N}(u_0)
\mathbb{E}\left[\frac{\partial q_{x_+}}{\partial u_x} \Bigg|_{\red{u_0}} \right]
\approxeq \frac{1}{N} \sum_{i=1}^N \frac{\partial q_{x_+}}{\partial u_x}
u_i
> 0

[SPT2021, PSYT2023]

u_x
u_y
q_x

Randomized Smoothing

u_x
u_y
u_0
u_i \sim \mathcal{N}(u_0)
\approxeq \frac{1}{N} \sum_{i=1}^N \frac{\partial q_{x_+}}{\partial u_x}
u_i
> 0
N=10
\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y
N=100
N=500

[SPT2021, PSYT2023]

\mathbb{E}\left[\frac{\partial q_{x_+}}{\partial u_x} \Bigg|_{\red{u_0}} \right]

Randomized Smoothing

\approxeq \frac{1}{N} \sum_{i=1}^N \frac{\partial q_{x_+}}{\partial u_x}
u_i
> 0
N=10
\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y
N=100
N=500

[Duchi et al,  2012]

Randomized smoothing: sampling regularizes flat/stiff landscapes.

[SPT2021, PSYT2023]

\mathbb{E}\left[\frac{\partial q_{x_+}}{\partial u_x} \Bigg|_{\red{u_0}} \right]
u_x
u_y
u_0
u_i \sim \mathcal{N}(u_0)

Contact Mode Abstraction via Sampling

"Thumb Only"

"Thumb and index"

Ring Only

"Thumb, Index, Ring"

[SPT2021, PSYT2023]

x_+
u

Contact Mode Abstraction via Sampling

"Thumb Only"

"Thumb and index"

Ring Only

"Thumb, Index, Ring"

[SPT2021, PSYT2023]

x_+
u

Contact Mode Abstraction via Sampling

"Thumb Only"

"Thumb and index"

Ring Only

"Thumb, Index, Ring"

[SPT2021, PSYT2023]

x_+
u

Randomized vs Barrier Smoothing

\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y

Barrier smoothing

Randomized smoothing

u_x
u_y

The two smoothing schemes are practically equivalent!

1-step dynamics

[PSYT2023]

Randomized vs Barrier Smoothing

\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y

Barrier smoothing

Randomized smoothing

u_x
u_y

The two smoothing schemes are practically equivalent, but...

1-step dynamics

<

[PSYT2023]

500 dynamics evaluations per grid point

1 dynamics evaluation per grid point

Where can we trust the smoothed linearization? 

Drawing a circle around the nominal action?

u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y
q_x
{\color{green} \bar{u}}

Nominal action:

{\color{green} \bar{u}}
u_x
u_y

[SPZT2025]

{\color{green} \bar{u}}

Adding a few more constraints back to correctly capture the boundary.

u_x
u_y

Sticking

Sliding Left

Sliding Right

Separation

\frac{\partial q_{x_+}}{\partial u_x}
u_x
u_y
q_x
{\color{green} \bar{u}}

Nominal action:

{\color{green} \bar{u}}
u_x
u_y

[SPZT2025]

{\color{green} \bar{u}}

Where can we trust the smoothed linearization? 

Finally, moving the box to the right

Iteration 1

Iteration 2

u_x
u_y
q_x
q_{x_\text{goal}}

Initial Guess

Solution

\begin{aligned} \min_{u} &\|q_{x_+} - {\color{blue} q_{x_\text{goal}}}\|^2 + \|u\|^2 \\ \text{s.t. }& q_{x_+} = f(q_x, u) \end{aligned}

Dynamics

Distance to goal

Effort

[SPZT2025]

The same basic idea works on other embodiments

[SPZT2025]

To summarize...

  • Contact modes artificially inflate the hardness of dexterous manipulation.

  • Summarize many contact modes into one linear dynamics. 

So... better tools => better agents, what's next?

Robotics is notoriously long-tail.

So... better tools => better agents, what's next?

Robotics is notoriously long-tail.

So... better tools => better agents, what's next?

Robotics is notoriously long-tail.

To be truly generalists, robots need to efficiently learn from and adapt to real-world interactions.