StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows

StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows

26 Aug 2024 | Yiran Wu, Tianwei Yue, Shaokun Zhang, Chi Wang, Qingyun Wu
StateFlow is a novel LLM-based task-solving paradigm that models complex task-solving processes as state machines, enhancing control and interpretability. The framework distinguishes between "process grounding" (via state and state transitions) and "sub-task solving" (through actions within a state). Each state represents a specific phase of the task-solving process, and transitions between states are controlled by heuristic rules or decisions made by the LLM. Upon entering a state, a series of actions are executed, including calling LLMs guided by different prompts and utilizing external tools. StateFlow significantly improves LLM efficiency, achieving 13% and 28% higher success rates compared to ReAct in InterCode SQL and ALFWorld benchmarks, with 5× and 3× less cost respectively. It can be combined with iterative refining methods like Reflexion to further improve performance. StateFlow is evaluated on the SQL and Bash tasks from the InterCode benchmark and the ALFWorld benchmark. Results show that StateFlow outperforms existing methods in terms of both effectiveness and efficiency. With GPT-3.5, StateFlow outperforms ReAct by 13% on InterCode SQL and 28% on ALFWorld, with 5× and 3× less LLM inference cost respectively. StateFlow is orthogonal to methods that iteratively improve future attempts using feedback based on previous trials. Notably, StateFlow can be combined with Reflexion to improve the success rate on ALFWorld from 84.3% to 94.8% after 6 iterations. The main contributions of StateFlow include modeling LLM workflows as state machines, providing guidelines for building with the framework, and demonstrating the effectiveness and efficiency of StateFlow through three different tasks. The framework also shows that StateFlow can be combined with iterative refining methods to further improve performance. StateFlow is designed for tasks that require a designated process to solve, transforming abstract control flow or human reasoning into a formalized logical model. It defines states, output functions, and transitions to model the various stages of the task-solving process. The framework is evaluated on multiple benchmarks, showing significant improvements in performance and efficiency. StateFlow is also integrated with Reflexion to further improve performance, with much less cost incurred than ReAct.StateFlow is a novel LLM-based task-solving paradigm that models complex task-solving processes as state machines, enhancing control and interpretability. The framework distinguishes between "process grounding" (via state and state transitions) and "sub-task solving" (through actions within a state). Each state represents a specific phase of the task-solving process, and transitions between states are controlled by heuristic rules or decisions made by the LLM. Upon entering a state, a series of actions are executed, including calling LLMs guided by different prompts and utilizing external tools. StateFlow significantly improves LLM efficiency, achieving 13% and 28% higher success rates compared to ReAct in InterCode SQL and ALFWorld benchmarks, with 5× and 3× less cost respectively. It can be combined with iterative refining methods like Reflexion to further improve performance. StateFlow is evaluated on the SQL and Bash tasks from the InterCode benchmark and the ALFWorld benchmark. Results show that StateFlow outperforms existing methods in terms of both effectiveness and efficiency. With GPT-3.5, StateFlow outperforms ReAct by 13% on InterCode SQL and 28% on ALFWorld, with 5× and 3× less LLM inference cost respectively. StateFlow is orthogonal to methods that iteratively improve future attempts using feedback based on previous trials. Notably, StateFlow can be combined with Reflexion to improve the success rate on ALFWorld from 84.3% to 94.8% after 6 iterations. The main contributions of StateFlow include modeling LLM workflows as state machines, providing guidelines for building with the framework, and demonstrating the effectiveness and efficiency of StateFlow through three different tasks. The framework also shows that StateFlow can be combined with iterative refining methods to further improve performance. StateFlow is designed for tasks that require a designated process to solve, transforming abstract control flow or human reasoning into a formalized logical model. It defines states, output functions, and transitions to model the various stages of the task-solving process. The framework is evaluated on multiple benchmarks, showing significant improvements in performance and efficiency. StateFlow is also integrated with Reflexion to further improve performance, with much less cost incurred than ReAct.
Reach us at info@study.space