代理式 AI/生成式 AI

训练小型编排智能体解决重大问题

在智能体设计中,为任务选择合适的工具和模型始终是一项极具挑战性的工程难题。NVIDIA Research 正通过训练并运用一个独立的模型——我们称之为“编排器”——来统筹调度其他模型与工具,从而在实现系统自动化方面取得快速进展。

编排器的任务是根据用户的偏好——例如对响应速度、成本效益或准确性的要求,或这些因素的某种组合——来协调其他模型,并在任务执行过程中调用适当的工具以达成目标。研究发现,只要经过合理优化,小型模型已具备足够的能力来胜任这一角色。

虽然使用隶属于小模型的大型模型可能令人意外,但这种架构能充分发挥各自的优势。由于小模型规模有限,不会因知识过度而负担过重,经过训练后反而能够更精准地捕捉解决问题的核心。

为构建编排器,我们提出了ToolOrchestra这一核心方法,涵盖数据准备、合成数据生成、多目标强化学习训练,以及对编排策略与模型的全面评估。

Diagram showing how an AI orchestrator coordinates tools and models to answer a user’s query efficiently. The Orchestrator uses multi-turn reasoning and calls basic tools, specialized LLMs, and generalist LLMs, optimizing for outcome, efficiency, and cost preference through reinforcement learning. Diagram showing how an AI orchestrator coordinates tools and models to answer a user’s query efficiently. The Orchestrator uses multi-turn reasoning and calls basic tools, specialized LLMs, and generalist LLMs, optimizing for outcome, efficiency, and cost preference through reinforcement learning.
图1。编排器概述:在接收到任务后,编排器会通过反复交替进行推理与工具调用来解决问题。

为何训练编排师?

您可能会想:“使用编排器是一个有趣的概念,但为什么需要专门训练模型来实现呢?直接修改代理的提示词,让它充当编排器,难道还不够吗?” 简短的回答是:确实不够。关键在于训练目标——这正是 ToolOrchestra 所训练的编排器优于其他方法的原因。在训练过程中,编排器会生成大量实验轨迹。不同策略在解决问题时表现各异:一些策略高效且成本较低,能快速找到正确解决方案;而另一些则频繁调用昂贵工具,耗时较长才能得出结果。ToolOrchestra 采用强化学习框架,能够根据具体问题的成本偏好,明确奖励那些在保证高解题准确率的同时,实现低成本和短耗时的解决方案。

使用编排器的结果如何?

为验证 ToolOrchestra 的有效性,我们训练了一个名为 Orchestrator-8B 的小型模型,用于处理一系列极具挑战性的任务,包括人类最后一次考试帧问题以及τ2-Bench

随后,我们提供开箱即用的统一式大语言模型,并引入一个在前沿大模型上运行的编排器,使 Orchestrator-8B 能够调用相同的工具,同时对其性能进行评估。结果如表 1 所示。总体来看,无论竞争对手模型的规模或宣传功能如何,Orchestrator-8B 在性能上均优于所有对比模型,且具备更低的成本和更短的问题解决延迟。

工具 模型 HLE (↑) FRAMES (↑) τ²-Bench (↑) 成本 (↓) 延迟 (↓)

现有报告的 SOTA
GPT-5 35.2 84.2
o3 24.3 68.4
GPT-4o 5.3 43.8


无工具
Qwen3-8B 3.2 24.2 0.2 0.6
Llama-Nemotron-49B 3.6 25.6 0.4 1.1
Llama-3.3-70B 3.8 32.4 0.5 1.4
Qwen3-235B-A22B 5.2 34.3 2.6 3.3
Claude Opus 4.1 11.7 58.2 27.4 8.2
GPT-5 23.4 66.3 6.2 4.1


基本工具
Qwen3-8B 4.7 26.5 40.7 1.3 2.2
Llama-Nemotron-49B 6.8 28.2 23.2 2.5 3.5
Llama-3.3-70B 4.6 42.3 17.6 2.8 4.3
Qwen3-235B-A22B 14.0 39.5 52.9 12.3 10.2
Claude Opus 4.1 19.8 63.5 46.0 76.2 32.5
GPT-5 35.1 74.0 77.7 30.2 19.8


基本工具,专用LLM,通用LLM
Qwen3-8B 30.6 68.9 72.3 27.6 18.3
Llama-Nemotron-49B 25.8 57.9 66.7 25.6 17.1
Llama-3.3-70B 19.7 52.4 55.8 19.7 13.4
Qwen3-235B-A22B 32.8 74.2 75.6 29.7 21.2
Claude Opus 4.1 34.6 72.8 76.8 52.5 25.6
GPT-5 21.2 57.5 62.3 17.8 13.6
Orchestrator-8B 37.1 76.3 80.2 9.2 8.2
表1:Orchestrator-8B 与各基准模型的对比

为提升 Orchestrator-8B 的效率,我们评估了前沿模型与 Orchestrator-8B 在不同对话回合限制(10、20、50 和 100 轮)下的准确性和成本表现,结果如下图所示。实验表明,无论对对比模型施加何种对话长度限制,Orchestrator-8B 均能在保持较低美元成本的同时,展现出优于竞争对手的性能。

Scatter plot showing HLE Accuracy (%) versus Cost ($) for multiple LLMs. Orchestrator-8B achieves higher accuracy than other models at the same cost and maintains the same quality at a lower cost. GPT-5 and Grok-4 perform well but are more expensive, while Claude Opus 4.1, Qwen3-235B-A22B, and Llama-3.3-70B have lower accuracy. The plot highlights Orchestrator-8B’s superior performance-cost efficiency compared to SOTA baselines. Scatter plot showing HLE Accuracy (%) versus Cost ($) for multiple LLMs. Orchestrator-8B achieves higher accuracy than other models at the same cost and maintains the same quality at a lower cost. GPT-5 and Grok-4 perform well but are more expensive, while Claude Opus 4.1, Qwen3-235B-A22B, and Llama-3.3-70B have lower accuracy. The plot highlights Orchestrator-8B’s superior performance-cost efficiency compared to SOTA baselines.
图2:Orchestrator-8B 与其他几种先进大语言模型在成本与 HLE 准确性方面的对比

如何训练编排器?

要在遵循 ToolOrchestra 方法的前提下,为实现自身目标训练编排器,您需要准备一个模型、相关数据以及我们的训练代码。

为了说明构建编排器在应对挑战性任务(例如我们用于测试 Orchestrator-8B 的高难度基准)中的实际需求之小,我们以 Qwen3-8B 作为基础模型,仅生成了 552 个合成问题,并在训练中使用了 1296 个提示词。

第 1 步:选择底层模型

您可以自主选择用于训练有效编排器的模型。我们建议根据智能体的特性,选用规模适中且性能匹配的语言模型。例如 NVIDIA Nemotron NanoQwen 3 系列xLAM 系列,都是值得考虑的选项。

第 2 步:准备和生成数据

关于 ToolOrchestra 的数据,好消息是启动所需的数据量并不大。该工具假设大部分数据将通过合成方式生成,我们在论文中详细阐述了这一数据生成过程。总体而言,您只需先提供智能体使用其首选工具解决问题的描述或示例,然后借助大型模型,即可生成更多类似的合成任务。

以下是用于生成与训练 Orchestrator-8B 所用示例类似的样本的代码示意图。

def generate_samples(domain):
    subjects = generate_subjects(domain)
    schema = generate_schema(subjects)
    data_model = generate_datamodel(schema)
    database = generated_database(domain,schema,data_model)
    tools = generate_tools(domain,database)
    tasks = generate_tasks(database,tools)
    return tasks
samples = generate_samples()
...

您可以亲身体验数据生成的真正魅力。

第 3 步:开始训练

在获取模型选择及相关数据后,您可以直接使用或调整 ToolOrchestra 发布的代码,以训练自己的编排器。该示意图可帮助您快速上手,更多详细信息请参阅资源库中的README文件。

train_dataset = prepare_data(raw_examples,tools)
train_dataloader = DataLoader(train_dataset)
reward_model = RewardManager(config)
trainer = RayTrainer(config,reward_model)
trainer.init_workers()
trainer.start()
...

您可以亲自开启训练,亲眼见证您的编排师栩栩如生地呈现! training run

第 4 步:可视化进度

ToolOrchestra 的训练代码支持通过 Wandb 直接记录日志。下图展示了 Orchestrator-8B 运行过程中的可视化示例。

Side-by-side line charts of training metrics. The left chart shows actor policy gradient loss decreasing and stabilizing around -2.5 over 150 Side-by-side line charts of training metrics
steps. The right chart shows critic mean score increasing and plateauing around 2.0, indicating training convergence and performance improvement. Side-by-side line charts of training metrics. The left chart shows actor policy gradient loss decreasing and stabilizing around -2.5 over 150 Side-by-side line charts of training metrics
steps. The right chart shows critic mean score increasing and plateauing around 2.0, indicating training convergence and performance improvement.
图3:Orchestrator-8B 的训练损失与评论家评分

编排的优势

如今,设计高效且高性能的智能体需要持续在能力与成本之间寻求平衡。开发者必须手动权衡每一项决策——包括模型规模、工具使用、查询长度以及推理深度——因为一次不当的调用就可能导致成本大幅上升或影响结果质量。随着所需设计的查询数量不断增加,这种复杂性迅速攀升,使得具备成本意识的智能体优化成为构建实际AI系统中最具挑战性且耗时较长的关键环节之一。

ToolOrchestra 改变了这一现状。通过训练小型编排器,以精准的方式按需调度大型模型与工具,我们能够自动实现这种平衡,不仅性能优于整体式大语言模型,还在准确性、延迟和成本方面显著优于传统的编排器配置。

我们的示例训练模型 Orchestrator-8B 是一个有力例证,表明合理的策略能够超越单纯的模型规模扩展或提示工程技巧。该模型在高难度基准测试中展现出卓越的性能,同时实现了更高的资源利用效率。简而言之,编排机制使智能体兼具强大能力与灵活适应性。

展望未来:复合 AI 系统的崛起

近年来,人工智能领域的主流范式是先通过训练将智能内置于大型基础模型中,再借助上下文学习将其应用于现实场景。然而,这一观念正面临越来越多的挑战,因为 AI 社界不断涌现出大量实例,表明复合型 AI 系统在安全性、响应速度和成本效益方面表现更优,同时其能力已超越单一的大型语言模型。

ToolOrchestra 标志着我们在实现智能复合 AI 系统方面迈出了开创性的第一步,有望成为取代 AI 巨石的新范式。这也进一步印证了我们长期坚持的观点:小型语言模型终将是可扩展的代理式 AI 的关键所在

如需了解详情:

 

标签