RepositoryPythonCNTrung Quốc
waltstephen

waltstephen/CaPtain

CaPtain: A Pipeline for Post-Training Code-as-Policy Robot Agents — CaPtain-Harness, SFT and RL training code, benchmark adapters

151sao
7fork
0issue
2lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: code-as-policy

#1 Repository của tuần

1
TINIX TRENDING·Chủ đề: vision-language-model

#1 Repository của tuần

1
TINIX TRENDING·Chủ đề: libero

#1 Repository của tuần

CaPtain: A Pipeline for Post-Training Code-as-Policy Robot Agents

The first fully open, all-stage pipeline for a small, pure code-as-policy model

Paper Project Page Hugging Face Video License: MIT

CaPtain-4B at a glance

What is CaPtain

CaPtain post-trains a small open vision-language model into a code-as-policy (CaP) robot agent: the agent controls a robot by writing Python against low-level perception and motion primitives, reads the receipts of its own robot calls, and decides itself when the task is done. Everything needed to reproduce and use it is open:

  • CaPtain-Harness — a persistent, sandboxed Python session with 22 low-level capabilities (perception, geometric measurement, IK-level motion) and finish(), no high-level skills and no VLA. Every call returns a text receipt. The same API runs on LIBERO, LIBERO-PRO / Plus / MAX, RoboTwin 2.0, RoboDojo, SimplerEnv, CaP-Bench and real robots. The harness lives in its own repository, CaPtain-Harness, and is included here as a pinned git submodule at harness/.
  • The pipeline — SFT on synthetic agent trajectories collected in the harness, then RL with a simulator critic: a small critic reads the simulator's physical state (object poses, grasp state, sub-goal progress) and turns the change in its predicted success across each model request into that request's credit. The policy never sees this state.
  • CaPtain-4B — Qwen3.5-4B after SFT and RL. At test time it uses neither a frontier model nor a benchmark-trained VLA.
  • Open release — SFT data, model weights, harness, SFT and RL training code, and the RL infrastructure (streaming rollout servers, critic co-training, run supervisor).
CaPtain overview: inference in CaPtain-Harness (top), training and test (bottom)

News

Results

SFT → RL on the LIBERO family (host / strict success %; strict additionally requires that the agent called finish() itself):

BenchmarkEpisodesQwen3.5-4BCaPtain-4B-SFTCaPtain-4B
LIBERO, official held-out states 11–162400.0 / 0.055.4 / 52.173.8 / 67.5
LIBERO-PRO Pos+Task, 6-cell mean6000.3 / 0.259.5 / 56.778.5 / 71.5
LIBERO-PRO Pos+Task, 8-cell mean8000.2 / 0.149.2 / 45.168.6 / 58.9
LIBERO-Plus, 7 categories7000.0 / 0.048.6 / 44.666.1 / 59.0
LIBERO-PRO, 4 categories1600.0 / 0.048.8 / 48.168.8 / 60.6
LIBERO-MAX Dynamic800.0 / 0.040.0 / 40.061.2 / 50.0
LIBERO-MAX Base800.0 / 0.051.2 / 45.070.0 / 63.8
SFT vs RL host and strict success

LIBERO-PRO Pos+Task (6-cell / 8-cell mean, %): CaPtain-4B reaches 78.5, the best result we know of among systems that use neither a frontier model nor a LIBERO-trained VLA at test time (the full comparison is in the paper).

Zero-shot transfer of CaPtain-4B, trained only on LIBERO:

BenchmarkProtocolCaPtain-4BReference points
RoboTwin 2.0official Hard protocol, 50 tasks × 100 trials22.6 (single-arm 30.0)X-VLA 20.9, Xiaomi-Robotics-0 18.2, π0 16.3 (trained on RoboTwin demos)
SimplerEnvWidowX (Bridge) visual matching, 4 tasks × 2483.3ManiAgent (GPT-5) 86.8, PhysBrain 1.0 80.2, π0.5 57.1
CaP-BenchCube Lift + Cube Stack at CaP-Gym's step horizon75.0CaP-X M2 (Gemini-3-Pro) 73.5, CaP-RL 62.0
RoboDojo42 tasks, official layouts and action budget (leaderboard Score)1.7GPT-5.5 agent 1.1, RDT 0.5, OpenVLA-OFT 0.2

The transfer backends use inputs beyond the benchmarks' official policy observation (simulated depth, camera calibration, a wrist force or contact signal, and on SimplerEnv an added wrist camera); they are listed per benchmark in harness/eval/transfer/README.md. The agent never receives object poses, the success predicate or task progress.

Installation

Linux x86_64 with NVIDIA GPUs (EGL for MuJoCo; Vulkan for the SAPIEN / Isaac Sim transfer benchmarks), bubblewrap ≥ 0.5.

RouteUse it when you want to…
Harness onlyevaluate CaPtain-4B (or your own model) in CaPtain-Harness, or plug in a new robot or benchmark
+ transfer environmentsrun RoboTwin 2.0, RoboDojo or SimplerEnv (harness/eval/transfer/)
+ trainingreproduce SFT (sft/) and RL (rl/)

The harness is a git submodule (CaPtain-Harness, pinned to the commit used for this release), so clone recursively. In an existing clone, run git submodule update --init.

git clone --recursive https://github.com/waltstephen/CaPtain.git && cd CaPtain/harness
scripts/setup_third_party.sh                                   # LIBERO @ pinned revision into third_party/
python3.10 -m venv .venv-libero && .venv-libero/bin/pip install -r requirements-libero.txt \
  && .venv-libero/bin/pip install -e third_party/libero --no-deps && .venv-libero/bin/pip install -e . --no-deps
python3.11 -m venv ~/envs/student-py311 && ~/envs/student-py311/bin/pip install -r requirements-student.txt   # the agent's sandboxed Python
python3.11 -m venv .venv-transfer && .venv-transfer/bin/pip install -r requirements-transfer.txt              # only for RoboTwin / RoboDojo / SimplerEnv

Model weights (SAM 3, Molmo2-8B, CaPtain-4B): harness/scripts/download_models.sh. Perception services, the policy server (vLLM 0.29) and per-benchmark simulator installs are described in harness/INSTALL.md.

Quick Start

1. Evaluate CaPtain-4B on one LIBERO episode

cd harness
services/start_perception.sh                                    # SAM 3 :8114 + Molmo2-8B :8122
services/serve_policy.sh YijiaFan/CaPtain-4B 8600              # vLLM 0.29, OpenAI-compatible endpoint
STUDENT_PYTHON=~/envs/student-py311/bin/python eval/run_episode.sh libero_spatial 0 11 runs/demo
cat runs/demo/libero_spatial_0_seed-11/episode_result.json      # host_final_success, agent_finished, termination_reason, ...

Any OpenAI-compatible endpoint works (POLICY_URL, default http://127.0.0.1:8600/v1; --auth bearer reads CAPTAIN_API_KEY or OPENAI_API_KEY), so the harness can also run frontier models or your own checkpoints.

2. Reproduce the paper's evaluations

export POLICY_URL=http://127.0.0.1:8600/v1 STUDENT_PYTHON=~/envs/student-py311/bin/python EGL_DEVICE=0
python3 eval/run_jobs.py eval/tasks/libero_official_240.tsv --out runs/captain-4b --parallel 8
python3 eval/summarize.py eval/tasks/libero_official_240.tsv runs/captain-4b

The other task lists (LIBERO-PRO, LIBERO-Plus, LIBERO-MAX) are in harness/docs/harness.md; the transfer benchmarks in harness/eval/transfer/README.md.

3. Train

  • SFT (2 × 8 GPUs): sft/README.md — data format, recipe and train/launch_sft.sh.
  • RL (16 GPUs: 8 trainer + 8 rollout; an 8-GPU config is included): rl/README.md — bash rl/scripts/run_stream.sh rl/configs/captain-4b.json starts perception, policy servers, the environment server and the trainer under one supervisor.

Repository layout

PathWhat it is
harness/CaPtain-Harness (git submodule, pinned; repository): the python tool, the 22-capability robot API, receipts, completion gate, context compaction, perception services, all backends, evaluation runners, task lists and scorers
harness/eval/transfer/zero-shot transfer: install notes, official protocol settings, task lists, run and scoring scripts per benchmark
sft/SFT for CaPtain-4B-SFT: data format, trainer (DeepSpeed ZeRO-3), launch script, exact configuration
rl/RL for CaPtain-4B: streaming rollout and environment servers, the simulator critic, advantages, SAO-style update, trainer, run supervisor, final-run configuration
docs/figures used in this README

For AI agents

🤖 Most people now hand a repository to a coding agent. This section is written for that agent: paste it, or point your agent at AGENTS.md, which holds the same rules in more detail.

  • Entry points. Run one episode: harness/eval/run_episode.sh <suite> <task_id> <seed> <out_dir>. Run a task list: harness/eval/run_jobs.py <tasks.tsv> --out <dir>. Score: harness/eval/summarize.py. Train: sft/train/launch_sft.sh, rl/scripts/run_stream.sh <config>.
  • Where things live. Robot API, receipts and capability contracts: harness/src/captain_harness/adapters/ and ports/. One episode: harness/src/captain_harness/server/. ReAct loop, compaction, model client: harness/src/captain_harness/react/. Backends: adapters/{libero,robotwin2,robodojo,simplerenv,capgym,hardware}. RL critic and advantages: rl/.
  • Invariants you must keep.
    1. react must not import server or adapters and must not use robot or task vocabulary (tests/test_import_boundaries.py).
    2. Hidden state stays hidden: nothing served to the model carries poses, contacts or the success predicate; the episode output directory is hidden from the sandbox.
    3. Budgets (request cap, wall time, action budget) are enforced in the server, not the driver.
    4. Do not change model-visible text (TASK.md, tool descriptions, receipts, request template) when evaluating the released checkpoints; they were trained on exactly this text.
  • Adding a robot or benchmark. Implement a backend under adapters/ with the same capability manifest, register its suite, add a task list under eval/, and run pytest tests/test_transfer_wiring.py. For real hardware implement the driver protocol in adapters/hardware (measured state, one control tick, hold, camera frames with depth and intrinsics).
  • Checks before you finish. cd harness && .venv-libero/bin/python -m pytest -q tests/test_react_*.py tests/test_server_env_server.py tests/test_import_boundaries.py tests/test_transfer_wiring.py (seconds, CPU).
  • Configuration. Machine paths come from environment variables (POLICY_URL, STUDENT_PYTHON, EGL_DEVICE, CAPTAIN_ROOT, CAPTAIN_WORKSPACE, …); never hard-code paths or keys.

Hardware used for the paper

StageHardwareTime
SFT16 × H100-80GB~7.6 h (~120 GPU-hours)
RL (CaPtain-4B, 300 rounds of 256 episodes)16 × H100-80GB: 8 trainer; 8 rollout (6 vLLM policies, SAM 3, Molmo2-8B, EGL rendering)~1,290 GPU-hours
Evaluation1 GPU for the policy plus 1 for perception and rendering~6 min median per LIBERO episode

License

The code is released under the MIT License. Third-party components keep their own licenses; see THIRD_PARTY_LICENSES.md (SAM 3 weights fall under the SAM License). Model weights follow the license of the base model, Qwen3.5-4B (Apache-2.0). Release notes: RELEASE_NOTES.md.

Citation

@misc{fan2026captainpipelineposttrainingcodeaspolicy,
      title={CaPtain: A Pipeline for Post-Training Code-as-Policy Robot Agents}, 
      author={Yijia Fan and Xilin He and Yilei Jiang and Dongming Wu and Jiaxu Wang and Xiangyu Yue},
      year={2026},
      eprint={2610.40799},
      archivePrefix={arXiv},
      primaryClass={cs.RO},
      url={https://arxiv.org/abs/2610.40799}, 
}

Contact

Questions and issues: open a GitHub issue, or contact the corresponding author, Xiangyu Yue (xyyue@ie.cuhk.edu.hk).

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryPython
mani-skill/ManiSkill

Manipulation Skill Framework, an open source GPU parallelized robotics simulator and benchmark

3.6k
Aug 4, 2026
Repository
Octoday-Hub/Embodied-AI

「Octoday Hub 星期八具身智能生态社区」聚合论文、项目、课程、工具、数据集、招聘等资源,连接全球开发者、研究者与产业伙伴。

3.2k
Nov 19, 2026
RepositoryPython
isaac-sim/IsaacLab

Unified framework for robot learning with multi-physics/renderer support

8.8k
Dec 2, 2026
RepositoryPython
mbzuai-oryx/groundingLMM

[CVPR 2024 🔥] Grounding Large Multimodal Model (GLaMM), the first-of-its-kind model capable of generating natural language responses that are seamlessly integrated with object segmentation masks.

970
Sep 5, 2026
Repository
TianxingChen/Embodied-AI-Guide

[Lumina具身智能社区] 具身智能技术指南 Embodied-AI-Guide

17.1k
Nov 17, 2026
RepositoryRust
dora-rs/dora

DORA (Dataflow-Oriented Robotic Architecture) is middleware designed to streamline and simplify the creation of AI-based robotic applications. It offers low latency, composable, and distributed dataflow capabilities. Applications are modeled as directed graphs, also referred to as pipelines.

4.1k
Nov 30, 2026
Dataset
DAGroup-PKU/Open-HumanWAM-50K

Open-HumanWAM An Open Recipe for Scaling Human and Robot Experience for Embodied Foundation Models Report · Code · Project page · Models · HF Paper · Citation Open-HumanWAM overview: scaling human and robot experience for embodied foundation models. Open-HumanWAM-50K 50,000 hours of egocentric human manipulation video, with hand-motion and natural-language annotations, for scaling robot learning. Status: Upload in progress · Upload details. Open-HumanWAM-50K… See the full description on the dataset page: https://huggingface.co/datasets/DAGroup-PKU/Open-HumanWAM-50K.

♥0
1.8M
Nov 11, 2026
Dataset
HubLabs/HubEgo-100K

HubEgo-100K Release 3 (December 2026): +10,007 h added, 30,120 h in all. A 100,000-hour dataset of first-person video of skilled manual work, recorded by Hub contributors: building sites, workshops, salons, kitchens, shops, warehouses and homes, released in stages. Releases 1, 2 and 3 together have 30,120 hours of RGB + IMU from 24,333 contributors, in LeRobot and MCAP formats. Paper: HubEgo-100K: In-the-Wild Egocentric Video of Skilled Work for Robot Learning (arXiv:2611.21938… See the full description on the dataset page: https://huggingface.co/datasets/HubLabs/HubEgo-100K.

♥0
669.7k
Dec 2, 2026
Dataset
Hubdata/HubEgo-100K

HubEgo-100K First release as of 12th Nov 2026: 10,124 hours of first-person video of skilled manual work, recorded where the work actually happens: building sites, workshops, salons, kitchens, shops, warehouses and homes. 72,754 episodes from 12,227 people, filmed with a head-worn phone (1080p, 30 fps) with its motion sensors recorded alongside, in LeRobot v3 format. HubEgo-100K grows toward 100,000 hours in later releases. Highlights Real work, in the wild. No… See the full description on the dataset page: https://huggingface.co/datasets/Hubdata/HubEgo-100K.

♥0
669.7k
Dec 2, 2026