Modern LLM pipelines increasingly resemble complex data-centric applications: they retrieve data, correct errors, call external tools, and coordinate interactions between agents. Yet, the central element controlling this entire process -- the prompt -- remains a brittle, opaque string that is entirely disconnected from the surrounding program logic. This disconnect fundamentally limits opportunities for reuse, optimization, and runtime adaptivity. In this paper, we describe our vision and an initial design of SPEAR (Structured Prompt Execution and Adaptive Refinement), a new approach to prompt management that treats prompts as first-class citizens in the execution model. Specifically, SPEAR enables: (1) structured prompt management, with prompts organized into versioned views to support introspection and reasoning about provenance; (2) adaptive prompt refinement, whereby prompts can evolve dynamically during execution based on runtime feedback; and (3) policy-driven control, a mechanism for the specification of automatic prompt refinement logic as when-then rules. By tackling the problem of runtime prompt refinement, SPEAR plays a complementary role in the vast ecosystem of existing prompt optimization frameworks and semantic query processing engines. We describe a number of related optimization opportunities unlocked by the SPEAR model, and our preliminary results demonstrate the strong potential of this approach.
翻译:现代LLM流水线日益复杂,类似于数据密集型应用:它们检索数据、纠正错误、调用外部工具,并协调代理间的交互。然而,控制整个流程的核心要素——提示——仍然是一个脆弱、不透明的字符串,完全脱离于周围的程序逻辑。这种脱节从根本上限制了复用、优化和运行时自适应的可能性。本文阐述了我们在SPEAR(结构化提示执行与自适应优化)方法上的愿景与初步设计,这是一种将提示视为执行模型中一等公民的新型提示管理方案。具体而言,SPEAR支持:(1) 结构化提示管理,通过将提示组织为版本化视图以支持来源追溯与推理;(2) 自适应提示优化,使提示能在执行过程中基于运行时反馈动态演化;(3) 策略驱动控制,一种通过when-then规则指定自动提示优化逻辑的机制。通过解决运行时提示优化问题,SPEAR在现有庞大的提示优化框架与语义查询处理引擎生态系统中发挥了补充作用。我们描述了SPEAR模型解锁的若干相关优化机遇,初步结果证明了该方法的巨大潜力。