用系统F类型推断评估模型是否真懂代码语义
Evaluating Program Semantics Reasoning with Type Inference in System F
- 以系统F类型推断为任务,构建纯语义驱动的评测基准
- 顶尖模型在纯语义任务上准确率仅55.85%
- 提出新指标衡量推理鲁棒性,揭示模型本质缺陷
大型语言模型(LLMs)正深度融入软件工程生态,其测试时计算(TTC)推理能力在理解程序逻辑与语义方面展现出巨大潜力。然而,当前代码推理基准缺乏以程序为中心的严格演绎框架,无法判断模型是真正理解程序语义,还是仅依赖自然语言与代码标记之间的表面关联。为此,我们提出TF-Bench,一个基于系统F类型推断的评测基准,用于评估模型的程序语义推理能力。通过采用已验证的变换去除语义无关的自然语言,我们构建了纯语义驱动的变体TF-Bench_pure。分析显示,现有最先进模型存在显著局限:最佳模型Claude-3.7-sonnet在TF-Bench_pure上仅达55.85%准确率。此外,我们提出两种新指标,用于评估推理鲁棒性与测试时推理有效性,揭示当前模型的核心瓶颈,并指明未来研究关键方向。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are increasingly integrated into the software engineering ecosystem. Their test-time compute (TTC) reasoning capabilities show significant potential for understanding program logic and semantics beyond mere token recognition. However, current benchmarks for code reasoning lack a formal, program-centric deductive framework to ensure sound evaluation, and are incapable of assessing whether models genuinely reason about program semantics or merely exploit superficial associations between natural language and code tokens. To bridge this gap, we introduce TF-Bench, a benchmark designed to evaluate LLM reasoning based on type inference in System F, a task we refer to as program semantics reasoning. By employing verified transformations to remove semantically irrelevant natural language, we construct TF-Bench_pure, a purely semantics-driven variant of TF-Bench. Our analysis reveals substantial limitations in state-of-the-art LLMs, with the best-performing LLM (Claude-3.7-sonnet) achieving only 55.85% accuracy on TF-Bench_pure. Additionally, we propose two novel metrics to assess robustness and the effectiveness of test-time reasoning, underscoring critical limitations in current LLM capabilities and highlighting essential directions for future research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。