Skip to main content
QUICK REVIEW

[Paper 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 Accounting3 citations
TL;DR

StateFlow introduces a state-driven workflow paradigm that models LLM task-solving as finite state machines, separating process grounding from sub-task execution for improved control and interpretability. It achieves 13% and 28% higher success rates than ReAct on InterCode SQL and ALFWorld benchmarks, respectively, with 3–5× lower inference cost, and integrates effectively with iterative refinement methods like 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.

Motivation & Objective

  • To address the lack of precise control and interpretability in LLM-driven task-solving workflows.
  • To improve efficiency and reliability in complex, multi-step tasks requiring tool use and environment interaction.
  • To model task-solving as finite state machines, decoupling state transitions from action execution.
  • To enable dynamic, heuristic- or LLM-controlled progression through states for adaptive problem solving.
  • To demonstrate compatibility with iterative refinement techniques like Reflexion for further performance gains.

Proposed method

  • StateFlow models task-solving as a finite state machine (FSM), where each state represents a distinct phase in the process.
  • Each state triggers a sequence of output functions—LLM calls with task-specific prompts or external tool invocations—based on context history.
  • State transitions are governed by heuristic rules or LLM decisions, enabling dynamic progression through the workflow.
  • The framework distinguishes 'process grounding' (state management) from 'sub-task solving' (action execution within a state), enhancing modularity and control.
  • External tools (e.g., SQL executors, shell commands) are integrated via action functions triggered upon state entry.
  • The system terminates upon reaching a final 'End' state, validated by success criteria or error handling.
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}\

Experimental results

Research questions

  • RQ1Can modeling LLM task-solving as a finite state machine improve control, interpretability, and efficiency in complex, multi-step tasks?
  • RQ2How does StateFlow compare to ReAct in terms of success rate and inference cost across diverse benchmarks?
  • RQ3To what extent can StateFlow be combined with iterative refinement methods like Reflexion to further improve performance?
  • RQ4What role do specific states (e.g., Observe, Verify, Error) play in the overall task-solving effectiveness?
  • RQ5How do heuristic rules and LLM-driven decisions jointly influence state transition accuracy and workflow robustness?

Key findings

  • StateFlow achieves a 13% higher success rate than ReAct on the InterCode SQL benchmark, with 5× lower LLM inference cost.
  • On the ALFWorld benchmark, StateFlow improves success rate by 28% compared to ReAct, while reducing cost by 3×.
  • The framework demonstrates strong compatibility with iterative refinement, boosting ALFWorld success rate from 84.3% to 94.8% when combined with Reflexion over six iterations.
  • Ablation studies confirm that states like Observe, Solve, and Verify contribute significantly to performance, with state-specific action sequences improving task completion accuracy.
  • StateFlow’s decoupled design enables clearer tracking of task progress and decision logic, enhancing interpretability compared to end-to-end prompting.
  • The use of heuristic-based transitions alongside LLM-driven decisions enables robust, adaptive workflow progression across diverse task types.
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.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.