Hugging Face Hub 上线 RL 环境专区

原标题:Welcome RL Environments to the hub
68AI 研判分

Hugging Face Hub 正式推出强化学习(RL)环境专属板块,旨在为智能体提供标准化的任务交互、观测反馈与奖励评分机制。该功能允许开发者上传包含运行命令和奖励规则的环境文件,支持多种框架接入,以优化智能体的训练与评估流程。

报道正文

本文目录11 个章节

返回文章列表

欢迎 RL Environments 入驻 Hub

发布于 2026 年 9 月 28 日 在 GitHub 上更新 点赞 25

ben burtenshaw burtenshaw Adithya S K AdithyaSK Florian xeophon guest Ryan Marten ryanmarten guest merve merve Quentin Lhoest lhoestq Julien Chaumond julien-c

强化学习(RL)环境为智能体 AI 系统赋予了新的能力,同时也是衡量和提升智能体性能的有效方式。因此,Hugging Face Hub 现已为 RL Environments 设立了专属区域。

环境会为智能体分配任务,根据其动作返回观测结果,并对最终结果进行评分。由此产生的奖励可用于在评估阶段衡量智能体的性能,或在训练阶段提供学习信号。如需了解这一交互循环的入门介绍,请参阅我们关于环境的博客文章。在环境中,智能体将执行一组以数据集形式表示的任务。因此,环境大致可分为两个部分:任务集(tasksets)和运行时(runtimes)。在本次发布中,我们将重点聚焦于任务集。

在 Hugging Face Hub 上浏览 RL Environments 筛选器

Hub 上的一个 RL 环境就是一个数据集仓库,它会出现在新的 RL Environments 筛选器中。使用此数据集按钮会为你提供在该框架下运行它的命令。这里没有新增的仓库类型,没有注册表,也不需要注册账号。Harbor、Verifiers 以及 NVIDIA NeMo Gym 中已经存在相关的环境。

停止构建环境注册表

每篇 RL 论文或框架都采用各自独特的方式来查找环境:自定义中心、运行时注册表、独立的任务数据集,或是带有自定义加载器的 GitHub 任务列表。这意味着许多已发布的环境处于孤岛状态:如果你为某个框架发布了一个环境,其他三个框架的用户便无法加载它。若想使用来自其他框架或新论文中的环境进行训练,你就必须手动将其移植过来。

我们认为这种模式并不合理。一个环境本质上包含任务、测试、容器和奖励规则,即“数据加上其上的运行时”。Hub 已经具备存储数据、版本管理、访问控制、预览以及向数百万用户提供数据的能力。它不需要第二套系统来承载环境,只需要一种机制来声明:“这份数据是一个环境,这是它的运行方式。”

任务数据存储在 Hub 上。运行时配置和验证器代码可以存放在仓库或框架中。

各框架继续发挥其所长。Hub 则专注于其擅长的领域:托管、发现和版本管理。没有人需要独自维护整个目录。事实上,目录也可以在其他平台上运行,并由 Hub 提供支持。

数据集仓库负责托管你的环境文件。框架可以在本地或受支持的云端后端上运行这些文件。Hugging Face Jobs 可执行云端工作负载,而基于 Jobs 构建的 Hugging Face Sandboxes 则提供交互式命令执行功能。标签用于描述兼容性并生成加载命令;添加标签并不会启动任何 Job 或 Sandbox。

已发布的功能

RL Environments 筛选器。 访问 huggingface.co/datasets?other=rl-environment。所有带有 rl-environment 标签的数据集都会在此显示,无论它们适配哪个框架。

框架标签。 四个环境框架已被注册为数据集库:

标签框架
harborHarbor
verifiersVerifiers
openenvOpenEnv
nemo-gymNeMo Gym

每个框架标签都会在数据集页面上显示该框架的图标,并在 Use this dataset(使用此数据集)部分添加一段生成的代码片段。

一个数据集可以包含多个框架标签。这正是其设计初衷。标签描述的是兼容性,而兼容性并非互斥关系。每个列出的框架都必须支持仓库中的文件;添加标签并不会改变这些文件的性质。

运行环境并检查其奖励

选择适合你框架的示例,并在独立的 Python 环境中运行它,同时满足下文列出的先决条件。

Harbor:运行参考解决方案

Harbor 可以从 Hub 仓库加载任务目录。Oracle agent 会运行任务的参考解决方案,然后由验证器对结果进行评分。此过程不调用模型。

BASH
uv tool install --python 3.13 'harbor==0.21.0'
harbor run \
    --repo https://huggingface.co/datasets/harborframework/terminal-bench-2.1 \
    --dataset [email protected] \
    --include-task-name '*regex-log' \
    --agent oracle --env docker --jobs-dir results/harbor
harbor view results/harbor

查看器会显示任务的奖励、验证器输出和日志。这可以在你尝试使用模型 agent 之前,先检查任务及其参考解决方案。

Verifiers:在同一任务上运行模型

verifiers v1 的 Harbor 集成可以在不同的运行时(例如 Docker)中运行相同的任务目录。它还支持不同的 harness,包括一个极简的 bash harness。

BASH
uvx --python 3.13 --from 'verifiers[harbor]' eval harbor \
    --env.taskset.repo https://huggingface.co/datasets/harborframework/terminal-bench-2.1 \
    --env.taskset.dataset [email protected] \
    --env.taskset.tasks '["regex-log"]' \
    --env.agent.runtime.type docker \
    --env.agent.harness.id bash \
    --model "$MODEL" \
    --client.base-url "$LLM_URL"

这里的 repo 是完整的 Hugging Face Git URL,而 dataset 是该仓库 registry.json 中的名称和版本。此加载器遵循 Harbor 的注册表约定,因此不能仅用一个 Hub 仓库 ID 来替代这两个值。

OpenEnv:运行 agent 并检查其奖励

OpenEnv 的 Harbor 集成 可以使用诸如 OpenCode 这样的 agent 运行相同的任务目录,并返回验证器的奖励以及 agent 的执行轨迹。

BASH
pip install "openenv[harbor]==0.7.0"

openenv harbor rollout \
    --llm-url "$LLM_URL" \
    --model "$MODEL" \
    --dataset harborframework/terminal-bench-2.1 \
    --task-index 0 \
    --harness opencode \
    --sandbox docker \
    --out rollout.json

The command downloads the dataset's tasks/ directories, runs one task in Docker, and writes the result. The default connection uses a temporary Gradio tunnel so the sandboxed agent can reach OpenEnv's model proxy. Read the verifier result and the number of model calls:

PYTHON
import json
from pathlib import Path

result = json.loads(Path("rollout.json").read_text())[0]
print("Reward:", result["reward"])
print("Model calls:", result["n_turns"])
print("Error:", result["error"])

A reward of None means no verifier reward was produced; inspect error before interpreting the run as a model failure. This path expects Harbor task directories.

NeMo Gym: generate responses and inspect rewards

NeMo Gym supports evaluation and RL training: its environments collect trajectories and compute rewards, while a training framework updates model weights. For example, the Structured Outputs dataset pairs prompts with JSON schemas. Its verifier rewards schema adherence; it does not check whether the generated content is factually correct.

The best part is that this gives one repo and one discussion tab where people report broken tasks from all major frameworks. So when an author fixes a bad test, every framework gets the fix on the next pull.

Tag your environment

Open your dataset card and add this to the YAML header:

文本
---
pretty_name: Terminal-Bench 2.0
tags:
- rl-environment
- harbor
- verifiers
---

That is the whole integration. Keep rl-environment, then list every framework that can load your files. If your environment works with a framework we have not registered yet, open a PR to the list of supported libraries.

The docs have the full reference.

Already on the Hub

We opened PRs to tag some of the environments people already train on. If you maintain one of these, merge the PR and your environment shows up in the filter.

Harbor

[注:本文篇幅超长,以上为核心前篇精译,后续内容保留原文呈现]

  • BeyondSWE: the BeyondSWE benchmark as Harbor task directories, one folder per instance.
  • Terminal-Lego: Terminal-Bench-style tasks built from real StackOverflow issues, kept only after Docker round-trip verification.
  • Harbor-Mix: 100 hard agentic tasks picked from the Harbor adapters pool, cheaper to run than a full multi-benchmark sweep.
  • NatureBench: the 90 NatureBench tasks prebuilt for Harbor.

Verifiers

  • Reverse-Text-RL: the small reversal task prime-rl uses in CI to debug RL training.
  • Multi-SWE-RL-Verified: 2,232 of 4,703 Multi-SWE-RL rows that pass gold-patch validation across C, Go, Java, JavaScript, Rust, and TypeScript.
  • R2E-Gym-Subset-Verified: a verified R2E-Gym subset.
  • Scale-SWE-Verified: 17,202 of 20,181 Python issue-resolving tasks that give a clean reward signal end to end.

NeMo Gym

  • Workplace Assistant: a multi-step tool-use sandbox with five databases, 26 tools, and 690 business tasks.
  • Structured Outputs: instruction following with structured outputs.
  • CFBench: multilingual constraint following.
  • SysBench: multi-turn system message following.

What comes next

The first version generates one default snippet per framework. Per-config snippets are next, so a repo with several task sets can show the right command for each. After that we will look at structural detection for frameworks with strict layouts. It would also be really cool build custom task UIs, we’ve been experimenting with this here:

The bigger goal is for framework tagging to be automatic everywhere. OpenEnv already does it on upload. If you maintain Harbor, Verifiers, Nemo Gym, or any other environment framework, add the tags in your push path. It is a few lines, and every environment your users publish becomes visible to everyone else.

If you train agents, go browse the filter. If you build environments, publish and tag them, whether they cover coding, tool use, games, robotics, or another task. Include the files, a working run command, and the rule that produces the reward so others can use them. If your framework is missing, contribute it to the list of supported libraries.