数据集:

mxeval/mbxp

语言:

en

预印本库:

arxiv:2210.14868

大小:

10K<n<100K
英文

MBXP

MBXP

数据集概述

该存储库包含执行基于多种语言的代码生成能力的多语言评估所需的数据和代码,即多语言基准测试MBXP、多语言数学问题回答(MathQA)和多语言人类评估(HumanEval)的相应数据。结果和发现可在论文 "Multi-lingual Evaluation of Code Generation Models" 中找到。

相关任务和排行榜

支持的语言

编程问题使用多种编程语言编写,并包含注释和文档字符串中的英文自然文本。

数据集结构

查找当前支持的数据集

from datasets import get_dataset_config_names
get_dataset_config_names("mxeval/mbxp")
['python', 'csharp', 'go', 'java', 'javascript', 'kotlin', 'perl', 'php', 'ruby', 'scala', 'swift', 'typescript']

加载特定的数据集和语言

from datasets import load_dataset
load_dataset("mxeval/mbxp", "python")
DatasetDict({
    test: Dataset({
        features: ['task_id', 'language', 'prompt', 'test', 'entry_point', 'canonical_solution', 'description'],
        num_rows: 974
    })
})

数据实例

数据集实例示例:

{
  "task_id": "MBPP/1",
  "language": "python",
  "prompt": "\n\ndef min_cost(cost, m, n):\n\t\"\"\"\n\tWrite a function to find the minimum cost path to reach (m, n) from (0, 0) for the given cost matrix cost[][] and a position (m, n) in cost[][].\n\t>>> min_cost([[1, 2, 3], [4, 8, 2], [1, 5, 3]], 2, 2)\n\t8\n\t>>> min_cost([[2, 3, 4], [5, 9, 3], [2, 6, 4]], 2, 2)\n\t12\n\t>>> min_cost([[3, 4, 5], [6, 10, 4], [3, 7, 5]], 2, 2)\n\t16\n\t\"\"\"\n",
  "test": "\n\nMETADATA = {}\n\n\ndef check(candidate):\n    assert candidate([[1, 2, 3], [4, 8, 2], [1, 5, 3]], 2, 2) == 8\n    assert candidate([[2, 3, 4], [5, 9, 3], [2, 6, 4]], 2, 2) == 12\n    assert candidate([[3, 4, 5], [6, 10, 4], [3, 7, 5]], 2, 2) == 16\n\n",
  "entry_point": "min_cost",
  "canonical_solution": "\tR = 3\n\tC = 3\n\t \n\ttc = [[0 for x in range(C)] for x in range(R)] \n\ttc[0][0] = cost[0][0] \n\tfor i in range(1, m+1): \n\t\ttc[i][0] = tc[i-1][0] + cost[i][0] \n\tfor j in range(1, n+1): \n\t\ttc[0][j] = tc[0][j-1] + cost[0][j] \n\tfor i in range(1, m+1): \n\t\tfor j in range(1, n+1): \n\t\t\ttc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] \n\treturn tc[m][n]",
  "description": "Write a function to find the minimum cost path to reach (m, n) from (0, 0) for the given cost matrix cost[][] and a position (m, n) in cost[][]."
}

数据字段

  • task_id: 数据样本的标识符
  • prompt: 包含函数头和文档字符串的模型输入
  • canonical_solution: 针对prompt中问题的解决方案
  • description: 任务描述
  • test: 包含用于验证生成的代码正确性的函数
  • entry_point: 测试的入口点
  • language: 调用适当的子进程以执行程序的编程语言标识符

数据拆分

  • MBXP
    • Python
    • Java
    • Javascript
    • Typescript
    • Kotlin
    • Ruby
    • Php
    • Cpp
    • Csharp
    • Go
    • Perl
    • Scala
    • Swift

数据集创建

策划理由

由于代码生成模型通常在GitHub的存储库转储上进行训练,因此需要一个不包含在转储中的数据集来对模型进行正确评估。但是,由于该数据集已发布在GitHub上,可能会包含在将来的转储中。

个人和敏感信息

无。

数据集的社会影响

使用该数据集可以更好地评估代码生成模型,从而在使用这类模型时减少引入的问题。

数据集策划者

AWS AI实验室

执行

执行示例

安装库 mbxp-exec-eval 以执行从该数据集的提示生成或规范解决方案。

>>> from datasets import load_dataset
>>> from mxeval.execution import check_correctness
>>> mbxp_python = load_dataset("mxeval/mbxp", "python", split="test")
>>> example_problem = mbxp_python[0]
>>> check_correctness(example_problem, example_problem["canonical_solution"], timeout=20.0)
{'task_id': 'MBPP/1', 'passed': True, 'result': 'passed', 'completion_id': None, 'time_elapsed': 10.314226150512695}

使用数据的注意事项

确保对执行环境进行沙箱处理。

许可信息

LICENSE THIRD PARTY LICENSES

引用信息

@article{mbxp_athiwaratkun2022,
  title = {Multi-lingual Evaluation of Code Generation Models},
  author = {Athiwaratkun, Ben and
   Gouda, Sanjay Krishna and
   Wang, Zijian and
   Li, Xiaopeng and
   Tian, Yuchen and
   Tan, Ming
   and Ahmad, Wasi Uddin and
   Wang, Shiqi and
   Sun, Qing and
   Shang, Mingyue and
   Gonugondla, Sujan Kumar and
   Ding, Hantian and
   Kumar, Varun and
   Fulton, Nathan and
   Farahani, Arash and
   Jain, Siddhartha and
   Giaquinto, Robert and
   Qian, Haifeng and
   Ramanathan, Murali Krishna and
   Nallapati, Ramesh and
   Ray, Baishakhi and
   Bhatia, Parminder and
   Sengupta, Sudipta and
   Roth, Dan and
   Xiang, Bing},
  doi = {10.48550/ARXIV.2210.14868},
  url = {https://arxiv.org/abs/2210.14868},
  keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
  publisher = {arXiv},
  year = {2022},
  copyright = {Creative Commons Attribution 4.0 International}
}

贡献

skgouda@ benathi@