Skip to main content
QUICK REVIEW

[论文解读] LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code

Naman Jain, King Han|arXiv (Cornell University)|Mar 12, 2024
Software Engineering ResearchComputer Science被引用 22
一句话总结

LiveCodeBench 提供一个无污染、全面的代码焦点大语言模型评估,覆盖四种场景(代码生成、自我修复、代码执行、测试输出预测),使用来自 LeetCode、AtCoder、CodeForces 的题目,基准测试 9 个基础模型和 20 个指令微调模型,并揭示污染和过拟合现象。

ABSTRACT

Large Language Models (LLMs) applied to code-related applications have emerged as a prominent field, attracting significant interest from both academia and industry. However, as new and improved LLMs are developed, existing evaluation benchmarks (e.g., HumanEval, MBPP) are no longer sufficient for assessing their capabilities. In this work, we propose LiveCodeBench, a comprehensive and contamination-free evaluation of LLMs for code, which continuously collects new problems over time from contests across three competition platforms, namely LeetCode, AtCoder, and CodeForces. Notably, our benchmark also focuses on a broader range of code related capabilities, such as self-repair, code execution, and test output prediction, beyond just code generation. Currently, LiveCodeBench hosts four hundred high-quality coding problems that were published between May 2023 and May 2024. We have evaluated 18 base LLMs and 34 instruction-tuned LLMs on LiveCodeBench. We present empirical findings on contamination, holistic performance comparisons, potential overfitting in existing benchmarks as well as individual model comparisons. We will release all prompts and model completions for further community analysis, along with a general toolkit for adding new scenarios and model

研究动机与目标

  • 解决现有代码基准中的局限性(污染、对 NL-to-code 的狭窄聚焦)
  • 提出一个实时更新、无污染的评估框架
  • 评估除生成之外的多种代码相关能力(自我修复、执行、测试输出)
  • 策划高质量、多样化的问题集,标注发布时间和难度标签
  • 提供全面的跨模型比较,揭示开源与闭源模型以及过拟合倾向

提出的方法

  • 来自三个平台的实时、带时间戳的问题收集,确保只在模型截断日期之后发布的问题上评估模型以防止污染
  • 跨四个场景的全面评估:代码生成、自我修复、代码执行、测试输出预测,包含 Pass@1 和基于执行的指标
  • 通过 HTML 爬虫收集数据,提取问题 P、测试用例 T 和标准答案 S,以及竞赛发布时间 D,以实现时间窗口滚动
  • 具体情景的提示和评估:生成使用零-shot 或 few-shot 提示;自我修复使用错误反馈;代码执行使用带或不带链式推理的 few-shot 提示;测试输出预测使用零-shot 提示
  • 在 Easy/Medium/Hard 难度标签基础上构建平衡基准,并汇集来自 LeetCode、AtCoder、CodeForces 的 400 道题目的最终数据集
  • 平台特定的筛选协议(LeetCode 每周/双周比赛,AtCoder abc 题目,且评分在 ≤500,CodeForces Division 3/4)及后处理以确保可测试性和质量
Figure 1 : LiveCodeBench comprises problems marked with release dates, allowing evaluations over different time windows. For newer models, we can detect and avoid contamination by only evaluating on time-windows after the model’s cutoff date. The figures demonstrate the performance of models on code
Figure 1 : LiveCodeBench comprises problems marked with release dates, allowing evaluations over different time windows. For newer models, we can detect and avoid contamination by only evaluating on time-windows after the model’s cutoff date. The figures demonstrate the performance of models on code

实验结果

研究问题

  • RQ1数据污染如何影响在代码基准上的大语言模型评估?
  • RQ2全面、多场景评估是否揭示出与仅生成基准不同的模型强项与弱点?
  • RQ3在无污染条件下,开源模型与闭源模型在多样化代码任务中的相对表现如何?
  • RQ4在 LiveCodeBench 上评估时,是否存在对现有基准(如 HumanEval)的过拟合证据?
  • RQ5指令微调模型在生成、修复、执行和测试输出预测任务上,与基础模型相比表现如何?

主要发现

  • 污染是显而易见的:在截断日期之后发布的 LeetCode 题目上,较旧模型的表现下降(例如 DeepSeek/DS-Ins-33B)。
  • 全面评估显示跨任务的模型表现相关性,但相对差异各异;GPT-4-Turbo 在若干任务中领先,某些模型在特定情景中表现出色(例如 Claude-3-Opus 与 Mistral-L 在代码执行和测试输出预测方面)。
  • 通过 HumanEval+ 表现良好但在 LiveCodeBench 上不佳的两类模型暗示了过拟合;绿色簇(基础/闭源模型)与 LiveCodeBench 一致,红色簇(微调的开源模型)则不一致。
  • 开源与闭源模型:闭源 API 模型通常优于开源模型;只有强指令微调的开源模型(如 DS-Ins-33B、Phind-34B)缩小了差距。
  • GPT-4 与 GPT-4-Turbo 在各场景中表现强劲,相对其他模型的优势更大;基础的 DeepSeek、CodeLLaMa、StarCoder2 展现出不同的优势,其中 DS-Base-6.7B 勢一些更大的开源模型。
  • 指令微调在 HumanEval+ 与 LiveCodeBench 均带来稳定的提升(如 DS-Ins-33B、Phind-34B),相比其基础变体。
Figure 2 : Left. We propose evaluating LLMs across scenarios capturing various coding-related capabilities. Specifically, we host four different scenarios, namely code generation, self-repair, code execution, and test output prediction. The figure depicts various model performances across the four s
Figure 2 : Left. We propose evaluating LLMs across scenarios capturing various coding-related capabilities. Specifically, we host four different scenarios, namely code generation, self-repair, code execution, and test output prediction. The figure depicts various model performances across the four s

阅读本论文

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

在 Nubint 中阅读本论文

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