Research Papers 论文研究 4h ago Updated 2h ago 更新于 2小时前 49

When JSON Is Not Enough: Semantic Reliability of Schema-Constrained LLM Ordering Agents 当JSON不够用时:模式约束LLM订单代理的语义可靠性

Introduces OrderBench, a deterministic benchmark evaluating the semantic reliability of LLM agents in restaurant ordering scenarios beyond simple syntax. Demonstrates that while JSON Schema ensures structural validity, it fails to guarantee semantic correctness, with strong models achieving only ~80% semantic success despite 100% schema compliance. Highlights that weaker models exhibit significant rates of "schema-valid unsafe acceptances," where structurally correct outputs contain dangerous or 提出OrderBench基准测试,专门评估餐厅订购场景中LLM代理的语义可靠性,区分语法有效性与语义正确性。 研究发现即使输出符合JSON Schema且语法完全合法,最强模型的语义成功率仍仅约80%,存在显著的“语义幻觉”。 较弱模型在保持Schema有效的情况下,会出现双位数比例的“不安全接受”(unsafe acceptances),即错误地执行了无效或危险的操作。 结论指出结构化输出(如JSON Schema)仅是必要的接口层,不能替代领域验证和“失败关闭”(fail-closed)的执行机制。

65
Hot 热度
75
Quality 质量
70
Impact 影响力

Analysis 深度分析

TL;DR

  • Introduces OrderBench, a deterministic benchmark evaluating the semantic reliability of LLM agents in restaurant ordering scenarios beyond simple syntax.
  • Demonstrates that while JSON Schema ensures structural validity, it fails to guarantee semantic correctness, with strong models achieving only ~80% semantic success despite 100% schema compliance.
  • Highlights that weaker models exhibit significant rates of "schema-valid unsafe acceptances," where structurally correct outputs contain dangerous or incorrect business logic.
  • Establishes that structured output generation is a necessary interface layer but insufficient for ensuring safe, faithful transactions without additional domain verification.

Why It Matters

This research challenges the common assumption that enforcing JSON schemas eliminates errors in LLM-based transaction systems, revealing a critical gap between syntactic validity and semantic safety. For AI practitioners building agent workflows, it underscores the necessity of implementing robust post-processing verification and fail-closed mechanisms rather than relying solely on model-generated structured outputs. This insight is vital for industries requiring high reliability, such as finance, healthcare, and e-commerce, where semantic errors can lead to significant operational or financial risks.

Technical Details

  • Benchmark Design: OrderBench separates evaluation into six distinct dimensions: syntactic validity, schema validity, status decisions, exact item semantics, constraint preservation, and unsafe acceptances.
  • Experimental Setup: The study utilized 2,400 calls to four open-source LLMs via the Nebius Token Factory, comparing performance across standard prompt-only modes and JSON-schema constrained modes.
  • Key Findings: Even the strongest models achieved 100% schema validity in constrained mode, yet semantic success rates hovered around 80%. Weaker models showed double-digit percentages of unsafe acceptances that were nonetheless schema-compliant.
  • Methodology: The approach isolates "transaction compilation" tasks where natural language intents are converted into executable API objects, specifically focusing on the reliability of these conversions in a controlled restaurant ordering context.

Industry Insight

  • Implement Domain Verification: Treat LLM structured outputs as untrusted data sources; always implement a verification layer that checks semantic constraints and business logic before executing API calls.
  • Adopt Fail-Closed Architectures: Design systems to default to safe, non-execution states when semantic ambiguity or potential violation is detected, rather than proceeding with schema-valid but semantically flawed commands.
  • Monitor Beyond Syntax: When evaluating LLM agents for production use, prioritize metrics related to semantic accuracy and constraint preservation over simple parsing success rates, as the latter can mask critical functional errors.

TL;DR

  • 提出OrderBench基准测试,专门评估餐厅订购场景中LLM代理的语义可靠性,区分语法有效性与语义正确性。
  • 研究发现即使输出符合JSON Schema且语法完全合法,最强模型的语义成功率仍仅约80%,存在显著的“语义幻觉”。
  • 较弱模型在保持Schema有效的情况下,会出现双位数比例的“不安全接受”(unsafe acceptances),即错误地执行了无效或危险的操作。
  • 结论指出结构化输出(如JSON Schema)仅是必要的接口层,不能替代领域验证和“失败关闭”(fail-closed)的执行机制。

为什么值得看

这篇文章揭示了当前LLM Agent开发中的一个关键盲区:格式合规不等于逻辑正确。对于依赖LLM进行事务处理(Transaction Compilation)的行业而言,它提供了具体的工程警示,强调了在API调用前必须引入额外的领域验证层,以避免因语义错误导致的业务风险。

技术解析

  • 基准测试设计:OrderBench是一个确定性基准,针对餐厅订购代理,将评估维度细分为语法有效性、Schema有效性、状态决策、精确物品语义、约束保持以及不安全接受情况。
  • 实验设置:使用了Nebius Token Factory进行了2,400次调用,测试了四个开源模型,对比了纯Prompt模式和JSON Schema模式。
  • 核心发现:最强的模型在两种模式下均达到100%的Schema有效性,但语义成功率徘徊在80%左右;较弱模型则表现出更高的语义错误率,特别是在保持Schema有效的前提下发生不安全操作。
  • 工程建议:明确界定结构化输出作为“必要接口层”而非“安全保证”,主张采用Fail-Closed(失败时关闭/拒绝执行)策略,并强调领域特定验证的重要性。

行业启示

  • 重构Agent安全架构:企业不应盲目信任LLM的结构化输出能力,必须在Agent与后端API之间增加独立的验证服务(Validation Service),确保业务逻辑的正确性。
  • 关注语义而非仅语法:在评估LLM性能时,除了常规的格式遵循率(Format Compliance),应引入更严格的语义一致性指标,特别是针对金融、医疗等高可靠性要求的场景。
  • 推动标准化基准建设:行业需要更多类似OrderBench的垂直领域基准测试,以量化不同模型在复杂事务处理中的真实可靠性,指导模型选型和微调方向。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

LLM 大模型 Agent Agent Benchmark 基准测试 Evaluation 评测