FlowCompile: 一种用于结构化大语言模型工作流的优化编译器
FlowCompile: An Optimizing Compiler for Structured LLM Workflows
AI总结:
本文提出FlowCompile,一种优化结构化大语言模型工作流的编译器,通过编译时设计空间探索生成高质量可重用配置集,实现准确率与延迟的平衡,实验表明其在多种工作流和基准测试中表现优异,速度提升达6.4倍。
摘要:
结构化大语言模型工作流,其中专门的大语言模型子代理根据预定义图执行,已成为解决复杂任务的强大抽象。优化此类工作流,即为每个子代理选择配置以平衡准确性和延迟,具有挑战性,因为模型选择、推理预算和工作流结构的组合设计空间是组合的。现有成本感知方法大多将工作流优化视为路由问题,在推理时根据训练期间使用的准确率-延迟目标为每个查询选择配置。我们认为结构化大语言模型工作流也可以从编译角度进行优化:在部署前,系统可以全局探索工作流设计空间,并构建一个涵盖多样准确率-延迟权衡的可重用工作流配置集。受机器学习编译器的启发,我们引入FlowCompile,一种结构化大语言模型工作流编译器,通过编译时设计空间探索来识别高质量、可重用的权衡集。FlowCompile将工作流分解为子代理,对每个子代理在多样化配置下进行性能分析,并通过结构感知代理将这些测量结果组合起来,以估计工作流级别的准确性和延迟。然后在单次编译时通过程中识别出多样化的高质量配置,无需重新训练或在线适应。在多种工作流和具有挑战性的基准测试中,实验表明FlowCompile在多种工作流和具有挑战性的基准测试中,FlowCompile一致优于启发式优化的工作流配置和基于路由的基线,实现了高达6.4倍的速度提升。编译的配置集进一步充当可重用的优化艺术,使在不同运行时偏好下灵活部署成为可能,并支持下游选择或路由。
英文摘要:
Structured LLM workflows, where specialized LLM sub-agents execute according to a predefined graph, have become a powerful abstraction for solving complex tasks. Optimizing such workflows, i.e., selecting configurations for each sub-agent to balance accuracy and latency, is challenging due to the combinatorial design space over model choices, reasoning budgets, and workflow structures. Existing cost-aware methods largely treat workflow optimization as a routing problem, selecting a configuration at inference time for each query according to the accuracy-latency objective used during training. We argue that structured LLM workflows can also be optimized from a compilation perspective: before deployment, the system can globally explore the workflow design space and construct a reusable set of workflow-level configurations spanning diverse accuracy-latency trade-offs. Drawing inspiration from machine learning compilers, we introduce FlowCompile, a structured LLM workflow compiler that performs compile-time design space exploration to identify a high-quality, reusable trade-off set. FlowCompile decomposes a workflow into sub-agents, profiles each sub-agent under diverse configurations, and composes these measurements through a structure-aware proxy to estimate workflow-level accuracy and latency. It then identifies diverse high-quality configurations in a single compile-time pass, without retraining or online adaptation. Experiments across diverse workflows and challenging benchmarks show that FlowCompile consistently outperforms heuristically optimized workflow configurations and routing-based baselines, delivering up to 6.4x speedup. The compiled configuration set further serves as a reusable optimization artifact, enabling flexible deployment under varying runtime preferences and supporting downstream selection or routing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。