Skip to content
hs-blackPublic

About

Official GeCo release codebase

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Generative Control as Optimization (GeCO)

Official PyTorch implementation of the NeurIPS 2026 paper "Generative Control as Optimization: Time-Unconditional Flow Matching for Adaptive and Robust Robotic Control".

GeCO reformulates continuous action generation in robot policies as iterative optimization over a stationary, observation-conditioned velocity field, replacing the fixed integration schedule used by standard diffusion and flow-matching controllers. The same field norm doubles as a convergence criterion (for adaptive inference) and as a training-free OOD signal (for deployment-time anomaly detection).

This repository provides a DiT-based GeCO policy on the LIBERO benchmark, along with the rectified-flow baseline used in the paper.

Project page · Paper · Presentation video

Repository layout

GeCO/
├── geco.py                    # Hydra entry point (training / inference)
├── geco/                      # GeCOModel + training and evaluation pipeline
├── policy/
│   ├── geco/                  # Time-unconditional transport / path / interpolant
│   ├── geco_samplers/         # GD, Adam, Newton, Muon, BFGS, ... refinement steps
│   ├── geco_step_schedulers/  # Fixed / linear / custom step-size schedules
│   ├── geco_stoppers/         # Convergence-based early stopping
│   ├── geco_detectors/        # OOD detectors built on the residual norm
│   ├── observation.py         # Image transforms used at training/eval time
│   └── vision_language.py     # ViT + T5 conditioner
├── conf/config.yaml           # Default Hydra config (sampler / scheduler / stopper)
├── baseline.py                # Rectified-flow baseline (Table 1)
└── utils.py                   # Dataset wrapper + T5 language encoder

Installation

GeCO is built on top of CleanDiffuser (lightning branch).

conda create -n geco python==3.10
conda activate geco

# Install PyTorch for your GPU and CUDA version. Example for CUDA 12.1:
conda install pytorch==2.2.2 torchvision==0.17.2 pytorch-cuda=12.1 -c pytorch -c nvidia

git clone https://github.com/hs-black/GeCo.git
cd GeCo
git clone --branch lightning https://github.com/CleanDiffuserTeam/CleanDiffuser.git
pip install -e ./CleanDiffuser
pip install hydra-core sentencepiece torchdiffeq wandb "transformers>=4.39,<5"

Install the simulator and LIBERO assets using the CleanDiffuser LIBERO guide. Run the commands below from the GeCo repository root. The first evaluation downloads T5-base and DINOv2-base from Hugging Face.

Evaluate the released LIBERO policies

The GeCO LIBERO model repository contains one policy per suite. Each PyTorch state dictionary has a matching action normalizer. With that file, evaluation requires the LIBERO simulator and task assets, and can run without the training demonstrations.

Suite Weights Action normalizer
LIBERO-Goal (libero_goal) libero_goal.pt libero_goal.json
LIBERO-Spatial (libero_spatial) libero_spatial.pt libero_spatial.json
LIBERO-Object (libero_object) libero_object.pt libero_object.json
LIBERO-Long (libero_10) libero_10.pt libero_10.json

From the GeCo checkout, set suite to one of the four suite IDs above. This example runs task 0, initial state 0.

suite=libero_goal
hub=https://huggingface.co/hs-black/geco-libero/resolve/main
mkdir -p checkpoints
curl -fL --retry 3 -o "checkpoints/$suite.pt" "$hub/$suite.pt"
curl -fL --retry 3 -o "checkpoints/$suite.json" "$hub/$suite.json"
curl -fL --retry 3 -o checkpoints/SHA256SUMS "$hub/SHA256SUMS"
(cd checkpoints && awk -v s="$suite" '$2 == s ".pt" || $2 == s ".json"' SHA256SUMS | sha256sum -c -)

MUJOCO_GL=egl PYOPENGL_PLATFORM=egl python geco.py mode=inference "task_suite=$suite" \
  "inference.ckpt_file=$PWD/checkpoints/$suite.pt" \
  "inference.normalizer_file=checkpoints/$suite.json" \
  'inference.task_ids=[0]' inference.max_init_states=1 seed=0

In a LIBERO-Goal reference run on an RTX 5090, the robot opened the middle drawer (task 0, initial state 0) with 7.47 refinement steps per planning call on average. This checks a single rollout. To evaluate the full suite, omit the task and initial-state overrides. Use inference.max_workers to increase concurrency if GPU memory permits.

Train and evaluate your own policy

Download the LIBERO demonstrations and run CleanDiffuser's regeneration script as described in its LIBERO guide. Set paths.dataset_root in conf/config.yaml to the directory containing libero_goal.zarr. Both GeCO and the rectified-flow baseline read this setting and paths.save_root (default ./models).

Training

python geco.py mode=training task_suite=libero_goal wandb.enabled=false

This trains a single GeCO policy on a LIBERO suite with the truncated-linear velocity-rescale target $c(\gamma)$ described in Section 3.2 of the paper.

GeCO writes checkpoints to <save_root>/<task_suite>/step=<N>.ckpt with either local or W&B logging. Inference resolves relative checkpoint filenames under the same directory and also accepts an absolute path.

Inference

Set CKPT_FILE to the filename or absolute path of your saved checkpoint for the selected suite.

python geco.py mode=inference task_suite=libero_goal \
    "inference.ckpt_file='${CKPT_FILE}'"

Inference runs the optimization-based action generator from Algorithm 1: at each planning call the policy refines the action chunk under the stationary field $f_\theta(\cdot, z_t)$ until $|f_\theta|2 < \tau\text{opt}$ or the maximum step budget is reached. Evaluation reports task success rate and mean refinement steps per planning call, for each task and for the suite overall.

Adaptive inference knobs

The relevant Hydra blocks live in conf/config.yaml:

Block Purpose
sampler_config Optimizer used to follow $f_\theta$ (GD by default)
scheduler_config Step-size schedule ${\eta_k}$ during refinement
stopper_config Convergence threshold $\tau_\text{opt}$ for early exit
detector_config Optional sampling diagnostics (disabled by default)

For a policy trained on LIBERO-Long (suite ID libero_10), evaluate with a 20-step budget and a convergence threshold of 0.4:

python geco.py mode=inference task_suite=libero_10 \
    "inference.ckpt_file='${CKPT_FILE}'" \
    scheduler_config.params.steps=20 \
    stopper_config.gmin=0.4

Rectified-flow baseline

python baseline.py --mode training   --task_suite libero_goal
python baseline.py --mode inference  --task_suite libero_goal --solver euler --sample_steps 20

The baseline stores its checkpoints under <save_root>/baseline_fm/<task_suite>/. Use --dataset_root or --save_root to override the shared configuration.

This is the time-conditioned Continuous Rectified Flow baseline reported in Table 1 of the paper.

About

Official GeCo release codebase

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages