Skip to main content
QUICK REVIEW

[论文解读] DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation

Yuhang Lai, Chengxi Li|arXiv (Cornell University)|Nov 18, 2022
Software Engineering Research被引用 31
一句话总结

DS-1000 是跨七个 Python 库的千个来自 StackOverflow 的自然数据科学编码问题,具备多标准基于执行的评估与记忆防御。它对 Codex-002 和其他模型进行基准测试,显示存在相当大的改进空间。

ABSTRACT

We introduce DS-1000, a code generation benchmark with a thousand data science problems spanning seven Python libraries, such as NumPy and Pandas. Compared to prior works, DS-1000 incorporates three core features. First, our problems reflect diverse, realistic, and practical use cases since we collected them from StackOverflow. Second, our automatic evaluation is highly specific (reliable) -- across all Codex-002-predicted solutions that our evaluation accept, only 1.8% of them are incorrect; we achieve this with multi-criteria metrics, checking both functional correctness by running test cases and surface-form constraints by restricting API usages or keywords. Finally, we proactively defend against memorization by slightly modifying our problems to be different from the original StackOverflow source; consequently, models cannot answer them correctly by memorizing the solutions from pre-training. The current best public system (Codex-002) achieves 43.3% accuracy, leaving ample room for improvement. We release our benchmark at https://ds1000-code-gen.github.io.

研究动机与目标

  • 介绍 DS-1000:一千个来自 StackOverflow 的真实世界数据科学编码问题。
  • 提供一个可靠的、基于执行的评估,包含功能正确性和表述形式检查。
  • 通过对问题及参考解进行扰动来防御记忆化。
  • 评估最先进的代码模型,以建立基线并识别改进领域。

提出的方法

  • curate 1000 problems from StackOverflow across seven libraries (NumPy, Pandas, TensorFlow, PyTorch, SciPy, Scikit-learn, Matplotlib );
  • rewrite problems and reference solutions to ensure executability and unambiguity;
  • implement multi-criteria evaluation with test cases for functional correctness and surface-form constraints;
  • perturb problems to defend against memorization (surface, semantic, and difficult rewrites);
  • quality-review and calibration to measure false discovery/omission rates of the automatic metric;
  • benchmark Codex-002, CodeGen, and InCoder using both Left-to-right Completion and Insertion (infilling) formats.

实验结果

研究问题

  • RQ1如何让数据科学代码生成基准体现来自真实世界问题的自然化意图与语境?
  • RQ2多标准、基于执行的评估是否可以可靠地衡量数据科学任务的代码生成质量?
  • RQ3大型代码模型(如 Codex-002)在 DS-1000 问题上有何提升,记忆化如何影响表现?
  • RQ4插入(insertion)格式是否提高数据科学代码生成任务的模型表现?

主要发现

FormatModelPandasNumPyMatplotlibScikit-learnSciPyTensorFlowPyTorch总体
从左到右完成Codex-00226.543.157.044.831.839.341.839.2
从左到右完成Codex-0019.426.641.818.515.017.29.720.2
从左到右完成Codex-Cushman7.921.840.718.011.312.212.418.1
插入Codex-00230.146.557.0*53.734.853.447.743.3
插入InCoder-6B2.94.628.3*3.13.17.83.27.5
  • DS-1000 含有跨七个库的一千个问题,底层 StackOverflow 问题共 451 个,平均每个问题有 1.6 个测试用例。
  • 自动化评估在样本层面通过预测的假阳性率为 1.8%,显示出可靠性。
  • Codex-002 Insertion 在 DS-1000 上实现了最佳平均通过率 43.3%,相比其他模型有显著改进空间。
  • 当对问题进行扰动以防记忆化时,性能下降,表明部分此前的模型成功受记忆化影响。
  • 插入格式通常比完成格式获得更高的准确性,凸显了填充能力的好处。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。