arXiv:2409.00608cs.CLcs.LG2024-09EMNLP被引 62

让小模型在设备端实现高效函数调用,媲美大模型。

TinyAgent: Function Calling at the Edge

论文配图:TinyAgent: Function Calling at the Edge
图 1 · 摘自论文原文
  • 用编译器框架训练小模型,精准调用函数。
  • 1.1B和7B模型在边缘端表现超越GPT-4-Turbo。
  • 适合开发本地化智能助手的开发者使用。

近期大型语言模型(LLMs)推动了可集成多种工具与API的智能体系统发展,通过函数调用响应用户请求。然而,由于模型规模庞大且计算需求高,这些模型通常依赖云端部署,难以在边缘设备运行。为此,我们提出TinyAgent,一个端到端框架,用于训练和部署任务特定的小型语言模型智能体,使其能在边缘设备上执行函数调用,驱动本地化智能体系统。我们首先展示如何通过LLMCompiler框架使开源模型实现准确的函数调用。随后,系统性构建高质量函数调用数据集,并以此微调两个小型模型:TinyAgent-1.1B 和 7B。为提升推理效率,引入新型工具检索方法以减少输入提示长度,并采用量化技术进一步加速推理。作为应用场景,我们实现了一个本地Siri-like系统,可在Apple MacBook上通过文本或语音输入执行用户指令。实验表明,我们的模型不仅达到,甚至超越了GPT-4-Turbo的函数调用能力,同时完全部署于边缘设备。我们开源了数据集、模型及可安装包,并提供笔记本助手演示视频。

原文摘要 · Abstract (English)

Recent large language models (LLMs) have enabled the development of advanced agentic systems that can integrate various tools and APIs to fulfill user queries through function calling. However, the deployment of these LLMs on the edge has not been explored since they typically require cloud-based infrastructure due to their substantial model size and computational demands. To this end, we present TinyAgent, an end-to-end framework for training and deploying task-specific small language model agents capable of function calling for driving agentic systems at the edge. We first show how to enable accurate function calling for open-source models via the LLMCompiler framework. We then systematically curate a high-quality dataset for function calling, which we use to fine-tune two small language models, TinyAgent-1.1B and 7B. For efficient inference, we introduce a novel tool retrieval method to reduce the input prompt length and utilize quantization to further accelerate the inference speed. As a driving application, we demonstrate a local Siri-like system for Apple's MacBook that can execute user commands through text or voice input. Our results show that our models can achieve, and even surpass, the function-calling capabilities of larger models like GPT-4-Turbo, while being fully deployed at the edge. We open-source our dataset, models, and installable package and provide a demo video for our MacBook assistant agent.

边缘计算小模型函数调用智能体

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