How qiqihezh/agentic-grpo-longhorizon works
1. What this repo is
This is a research/experiment repository for training and evaluating long-horizon, multi-tool agents on τ-bench, with the main focus on the airline domain. The project’s contribution is not a new runtime from scratch; it is a config-driven experiment layer on top of two vendored codebases: verl/ for RL training/inference infrastructure and tau-bench/ for the benchmark environment and tools.
2. Main architectural split
The repository has three major layers:
- Experiment orchestration in agentic-grpo-longhorizon/
- Benchmark/environment in tau-bench/
- RL framework and model/runtime infrastructure in verl/
The top layer wires the other two together with configs, scripts, and analysis artifacts.
3. Experiment configuration layer
Most experiment behavior is driven by Hydra YAMLs under agentic-grpo-longhorizon/configs/. These separate:
- training configs for GRPO/SFT/mock runs,
- evaluation configs for each ablation and checkpoint,
- interaction configs that define how τ-bench conversations and tool use are exposed,
- tool configs that bind the agent to benchmark tools.
This is the main boundary for reproducible experiments: the code is relatively stable, while each ablation is a different config stack.
4. Training pipeline
Training is launched from scripts/train/ and mainly follows two tracks:
- SFT data collection and warm-start training,
- GRPO training for the four ablations and baseline.
The scripts emit run-specific artifacts into outputs/, while curated experiment results and checkpoints live in experiments/. The src/training/sft_dataset.py module supports dataset construction for the SFT phase.
5. Evaluation pipeline
Evaluation is separate from training and is launched through scripts/eval/. It reads model checkpoints and experiment configs, runs benchmark episodes, and writes structured results such as:
- eval_report.json,
- split_eval_report.json,
- failure-case JSON files.
src/evaluation/pass_k_eval.py provides the independent pass@k-style evaluator used to compare checkpoints across vanilla GRPO, Turn-Discount, PRM-Lite, LATA, and the joint method.
6. Environment and tool boundary
The project-specific environment glue is in src/envs/, which wraps τ-bench airline interactions and tool definitions:
- tau_bench_wrapper.py
- tau_bench_interaction.py
- tau_bench_tools.py
This layer is the boundary between the policy and the benchmark. It translates agent actions into benchmark tool calls and interaction state, and it is where the PRM-Lite-style interaction shaping lives.
7. Benchmark internals
tau-bench/ contains the actual benchmark domains, data, and tools. The airline and retail domains each include:
- environment logic,
- task definitions,
- tool implementations,
- domain data files,
- human-agent transfer and think/calculate helpers.
The airline domain is the primary training target in this repo; retail is used for cross-domain evaluation and sanity checks.
8. Policy and inference runtime
src/models/vllm_policy.py is the local wrapper around the inference stack, and scripts/vllm_server/ contains launch scripts for the serving side. In the experiment setup, vLLM is used to run both:
- the policy model,
- the user simulator.
This is important architecturally because rollout generation is not just offline dataset replay; it is a live multi-turn interaction loop backed by model serving.
9. Core RL framework
The vendored verl/ tree is the main execution engine. It provides:
- trainer entrypoints,
- actor/critic/reward manager abstractions,
- rollout implementations,
- FSDP and Megatron worker stacks,
- vLLM/SGLang rollout backends,
- model registry and checkpoint utilities.
The project-specific configs and scripts select among these backend choices. In architecture terms, verl is the heavy distributed runtime, while this repo’s top-level code decides how to apply it to τ-bench.
10. Ablation-specific algorithmic boundary
The key experimental logic is split across the ablation configs and the benchmark interaction/reward path:
- Vanilla GRPO baseline,
- Turn-Discount shaping,
- PRM-Lite process reward rules,
- LATA length-aware token advantage,
- Joint PRM-Lite + LATA.
These are not separate services; they are alternate reward/advantage formulations that plug into the same training pipeline.
11. Data artifacts and provenance
The repository keeps both generated and intermediate artifacts under versioned directories:
- experiments/ for collected datasets, evaluation reports, and failure cases,
- outputs/ for Hydra run outputs and config snapshots,
- docs/ for diagnosis reports and ablation analysis,
- agentic-grpo-longhorizon-blog.md as a narrative summary of the findings.
This makes the repo self-documenting and allows offline reproduction of a specific run.
12. Operational constraints
The project is designed for offline HPC-style execution with explicit launcher scripts and environment setup. The stack is Python 3.10+, PyTorch 2.7, CUDA 12.6, and relies on distributed inference/training infrastructure from verl. The presence of many shell scripts and generated configs indicates that the main architectural control plane is script + config, not a long-running application server.
13. How to draw the architecture diagram
A correct diagram should show:
- a config/script orchestration layer at the top,
- a training/evaluation pipeline in the middle,
- a benchmark environment/tool layer on one side,
- a model serving/rollout layer on the other,
- and the verl distributed trainer/runtime as the core engine.
The principal data flow is: configs/scripts → trainer/runtime → rollout against τ-bench environment/tools → reward/evaluation → checkpoints/reports back into experiments/ and outputs/.
Main entry points: envs τ-bench glue · trainer Trainer core · outputs Outputs · train Train scripts
Components 18
Experiment layer
Config-driven experiment control plane in the repository root.
- Configs · Hydra YAML stacks for training, evaluation, interactions, tools, and mock runs.
agentic-grpo-longhorizon/configs - Train scripts · Shell entrypoints for SFT, GRPO, and mock experiment runs.
agentic-grpo-longhorizon/scripts/train - Eval scripts · Shell and Python entrypoints for benchmark evaluation and ablation comparison.
agentic-grpo-longhorizon/scripts/eval - vLLM launch · Launch scripts for policy and user-simulator inference serving.
agentic-grpo-longhorizon/scripts/vllm_server
Project code
Repository-specific glue code for training, evaluation, models, and τ-bench integration.
- τ-bench glue · Wrappers that adapt τ-bench airline interactions, context, and tools to the agent loop.
agentic-grpo-longhorizon/src/envs - SFT data · Builds supervised fine-tuning datasets for the airline warm-start phase.
agentic-grpo-longhorizon/src/training/sft_dataset.py - Pass@k eval · Independent evaluator used to compare checkpoints across ablations.
agentic-grpo-longhorizon/src/evaluation/pass_k_eval.py - Policy wrapper · Local wrapper around the inference stack for rollout-time policy execution.
agentic-grpo-longhorizon/src/models/vllm_policy.py
τ-bench
Vendored benchmark environment, domains, tools, and model utilities.
- Airline domain · Primary τ-bench domain with tasks, rules, data, and tools for airline interactions.
tau-bench/tau_bench/envs/airline - Retail domain · Secondary τ-bench domain used for cross-domain evaluation and sanity checks.
tau-bench/tau_bench/envs/retail - Model utils · τ-bench model serving and API utilities for agent/user simulation.
tau-bench/tau_bench/model_utils
verl runtime
Vendored distributed RL framework, workers, trainers, and rollout backends.
- Trainer core · Main RL training entrypoints, configs, PPO/SFT orchestration, and runtime wiring.
verl/verl/trainer - Workers · Actor, critic, rollout, reward, and engine workers used by the trainer.
verl/verl/workers - Rollouts · vLLM and SGLang rollout implementations, async servers, and sharding managers.
verl/verl/workers/rollout - Reward loop · Reward managers and algorithm-specific reward loops for GRPO and related methods.
verl/verl/experimental/reward - Model registry · Model adapters, checkpoint utilities, and backend-specific model implementations.
verl/verl/models
Artifacts
Generated experiment outputs, checkpoints, and reports.
- Outputs · Hydra run outputs, config snapshots, checkpoints, reports, and failure cases.
agentic-grpo-longhorizon/outputs - Experiments · Versioned experiment datasets, evaluation reports, and collected trajectories.
agentic-grpo-longhorizon/experiments
Connections 23
- Configs → Train scripts: drives · Training runs are selected by config stacks and launched by shell scripts.
- Configs → Eval scripts: drives · Evaluation variants are selected via dedicated Hydra configs and scripts.
- Train scripts → Trainer core: launches · Scripts invoke the distributed trainer runtime for SFT and GRPO.
- Eval scripts → Pass@k eval: runs · Evaluation scripts call the checkpoint comparison and pass@k evaluator.
- vLLM launch → Policy wrapper: serves · Serving scripts boot the local vLLM policy/user-simulator wrapper.
- Trainer core → Workers: coordinates · Trainer orchestrates actor, critic, rollout, and reward workers.
- Workers → Rollouts: uses · Workers delegate generation to vLLM or SGLang rollout backends.
- Workers → Reward loop: scores · Reward managers and reward loops compute training signals.
- Trainer core → Model registry: loads · Trainer and workers rely on the model registry and checkpoint utilities.
- τ-bench glue → Airline domain: wraps · Project glue translates agent actions into airline benchmark interactions.
- τ-bench glue → Retail domain: wraps · The same glue supports retail cross-domain evaluation paths.
- τ-bench glue → Reward loop: defines shaping · Interaction shaping and ablation-specific rules feed the reward path.
- Policy wrapper → Model utils: calls · Rollout-time policy execution uses τ-bench model utilities and simulators.
- Policy wrapper → τ-bench glue: acts in · The policy interacts with benchmark state through the local env wrapper.
- Airline domain → Model utils: uses · Airline domain episodes rely on benchmark model utilities and simulator support.
- Retail domain → Model utils: uses · Retail episodes also use the shared benchmark model utilities.
- Rollouts → τ-bench glue: rolls out against · Distributed generation is executed inside the τ-bench environment boundary.
- Reward loop → Pass@k eval: compared by · Reward formulations are compared offline through the evaluator and reports.
- Train scripts → Outputs: writes · Hydra outputs and snapshots are produced during training runs.
- Eval scripts → Outputs: writes · Evaluation jobs write structured reports and failure cases.
- Outputs → Experiments: curates · Selected run artifacts are promoted into versioned experiment directories.
- Trainer core → Outputs: persists · Trainer checkpoints and logs are saved for later evaluation.
- Pass@k eval → Experiments: reads · Comparative evaluation consumes stored experiment checkpoints and reports.