arXiv:2503.23145cs.PLcs.AI2025-03被引 16

构建交互式编程推理基准,测试大模型从示例中归纳函数的能力

CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis

  • 通过调用隐藏函数并根据反馈迭代修正,模拟真实编程场景
  • 1114个函数的基准上,o3-mini成功率52.7%,微调后性能提升31%
  • 适合评估大模型在逆向工程等复杂任务中的归纳推理能力

归纳程序合成,即通过输入输出示例生成可泛化的函数,是程序自动生成的重要方向。尽管大语言模型代理在自然语言引导的任务中表现良好,但其在归纳程序合成方面的能力仍缺乏深入研究。现有评估方法依赖静态示例集和保留测试,无法提供错误反馈,也难以反映真实场景如逆向工程。本文提出CodeARC——代码抽象与推理挑战,一个新型交互式评估框架:代理通过向隐藏目标函数查询新输入、生成候选函数,并利用差分测试判别器不断迭代优化。该设置促使代理进行函数调用与自我修正。我们构建了首个大规模通用归纳程序合成基准,包含1114个函数。在18个模型中,o3-mini表现最佳,成功率达52.7%。对LLaMA-3.1-8B-Instruct在精选合成轨迹上微调,可实现最高31%的相对性能提升。CodeARC为基于大模型的程序合成与归纳推理提供了更真实且具挑战性的测试平台。代码、数据与模型已公开于https://github.com/Anjiang-Wei/CodeARC。

原文摘要 · Abstract (English)

Inductive program synthesis, or programming by example, requires synthesizing functions from input-output examples that generalize to unseen inputs. While large language model agents have shown promise in programming tasks guided by natural language, their ability to perform inductive program synthesis is underexplored. Existing evaluation protocols rely on static sets of examples and held-out tests, offering no feedback when synthesized functions are incorrect and failing to reflect real-world scenarios such as reverse engineering. We propose CodeARC, the Code Abstraction and Reasoning Challenge, a new evaluation framework where agents interact with a hidden target function by querying it with new inputs, synthesizing candidate functions, and iteratively refining their solutions using a differential testing oracle. This interactive setting encourages agents to perform function calls and self-correction based on feedback. We construct the first large-scale benchmark for general-purpose inductive program synthesis, featuring 1114 functions. Among 18 models evaluated, o3-mini performs best with a success rate of 52.7%, highlighting the difficulty of this task. Fine-tuning LLaMA-3.1-8B-Instruct on curated synthesis traces yields up to a 31% relative performance gain. CodeARC provides a more realistic and challenging testbed for evaluating LLM-based program synthesis and inductive reasoning. Our code, data, and models are publicly available at https://github.com/Anjiang-Wei/CodeARC

程序合成大模型推理交互评估归纳学习

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。