Skip to main content
QUICK REVIEW

[论文解读] Reasoning Runtime Behavior of a Program with LLM: How Far Are We?

Junkai Chen, Zhiyuan Pan|arXiv (Cornell University)|Mar 25, 2024
Software System Performance and ReliabilityComputer Science被引用 3
一句话总结

该论文提出 $ρ$Eval,一种通过分析程序执行行为(包括运行时状态、执行路径和代码覆盖率)来评估大语言模型(LLMs)代码推理能力的框架。尽管使用了思维链(chain-of-thought)提示,大多数模型表现不佳——在运行时行为推理任务上平均准确率仅为 44.4%,增量一致性(IC)平均得分为 10.3——凸显了 LLM 在逻辑推理程序执行方面存在显著能力缺口。

ABSTRACT

Large language models for code (i.e., code LLMs) have shown strong code understanding and generation capabilities. To evaluate the capabilities of code LLMs in various aspects, many benchmarks have been proposed (e.g., HumanEval and ClassEval). Code reasoning is one of the most essential abilities of code LLMs, but existing benchmarks for code reasoning are not sufficient. Typically, they focus on predicting the input and output of a program, ignoring the evaluation of the intermediate behavior during program execution, as well as the logical consistency (e.g., the model should not give the correct output if the prediction of execution path is wrong) when performing the reasoning. To address these problems, in this paper, we propose a framework, namely REval, for evaluating code reasoning abilities and consistency of code LLMs with program execution. We utilize existing code benchmarks and adapt them to new benchmarks within our framework. A large-scale empirical study is conducted and most LLMs show unsatisfactory performance on both Runtime Behavior Reasoning (i.e., an average accuracy of 44.4%) and Incremental Consistency Evaluation (i.e., an average IC score of 10.3). Evaluation results of current code LLMs reflect the urgent need for the community to strengthen the code reasoning capability of code LLMs. Our code, data, and ewname leaderboard are available at https://r-eval.github.io.

研究动机与目标

  • 为解决当前缺乏对代码 LLM 在程序执行过程中动态行为推理能力的评估问题。
  • 识别现有基准在忽略控制流和变量状态等中间执行状态方面的缺陷。
  • 提出一个全面的评估框架,用于衡量运行时行为推理与顺序推理任务中的逻辑一致性。
  • 通过大规模实证评估揭示当前代码 LLM 推理能力的局限性。
  • 为未来提升训练与提示策略提供指导,以增强 LLM 的代码推理能力。

提出的方法

  • 该框架 $ρ$Eval 通过四项运行时行为推理任务评估代码 LLM:代码覆盖率预测(CCP)、程序状态预测(PSP)、执行路径预测(EPP)和输出预测(OP)。
  • 引入增量一致性评估(ICE)以衡量顺序推理任务中的逻辑一致性,确保预测结果与执行语义一致。
  • 将现有基准(HumanEval 和 ClassEval)改编为聚焦于执行动态与一致性的新评估集。
  • 采用思维链(CoT)提示方法,从 LLM 中提取推理轨迹,实现对其推理过程的结构化分析。
  • 开展大规模实证研究,评估 10 种主流代码 LLM 在多个模型与基准上的推理与一致性表现。
  • 研究采用人工规则标准,选取具有代表性的语句与变量用于评估,确保任务的相关性与挑战性。

实验结果

研究问题

  • RQ1代码 LLM 在推理中间程序执行状态(如代码覆盖率、变量状态与执行路径)方面表现如何?
  • RQ2当推理顺序依赖的执行行为时,代码 LLM 在多大程度上保持了逻辑一致性?
  • RQ3当前最先进代码 LLM 与人类水平推理能力在动态程序行为理解方面存在多大性能差距?
  • RQ4现有基准(如 HumanEval 和 ClassEval)能否有效捕捉运行时行为推理能力?
  • RQ5导致当前代码 LLM 推理能力差与不一致性的关键因素有哪些?

主要发现

  • 大多数代码 LLM 在运行时行为推理任务上的平均准确率仅为 44.4%,表明其对程序执行动态的理解能力较弱。
  • 各模型的平均增量一致性(IC)得分为 10.3,揭示了在顺序推理任务中存在严重的逻辑不一致性。
  • 即使是最强的 GPT-4-Turbo,IC 得分也仅为 42.5,凸显了维持推理一致性的长期挑战。
  • 结果表明,当前 LLM 缺乏足够的程序执行行为知识,可能源于对运行时语义的训练数据不足。
  • 思维链提示虽能提升推理能力,但仍不足以克服根本性的推理与一致性局限。
  • 本研究揭示了迫切需要通过执行行为训练与改进提示策略,以提升 LLM 的代码推理能力。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。