Skip to main content
QUICK REVIEW

[论文解读] StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows

Yiran Wu, Tianwei Yue|arXiv (Cornell University)|Mar 17, 2024
Business Process Modeling and AnalysisBusiness, Management and Accounting被引用 3
一句话总结

StateFlow 引入了一种以状态驱动的工作流范式,将 LLM 任务求解建模为有限状态机,将流程控制与子任务执行分离,从而提升控制力与可解释性。在 InterCode SQL 和 ALFWorld 基准测试中,其成功率分别比 ReAct 高 13% 和 28%,同时推理成本降低 3–5 倍,并能有效集成迭代优化方法(如 Reflexion)。

ABSTRACT

It is a notable trend to use Large Language Models (LLMs) to tackle complex tasks, e.g., tasks that require a sequence of actions and dynamic interaction with tools and external environments. In this paper, we propose StateFlow, a novel LLM-based task-solving paradigm that conceptualizes complex task-solving processes as state machines. In StateFlow, we distinguish between "process grounding" (via state and state transitions) and "sub-task solving" (through actions within a state), enhancing control and interpretability of the task-solving procedure. A state represents the status of a running process. The transitions between states are controlled by heuristic rules or decisions made by the LLM, allowing for a dynamic and adaptive progression. Upon entering a state, a series of actions is executed, involving not only calling LLMs guided by different prompts, but also the utilization of external tools as needed. Our results show that StateFlow significantly enhances LLMs' efficiency. For instance, StateFlow achieves 13% and 28% higher success rates compared to ReAct in InterCode SQL and ALFWorld benchmark, with 5x and 3x less cost respectively. We also show that StateFlow can be combined with iterative refining methods like Reflexion to further improve performance.

研究动机与目标

  • 为解决 LLM 驱动的任务求解工作流中缺乏精确控制与可解释性的问题。
  • 提升在需要工具使用与环境交互的复杂多步任务中的效率与可靠性。
  • 将任务求解建模为有限状态机,解耦状态转换与动作执行。
  • 实现通过启发式规则或 LLM 控制的状态动态推进,以支持自适应问题求解。
  • 展示与迭代优化技术(如 Reflexion)的兼容性,以进一步提升性能。

提出的方法

  • StateFlow 将任务求解建模为有限状态机(FSM),其中每个状态代表流程中的一个独立阶段。
  • 每个状态根据上下文历史触发一系列输出函数——包括特定任务的提示词调用 LLM 或外部工具调用。
  • 状态转换由启发式规则或 LLM 决策控制,实现工作流中的动态推进。
  • 该框架区分了“流程控制”(状态管理)与“子任务求解”(状态内的动作执行),提升了模块化与控制能力。
  • 通过进入状态时触发的动作函数,集成外部工具(如 SQL 执行器、shell 命令)。
  • 当到达最终的“End”状态时,系统终止,该状态由成功标准或错误处理机制验证。
Figure 1: The StateFlow models for the SQL and Bash task. Init and End state are basic components of state machines, and states like Observe , Solve , Verify , Error can be adaptable across various tasks. When reaching a state, a sequence of output functions defined is executed (e.g., $\text{M}_{i}\
Figure 1: The StateFlow models for the SQL and Bash task. Init and End state are basic components of state machines, and states like Observe , Solve , Verify , Error can be adaptable across various tasks. When reaching a state, a sequence of output functions defined is executed (e.g., $\text{M}_{i}\

实验结果

研究问题

  • RQ1将 LLM 任务求解建模为有限状态机,是否能提升复杂多步任务中的控制力、可解释性与效率?
  • RQ2在多样化的基准测试中,StateFlow 与 ReAct 相比,在成功率与推理成本方面表现如何?
  • RQ3StateFlow 在多大程度上可与迭代优化方法(如 Reflexion)结合,以进一步提升性能?
  • RQ4特定状态(如 Observe、Verify、Error)在整体任务求解有效性中发挥何种作用?
  • RQ5启发式规则与 LLM 驱动的决策如何共同影响状态转换的准确性与工作流的鲁棒性?

主要发现

  • 在 InterCode SQL 基准测试中,StateFlow 的成功率比 ReAct 高 13%,LLM 推理成本降低 5 倍。
  • 在 ALFWorld 基准测试中,StateFlow 的成功率比 ReAct 高 28%,成本降低 3 倍。
  • 框架与迭代优化技术兼容性良好,与 Reflexion 结合后,ALFWorld 的成功率在六轮迭代中从 84.3% 提升至 94.8%。
  • 消融实验证实,Observe、Solve 和 Verify 等状态对性能有显著贡献,特定状态的动作序列可提升任务完成的准确性。
  • StateFlow 的解耦设计使任务进度与决策逻辑更清晰可追踪,相比端到端提示,显著提升了可解释性。
  • 结合启发式转换与 LLM 驱动的决策,使工作流在多种任务类型中均能实现稳健且自适应的推进。
Figure 2: A ReAct few-shot example for the SQL task. From the example, we can abstract a general workflow to solve the problem.
Figure 2: A ReAct few-shot example for the SQL task. From the example, we can abstract a general workflow to solve the problem.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。