用数学框架保证大模型输出结构化数据的正确性与可迭代优化。
XML Prompting as Grammar-Constrained Interaction: Fixed-Point Semantics, Convergence Guarantees, and Human-AI Protocols
- 基于格理论构建可收敛的提示递推机制
- 证明了在语法约束下输出始终合法且稳定
- 适合需要可靠结构化输出的交互式应用
使用XML标签的结构化提示已成为引导大语言模型生成可解析、符合模式输出的有效方法。本文从逻辑出发,统一处理(i)语法约束解码,(ii)层次提示上的不动点语义,以及(iii)收敛的人机交互循环。我们形式化了在细化序下的完整格结构的XML树,并证明单调的提示到提示映射存在最小不动点(Knaster-Tarski定理),表征了稳态交互协议;在树空间上引入任务感知压缩度量后,进一步证明了迭代引导的Banach型收敛性。通过上下文无关文法(CFG)实现XML模式,验证了约束解码能保证输出合法性且不牺牲任务性能。多层人机交互范式展示了实际部署模式,包括多轮“规划→验证→修正”流程和代理工具调用。提供完整的数学证明,并与近期语法对齐解码、链式验证及程序化提示进展相联系。
原文摘要 · Abstract (English)
Structured prompting with XML tags has emerged as an effective way to steer large language models (LLMs) toward parseable, schema-adherent outputs in real-world systems. We develop a logic-first treatment of XML prompting that unifies (i) grammar-constrained decoding, (ii) fixed-point semantics over lattices of hierarchical prompts, and (iii) convergent human-AI interaction loops. We formalize a complete lattice of XML trees under a refinement order and prove that monotone prompt-to-prompt operators admit least fixed points (Knaster-Tarski) that characterize steady-state protocols; under a task-aware contraction metric on trees, we further prove Banach-style convergence of iterative guidance. We instantiate these results with context-free grammars (CFGs) for XML schemas and show how constrained decoding guarantees well-formedness while preserving task performance. A set of multi-layer human-AI interaction recipes demonstrates practical deployment patterns, including multi-pass "plan $\to$ verify $\to$ revise" routines and agentic tool use. We provide mathematically complete proofs and tie our framework to recent advances in grammar-aligned decoding, chain-of-verification, and programmatic prompting.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。