arXiv:2508.03680cs.AIcs.LG2025-08被引 76

让任意AI代理通过强化学习高效训练,无需改代码

Agent Lightning: Train ANY AI Agents with Reinforcement Learning

  • 将代理执行抽象为马尔可夫决策过程,解耦训练与运行
  • 支持文本到SQL等任务,训练持续稳定提升性能
  • 兼容LangChain等主流框架,适合想快速部署的开发者

我们提出Agent Lightning,一个灵活可扩展的框架,支持对任意AI代理进行基于强化学习(RL)的训练。不同于现有方法将强化学习与特定代理强绑定或依赖序列拼接加掩码,Agent Lightning实现训练与代理执行的完全解耦,可无缝集成使用LangChain、OpenAI Agents SDK、AutoGen等框架开发的代理,或从零构建的代理,几乎无需修改代码。通过将代理执行建模为马尔可夫决策过程,我们定义统一数据接口,并提出分层强化学习算法LightningRL,包含信用分配模块,可将任意代理生成的轨迹分解为训练样本。该设计使强化学习能处理复杂交互逻辑,如多代理场景和动态工作流。系统层面,引入Training-Agent Disaggregation架构,并在代理运行时集成可观测性框架,提供标准化的微调接口。在文本到SQL、检索增强生成及数学工具使用等任务上的实验表明,模型性能持续稳定提升,验证了该框架在真实场景中训练与部署智能代理的潜力。

原文摘要 · Abstract (English)

We present Agent Lightning, a flexible and extensible framework that enables Reinforcement Learning (RL)-based training of Large Language Models (LLMs) for any AI agent. Unlike existing methods that tightly couple RL training with agent or rely on sequence concatenation with masking, Agent Lightning achieves complete decoupling between agent execution and training, allowing seamless integration with existing agents developed via diverse ways (e.g., using frameworks like LangChain, OpenAI Agents SDK, AutoGen, and building from scratch) with almost ZERO code modifications. By formulating agent execution as Markov decision process, we define an unified data interface and propose a hierarchical RL algorithm, LightningRL, which contains a credit assignment module, allowing us to decompose trajectories generated by ANY agents into training transition. This enables RL to handle complex interaction logic, such as multi-agent scenarios and dynamic workflows. For the system design, we introduce a Training-Agent Disaggregation architecture, and brings agent observability frameworks into agent runtime, providing a standardized agent finetuning interface. Experiments across text-to-SQL, retrieval-augmented generation, and math tool-use tasks demonstrate stable, continuous improvements, showcasing the framework's potential for real-world agent training and deployment.

强化学习AI代理大模型训练框架

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。