先前的研究通常假设大型语言模型在不使用计算器工具的情况下无法准确执行算术运算,特别是 >8 位数字的乘法以及涉及小数和分数的运算。 本文旨在挑战这种误解。 在足够的训练数据下,20亿参数的语言模型可以准确地进行多位算术运算,几乎100%的准确率且不会泄漏数据,大幅超越GPT-4(其多位乘法准确率仅为4.3%)。 我们还证明,我们的 MathGLM 在数据集上对 GLM-10B 进行了微调,并添加了额外的多步算术运算和文本中描述的数学问题,在 5,000 个样本的中国数学问题测试集上实现了与 GPT-4 类似的性能。 If you wat to fid the detailed itroductio, Read our paper: GPT Ca Solve Mathematical Problems Without a Calculator. method 1: use model method 2: use pipelie模型介绍
GPT Ca Solve Mathematical Problems Without a Calculator
Official Pytorch Implemetatio
Previous studies have typically assumed that large laguage models are uable to accurately perform arithmetic operatios, particularly multiplicatio of >8 digits, ad operatios ivolvig decimals ad fractios, without the use of calculator tools. This paper aims to challege this miscoceptio. With sufficiet traiig data, a 2 billio-parameter laguage model ca accurately perform multi-digit arithmetic operatios with almost 100% accuracy without data leakage, sigificatly surpassig GPT-4 (whose multi-digit multiplicatio accuracy is oly 4.3%). We also demostrate that our MathGLM, fietued from GLM-10B o a dataset with additioal multi-step arithmetic operatios ad math problems described i text, achieves similar performace to GPT-4 o a 5,000-samples Chiese math problem
test set.
依赖
pip istall SwissArmyTrasformer==0.2.*
推理代码
from modelscope import sapshot_dowload, Model, pipelie, Tasks
model_dir = sapshot_dowload('ZhipuAI/MathGLM', revisio='v1.0.0')
model = Model.from_pretraied(model_dir)
query = '鸡和兔在一个笼子里,共有35个头,94只脚,那么鸡有多少只?'
respose = model(query)
prit(respose)
"""Out
x=35-((94-35*2)/(4-2))=35-((94-70)/(4-2))=35-(24/(4-2))=35-(24/2)=35-12=23
"""
from modelscope import sapshot_dowload, Model, pipelie, Tasks
model_dir = sapshot_dowload('ZhipuAI/MathGLM', revisio='v1.0.0')
pipe = pipelie(task=Tasks.text_geeratio, model=model_dir)
query = '10*9*8=?'
respose = pipe(query)
prit(respose)
"""Out
x=10*9*8=90*8=720
"""
Citatio
@article{yag2023gpt,
title={GPT Ca Solve Mathematical Problems Without a Calculator},
author={Yag, Zhe ad Dig, Mig ad Lv, Qigsog ad Jiag, Zhihua ad He, Zehai ad Guo, Yuyi ad Bai, Jifeg ad Tag, Jie},
joural={arXiv preprit arXiv:2309.03241},
year={2023}
}
点击空白处退出提示
评论