arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.00215cs.SE
收藏

解析LLM推理轨迹中的错误:对代码执行模拟的实证研究

Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation

York University(约克大学);Concordia University(康考迪亚大学)

Mohammad Abdollahi, Khandaker Rifah Tasnia, Soumit Kanti Saha, Jinqiu Yang, Song Wang, Hadi Hemmati

AI总结:

本研究通过实证分析揭示LLM推理轨迹中的错误类型,开发了九类错误分类体系,并展示工具增强推理可有效提升LLM的推理能力。

摘要:

理解程序的运行时推理行为,即中间状态和控制流如何导致最终执行结果,对于可靠的代码生成、调试和自动化推理至关重要。尽管大语言模型(LLMs)能够准确预测程序输出,但大多数先前工作都集中在输出准确性和性能上,将推理视为一个黑箱。因此,人们对它们推理轨迹的结构或失败模式知之甚少。为了解决这一差距,我们进行了首次针对运行时行为推断的实证研究,旨在揭示并表征LLM推理轨迹中的错误。我们从HumanEval Plus和LiveCodeBench中整理了一个基准,包含427个代码片段。对于每个片段,我们测试了三种输入类型:常规、边缘和无效。每个片段选择12个输入值,每个都配以真实的执行结果。我们评估了四种最先进的推理LLM。我们的结果表明,这些模型在不同输入类型上的准确率介于85%到98%之间。我们还分析了生成的推理轨迹,并开发了包含九类推理错误的分类体系。最后,我们探讨了工具增强的推理。通过计算错误类别的失败作为案例研究,我们的实验表明,这种方法可以纠正58%的此类错误,证明了工具支持在改进LLM推理方面的潜力。

英文摘要:

Understanding a program's runtime reasoning behavior, meaning how intermediate states and control flows lead to final execution results, is essential for reliable code generation, debugging, and automated reasoning. Although large language models (LLMs) can accurately predict program outputs, most prior work has focused on output accuracy and performance, treating reasoning as a black box. As a result, little is known about the structure or failure modes of their reasoning traces. To address this gap, we conduct the first empirical study on runtime behavior inference with reasoning LLMs, aiming to uncover and characterize errors in their reasoning traces. We curate a benchmark from HumanEval Plus and LiveCodeBench, containing 427 code snippets. For each snippet, we test three input types: regular, edge, and invalid. Twelve input values are selected per snippet, each paired with its ground-truth execution result. We evaluate four state-of-the-art reasoning LLMs. Our results show that these models reach accuracies between 85 percent and 98 percent across input types. We also analyze the produced reasoning traces and develop a taxonomy with nine categories of inference errors. Finally, we explore tool-augmented reasoning. Using failures in the Computation Errors category as a case study, our experiments show that this approach corrects 58 percent of such errors, demonstrating the potential of tool support for improving LLM reasoning.

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

↑