---
id: 16777
lang: en
title: "An LLM Writes Code for a Robot Arm: The Best Pairing Solved 22 of 25 Tasks Within Three Attempts"
published_at: "2026-10-27 20:02:15"
source_name: "Хабр: Машинное обучение"
source_url: "https://habr.com/ru/companies/ru_mts/articles/1097388/?utm_campaign=1097388&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/16777"
categories: ["robotics", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# An LLM Writes Code for a Robot Arm: The Best Pairing Solved 22 of 25 Tasks Within Three Attempts

> **Краткая суть (BLUF):** Code as Policy (CaP) means a language model does not drive the motors directly. Instead, it writes Python code for a robot arm: "put the cube on the table" becomes calls to move_to() and close_gripper(). On CodeActionBench, the best pairing, GPT-6 Astra with Codex CLI, solved 22 of 25 tasks in at least one of three attempts. But the code often runs without error while the cube stays where it was, so CaP suits quick prototyping and debugging, not precise physics.  - The loop: the model sees a frame, writes code, reads the errors, and rewrites the code. - Results on CodeActionBench range from 2.7% to 73.3%. - Weak spot: turning "to the left of the cup" into coordinates is hard.

Imagine telling a robot arm "put the cube on the red table," and instead of spinning the motors directly, the neural network writes an ordinary Python program. This approach is called Code as Policy, or CaP: the language model receives a description of the robot's functions and assembles them into an action script itself. The CodeActionBench benchmark, released at the end of September, tested how well this works. The best pairing, GPT-6 Astra with the Codex CLI tool, solved 22 of 25 tasks (about 88%) when given up to three attempts and counted as successful if it succeeded in at least one of them. Below, we look at where this result comes from and why it comes with serious caveats.

## Where the idea came from

In 2023, Alphabet shut down Everyday Robots, a project that aimed to build a robot for cleaning offices and sorting trash. The real human environment proved too chaotic. But the effort gave rise to a direction that continues to develop on its own: CaP.

For a long time, robotics had two poles. The first: an engineer hand-writes a rigid sequence of actions. The robot is predictable, but every new task requires a new program. The second: end-to-end learning, where a neural network takes in pixels and outputs servo angles. This is flexible, but opaque and requires thousands of demonstrations.

CaP offers a middle ground. The model receives a natural-language instruction and a description of the robot's API: get_object_position(), move_to(), close_gripper(). It outputs executable code that calls these functions in the right order. The code becomes a bridge between meaning ("what it means to put something down") and physics ("which calls implement that").

It has three practical advantages:

- **Debugging.** If the robot makes a mistake, you can open the code and see whether the coordinates are wrong, an obstacle was not accounted for, or the gripper was never opened. A VLA model (vision-language-action, a neural network that outputs actions directly from an image and text) only shows a wrong action vector.
- **Reuse.** A function such as pick_up(object) is written once and applied across different tasks.
- **Zero fine-tuning.** CodeActionBench deliberately denies the agent demonstrations and specialized perception modules. All learning happens through the prompt and by rewriting code based on feedback.

## Why one run is not enough

If the scheme were simply "the model wrote code, the robot executed it," success would be close to zero. CaP's strength lies in the agent loop. The agent receives an RGB image and the system state, writes a program, runs it, and checks the result: the object didn't move, the grasp failed. The model analyzes the failure, revises the code, and tries again.

The loop is what produces the numbers: those 22 of 25 tasks solved with at least one of three attempts. For an engineer, this is also a budget question. Each iteration means a new model call, new tokens, and time for a physical run. Three attempts per task noticeably increase cost and latency, and a real system has to account for that.

Results in the benchmark vary widely, from 2.7% to 73.3%. The potential is there, but stability is not yet.

## Where the method breaks down

Analysis of the trajectories revealed three problems.

1. **Spatial grounding.** The model understands what needs to be done but has trouble pinning down where the object is. The phrase "red cube to the left of the blue cup" has to become exact coordinates that account for perspective and camera calibration. An error here, and the robot grabs at air.
2. **Grasp physics.** The generated code rarely accounts for grip force. The LLM receives no real-time data on friction or acceleration, so the object can slip during movement.
3. **False success.** The agent sometimes considered the task complete when the cube stayed put or fell over. Running a script is not the same as achieving the goal. Research shows that VLMs acting as visual critics see the final frame but miss improper contact, misalignment, or a broken sequence of actions.

## What to do in practice

CaP does not replace VLAs; it complements them. It wins where fast adaptation without data collection is needed: a prompt describing the API can be written in minutes, while a VLA needs thousands of trajectories and lengthy training. It also wins where interpretability matters. It loses where physical precision and reliability are required.

The most likely future is hybrids: CaP handles high-level planning and policy generation, while a VLA or classical controllers handle low-level execution. The model decides what to do and in what order, while specialized modules make sure the object doesn't slip. If datasets for VLAs, for example from ordinary first-person video, become more accessible, CaP will have fewer speed-to-start advantages.

Advice for those building such systems: do not trust an agent's "done" message. Add independent verification of the outcome based on the state of the world, not on whether the code ran. Limit the number of attempts so the loop does not consume the budget. And keep physically sensitive operations such as grasping outside the language model's sphere of responsibility.

---
- **Первоисточник:** [Хабр: Машинное обучение](https://habr.com/ru/companies/ru_mts/articles/1097388/?utm_campaign=1097388&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/16777
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
