Binjie Zhang, Mike Zheng Shou†
Show Lab, National University of Singapore (†Corresponding author)
Project Page | arXiv | ECCV 2026 Paper | Code | Dataset
Official implementation of the ECCV 2026 paper ReGRPO: Reflection-Augmented Policy Optimization for Tool-Using Agents.
Tool-using vision-language models solve multimodal tasks by calling external tools, yet standard training gives little signal for recovering from tool errors. Supervised fine-tuning trains mostly on successful trajectories, while sparse trajectory-level RL rewards do not tell the model which step failed or how to fix it.
ReGRPO (Reflection-augmented Group Relative Policy Optimization) trains a tool-using agent to detect and fix tool errors in three stages:
-
Reflective Data Engine (Stage-1 SFT). Starting from clean trajectories in MM-Traj, we construct near-miss tool failures (corrupted arguments, wrong tools, missing context, or spatial grounding errors) and pair each failure observation with a structured
(ErrorType, Evidence, FixPlan)Reflection-of-Thought (RoT) triplet and the corrected action. Stage-1 SFT trains on these error-reflection-correction turns while masking earlier context turns. -
Reflection-Augmented Policy Optimization (Stage-2 RL). Reflection tokens
z_iare included directly in the local trajectorya_i^(0) -> o_i^(0) -> z_i -> a_i^(1) -> o_i^(1), so group-relative advantagesA_i^(k) = R(tau_i^(k)) - R_bar_iupdate both the diagnostic reflection and the corrected action. The reward is:R(tau) = lambda_exec * 1{success} - eta * C(tau) + lambda_val * V(x, tau)C(tau)penalizes reflection length (0when the first action succeeds), keeping reflections short. The first two terms give the default verifier-free objective (lambda_val = 0). An optional deterministic verifier termV(x, tau) = w_a * s_a + w_g * s_g + w_p * s_pwith weights(w_a, w_g, w_p) = (0.25, 0.50, 0.25)can be enabled during training withlambda_val = 0.3and is never used at test time. -
Zero-Verifier Inference. At test time, the agent runs single-path execution without calling any external verifier. Tool outputs are normalized into
{status, payload, meta}, and a deterministic trigger:g_i = 1{ToolError or EmptyObs or (i > 1 and u_i < kappa_i)}allows at most one local reflection and correction per step, where
u_i = exp(mean log pi_theta(action tokens))andkappa_iis the mean confidence of earlier steps in the trajectory.
Our multimodal planner is Qwen2-VL-7B-Instruct with LoRA on the attention projections (vision encoder and token compressor frozen), run inside a MAT-Agent ReAct loop.
All open-source controllers use single-path, zero-verifier inference (ECCV 2026 paper, Table 1).
| Method | Controller | GTA ToolAcc | GTA CodeExec | GTA AnsAcc | GAIA L1 | GAIA L2 | GAIA L3 | GAIA AnsAcc |
|---|---|---|---|---|---|---|---|---|
| HF Agent (closed ref.) | GPT-4o | 63.41 | 95.12 | 57.05 | 47.17 | 31.40 | 11.54 | 33.40 |
| HF Agent | Qwen2-VL-7B | 44.85 | 65.19 | 42.31 | 16.98 | 8.14 | 0.00 | 9.70 |
| T3-Agent | MAT-MiniCPM-V-8.5B | 65.85 | 80.49 | 52.56 | 26.42 | 11.63 | 3.84 | 15.15 |
| T3-Agent | MAT-Qwen2-VL-7B | 64.63 | 84.32 | 53.85 | 26.42 | 15.12 | 3.84 | 16.97 |
| SPORT Agent | Tuned-Qwen2-VL-7B | 72.41 | 91.87 | 60.26 | 35.85 | 16.28 | 3.84 | 20.61 |
| ReGRPO (default, λ_val = 0) | MAT-Qwen2-VL-7B | 76.35 | 93.77 | 67.66 | 39.02 | 18.71 | 4.89 | 23.35 |
All rows share the same Qwen2-VL-7B backbone and tool suite under single-path, zero-verifier inference (ECCV 2026 paper, Table 2).
| Method | SFT Data | RL | Reflection | GTA ToolAcc | GTA CodeExec | GTA AnsAcc | GAIA L1 | GAIA L2 | GAIA L3 | GAIA AnsAcc |
|---|---|---|---|---|---|---|---|---|---|---|
| MAT-Agent | MM-Traj | — | — | 64.63 | 84.32 | 53.85 | 26.42 | 15.12 | 3.84 | 16.97 |
| + RoT (SFT) | RoT | — | ✓ | 68.73 | 87.92 | 58.59 | 30.58 | 15.61 | 4.17 | 19.03 |
| + Optional Verifier Distill (no RL) | RoT | — | ✓ | 69.84 | 88.41 | 59.72 | 31.04 | 15.94 | 4.17 | 19.84 |
| GRPO-only (w/o RoT) | MM-Traj | GRPO | — | 71.34 | 90.23 | 64.51 | 36.79 | 18.12 | 3.84 | 18.92 |
| GRPO + Free-form Reflection | RoT | GRPO | ✓ | 73.05 | 91.02 | 65.34 | 37.26 | 18.02 | 4.17 | 21.38 |
| ReGRPO (default, λ_val = 0) | RoT | ReGRPO | ✓ | 76.35 | 93.77 | 67.66 | 39.02 | 18.71 | 4.89 | 23.35 |
| + Optional Verifier Reward (λ_val = 0.3) | RoT | ReGRPO | ✓ | 77.26 | 94.91 | 68.49 | 40.09 | 19.67 | 5.32 | 24.01 |
With lambda_val = 0, ReGRPO improves GTA AnsAcc by +7.40 and GAIA AnsAcc by +2.74 over SPORT Agent. Adding the optional deterministic verifier reward during training (lambda_val = 0.3) adds a further +0.83 on GTA AnsAcc and +0.66 on GAIA AnsAcc without changing inference.
ReGRPO/
├── regrpo/
│ ├── common/ # io.py, trajectory.py (tool-call parser), schema.py (RoT schema and checks)
│ ├── data/ # RoT data engine: teacher_client, perturb, prompts, quality, build_rot, verify_rot
│ ├── sft/ # Stage-1 SFT: train_sft.py (text); convert_qwen_vl.py, finetune_qwen_vl.py (vision)
│ ├── rl/ # Stage-2 RL: core.py, environment.py, trainer_minimal.py (text), trainer_qwen_vl.py (vision)
│ ├── inference/ # Zero-verifier trigger (trigger.py) and ReGRPOAgent (agent.py)
│ ├── configs/ # data_rot.yaml, sft_*.yaml, regrpo_*.yaml, regrpo_vl_{full,stab,verifier}.yaml
│ └── scripts/ # prepare_data.sh, run_build_rot.sh, run_sft.sh, run_regrpo.sh, run_inference.sh
├── tests/ # Unit tests for schema, parser, RL core, environment, trigger, and data converters
├── samples/ # Small sample JSON files for quick local tests
├── docs/ # Project page source (https://binjiezhang.github.io/ReGRPO/)
├── imgs/ # Paper figures
├── DATASET.md # RoT dataset documentation, schema, statistics, and upstream licenses
├── pyproject.toml # Package metadata and dependencies
├── requirements.txt # Core Python dependencies
├── LICENSE
└── README.md
Both the text and vision trainers share the RL loss and environment in regrpo/rl/core.py (reward, group advantage, sequence log-probability, and KL penalty) and regrpo/rl/environment.py.
We separate the lightweight text/dev environment from the Qwen2-VL-7B-Instruct GPU training environment, since Qwen2-VL agent code relies on transformers==4.50.2.
conda create -n regrpo python=3.10 -y && conda activate regrpo
pip install -e ".[dev]"conda create -n regrpo_vl python=3.10 -y && conda activate regrpo_vl
pip install "transformers==4.50.2" peft accelerate deepspeed qwen_vl_utils torch pyyaml
pip install -e . --no-depsBenchmark evaluation on GTA and GAIA uses the MAT-Agent evaluation framework. Each trained checkpoint is saved as a standard PEFT LoRA adapter that loads directly as the planner.
The released Reflection-of-Thought dataset (rot_train_clean.json, 16,552 records: 37.0% multimodal with image, 63.0% text-only) is available on HuggingFace at Benjaminzzz/ReGRPO-RoT. See DATASET.md for the schema, error-type counts, and upstream image dataset sources.
prepare_data.sh downloads rot_train_clean.json from Benjaminzzz/ReGRPO-RoT, links dataset/rot_train.json -> rot_train_clean.json, downloads mat_train.json from PengxiangLi/MAT, and runs verify_rot.py:
bash regrpo/scripts/prepare_data.sh
# Validate any RoT JSON file directly
python -m regrpo.data.verify_rot --path dataset/rot_train_clean.jsonMix the RoT records with clean MM-Traj trajectories (dataset/mat_train.json, 21,168 clean trajectories from PengxiangLi/MAT) for Stage-1 vision SFT:
python -m regrpo.sft.convert_qwen_vl \
--rot dataset/rot_train_clean.json \
--clean dataset/mat_train.json \
--clean-ratio 0.5 \
--out dataset/qwen_vl_train.jsonEach output sample includes mask_policy (clean trains all assistant turns; rot trains only the reflection-and-correction turn at train_turn_index).
You can also generate new RoT records from clean trajectories with any OpenAI-compatible teacher model (gpt-4o by default):
export OPENAI_API_KEY=sk-...
# Optional: export OPENAI_BASE_URL=https://your-endpoint/v1
# Optional: export REGRPO_TEACHER_MODEL=gpt-4o
# Small sample run
bash regrpo/scripts/run_build_rot.sh 50 dataset/rot_train.sample.json
# Full run (set num_trajectories: null in data_rot.yaml to process all trajectories)
python -m regrpo.data.build_rot \
--config regrpo/configs/data_rot.yaml \
--output dataset/rot_train.json
python -m regrpo.data.verify_rot --path dataset/rot_train.jsonYou can run the unit tests and minimal 1-step CPU examples on the sample data in samples/ without downloading external datasets or setting API keys:
# Unit tests
pytest
# Stage-1 SFT (1-step example on Qwen2.5-0.5B + LoRA) -> .cache/sft_smoke
bash regrpo/scripts/run_sft.sh 1
# Stage-2 ReGRPO RL (1-step example) -> .cache/regrpo_rl_smoke
bash regrpo/scripts/run_regrpo.sh 1
# Zero-verifier inference example (triggers one local reflection on a tool error)
bash regrpo/scripts/run_inference.shThe inference script prints reflections_fired=1. Once Qwen/Qwen2.5-0.5B-Instruct is cached locally, set HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 to run completely offline.
# Stage-1 SFT -> ./checkpoints/regrpo_text_sft
python -m regrpo.sft.train_sft --config regrpo/configs/sft_full.yaml
# Stage-2 ReGRPO RL -> ./checkpoints/regrpo_text_rl
# Set init_adapter: ./checkpoints/regrpo_text_sft in regrpo_full.yaml to start from Stage-1
python -m regrpo.rl.trainer_minimal --config regrpo/configs/regrpo_full.yamlSet model_name in the YAML config to any HuggingFace causal LM (e.g., Qwen/Qwen2.5-7B-Instruct).
conda activate regrpo_vl
# Stage-1: SFT on Qwen2-VL-7B with LoRA
python -m regrpo.sft.finetune_qwen_vl \
--data dataset/qwen_vl_train.json \
--model Qwen/Qwen2-VL-7B-Instruct \
--output-dir ./checkpoints/regrpo_vision_sft \
--max-len 8192 --bf16 --use-lora --gradient-checkpointing --use-images
# Stage-2: default verifier-free ReGRPO (lambda_val = 0)
python -m regrpo.rl.trainer_qwen_vl \
--config regrpo/configs/regrpo_vl_stab.yaml \
--data dataset/rot_train_clean.json
# Stage-2: optional training-time verifier reward (lambda_val = 0.3)
python -m regrpo.rl.trainer_qwen_vl \
--config regrpo/configs/regrpo_vl_verifier.yaml \
--data dataset/rot_train_clean.jsonUpdate model_name and init_adapter in the YAML configs when loading from local model or checkpoint directories.
The default vision RL config (regrpo/configs/regrpo_vl_stab.yaml) uses group_size=5, lambda_exec=1.0, eta=0.1, lambda_val=0.0, beta=0.3, lr=1.0e-6, max_len=2048, length_normalize=true, advantage_normalize=true, advantage_clip=1.0, grad_clip_norm=1.0, and warmup_steps=10. The optional verifier config (regrpo/configs/regrpo_vl_verifier.yaml) sets lambda_val=0.3 with subscore weights (w_a, w_g, w_p) = (0.25, 0.50, 0.25) during training while keeping inference verifier-free.
| Variable | Default | Purpose |
|---|---|---|
HF_DATASET_REPO |
Benjaminzzz/ReGRPO-RoT |
HuggingFace dataset repository used by regrpo/scripts/prepare_data.sh. |
DATA_DIR |
dataset |
Output directory for regrpo/scripts/prepare_data.sh. |
SKIP_MAT |
0 |
Set to 1 to skip downloading mat_train.json from PengxiangLi/MAT. |
OPENAI_API_KEY |
unset | API key for the teacher model when generating RoT data (not needed for training or inference). |
OPENAI_BASE_URL |
OpenAI default | Optional base URL for an OpenAI-compatible endpoint. |
REGRPO_TEACHER_MODEL |
gpt-4o |
Teacher model name for RoT data generation. |
REGRPO_SHUFFLE_RECORDS |
1 |
Shuffle records before applying the RL step budget in trainer_qwen_vl.py. |
HF_HUB_OFFLINE, TRANSFORMERS_OFFLINE |
unset | Set both to 1 for offline runs once models are cached. |
If you find this work useful, please cite our paper:
@inproceedings{zhang2026regrpo,
title = {ReGRPO: Reflection-Augmented Policy Optimization for Tool-Using Agents},
author = {Zhang, Binjie and Shou, Mike Zheng},
booktitle = {European Conference on Computer Vision (ECCV)},
year = {2026}
}Released under the MIT License.
Copyright (c) 2026 Binjie Zhang (Show Lab, National University of Singapore).
This code references and builds on MAT-Agent.
