HuggingFace公开训练智能体系列视频及代码
HuggingFace Training Agents 系列视频公开、代码开源 @huggingface 团队 @ben_burtenshaw 发起,6 个月、6 场直播,完成 SFT → 蒸馏 →...
HuggingFace团队做的,教你怎么从SFT到RL训练智能体,比单纯看理论更实用,适合想动手的开发者。
HuggingFace团队发起的6个月系列直播,涵盖智能体评估、RL训练全流程(SFT→蒸馏→GRPO→环境RL),基于2B模型后训练。第3讲用TRL+LoRA微调公开代码轨迹,第5讲通过OpenEnv构建环境并推上Hub,最后在HF沙箱上训练真实coding agent。方法论核心包括四阶段挑战阶梯、Looping RL和明确总目标(2B模型在Terminal-Bench超40分)。
HuggingFace Training Agents 系列视频公开、代码开源 @huggingface 团队 @ben_burtenshaw 发起,6 个月、6 场直播,完成 SFT → 蒸馏 →...
HuggingFace Training Agents 系列视频公开、代码开源 @huggingface 团队 @ben_burtenshaw 发起,6 个月、6 场直播,完成 SFT → 蒸馏 → GRPO → 环境 RL,基于一个 2B 模型的后训练全路线! 6 个视频 Youtube 地址 youtube.com/playlist?list=… 开源项目 github.com/burtenshaw/tra… # 六讲 workshop 主线逻辑 第 1 讲:智能体评估(起点)。先讲“评估为什么难”:benchmark 分数与实际使用体验严重脱节。嘉宾阵容横跨学界与工业界(Princeton、MIT CSAIL、Meta、英国 AI 安全研究所、Bespoke Labs),奠定了整个系列的基调:先建立可信的度量,再谈训练。 第 2 讲:面向智能体的 RL(理论准备)。讲清楚从“RL for LLM”到“RL for agents”的关键差异:需要环境、需要 rollout、需要重新设计奖励,并且会遇到推理侧的瓶颈。 第 3 讲:SFT on agent traces(第一步)。把公开 coding agent 的轨迹转成 prompt/completion 数据,用 TRL + LoRA 在 Hugging Face Jobs 上微调,Trackio 看指标。诚实讨论了第一批评估数字能说明什么、不能说明什么——这一讲的元信息是“SFT 教会模型的是交互格式和基本行为,不是能力本身”。 第 4 讲:蒸馏。用 off-policy、on-policy 和 self-distillation 三种方式,把教师模型的能力迁移到更小的 coding agent。 第 5 讲:GRPO 强化学习。SFT 之后上 RL:组采样(group sampling)、可验证的奖励函数、如何读 reward/KL/length 曲线。最有价值的设计是做了三个实验,其中一个故意放了可被 game 的奖励,让学员亲眼看到 reward hacking 如何发生;这是评估意识的延续。 第 6 讲(收官):从奖励函数到环境。概念上的关键跃迁:奖励不再是一个函数,而是智能体活动于其中的“场所”。实操路径是:从 Gym 的 reset()/step() 契约讲到 LLM 智能体,用 OpenEnv 构建环境并推上 Hub,接入 TRL 的 GRPOTrainer,最后通过 Harbor + AsyncGRPOTrainer 在 HF sandboxes 上训练了真实的 coding agent @opencode # 开源项目里的方法论核心 开源项目里是一套可复用的训练操作系统,有三个值得记住的设计: 1. 四阶段挑战阶梯(challenge ladder):SFT(学格式)→ GRPO(学从可验证奖励中学习)→ 带环境的 GRPO(学与有状态的世界交互)→ 自蒸馏(把验证过的成功轨迹回收为下一轮训练数据)。每一级都有晋级门槛:必须出现非零的奖励方差、held-out 任务上有真实提升,才能爬下一级;且训练任务必须与 Terminal-Bench 等评估基准严格隔离,防泄漏。 2. Looping RL(双层循环):内层是常规 RL 循环(采样→打分→更新);外层训练“研究系统本身”——每次实验要回答的是“这个 setup 是否真的度量了我们想要的行为”,而不是只看奖励涨没涨。文章给出了非常实用的故障启发式,比如:奖励方差为零 → 重新设计 prompt 分组;语法改善但成功率持平 → 数据要从语法级换成语义级;proxy 分数不动 → 不得宣称 benchmark 有进展。 3. 明确的总目标:训练一个约 2B 的开源模型,在 Terminal-Bench 上超过 40 分。所有阶段都服务于这个可度量的北极星,且只有 held-out 评估结果(而非训练奖励)才能让 checkpoint 进入发布状态。 Ben Burtenshaw @ben_burtenshaw We finished the Training Agents series. Six live sessions over six months, from evaluating agents to training them inside real environments. All of it is on the Hugging Face YouTube channel and all of the code is open. Here's what we did and who made it happen: 1. Agentic Evaluations WorkshopWhere agent evals actually stand, and why benchmark scores don't match what people see in use. With Avijit Ghosh and Nathan Habib (Hugging Face), Arvind Narayanan (Princeton), Pierre Andrews (Meta), J.J. Allaire (UK AI Security Institute) and Mahesh Sathiamoorthy (Bespoke Labs). 2. RL for Agents Workshop Environments, rollouts, reward design and the inference bottlenecks that appear when you move from RL for LLMs to RL for agents. With Lewis Tunstall (Hugging Face), Will Brown (Prime Intellect), Ofir Press (Princeton) and Alex Zhang (MIT CSAIL). 3. Training Agents 1: SFT on agent traces Public coding-agent traces turned into prompt/completion data, a TRL + LoRA fine-tune on Hugging Face Jobs, metrics in Trackio, and an honest look at what the first eval numbers can and cannot tell you. Joined by Sergio Paniego and Quentin Gallouédec. 4. Training Agents 2: Distillation Off-policy, on-policy and self-distillation for moving capability from a teacher into a smaller coding agent. 5. Training Agents 3: Reinforcement learning GRPO after SFT: group sampling, verifiable reward functions, reading the reward/KL/length curves, and three experiments, one of them with a deliberately gameable reward so we could watch the hacking happen. 6. Training Agents 4: From reward functions to environments The reward stops being a function and becomes a place the agent acts in. We walked the reset()/step() contract from Gym to LLM agents, built an OpenEnv environment and pushed it to the Hub, plugged it into TRL's GRPOTrainer, then trained a real coding agent (OpenCode) through Harbor with AsyncGRPOTrainer on Hugging Face sandboxes. The series has passed 300k views. Thank you to every speaker, to the TRL team, and to everyone who showed up live with questions. Playlist: youtube.com/playlist?list=… 🔗 View Quoted Tweet 💬 1 🔄 0 ❤️ 4 👀 478 📊 2 ⚡