iGSM
收藏数据集概述
数据集名称
iGSM
数据集简介
iGSM 是一个用于生成和评估小学级别数学问题的合成数据生成器/评估器。该数据集设计用于生成特定类别的小学数学问题,并评估给定解决方案的正确性。数据集还提供了不同难度级别的选择,并生成 networkx.DiGraph 对象以供未来使用。
数据集用途
- 生成小学数学问题。
- 评估给定解决方案的正确性。
- 提供不同难度级别的问题生成。
- 生成结构图和依赖图,用于问题描述和解决方案的生成。
数据集特点
- 难度级别:支持中等(med)和困难(hard)两种难度级别。
- 问题生成:通过
get_prob_sol_ans_triple函数生成问题、解决方案和答案的三元组。 - 解决方案验证:使用
true_correct函数验证解决方案的正确性。 - 重试数据生成:支持生成重试数据和弱重试数据。
数据集结构
- 问题生成:通过
IdGen类生成问题、解决方案和答案的 token 序列。 - 结构图:问题生成过程中会生成结构图,存储在
id_gen.problem.G中,用于表示问题中各节点的连接关系。 - 依赖图:依赖图存储在
id_gen.problem.template中,使用networkx.DiGraph类表示。
数据集生成示例
python from data_gen.pretrain.id_gen import IdGen from tools.tools import fix_seed
fix_seed(42) # 确保可重复性
初始化 IdGen 实例
id_gen = IdGen( max_op=15, # 最大操作数 max_edge=20, # 结构图中的最大边数 perm_level=5, # 问题描述的随机化级别 detail_level=0 # 解决方案的详细级别 )
生成问题并格式化
id_gen.gen_prob([i for i in range(23)], p_format="pq")
数据集验证示例
python from tools.tools_test import true_correct
示例解决方案字符串
wrong_sol = " Define Penguin Beachs Giraffe as t; so t = 6. Define Octopus Dens Leopard as r; so r = t = 6. Define Penguin Beachs Animal as J; so J = t = 6."
验证解决方案
correct, my_print, parser = true_correct(wrong_sol, id_gen.problem) print(f"Correct or not: {correct}") my_print.display()
数据集引用
如果使用 iGSM 数据集,请引用以下论文: bibtex @article{YXLA2024-gsm1, author = {Ye, Tian and Xu, Zicheng and Li, Yuanzhi and {Allen-Zhu}, Zeyuan}, title = {{Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Process}}, journal = {ArXiv e-prints}, year = 2024, month = jul, volume = {abs/2407.20311}, note = {Full version available at url{http://arxiv.org/abs/2407.20311}} }
如果使用重试数据或 box-over-box 数据,请同时引用以下论文: bibtex @article{YXLA2024-gsm2, author = {Ye, Tian and Xu, Zicheng and Li, Yuanzhi and {Allen-Zhu}, Zeyuan}, title = {{Physics of Language Models: Part 2.2, How to Learn From Mistakes on Grade-School Math Problems}}, journal = {ArXiv e-prints}, year = 2024, month = aug, volume = {abs/2408.16293}, note = {Full version available at url{http://arxiv.org/abs/2408.16293}} }
许可证
MIT 许可证。




