测试大模型如何判断软件文档与代码冲突时的可信度。
Measuring LLM Trust Allocation Across Conflicting Software Artifacts

- 构建带故障的代码-文档对,模拟真实开发中的不一致场景。
- 模型更易发现文档错误,但对代码变动反应迟钝,检测率下降21-43个百分点。
- 多数模型无法正确降权有缺陷的实现,且自信度无法区分对错判断。
基于大语言模型的软件工程助手常需在代码、文档、签名和测试等多类文档间推理,即使这些文档存在不完整或相互矛盾的情况。现有评估主要关注最终输出,未能揭示模型是否识别出不可靠证据、定位故障来源或合理排序信息源。本文提出TRACE方法,通过向真实世界Java方法包中注入已知故障(在文档、实现或两者中),构造成对的清洁版与扰动版,评估模型对文档质量的判断、不一致检测与定位能力,以及对各来源可靠性的排序。基于7个大模型在456个方法包上生成的22,339条有效响应,结果表明:质量惩罚通常仅集中于被扰动的文档,且随故障严重性上升;然而模型表现出显著的来源偏倚——文档故障检出率达67-94%,文档-实现矛盾检出率为50-91%,但当仅代码变动而文档未变时,检出率下降21-43个百分点;模型也难以降低有缺陷实现的优先级,且六种模型的置信度无法有效区分正确与错误判断。这说明当前大模型并非对软件证据对称整合:它们更可靠地审计自然语言规格,而非细微的实现行为。TRACE为在关键软件流程中使用前暴露此缺陷模式提供可控评估手段。
原文摘要 · Abstract (English)
LLM-based software engineering assistants often reason over multiple artifacts, including code, documentation, signatures, and tests, even when those artifacts are incomplete or mutually inconsistent. Existing evaluations primarily measure final outputs, leaving unclear whether a model recognized unreliable evidence, identified the faulty source, or prioritized the appropriate artifact. We introduce TRACE, a controlled method for evaluating how LLMs assess and prioritize conflicting software artifacts. TRACE constructs paired clean and perturbed versions of real-world Java method bundles by injecting known faults into the documentation, implementation, or both while holding the remaining artifacts fixed. Models then assess artifact quality, detect and localize inconsistencies, and rank the available sources by reliability. Using 22,339 valid responses from seven LLMs on 456 method bundles, we find that quality penalties are generally localized to the perturbed artifact and increase with fault severity. However, models exhibit a consistent source-origin asymmetry: they detect documentation faults at 67-94% and explicit documentation-implementation contradictions at 50-91%, but detection falls by 21-43 percentage points when only the implementation changes while documentation remains intact. Models also struggle to deprioritize faulty implementations, and confidence provides little separation between correct and incorrect judgments for six of seven models. These results show that current LLMs are not symmetric integrators of software evidence: they audit natural-language specifications more reliably than subtle implementation behavior. TRACE provides a controlled method for exposing this failure mode before LLMs are used in correctness-critical software engineering workflows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。