arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2606.09395cs.SE
收藏

软件工程中大语言模型结构化输出控制的实证研究

Empirical Study for Structured Output Control in LLMs for Software Engineering

University of Luxembourg(卢森堡大学);Luxembourg Institute of Science and Technology(卢森堡科学与技术研究所);King Fahd University of Petroleum and Minerals, Saudi Arabia(沙特阿拉伯国王法赫德国立石油与矿产大学)

Yewei Song, Prateek Rajput, Tiezhu Sun, Saad Ezzini, Tegawendé F. Bissyandé, Jacques Klein

AI总结:

针对LLM在软件工程中输出格式不匹配问题,提出TTMG方法消除语法错误,但结构性和语义错误仍存在,表明核心瓶颈超越语法格式化。

摘要:

LLM在软件工程中的输出很少孤立存在。它们必须插入到工具链、API和数据管道中,这些管道施加了严格的、通常是组织特定的结构契约。语义正确但违反预期格式的输出,从消费系统的角度来看,与错误答案无法区分,这使得结构保真度成为在实践中部署LLM的操作前提。然而,当前模型经常产生语法无效或结构不合规的输出。与编码器不同,自回归解码器以局部而非全局的方式逐词生成文本,当目标格式偏离熟悉的训练分布时,会放大结构脆弱性。\n我们针对四个代表性SE任务进行了结构可靠性的系统评估,将失败分类为语法、结构和语义错误。我们基准测试了针对解码器的缓解方法:语法约束解码、基于正则表达式的验证以及严格的模板驱动控制(模板令牌匹配生成,TTMG),以隔离这些失败的来源。TTMG几乎消除了语法错误,但大量的结构和语义错误仍然存在,表明核心瓶颈在于语法格式化之外。一个详细的案例研究进一步说明了残余错误如何在下游工作流中级联。我们的发现表明,当前的结构强制工具是必要的但不足,并强调了在LLM驱动的工作流中联合确保结构保真度和语义正确性的方法的必要性。

英文摘要:

LLM-generated outputs in software engineering rarely exist in isolation. They must plug into toolchains, APIs, and data pipelines that impose strict, often organization-specific structural contracts. A semantically correct output that violates the expected format is, from the consuming system's perspective, indistinguishable from a wrong answer, making structural fidelity an operational prerequisite for deploying LLMs in practice. Yet current models routinely produce syntactically invalid or structurally non-compliant outputs. Unlike encoders, autoregressive decoders generate text token-by-token with a local rather than global focus, amplifying structural fragility whenever the target format deviates from familiar training distributions. We present a systematic evaluation of structural reliability across four representative SE tasks, categorizing failures into syntax, structural, and semantic errors. We benchmark ways of mitigation targeting the decoder: grammar-constrained decoding, regex-based validation, and a strict template-driven control (Template Token Match Generation, TTMG) to isolate the sources of these failures. TTMG nearly eliminates syntax errors, yet substantial structural and semantic errors persist, demonstrating that the core bottleneck lies beyond syntax formatting. A detailed case study further illustrates how residual errors cascade in downstream workflows. Our findings show that current structure-enforcing tools are necessary but insufficient, and highlight the need for approaches that jointly ensure structural fidelity and semantic correctness in LLM-driven workflows.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑