用图结构生成多轮工具调用数据,让大模型更懂复杂任务
Magnet: Multi-turn Tool-use Data Synthesis and Distillation via Graph Translation

- 基于图结构自动构建多轮工具调用路径
- 训练后模型在BFCL-v3上达68.01分,超越教师模型
- 适合提升需要多步工具协作的智能体性能
大型语言模型(LLMs)已展现出有效利用外部工具解决用户问题的能力。然而,在涉及多个工具和多轮交互的复杂场景中,其表现可能受限。为此,我们提出Magnet框架,通过从函数签名路径到查询与可执行函数调用序列的自动迭代转换,合成高质量训练轨迹,以增强大模型代理在多轮人机对话中的函数调用能力。该框架利用图模型刻画多轮场景下复杂的函数交互,并设计新型节点操作构建可靠的签名路径。受上下文蒸馏启发,训练时使用教师模型指导正负轨迹生成:在上下文中提供正确的函数调用序列作为正提示,以及对比性的错误调用作为负提示。实验表明,采用监督微调和对抗负轨迹的偏好优化训练后,我们的14B模型Magnet-14B-mDPO在BFCL-v3上取得68.01分,在ToolQuery上取得73.30分,显著优于教师模型Gemini-1.5-pro-002。
原文摘要 · Abstract (English)
Large language models (LLMs) have exhibited the ability to effectively utilize external tools to address user queries. However, their performance may be limited in complex, multi-turn interactions involving users and multiple tools. To address this, we propose Magnet, a principled framework for synthesizing high-quality training trajectories to enhance the function calling capability of large language model agents in multi-turn conversations with humans. The framework is based on automatic and iterative translations from a function signature path to a sequence of queries and executable function calls. We model the complicated function interactions in multi-turn cases with graph and design novel node operations to build reliable signature paths. Motivated by context distillation, when guiding the generation of positive and negative trajectories using a teacher model, we provide reference function call sequences as positive hints in context and contrastive, incorrect function calls as negative hints. Experiments show that training with the positive trajectories with supervised fine-tuning and preference optimization against negative trajectories, our 14B model, Magnet-14B-mDPO, obtains 68.01 on BFCL-v3 and 73.30 on ToolQuery, surpassing the performance of the teacher model Gemini-1.5-pro-002 by a large margin in function calling.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。