arXiv:2607.08028cs.AIcs.CL2026-07

将企业级大模型应用从提示工程转向可审计的代码化架构。

From Prompts to Contracts: Harness Engineering for Auditable Enterprise LLM Agents

论文配图:From Prompts to Contracts: Harness Engineering for Auditable Enterprise LLM Agents
图 1 · 摘自论文原文
  • 用可替换的组件边界和代码化验证,实现行为确定性与溯源。
  • 三类主流模型下270次测试均通过验证,故障仅出现在模型侧。
  • 代码级控制比提示工程更安全且不损失功能,适合生产落地。

企业大模型应用常始于依赖提示和检索上下文的原型。产品化需满足源码边界、实体路由、回答契约与可复现追踪等要求。本文提出一种钩子工程方法,将该模式重构为可追溯、可审计的大模型代理架构:确定性行为移入代码,表现为可版本化的规范、模式与验证产物,而源数据保持运行时答案权威。我们在五个韩国企业集团(25家上市公司)的公开数据子集上实现并评估三个研究问题:(1) 钩子在固定验证场景中维持了源码关联性、实体路由、追踪记录、输出清洁度及推荐语言契约;故障注入实验确认验证器能准确标记被破坏的契约。(2) 在三种托管模型间切换时,所有270次组件边界调用均通过检查;失败仅限于模型生成侧,且被完整捕获记录。(3) 代码拥有保证具备承载力,无法仅靠提示实现:固定模型、仅改变执行层时,提示指令允许推荐语言违规与内部追踪泄露到达用户,而钩子完全阻止此类风险。外部防护层虽能防范但过度拒绝,使可用性降至88/120,而钩子维持全可用性(120/120);消融实验表明,唯有代码级控制同时保障安全与效能。结果形成一套可复用的工程范式,助力探索性原型转化为具备版本化源码、控制与验证产物的可审计应用。

原文摘要 · Abstract (English)

Enterprise large language model (LLM) applications often begin as prototypes whose behavior is carried by prompts and retrieval context. Productization adds requirements for source boundaries, entity routing, answer contracts, and reproducible traces. We present a harness-engineering approach that reconstructs this pattern into a traceable, auditable LLM-agent architecture: deterministic behavior moves into code, manifests, schemas, and validation artifacts around a replaceable composition boundary, while source-backed claims remain the authority for runtime answers. We instantiate it on a public-data slice of five Korean corporate groups (25 listed companies) and evaluate three research questions. (1) The harness preserves its source-grounding, entity-routing, trace, output-hygiene, and recommendation-language contracts across the fixed validation scenarios; a fault-injection control confirms the validators flag deliberately broken contracts. (2) The checks the harness enforces held under model substitution: across three hosted models, they passed on all 270 composition-boundary runs; failures were confined to the model-composed side and were caught and recorded. (3) The code-owned guarantees are load-bearing, not reproducible by prompting alone: holding the model fixed and varying only the enforcement layer, prompt instructions alone let recommendation-language and internal-trace-leakage violations reach the reader, which the harness blocks entirely. A bolt-on external guardrail prevents such violations too but over-refuses, dropping utility to 88/120 where the harness preserves full utility (120/120); in this ablation, only code-owned enforcement preserves both safety and utility. The result is a reusable engineering pattern for turning exploratory prototypes into auditable applications with versioned source, control, and validation artifacts.

大模型应用可审计性钩子工程企业级部署

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。