arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.04511cs.CL
收藏

一种用于并行函数调用的LLM编译器

An LLM Compiler for Parallel Function Calling

UC Berkeley(加州大学伯克利分校);ICSI(国际计算机科学研究所);LBNL(劳伦斯伯克利国家实验室)

Sehoon Kim, Suhong Moon, Ryan Tabrizi, Nicholas Lee, Michael W. Mahoney, Kurt Keutzer, Amir Gholami

AI总结:

本文提出LLMCompiler,借鉴经典编译器原理,通过规划器、任务获取单元和执行器三组件实现并行函数调用,相比ReAct在延迟、成本和准确率上均取得显著提升。

摘要:

近期大语言模型(LLMs)的推理能力使它们能够执行外部函数调用,以克服其固有局限,如知识截止、算术能力差或无法访问私有数据。这一发展使LLMs能够根据上下文选择并协调多个函数,以处理更复杂的问题。然而,当前的函数调用方法通常需要对每个函数进行顺序推理和行动,这可能导致高延迟、高成本,有时还会产生不准确的行为。为了解决这一问题,我们提出了LLMCompiler,它并行执行函数,以高效地编排多个函数调用。LLMCompiler从经典编译器的原理中汲取灵感,通过三个组件实现并行函数调用:(i)函数调用规划器(Function Calling Planner),制定函数调用的执行计划;(ii)任务获取单元(Task Fetching Unit),分发函数调用任务;以及(iii)执行器(Executor),并行执行这些任务。LLMCompiler自动为函数调用生成优化的编排方案,并可与开源和闭源模型一起使用。我们在一系列具有不同函数调用模式的任务上对LLMCompiler进行了基准测试。与ReAct相比,我们观察到一致的延迟加速最高可达3.7倍,成本节省最高可达6.7倍,准确率提升最高可达约9%。我们的代码可在 https://github.com/SqueezeAILab/LLMCompiler 获取。

英文摘要:

The reasoning capabilities of the recent LLMs enable them to execute external function calls to overcome their inherent limitations, such as knowledge cutoffs, poor arithmetic skills, or lack of access to private data. This development has allowed LLMs to select and coordinate multiple functions based on the context to tackle more complex problems. However, current methods for function calling often require sequential reasoning and acting for each function which can result in high latency, cost, and sometimes inaccurate behavior. To address this, we introduce LLMCompiler, which executes functions in parallel to efficiently orchestrate multiple function calls. Drawing inspiration from the principles of classical compilers, LLMCompiler enables parallel function calling with three components: (i) a Function Calling Planner, formulating execution plans for function calling; (ii) a Task Fetching Unit, dispatching function calling tasks; and (iii) an Executor, executing these tasks in parallel. LLMCompiler automatically generates an optimized orchestration for the function calls and can be used with both open-source and closed-source models. We have benchmarked LLMCompiler on a range of tasks with different patterns of function calling. We observe consistent latency speedup of up to 3.7x, cost savings of up to 6.7x, and accuracy improvement of up to ~9% compared to ReAct. Our code is available at https://github.com/SqueezeAILab/LLMCompiler.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑