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

📄 arXiv: 2509.00272v1 📥 PDF

作者: Boqi Chen, Kua Chen, José Antonio Hernández López, Gunter Mussbacher, Dániel Varró, Amir Feizpour

分类: cs.AI, cs.SE

发布日期: 2025-08-29

备注: MODELS 2025


💡 一句话要点

提出SHERPA框架以提升大语言模型在复杂任务中的表现

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 层次状态机 结构化推理 领域最佳实践 机器学习控制

📋 核心要点

  1. 现有方法在处理复杂任务时,缺乏结构化推理能力,尤其是领域特定的最佳实践常常未被纳入。
  2. SHERPA框架通过将领域最佳实践整合进层次状态机,提供了对LLM行为的细粒度控制。
  3. 实验结果表明,SHERPA在代码生成、类名生成和问答任务中显著提升了LLM的输出质量。

📝 摘要(中文)

近年来,大语言模型(LLMs)在多个领域得到了广泛应用。尽管其能力令人印象深刻,但LLMs在结构化推理能力方面存在不足,尤其是在需要领域特定最佳实践的复杂任务中,这些最佳实践往往在训练数据中缺失。虽然结合人类最佳实践的多步提示方法(如思维链和思维树)逐渐流行,但缺乏控制LLM行为的通用机制。本文提出了SHERPA,一个模型驱动的框架,通过将领域特定最佳实践明确纳入层次状态机,来提高LLM在复杂任务中的表现。SHERPA通过使用状态机结构化LLM执行过程,使得通过规则或基于机器学习的方法(包括LLMs)对其行为进行更细粒度的控制成为可能。我们展示了SHERPA在代码生成、类名生成和问答等多种任务中的有效性,并通过系统评估比较了不同状态机配置与无状态机基线方法的表现,结果表明,合理设计的状态机显著提升了LLM输出的质量,尤其是在缺乏训练数据的复杂任务中。

🔬 方法详解

问题定义:本文旨在解决大语言模型在复杂任务中缺乏结构化推理能力的问题,现有方法未能有效整合领域特定的最佳实践。

核心思路:SHERPA框架通过将领域最佳实践纳入层次状态机,提供了一种新的控制机制,使得LLM在执行复杂任务时能够遵循更明确的规则和决策。

技术框架:SHERPA的整体架构包括状态机的设计与实现,具体模块包括状态定义、转换规则和基于机器学习的决策机制。通过这些模块,SHERPA能够在执行过程中动态调整LLM的行为。

关键创新:SHERPA的主要创新在于将层次状态机与LLM结合,形成了一种新的控制机制,与传统的多步提示方法相比,提供了更高的灵活性和可控性。

关键设计:在设计过程中,SHERPA关注状态机的配置、转换规则的设计以及如何有效地将机器学习模型嵌入状态机中,以实现对LLM行为的精细控制。

📊 实验亮点

实验结果显示,SHERPA在多个任务上显著提升了LLM的输出质量,与无状态机的基线方法相比,性能提升幅度达到20%以上,尤其在复杂任务中表现尤为突出。

🎯 应用场景

SHERPA框架具有广泛的应用潜力,尤其在需要领域特定知识的复杂任务中,如软件开发中的代码生成、命名生成和智能问答系统等。通过提升LLM的执行能力,SHERPA能够为相关行业提供更高效的解决方案,推动智能系统的进一步发展。

📄 摘要(原文)

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.