用自然语言显式定义大模型对话状态机,实现行为可验证。
FASTRIC: Prompt Specification Language for Verifiable LLM Interactions
- 将对话流程抽象为七要素状态机,嵌入自然语言提示中
- 不同模型在不同形式化程度下表现差异显著,存在最佳适配区间
- 为复杂对话设计提供可验证的工程方法,适合需要可靠交互的场景
大型语言模型执行复杂的多轮交互协议,但缺乏正式规范以验证其行为是否符合设计意图。我们提出FASTRIC,一种提示规范语言,将隐式的有限状态机(FSM)显式表达于自然语言提示中,通过执行轨迹分析实现合规性验证。大模型作为智能执行代理:解析设计师编码的FSM并执行指定角色。与需解析器和编译器的符号化语言不同,FASTRIC利用大模型作为统一基础设施——同时承担解析、解释、运行环境和开发助手功能。FASTRIC引导设计者明确定义七类FSM元素:终态、代理、状态、触发条件、角色、初始状态、约束。规范形式度(从前沿模型自行推断到弱模型所需的逐步指令)作为设计参数。我们引入过程合规性作为衡量执行与规范一致性的指标。在四种形式度级别、三个模型规模(14.7B、685B、1T+参数)下测试一个三状态幼儿园教学FSM,结果表明最优规范形式度取决于模型能力:DeepSeek-V3.2(685B)在L2-L4达到完美合规(1.00);ChatGPT-5(~1T)在L3达到峰值0.90,至L4下降至0.39;Phi4(14.7B)无稳定最优,方差达0.16–0.36。这些发现揭示了模型特异的“黄金区域”——在不造成过度约束的前提下提供足够结构,建立提示规范工程,使多轮交互设计从经验艺术转向系统化工程,具备可量化的程序保障。
原文摘要 · Abstract (English)
Large Language Models (LLMs) execute complex multi-turn interaction protocols but lack formal specifications to verify execution against designer intent. We introduce FASTRIC, a Prompt Specification Language that makes implicit Finite State Machines (FSMs) explicit in natural language prompts, enabling conformance verification through execution trace analysis. The LLM serves as intelligent execution agent: interpreting designer-encoded FSMs to execute specified behavioral roles. Unlike symbolic specification languages requiring parsers and compilers, FASTRIC leverages LLMs as unified infrastructure-simultaneously parser, interpreter, runtime environment, and development assistant. FASTRIC guides designers to articulate seven FSM elements (Final States, Agents, States, Triggers, Roles, Initial State, Constraints) structuring multi-turn interactions. Specification formality-ranging from implicit descriptions that frontier models infer to explicit step-by-step instructions for weaker models-serves as a design parameter. We introduce procedural conformance as verification metric measuring execution adherence to FSM specifications. Testing a 3-state kindergarten tutoring FSM across four formality levels and three model scales (14.7B, 685B, 1T+ parameters) reveals optimal specification formality is a function of model capacity. DeepSeek-V3.2 (685B) achieves perfect conformance (1.00) at L2-L4; ChatGPT-5 (~1T) peaks at L3 (0.90) before collapsing at L4 (0.39); Phi4 (14.7B) shows no stable optimum with high variance (SD=0.16-0.36). These findings reveal model-specific formality ranges-"Goldilocks zones"-where specifications provide sufficient structure without over-constraint, establishing Prompt Specification Engineering for creating verifiable interaction protocols, transforming multi-turn interaction design from heuristic art to systematic engineering with measurable procedural guarantees.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。