An LLM Compiler for Parallel Function Calling
Proposes LLMCompiler for parallel function calls, achieving up to 3.7× speedup and 6.7× cost reduction.
Key Findings
Methodology
LLMCompiler adopts classical compiler principles, comprising three core modules: the Function Calling Planner generates dependency graphs; the Task Fetching Unit schedules tasks in parallel; the Executor executes tasks asynchronously. It automatically derives optimized call sequences by analyzing task dependencies with LLM reasoning, forming a directed acyclic graph (DAG). This enables efficient multi-tool orchestration across models and workloads. Experiments on datasets like HotpotQA, Movie Recommendation, ParallelQA, and WebShop show consistent improvements: up to 3.7× latency speedup, 6.7× cost savings, and ~9% accuracy gain compared to ReAct.
Key Results
- On HotpotQA and Movie Recommendation, latency was reduced by 1.8× and 3.7× respectively, with costs dropping to 30-15% of baseline, outperforming serial approaches.
- In complex dependency scenarios like ParallelQA and dynamic planning, speed increased 2.27×, costs decreased 4.65×, with accuracy improving 9%.
- Using open-source LLaMA-2, the framework demonstrated effective parallelization, confirming scalability and practical utility.
Significance
This work addresses the bottleneck of serial function calling in large models, introducing a compiler-inspired parallel scheduling framework that significantly boosts inference speed and reduces costs. It enhances the ability of LLMs to handle complex, multi-step reasoning tasks efficiently, paving the way for scalable AI applications in automated reasoning, knowledge extraction, and decision support. The approach offers a foundational step toward more autonomous and resource-efficient AI systems.
Technical Contribution
The key innovation is the integration of compiler optimization strategies—automatic dependency analysis, DAG construction, and parallel task scheduling—into LLM workflows. The framework supports dynamic re-planning and multi-model compatibility, enabling high concurrency and adaptability. This contrasts with prior serial or semi-parallel solutions, providing a scalable, general-purpose architecture for multi-tool orchestration in large models.
Novelty
This is the first framework to systematically optimize large model function calling via compiler-inspired dependency analysis and parallel scheduling. Unlike existing methods like ReAct, it supports complex dependency graphs, dynamic re-planning, and cross-model deployment, representing a significant leap in multi-tool orchestration for LLMs.
Limitations
- Dependence on predefined tools and prompt examples may limit flexibility in unseen tasks.
- Handling extremely complex or highly dynamic dependency graphs can incur overhead, affecting performance.
- Resource demands are high, especially in large-scale parallel execution, requiring further optimization for deployment.
Future Work
Future directions include developing adaptive scheduling algorithms, integrating reinforcement learning for optimal task allocation, expanding multi-model collaboration, and deploying in real-world industrial settings to validate robustness and scalability.
AI Executive Summary
Large Language Models (LLMs) have revolutionized natural language understanding, but their practical deployment faces efficiency bottlenecks, especially in multi-tool, multi-step reasoning tasks. Traditional approaches like ReAct rely on sequential function calls, which lead to high latency and costs, limiting scalability. To overcome this, the paper introduces LLMCompiler, a novel framework inspired by classical compiler principles, designed to enable parallel function calling in LLMs.
LLMCompiler comprises three main components: the Function Calling Planner, which automatically analyzes input tasks to generate dependency graphs; the Task Fetching Unit, which schedules tasks based on their dependencies; and the Executor, which asynchronously executes tasks using various tools or models. This architecture allows for dynamic re-planning, supporting complex dependency patterns and improving efficiency.
The core technical innovation lies in translating natural language tasks into dependency graphs (DAGs), leveraging LLM reasoning to identify parallelizable tasks and dependencies. The framework then orchestrates concurrent execution, significantly reducing latency and costs. Experiments on datasets like HotpotQA, Movie Recommendation, ParallelQA, and WebShop demonstrate that LLMCompiler outperforms baseline methods such as ReAct, achieving up to 3.7× speedup, 6.7× cost reduction, and 9% accuracy improvements. Notably, it supports open-source models like LLaMA-2, broadening accessibility.
This work addresses critical scalability challenges in multi-tool LLM applications, offering a systematic, compiler-inspired solution that enhances performance and flexibility. Its success paves the way for more efficient, autonomous AI systems capable of complex reasoning and decision-making in real-world scenarios. Future research will focus on adaptive scheduling, reinforcement learning integration, and industrial deployment to further extend its capabilities.
Deep Analysis
Background
The evolution of LLMs from simple content generators to reasoning engines has been marked by significant milestones, including GPT series, LLaMA, and PaLM. Early work focused on single-task performance, but as reasoning capabilities improved, the need for multi-tool integration emerged. Frameworks like ReAct introduced tool invocation, enabling models to call external functions for reasoning enhancement. However, these approaches predominantly used serial execution, which limited scalability due to increased latency and costs. Recent efforts explored parallelism but lacked systematic optimization, especially for complex dependency management. The growing demand for open-source models and parameter-efficient training techniques further highlighted the need for scalable, flexible orchestration frameworks that can handle diverse tasks efficiently.
Core Problem
The core challenge lies in the serial nature of existing function calling methods, which severely hampers inference speed and increases operational costs. Complex tasks often involve multiple interdependent steps, making manual dependency management impractical. Current solutions lack automated dependency analysis and dynamic re-planning, leading to redundant computations and suboptimal resource utilization. This bottleneck restricts the deployment of large models in real-time applications like automated reasoning, multi-modal integration, and decision support systems. Overcoming these limitations requires a framework capable of automatically analyzing task dependencies, enabling high concurrency, and adapting to dynamic environments.
Innovation
The paper introduces a compiler-inspired framework, LLMCompiler, which innovatively applies classical compiler optimization strategies to LLM function calling. Its key innovations include:
1) Automatic dependency graph generation using LLM reasoning, enabling precise identification of task dependencies.
2) Parallel scheduling based on dependency DAGs, maximizing concurrency and reducing latency.
3) Support for dynamic re-planning, allowing the system to adapt to intermediate results and changing dependencies.
4) Compatibility with multiple models and tools, including open-source options like LLaMA-2, broadening applicability.
These innovations collectively address the inefficiencies of serial execution, enabling scalable, cost-effective, and accurate multi-tool reasoning.
Methodology
- �� Input natural language task is processed by the Function Calling Planner, which uses LLM prompting to generate a dependency DAG, identifying tasks and their dependencies.
- �� The Task Fetching Unit monitors the DAG, dispatching independent tasks immediately and queuing dependent tasks until dependencies are resolved.
- �� The Executor asynchronously executes tasks using specified tools or models, storing intermediate results.
- �� During execution, the system monitors intermediate outputs, and if necessary, triggers re-planning by regenerating the dependency DAG based on new information.
- �� The entire process supports multi-model and multi-tool integration, with optional in-context examples to improve planner accuracy.
- �� The framework is optimized for streaming dependency graphs, reducing latency by allowing tasks to start as soon as dependencies are met.
Experiments
The evaluation involved datasets like HotpotQA, Movie Recommendation, ParallelQA, and WebShop, using GPT-3.5-turbo and LLaMA-2 70B. Baselines included ReAct and OpenAI's parallel function calling. Metrics measured were latency, cost, and accuracy. Experiments tested simple parallel patterns, complex dependency graphs, and dynamic re-planning scenarios. Ablation studies analyzed the impact of dependency analysis, streaming, and re-planning. Results consistently showed significant improvements in speed and cost, with accuracy gains up to 9%. The framework demonstrated robustness across models and task complexities, validating its generality and scalability.
Results
LLMCompiler achieved up to 3.7× latency speedup and 6.7× cost reduction over ReAct in benchmark tasks. In complex scenarios like ParallelQA, speedup reached 2.27× with 4.65× cost savings. Accuracy improved by approximately 9%, especially in tasks with dynamic dependencies. Combining with open-source LLaMA-2, it maintained performance gains, confirming broad applicability. The experiments also highlighted the effectiveness of streaming dependency graphs, reducing latency by up to 1.3× in certain benchmarks. These results demonstrate the framework’s capacity to handle diverse, real-world reasoning tasks efficiently.
Applications
The framework is suitable for multi-step reasoning, automated question answering, knowledge graph construction, and decision support systems. It enables enterprises to deploy large models more efficiently by reducing inference costs and latency. Future applications include real-time AI assistants, autonomous agents, and complex multi-modal reasoning systems. Its ability to dynamically re-plan makes it adaptable to changing environments, supporting applications in robotics, finance, and healthcare where timely decision-making is critical.
Limitations & Outlook
Current reliance on predefined tools and prompt examples may limit flexibility in unforeseen tasks. Handling extremely complex or highly dynamic dependency graphs can introduce scheduling overhead, impacting performance. High computational resource requirements pose deployment challenges, especially in large-scale settings. Future work should focus on adaptive scheduling algorithms, reinforcement learning-based optimization, and broader multi-model integration to address these issues and enhance robustness.
Plain Language Accessible to non-experts
想象你在厨房里准备一顿大餐,你有很多不同的工具,比如锅、刀、搅拌器,每个工具都用来完成不同的任务。以前,你可能会一个步骤一个步骤地做:先切菜,再煮汤,然后搅拌。这种方法虽然简单,但很慢,因为每个任务都要等前一个完成。现在,想象你有一个聪明的厨房助手,它能自动分析哪些任务可以同时进行,比如切菜和煮汤可以同时开始,然后等都准备好后再搅拌。这个助手会根据每个任务的依赖关系,合理安排所有工作,让你可以同时用多个工具,节省很多时间。这就像是给模型配备了一个智能调度系统,能同时调用多个工具,快速完成复杂的任务,既省钱又省时。
ELI14 Explained like you're 14
想象你在学校准备一个大项目,你需要查资料、写报告、做演示。以前,你会一个步骤一个步骤来:先查资料,再写报告,最后做演示。这会花很长时间。而现在,如果你能提前安排:查资料和写报告可以同时进行,做演示也可以同时准备,只要资料查完了,其他任务就能马上开始。这样一来,整个项目就能快很多。LLMCompiler就像这个聪明的项目经理,它能帮模型同时调用不同的“工具”——比如搜索、计算、写作——让任务同时进行,节省时间和金钱。它还能根据中间的结果调整计划,确保每一步都顺利完成,最终让复杂的任务变得简单又高效。这样一来,模型就像一个超级高效的团队,能在更短时间内完成更多事情!
Abstract
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.