HuggingFace镜像/mbpp
数据集
数据集查看器
文件和版本

Mostly Basic Python Problems(mbpp)数据集卡片

目录

  • Mostly Basic Python Problems(mbpp)数据集卡片
    • 目录
    • 数据集描述
      • 数据集概述
      • 支持的任务与排行榜
      • 语言
    • 数据集结构
      • 数据实例
      • 数据字段
      • 数据划分
    • 数据集创建
      • 数据整理依据
      • 数据来源
        • 初始数据收集与标准化
        • 源语言提供者是谁?
      • 标注
        • 标注流程
        • 标注者是谁?
      • 个人与敏感信息
    • 数据使用注意事项
      • 数据集的社会影响
      • 偏见讨论
      • 其他已知局限性
    • 附加信息
      • 数据集整理者
      • 许可信息
      • 引用信息
      • 贡献

数据集描述

  • 仓库: https://github.com/google-research/google-research/tree/master/mbpp
  • 论文: Program Synthesis with Large Language Models

数据集概述

该基准测试包含约 1,000 道通过众包方式收集的 Python 编程题目,旨在让初级程序员能够解答,涵盖编程基础、标准库功能等内容。每道题目包含任务描述、代码解决方案和 3 个自动化测试用例。如论文所述,我们已对其中一部分数据进行了人工验证。

作为 Program Synthesis with Large Language Models, Austin et. al., 2021 的一部分,发布于此处。

支持的任务与排行榜

该数据集用于评估代码生成任务。

编程语言

英语 - Python 代码

数据集结构

dataset_full = load_dataset("mbpp")
DatasetDict({
    test: Dataset({
        features: ['task_id', 'text', 'code', 'test_list', 'test_setup_code', 'challenge_test_list'],
        num_rows: 974
    })
})

dataset_sanitized = load_dataset("mbpp", "sanitized")
DatasetDict({
    test: Dataset({
        features: ['source_file', 'task_id', 'prompt', 'code', 'test_imports', 'test_list'],
        num_rows: 427
    })
})

数据实例

mbpp - 完整版

{
    'task_id': 1,
    'text': '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[][].',
    'code': 'R = 3\r\nC = 3\r\ndef min_cost(cost, m, n): \r\n\ttc = [[0 for x in range(C)] for x in range(R)] \r\n\ttc[0][0] = cost[0][0] \r\n\tfor i in range(1, m+1): \r\n\t\ttc[i][0] = tc[i-1][0] + cost[i][0] \r\n\tfor j in range(1, n+1): \r\n\t\ttc[0][j] = tc[0][j-1] + cost[0][j] \r\n\tfor i in range(1, m+1): \r\n\t\tfor j in range(1, n+1): \r\n\t\t\ttc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] \r\n\treturn tc[m][n]',
    'test_list': [
        'assert min_cost([[1, 2, 3], [4, 8, 2], [1, 5, 3]], 2, 2) == 8',
        'assert min_cost([[2, 3, 4], [5, 9, 3], [2, 6, 4]], 2, 2) == 12',
        'assert min_cost([[3, 4, 5], [6, 10, 4], [3, 7, 5]], 2, 2) == 16'],
    'test_setup_code': '',
    'challenge_test_list': []
}

mbpp - 净化版

{
    'source_file': 'Benchmark Questions Verification V2.ipynb',
    'task_id': 2,
    'prompt': 'Write a function to find the shared elements from the given two lists.',
    'code': 'def similar_elements(test_tup1, test_tup2):\n  res = tuple(set(test_tup1) & set(test_tup2))\n  return (res) ',
    'test_imports': [],
    'test_list': [
        'assert set(similar_elements((3, 4, 5, 6),(5, 7, 4, 10))) == set((4, 5))',
        'assert set(similar_elements((1, 2, 3, 4),(5, 4, 3, 7))) == set((3, 4))',
        'assert set(similar_elements((11, 12, 14, 13),(17, 15, 14, 13))) == set((13, 14))'
        ]
}

数据字段

  • source_file: 未知
  • text/prompt: 编程任务描述
  • code: 编程任务的解决方案
  • test_setup_code/test_imports: 执行测试所需的代码导入
  • test_list: 用于验证解决方案的测试列表
  • challenge_test_list: 更具挑战性的测试列表,用于进一步检验解决方案

数据划分

数据集有两个版本(完整版和净化版),每个版本包含四个划分:

  • 训练集
  • 评估集
  • 测试集
  • 提示集

prompt 划分对应用于少样本提示的样本,不用于训练。

数据集构建

参见原始论文第 2.1 节。

数据整理依据

为了评估代码生成功能,需要一组简单的编程任务及其对应的解决方案,本数据集正是为此而提供。

数据来源

初始数据收集与标准化

该数据集完全从零开始手动创建。

源语言的生产者是谁?

该数据集通过 Google 内部众包方式创建。

标注

标注流程

首先创建了完整数据集,随后对其中一部分进行了第二轮标注以改进任务描述。

标注者是谁?

该数据集通过 Google 内部众包方式创建。

个人及敏感信息

无。

使用数据的注意事项

在针对该数据集进行评估时,务必在安全环境中运行生成的 Python 代码,因为生成的代码可能存在危害。

数据集的社会影响

借助该数据集,可以对代码生成模型进行更有效的评估,从而减少使用此类模型时引入的问题。

偏差讨论

其他已知局限性

由于任务描述可能不足以充分表达解题所需的信息,sanitized 划分旨在通过引入第二轮标注者来改进数据集,以解决这一问题。

补充信息

数据集整理者

Google Research

许可证信息

CC-BY-4.0

引用信息

@article{austin2021program,
  title={Program Synthesis with Large Language Models},
  author={Austin, Jacob and Odena, Augustus and Nye, Maxwell and Bosma, Maarten and Michalewski, Henryk and Dohan, David and Jiang, Ellen and Cai, Carrie and Terry, Michael and Le, Quoc and others},
  journal={arXiv preprint arXiv:2108.07732},
  year={2021}

贡献

感谢 @lvwerra 添加了该数据集。