SHERPA: A Model-Driven Framework for Large Language Model Execution

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Chen, Boqi, Chen, Kua, López, José Antonio Hernández, Mussbacher, Gunter, Varró, Dániel, Feizpour, Amir
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908510506188800
author Chen, Boqi
Chen, Kua
López, José Antonio Hernández
Mussbacher, Gunter
Varró, Dániel
Feizpour, Amir
author_facet Chen, Boqi
Chen, Kua
López, José Antonio Hernández
Mussbacher, Gunter
Varró, Dániel
Feizpour, Amir
contents Recently, large language models (LLMs) have achieved widespread application across various fields. Despite their impressive capabilities, LLMs suffer from a lack of structured reasoning ability, particularly for complex tasks requiring domain-specific best practices, which are often unavailable in the training data. Although multi-step prompting methods incorporating human best practices, such as chain-of-thought and tree-of-thought, have gained popularity, they lack a general mechanism to control LLM behavior. In this paper, we propose SHERPA, a model-driven framework to improve the LLM performance on complex tasks by explicitly incorporating domain-specific best practices into hierarchical state machines. By structuring the LLM execution processes using state machines, SHERPA enables more fine-grained control over their behavior via rules or decisions driven by machine learning-based approaches, including LLMs. We show that SHERPA is applicable to a wide variety of tasks-specifically, code generation, class name generation, and question answering-replicating previously proposed approaches while further improving the performance. We demonstrate the effectiveness of SHERPA for the aforementioned tasks using various LLMs. Our systematic evaluation compares different state machine configurations against baseline approaches without state machines. Results show that integrating well-designed state machines significantly improves the quality of LLM outputs, and is particularly beneficial for complex tasks with well-established human best practices but lacking data used for training LLMs.
format Preprint
id arxiv_https___arxiv_org_abs_2509_00272
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SHERPA: A Model-Driven Framework for Large Language Model Execution
Chen, Boqi
Chen, Kua
López, José Antonio Hernández
Mussbacher, Gunter
Varró, Dániel
Feizpour, Amir
Artificial Intelligence
Software Engineering
Recently, large language models (LLMs) have achieved widespread application across various fields. Despite their impressive capabilities, LLMs suffer from a lack of structured reasoning ability, particularly for complex tasks requiring domain-specific best practices, which are often unavailable in the training data. Although multi-step prompting methods incorporating human best practices, such as chain-of-thought and tree-of-thought, have gained popularity, they lack a general mechanism to control LLM behavior. In this paper, we propose SHERPA, a model-driven framework to improve the LLM performance on complex tasks by explicitly incorporating domain-specific best practices into hierarchical state machines. By structuring the LLM execution processes using state machines, SHERPA enables more fine-grained control over their behavior via rules or decisions driven by machine learning-based approaches, including LLMs. We show that SHERPA is applicable to a wide variety of tasks-specifically, code generation, class name generation, and question answering-replicating previously proposed approaches while further improving the performance. We demonstrate the effectiveness of SHERPA for the aforementioned tasks using various LLMs. Our systematic evaluation compares different state machine configurations against baseline approaches without state machines. Results show that integrating well-designed state machines significantly improves the quality of LLM outputs, and is particularly beneficial for complex tasks with well-established human best practices but lacking data used for training LLMs.
title SHERPA: A Model-Driven Framework for Large Language Model Execution
topic Artificial Intelligence
Software Engineering
url https://arxiv.org/abs/2509.00272