Kangrui Wang*, Pingyue Zhang*, Zihan Wang*, Yaning Gao*, Linjie Li*, Qineng Wang, Hanyang Chen, Chi Wan, Yiping Lu, Zhengyuan Yang, Lijuan Wang, Ranjay Krishna, Jiajun Wu, Li Fei-Fei, Yejin Choi, Manling Li
(* equal contribution)
VAGEN is a reinforcement learning framework for multi-turn VLM agents. Beyond task success, it can reward the agent's world model reasoning: StateEstimation ("what is the current state?") and TransitionModeling ("what comes next?"), scored by an LLM judge. Harness, environment, model, rollout, and evaluation are separate modules, so these rewards are independent of the training algorithm.
World Modeling RL supervises the agent's world-model reasoning explicitly (Figure 1) and treats a multi-turn task as a POMDP (Figure 2).
| Figure 1. Overview of the VAGEN framework. | Figure 2. POMDP formulation of multi-turn VLM agentic tasks. |
[2026/08] Moved to verl 0.9.0 and split the environment and harness layers. The previous codebase is tagged vagen-lite-verl-v0.6.1-final.
[2026/02] main is now VAGEN-Lite. The previous full-featured release is on the vagen-legacy branch.
[2025/12] Released VAGEN-Lite, a lightweight reimplementation on the verl agent loop.
[2025/09] VAGEN is accepted at NeurIPS 2025.
[2025/04] Modular environments and services: see Creating Environments and Creating Services (environments hosted in a separate process).
[2025/03] Released VAGEN.
Requires Python 3.12 and a CUDA 13 driver. See Quick Start for GPU sizing and a manual install.
conda create -n vagen python=3.12 -y
conda activate vagen
git clone https://github.com/mll-lab-nu/VAGEN.git
cd VAGEN
bash scripts/install.sh # SGLang 0.5.13 (default)scripts/install.sh checks out the pinned verl submodule (the verl 0.9 fork
JamesKrW/verl vagen-main) and installs
the CUDA 13 stack: Torch 2.11.0, SGLang 0.5.13, Transformers 5.8.1, and TransferQueue 0.1.9 (only used with
trainer.use_v1=true). It is safe to re-run; SKIP_ENGINE=1 keeps and verifies an existing
rollout engine. For vLLM:
BACKEND=vllm bash scripts/install.sh # vLLM 0.22.0Keep vLLM and SGLang in separate environments (their flashinfer builds conflict).
Training examples default to SGLang; pick vLLM explicitly.
Environments (vagen/configs/env_registry.yaml): Sokoban, FrozenLake, SpatialGym,
PrimitiveSkill, and RemoteEnv (used by Navigation). Extra setup is needed for
spatial_gym (dataset),
navigation (AI2-THOR), and
primitive_skill (ManiSkill).
All environments expect
<perception>...</perception><reasoning>...</reasoning><prediction>...</prediction><answer>...</answer>,
or the compact <think>...</think><answer>...</answer>; see
Configuration.
wandb login
# Self-hosted W&B:
# WANDB_BASE_URL=https://your-wandb-host wandb login --host https://your-wandb-hostcd VAGEN
# Qwen2.5-VL: concat / no-concat / compact
bash examples/train/sokoban/train_default_gae_qwen25vl3b.sh
bash examples/train/sokoban/train_ppo_no_concat_qwen25vl3b.sh
bash examples/train/sokoban/train_default_gae_compact_qwen25vl3b.sh
# Qwen2.5-VL: state reward -- LLM judge (started by the script) / exact bi-level GAE recipe
# (the bi-level script header explains how to switch it to a judge)
bash examples/train/sokoban/train_default_gae_sr_qwen25vl3b.sh
bash examples/train/sokoban/train_bi_level_gae_sr_qwen25vl3b.sh
# Any hydra override can be appended, e.g. more GPUs and another seed
bash examples/train/sokoban/train_default_gae_qwen25vl3b.sh trainer.n_gpus_per_node=8 seed=2
# Qwen3-VL, Qwen3.5 non-thinking, InternVL3.5 and GLM-4.6V-Flash accept
# HARNESS=concat|no_concat|compact (concat is the default).
HARNESS=concat bash examples/train/sokoban/train_default_gae_qwen3vl4b.sh
HARNESS=concat bash examples/train/sokoban/train_default_gae_qwen35_4b.sh
HARNESS=concat bash examples/train/sokoban/train_default_gae_internvl35_2b.sh
HARNESS=concat bash examples/train/sokoban/train_default_gae_glm46v_flash.sh
# Qwen3.5 native thinking (concat)
bash examples/train/sokoban/train_default_gae_qwen35_4b_think.sh
# Validation only, without starting training
bash examples/train/sokoban/train_default_gae_internvl35_2b.sh \
trainer.val_only=true trainer.save_freq=-1 trainer.test_freq=-1See Configuration for harnesses, estimators, model flags, and
state rewards. Training uses verl's V0 trainer by default; append
trainer.use_v1=true full_determinism=False for V1 colocate_async
(Colocated asynchronous training).
cd VAGEN
# SGLang (default)
MODEL_PATH=Qwen/Qwen2.5-VL-3B-Instruct \
bash examples/evaluate/sokoban/sglang/eval_qwen25_vl_3b.sh
# A hosted model on OpenRouter (export OPENROUTER_API_KEY)
bash examples/evaluate/sokoban/run_eval.shEach environment has sglang/ and vllm/ launchers; see Evaluation.
vagen/
├── algorithms/ # advantage algorithms and registry
├── envs/ # environment facade, shared contracts, implementations
├── harness/ # context-policy facade and implementations
├── models/ # model-family adaptation
├── rollout/ # framework-independent episode execution
├── evaluation/ # standalone evaluation and backend plugins
└── training/ # verl agent-loop and trainer integration
Each extension package (envs, harness, algorithms) has a _common/ directory for
shared contracts and one directory per implementation; import through the package
(vagen.envs, ...). Shared reward code is in vagen/envs/_common/rewards/; an
environment's own reward spec stays in that environment's directory.
- Subclass
GymImageEnv(from vagen.envs import GymImageEnv); seesokoban_env.py. - Register it in
vagen/configs/env_registry.yaml. - Write train/val configs, e.g. from
train_sokoban_vision.yamlandtest_sokoban_vision.yaml. - Copy a training script such as
train_default_gae_qwen25vl3b.sh.
Details: Custom Environment.
Add an estimator under vagen/algorithms/<name>/ and import it from the
vagen.algorithms facade:
from vagen.algorithms import AdvantageInputs, AdvantageOutputs, advantage_estimator
@advantage_estimator("my_estimator", needs_critic=True)
def my_estimator(inputs: AdvantageInputs):
returns = inputs.rewards
advantages = (returns - inputs.values) * inputs.response_mask
return AdvantageOutputs(advantages=advantages, returns=returns)Select it in a training command with algorithm.adv_estimator=my_estimator. See
inputs.py for the available inputs and the
implementation directories under vagen/algorithms for examples.
A harness is the agent loop: it owns the message list, calls client.create(messages),
and steps the environment until it terminates or truncates. concat, no_concat, and
compact differ only in how they build the message list. A harness never touches token
masks, verl rows, or rewards, so any BaseEnv or BaseHarness subclass works in both
training and evaluation unchanged.
from vagen.harness import BaseHarness, register_harness
@register_harness("mine")
class MyHarness(BaseHarness):
#: Whether one episode can end up in more than one row. The trainer asks the harness
#: rather than keeping a list of the ones it knows, and pairs the estimator accordingly.
splits_episode_across_rows = True
async def run_episode(self, client, env):
observation, _ = await env.reset()
messages = [await env.system_prompt(), observation]
while True:
response = await client.create(messages)
observation, reward, terminated, truncated, info = await env.step(response)
if terminated or truncated:
return
messages.extend([
{"role": "assistant", "content": response.text},
observation,
])Both training and evaluation read a harness key (a registered name or an import path):
# training -- vagen/configs/vagen_multiturn.yaml, or a -o override
trainer:
harness: mine
# each verl worker must import your module, or the name is unknown:
# actor_rollout_ref.model.external_lib=mypkg.harnesses# evaluation -- examples/evaluate/<env>/config.yaml
envs:
- name: Sokoban
harness: mypkg.harnesses:MyHarness # an import path, not a bare nameEvaluation has no external_lib, so nothing imports your module and a bare harness: mine
fails with unknown harness 'mine'. Use the import path; VAGEN imports it for you.
See the Documentation for more customization options:
- Custom Filter — Trajectory filtering (e.g., Reward Variance (RV) filter in RAGEN)
- Custom Metric — Add W&B logging metrics
- Configuration — Training configuration reference
Training defaults are in vagen/configs/vagen_multiturn.yaml.
# no_concat: the input is the system prompt + the current observation
trainer:
harness: no_concat # concat | no_concat | compact
model_adapter: auto # detects qwen | internvl | glm; verl remains the transport
# no_concat/compact split an episode across rows, so the estimator must stitch rows back
# together; verl's `gae`/`grpo` don't, and the trainer refuses them at startup.
algorithm:
adv_estimator: default_gae # or turn_level_gae | token_level_gae | trajectory_grpo
# default_gae: the whole episode reward on the last token (vanilla baseline)
# With a training rollout dir set, this also dumps every training image: watch disk usage.
trainer:
log_image:
enable: false # save rollout/validation images to disk
max_pending: 2 # max concurrent async image dump tasks
png_compress_level: 0 # PNG compression (0 = fastest, 9 = smallest)# export HF_TOKEN=xxx
huggingface_hub:
hf_save_freq: null # upload every N steps (must be a multiple of trainer.save_freq); null = disabled
repo_id: vagen-training # default; a bare name means <your account>/vagen-training
private: falsefilter:
name: reward_variance_top_p # registered by vagen.training.filters
filter_kwargs:
top_p: 0.9
enable: False # recommended for GRPOSee docs/issues.md
If you find our framework and paper useful, we appreciate it if you could cite our work:
@inproceedings{wang2025vagen,
title={VAGEN: Reinforcing World Model Reasoning for Multi-Turn VLM Agents},
author={Kangrui Wang and Pingyue Zhang and Zihan Wang and Yaning Gao and Linjie Li and Qineng Wang and Hanyang Chen and Chi Wan and Yiping Lu and Zhengyuan Yang and Lijuan Wang and Ranjay Krishna and Jiajun Wu and Li Fei-Fei and Yejin Choi and Manling Li},
booktitle={The Thirty-ninth Annual Conference on Neural Information Processing Systems},
year={2025},
url={https://arxiv.org/abs/2510.16907}
}