百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Q

qgf

> 编程语言
开源

用于 Q 指导流程和常用 RL 基准的 JAX 实现

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Q 指导流程和常用 RL 基准的 JAX 实现

Overview

Q-guided flow (QGF) is a test-time RL algorithm that trains a reference flow-matching policy via behavioral cloning and a TD-based critic separately, then at inference guides the denoising process with a novel critic gradient estimator to sample higher-value actions — achieving policy improvement without any actor-critic training.

Installation

With uv (recommended):

bash
uv venv --python 3.10
source .venv/bin/activate
uv sync

With pip:

bash
python3.10 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Datasets

OGBench (single-task, 100M)

Download the OGBench datasets and set OGBENCH_DATA_DIR to the directory containing per-environment subdirectories of .npz slice files:

$OGBENCH_DATA_DIR/
  cube-triple-play-100m-v0/    ← *.npz slice files
  cube-quadruple-play-100m-v0/
  puzzle-4x4-play-100m-v0/
  scene-play-100m-v0/
  ...

Refer to the OGBench repository for download instructions.

bash
export OGBENCH_DATA_DIR=/path/to/ogbench/data

The experiment generation scripts below assume this environment variable is set.

Running a single experiment

All experiments are launched through main.py. The agent configuration is passed via --agent=agents/.py and all agent hyperparameters can be overridden with --agent.=.

QGF (our method)

…

The above is an example command for running on cube-triple-play-singletask-task1-v0, change the environment name and dataset directory as needed. The --guidance_weights flag specifies all the guidance weights to try in a for-loop during policy evaluation, and the evaluation statistics (e.g. success rate) for different guidance weights are saved under different keys.

Checkpoints are saved to exp/qgf/{wandb_run_group}/{exp_name}/params_{step}.pkl.

Launching full paper experiments (via SLURM)

Each scripts/exp_*.py generates a SLURM batch script under sbatch/ and prints commands in debug mode. The generated scripts use GNU parallel to run multiple jobs per GPU — make sure it is installed on your cluster before submitting.

Train-time methods

These baselines train their own actor/critic jointly — just run the script:

bash
python scripts/exp_cfgrl.py  && bash sbatch/cfgrl.sh
python scripts/exp_fql.py    && bash sbatch/fql.sh
python scripts/exp_edp.py    && bash sbatch/edp.sh
python scripts/exp_qam.py    && bash sbatch/qam.sh
python scripts/exp_dac.py    && bash sbatch/dac.sh
python scripts/exp_qsm_bc.py && bash sbatch/qsm_bc.sh

Test-time methods

These methods apply guidance at inference time on top of a shared base model (BC as the actor, IQL as the critic). Train the base model first, then run the desired test-time script:

…

If you'd like, you can also run evaluation with your chosen test-time method periodically during training. For example, to run just QGF training + evaluation, use:

bash
python scripts/qgf_train_test.py && bash sbatch/qgf_train_test.sh

Environments

The paper experiments (and scripts above) use the simulated environments from OGBench. There are also other environment types supported under envs/, such as exorl, d4rl, and robomimic, though they are not used in the paper.

Agents

agents/ contains the implementation of common RL agents, including QGF, train- and test-time methods compared in the paper, as well as other common RL agents which are not used in the paper.

Pre-commit hooks

bash
pre-commit install

Acknowledgments

This codebase is built with reference implementations from FQL and QAM.

BibTeX

bibtex
@article{zhou2026qgf,
  title   = {Test-Time Gradient Guidance of Flow Policies in Reinforcement Learning},
  author  = {Zhou, Zhiyuan and Peng, Andy and Xu, Charles and Li, Qiyang and
             Springenberg, Jost Tobias and Frans, Kevin and Levine, Sergey},
  year    = {2026},
  journal = {arXiv preprint arXiv:2606.11087},
}

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonreinforcement-learning

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言