├── .gitignore ├── README.md ├── codes ├── PRP.py ├── README.md ├── SC.py ├── calculate_accuracy.py ├── extract_number.py ├── finetune │ └── gpt2 │ │ ├── GPT2DataSet.py │ │ ├── finetune.py │ │ ├── finetune_w_Trainer.py │ │ ├── test.py │ │ ├── test_w_calculator.py │ │ ├── verifier2_generate_verifier_train_data.py │ │ └── verifier3_train_verifier.py ├── get_data.py ├── infer_predict.py ├── preprocess_data │ ├── AI2.py │ ├── alg514.py │ ├── ape210k.py │ ├── aqua.py │ ├── asdiv.py │ ├── dolphin1878.py │ ├── dolphin18k.py │ ├── draw.py │ ├── geometry3k.py │ ├── gsm8k.py │ ├── math23k.py │ ├── math_dataset.py │ ├── mathqa.py │ ├── mawps.py │ ├── svamp.py │ └── svamp_sym.py ├── prompts.py ├── results │ ├── ChatGLM3_Alg_result.txt │ ├── ChatGPT-3.5_AI2_result.txt │ ├── ChatGPT-3.5_ASDiv_result.txt │ ├── ChatGPT-3.5_Alg_result.txt │ ├── ChatGPT-3.5_Ape210K_result.txt │ ├── ChatGPT-3.5_COT+tip_Alg_result.txt │ ├── ChatGPT-3.5_COT_Alg_result.txt │ ├── ChatGPT-3.5_GSM8K_result.txt │ ├── ChatGPT-3.5_Math23K_result.txt │ ├── ChatGPT-3.5_SVAMP_result.txt │ ├── ChatGPT-3.5_dolphin1878_result.txt │ ├── ChatGPT_PRP_Alg_result.txt │ ├── GLM4_Alg_result.txt │ ├── LLaMA3-8B-Instruct_Alg_result.txt │ ├── Yi_large_Alg_result.txt │ ├── Yi_large_preview_Alg_result.txt │ ├── deepseek-chat_Alg_result.txt │ ├── gpt2_AI2_result.txt │ ├── gpt2_Alg_result.txt │ ├── gpt2_GSM8K_result.txt │ ├── gpt2_GSM8K_w_calculator_result.txt │ ├── gpt2_direct_Alg_result.txt │ ├── moonshot_Alg_result.txt │ └── verifier_GSM8K_w_calculator_result.txt └── zero_shot_infer.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /datasets/ 2 | /my_checkpoints/ 3 | **/hide_config.py 4 | **/__pycache__/ 5 | **/randomly_try* 6 | /wandb/ 7 | **/mid_result/ -------------------------------------------------------------------------------- /codes/PRP.py: -------------------------------------------------------------------------------- 1 | import os, json, re, random 2 | from alive_progress import alive_bar 3 | 4 | import torch 5 | 6 | from get_data import get_data 7 | from infer_predict import get_infer 8 | from extract_number import extract_number_from_prediction 9 | 10 | num_threads = "32" 11 | torch.set_num_threads(int(num_threads)) 12 | os.environ["OMP_NUM_THREADS"] = num_threads 13 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 14 | os.environ["MKL_NUM_THREADS"] = num_threads 15 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 16 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 17 | 18 | import argparse 19 | 20 | parser = argparse.ArgumentParser() 21 | 22 | parser.add_argument( 23 | "-mc", "--model_checkpoint_path", type=str 24 | ) # 本地:预训练模型名或本地目录;API:模型名称 25 | # 目前支持的选项(与下一条参数逐行对应): 26 | # GPT-3.5 ("gpt-3.5-turbo"和"gpt-3.5-turbo-16k",根据输入文本长度自动判断) 27 | # THUDM/chatglm3-6b或存储checkpoint的本地文件夹 28 | 29 | parser.add_argument("-mn", "--model_name", type=str) 30 | # 目前支持的选项 31 | # TODO:OpenAI 32 | # ChatGLM3 33 | 34 | parser.add_argument("-dn", "--dataset_name", type=str) 35 | # 目前支持的选项: 36 | # Alg514 37 | 38 | parser.add_argument("-ds", "--dataset_path", type=str) 39 | # Alg514数据:train/valid/test json储存的文件夹 40 | 41 | parser.add_argument( 42 | "-rt", "--result_txt_path", type=str 43 | ) # 输出结果储存文件(将直接追加写入) 44 | 45 | # 以下默认参数都来自原论文 46 | parser.add_argument("-K", "--max_iteration", type=int, default=5, help="最大迭代数") 47 | 48 | # 以下默认参数都来自原论文官方代码 49 | parser.add_argument("--max_length", type=int, default=256) 50 | 51 | args = parser.parse_args() 52 | arg_dict = args.__dict__ 53 | 54 | # 数据预处理 55 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 56 | test_data = all_data["test"] 57 | 58 | 59 | # 构建模型 60 | predict = get_infer(arg_dict["model_name"], arg_dict["model_checkpoint_path"]) 61 | 62 | # 运行模型 63 | result_file = open(arg_dict["result_txt_path"], "a") 64 | 65 | init_template = "Q: {question}. \nA: Let’s think step by step" 66 | rectification_template = "Q: {question} (The answer is likely not {hypothesis}) . A: Let’s think step by step" 67 | verification_template = "Q: {verify_problem} If we know the answer to the above question is {generated_answer}, what is the value of unknown variable X? (If X is irrelevant to the calculation process please answer 'Unrelated')\nA: Let's think step by step." 68 | 69 | amount_predict_right = 0 70 | 71 | 72 | def get_verify_problem_and_answer(question, wrong_answer=[]): 73 | """mask problem中的数字为X""" 74 | numbers = re.findall(r"-?\d+\.\d+|-?\d+", question) 75 | random.shuffle(numbers) 76 | for n in numbers: 77 | if float(n) not in wrong_answer: 78 | return question.replace(str(n), "X"), float(n) 79 | return "No Number", "No Number" 80 | 81 | 82 | with alive_bar(len(test_data)) as bar: 83 | for i in range(len(test_data)): 84 | question = test_data[i]["question"] 85 | answer = test_data[i]["answer"] 86 | 87 | generated_values = [] 88 | 89 | initial_answer = predict( 90 | init_template.format(question=question), max_length=arg_dict["max_length"] 91 | ) 92 | 93 | print_result = "1. Initialization Reasoning Path: " + initial_answer 94 | 95 | initial_value = extract_number_from_prediction( 96 | predict, question, initial_answer, {"max_length": arg_dict["max_length"]} 97 | ) 98 | 99 | print_result += ( 100 | "\n2. Initialization Numerical Answer: " 101 | + str(initial_value) 102 | + "\n3. 迭代:" 103 | ) 104 | 105 | generated_values.append(initial_value) 106 | 107 | verify_problem, verify_answer = get_verify_problem_and_answer(question, []) 108 | 109 | incorrect_verify_answer = [] 110 | incorrect_answer = [] 111 | for iter_number in range(arg_dict["max_iteration"]): 112 | if verify_problem == "No Number": 113 | break 114 | verification_result = predict( 115 | verification_template.format( 116 | verify_problem=verify_problem, generated_answer=generated_values[-1] 117 | ), 118 | max_length=arg_dict["max_length"], 119 | ) 120 | while "Unrelated" in verification_result: 121 | incorrect_verify_answer.append(verify_answer) 122 | verify_problem, verify_answer = get_verify_problem_and_answer( 123 | question, incorrect_verify_answer 124 | ) 125 | if verify_problem == "No Number": 126 | break 127 | verification_result = predict( 128 | verification_template.format( 129 | verify_problem=verify_problem, 130 | generated_answer=generated_values[-1], 131 | ), 132 | max_length=arg_dict["max_length"], 133 | ) 134 | if verify_problem == "No Number": 135 | break 136 | print_result += ( 137 | "\n第" 138 | + str(iter_number + 1) 139 | + "轮. X: " 140 | + str(verify_answer) 141 | + "\nVerified Reasoning Path: " 142 | + verification_result 143 | ) 144 | 145 | verification_value = extract_number_from_prediction( 146 | predict, 147 | verify_problem, 148 | verification_result, 149 | {"max_length": arg_dict["max_length"]}, 150 | "X", 151 | ) 152 | print_result += "\n Verified Numerical Answer: " + str(verification_value) 153 | if abs(verification_value - verify_answer) < 0.00001: 154 | break 155 | 156 | incorrect_answer.append(generated_values[-1]) 157 | hypothesis = "{" + ",".join([str(x) for x in incorrect_answer]) + "}" 158 | rectification_result = predict( 159 | rectification_template.format(question=question, hypothesis=hypothesis), 160 | max_length=arg_dict["max_length"], 161 | ) 162 | print_result += "\nRectification Reasoning Path: " + rectification_result 163 | 164 | rectification_value = extract_number_from_prediction( 165 | predict, 166 | question, 167 | rectification_result, 168 | {"max_length": arg_dict["max_length"]}, 169 | ) 170 | print_result += "\nRectification Numerical Answer: " + str( 171 | rectification_value 172 | ) 173 | 174 | if abs(rectification_value - generated_values[-1]) < threshold: 175 | break 176 | 177 | generated_values.append(rectification_value) 178 | 179 | if abs(generated_values[-1] - answer) < threshold: 180 | amount_predict_right += 1 181 | 182 | result_file.write( 183 | json.dumps( 184 | { 185 | "model_prediction": print_result, 186 | "predict_value": generated_values[-1], 187 | }, 188 | ensure_ascii=False, 189 | ) 190 | + "\n" 191 | ) 192 | result_file.flush() 193 | 194 | bar() 195 | # break 196 | 197 | result_file.close() 198 | 199 | print(amount_predict_right) 200 | print(amount_predict_right / len(test_data)) 201 | -------------------------------------------------------------------------------- /codes/README.md: -------------------------------------------------------------------------------- 1 | # 方法简介 2 | 1. LLM 3 | 1. direct系列:直接将问题输入LLM 4 | 另一种写法是在问题后面加`The answer is` 5 | GPT-3.5-Turbo  ChatGLM3-6B  GLM-4 6 | 2. CoT系列:在问题后面直接加` Let's think step by step.` 7 | 另一种写法是:`Q: [Q]. A: Let’s think step by step` 8 | GPT-3.5-Turbo CoT 9 | 3. PRP系列:算是CoT的一种延伸,通过重复多次CoT→验证答案→带着错误答案CoT的过程来实现预测 10 | GPT-3.5-Turbo PRP 11 | 4. 微调系列: 12 | 1. GPT-2 finetune 13 | GPT-2英文版/原版我用的是:https://huggingface.co/openai-community/gpt2 14 | 5. verifier:通过generator生成答案,再用verifier验证答案 15 | 1. GPT-2 verifier 16 | 17 | 18 | # 运行命令 19 | 推广一下云GPU平台GpuMall:https://gpumall.com/login?user=%E5%A5%BD%E5%8F%8B&invitedUserId=1263207468&source=amb 20 | 我的专属邀请码:A1263269801 21 | 22 | GPT-3.5-Turbo + Alg514:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/ChatGPT-3.5_Alg_result.txt` 23 | 24 | GPT-3.5-Turbo + AI2:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn AI2 -ds datasets/AI2 -pt pure -rt codes/results/ChatGPT-3.5_AI2_result.txt`(约4分钟) 25 | 26 | GPT-3.5-Turbo + dolphin1878: `python codes/zero_shot_infer.py -mc GPT-3.5 -dn dolphin1878 -ds datasets/dolphin1878 -pt pure -rt codes/results/ChatGPT-3.5_dolphin1878_result.txt`(约9分钟) 27 | 28 | GPT-3.5-Turbo + Math23K:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn Math23K -ds datasets/math23k -pt pure -rt codes/results/ChatGPT-3.5_Math23K_result.txt`(约1小时32分钟) 29 | 30 | GPT-3.5-Turbo + ASDiv:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn ASDiv -ds datasets/asdiv -pt pure -rt codes/results/ChatGPT-3.5_ASDiv_result.txt`(约28分钟) 31 | 32 | GPT-3.5-Turbo + Ape210K:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn Ape210K -ds datasets/ape210k -pt pure -rt codes/results/ChatGPT-3.5_Ape210K_result.txt`(约7小时42分钟) 33 | 34 | GPT-3.5-Turbo + GSM8K:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn GSM8K -ds datasets/gsm8k -pt pure -rt codes/results/ChatGPT-3.5_GSM8K_result.txt`(约2小时) 35 | 36 | GPT-3.5-Turbo + SVAMP:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn SVAMP -ds datasets/svamp -pt pure -rt codes/results/ChatGPT-3.5_SVAMP_result.txt`(约20分钟) 37 | 38 | GPT-3.5-Turbo CoT + Alg514:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn Alg514 -ds datasets/Alg514 -pt CoT -rt codes/results/ChatGPT-3.5_COT_Alg_result.txt` 39 | 40 | GPT-3.5-Turbo CoT+tip + Alg514:`python codes/zero_shot_infer.py -mc GPT-3.5 -dn Alg514 -ds datasets/Alg514 -pt CoT+tip -rt codes/results/ChatGPT-3.5_COT+tip_Alg_result.txt` 41 | 42 | GPT-3.5_PRP + Alg514: `python codes/PRP.py -mc GPT-3.5 -dn Alg514 -ds datasets/Alg514 -rt codes/results/ChatGPT_PRP_Alg_result.txt`(约10分钟) 43 | 44 | ChatGLM3-6B + Alg514:`CUDA_VISIBLE_DEVICES=4 python codes/zero_shot_infer.py -mc /data/pretrained_models/chatglm3-6b -mn ChatGLM3 -dn Alg514 -ds datasets/Alg514 -rt codes/results/ChatGLM3_Alg_result.txt` 45 | 46 | GLM-4 + Alg514:`python codes/zero_shot_infer.py -mc GLM-4 -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/GLM4_Alg_result.txt`(约2.1元 + 6分钟) 47 | 48 | Yi-Large + Alg514:`python codes/zero_shot_infer.py -mc yi-large -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/Yi_large_Alg_result.txt`(约0.49元 + 7分钟) 49 | 50 | deepseek-chat + Alg514:`python codes/zero_shot_infer.py -mc deepseek-chat -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/deepseek-chat_Alg_result.txt`(约0.02元 + 7分钟) 51 | 52 | moonshot-v1-8k + Alg514:`python codes/zero_shot_infer.py -mc moonshot-v1-8k -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/moonshot_Alg_result.txt`(约0.25元 + 49分钟-手动限制了每次调用模型前睡眠1分钟) 53 | 54 | (由于网络问题未成功运行)llama2-70b-4096 + Alg514:`python codes/zero_shot_infer.py -mc llama2-70b-4096 -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/llama2-70b-4096_Alg_result.txt` 55 | 56 | LLaMA3-8B-Instruct + Alg514:`torchrun codes/zero_shot_infer.py -mn Meta-Llama-3-8B-Instruct -mc /gm-data/Meta-Llama-3-8B-Instruct/ -dn Alg514 -ds datasets/Alg514 -pt pure -rt codes/results/LLaMA3-8B-Instruct_Alg_result.txt`(约3分钟) 57 | 58 | GPT-2 + Alg514:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/test.py -dn Alg514 -ds datasets/Alg514 -cp openai-community/gpt2 -rt codes/results/gpt2_direct_Alg_result.txt`(约17秒) 59 | 60 | GPT-2 finetune + Alg514: 61 | 训练:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/finetune.py -dn Alg514 -ds datasets/Alg514 -cp my_checkpoints/gpt2_alg514 -bs 32`(约4秒) 62 | 测试:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/test.py -dn Alg514 -ds datasets/Alg514 -cp my_checkpoints/gpt2_alg514 -rt codes/results/gpt2_Alg_result.txt`(约17秒) 63 | 64 | GPT-2 finetune + AI2:(之所以采用不同的写法是为了练习代码能力) 65 | 训练:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/finetune_w_Trainer.py -dn AI2 -ds datasets/AI2 -cp my_checkpoints/gpt2_AI2 -bs 32`(约4秒) 66 | 测试:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/test.py -dn AI2 -ds datasets/AI2 -cp my_checkpoints/gpt2_AI2 -rt codes/results/gpt2_AI2_result.txt`(约33秒) 67 | 68 | GPT-2 finetune + GSM8K: 69 | 训练:`CUDA_VISIBLE_DEVICES=1 python codes/finetune/gpt2/finetune.py -dn GSM8K -ds datasets/gsm8k -cp my_checkpoints/gpt2_gsm8k`(约7分钟) 70 | 测试(未使用calculator):`CUDA_VISIBLE_DEVICES=1 python codes/finetune/gpt2/test.py -dn GSM8K -ds datasets/gsm8k -cp my_checkpoints/gpt2_gsm8k -rt codes/results/gpt2_GSM8K_result.txt`(约14分钟) 71 | 测试(使用calculator):`CUDA_VISIBLE_DEVICES=3 python codes/finetune/gpt2/test_w_calculator.py -dn GSM8K -ds datasets/gsm8k -cp my_checkpoints/gpt2_gsm8k -rt codes/results/gpt2_GSM8K_w_calculator_result.txt`(约2小时38分钟) 72 | 73 | GPT-2 verifier + GSM8K: 74 | (复现不完全,我在论文笔记里写了,看笔记) 75 | 第一阶段-训练generator:直接用了上面的GPT-2 finetune + GSM8K的checkpoint 76 | 第二阶段-获取用于训练verifier的数据集:`CUDA_VISIBLE_DEVICES=0 python codes/finetune/gpt2/verifier2_generate_verifier_train_data.py -dn GSM8K -ds datasets/gsm8k -cp my_checkpoints/gpt2_gsm8k -rt codes/finetune/gpt2/mid_result/gpt2_GSM8K_verifier_train_data.jsonl`(我用的verifier训练数据集其实是上一版GPT-2微调后得到的结果,而且没跑完,只得到了16695条结果,理论上应该跑 (100 × MWP数据训练集样本数) 这么多条结果出来。别在乎这个了这不重要,反正这个代码是能用的,虽然跟我实际用的代码不一样) 77 | 第三阶段-训练verifier:`CUDA_VISIBLE_DEVICES=5 python codes/finetune/gpt2/verifier3_train_verifier.py -dp codes/finetune/gpt2/mid_result/gpt2_GSM8K_verifier_train_data.jsonl -ip my_checkpoints/gpt2_gsm8k -lsp my_checkpoints/gpt2verifier_gsm8k -sp my_checkpoints/gpt2verifier_gsm8k.pt`(约30分钟:使用了16695个训练样本) 78 | 第四阶段-测试verifier:`CUDA_VISIBLE_DEVICES=4 python codes/finetune/gpt2/test_w_calculator.py -dn GSM8K -ds datasets/gsm8k -cp my_checkpoints/gpt2verifier_gsm8k -rt codes/results/verifier_GSM8K_w_calculator_result.txt`(我也不知道具体跑了多久,因为跑了一半服务器自动重启了,我断点续跑的)(其实不应该直接推理的,应该先推理100倍样本然后再打分。我当时没这么写是因为我忘了还有这茬……总之如果大家需要精确复现的话记得改改这部分) -------------------------------------------------------------------------------- /codes/SC.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | parser = argparse.ArgumentParser() 4 | 5 | parser.add_argument("-t","--temperature",type=float,default=0.7) 6 | parser.add_argument("--M",type=int,default=10) 7 | 8 | args = parser.parse_args() 9 | arg_dict=args.__dict__ -------------------------------------------------------------------------------- /codes/calculate_accuracy.py: -------------------------------------------------------------------------------- 1 | import argparse, json 2 | 3 | parser = argparse.ArgumentParser() 4 | 5 | parser.add_argument("-p", "--prediction_path", type=str) 6 | parser.add_argument("-a", "--answer_path", type=str) 7 | 8 | args = parser.parse_args() 9 | arg_dict = args.__dict__ 10 | 11 | predictions = [ 12 | json.loads(x)["predict_value"] 13 | for x in open(arg_dict["prediction_path"]).readlines() 14 | ] 15 | answers = [ 16 | float(x["answer"][x["answer"].find("#### ") + 5 :].replace(",", "")) 17 | for x in [json.loads(i) for i in open(arg_dict["answer_path"]).readlines()] 18 | ] 19 | 20 | c = 0 21 | for i in range(len(predictions)): 22 | if abs(predictions[i] - answers[i]) < 1e-5: 23 | c += 1 24 | print(c / len(answers)) 25 | -------------------------------------------------------------------------------- /codes/extract_number.py: -------------------------------------------------------------------------------- 1 | import re 2 | from typing import Union, Callable 3 | 4 | 5 | def extract_result_prompt(question, nl_result, x="the answer") -> str: 6 | """参考Get an A in Math: Progressive Rectification Prompting""" 7 | return f""" 8 | Q: {question} 9 | A: {nl_result} 10 | Therefore, {x} (expressed in Arabic numerals and without units) is: 11 | """ 12 | 13 | 14 | def extract_last_number(text) -> float: 15 | """从自然语言格式的结果中抽取出最后一个数值""" 16 | numbers = re.findall(r"-?\d+\.\d+|-?\d+", text) 17 | if not numbers: 18 | return 0 19 | last_number = numbers[-1] 20 | if "." in last_number: 21 | return float(last_number) 22 | else: 23 | i = int(last_number) 24 | try: 25 | return float(i) 26 | except OverflowError: # OverflowError: int too large to convert to float 27 | return 0 28 | 29 | 30 | def extract_number_from_prediction( 31 | predict_function: Callable[[str], str], 32 | question: str, 33 | prediction: str, 34 | predict_function_params: dict = None, 35 | x: str = "the answer", 36 | ) -> Union[int, float]: 37 | if predict_function_params is not None: 38 | predict_result = predict_function( 39 | extract_result_prompt(question, prediction, x), **predict_function_params 40 | ) 41 | else: 42 | predict_result = predict_function( 43 | extract_result_prompt(question, prediction, x) 44 | ) 45 | try: 46 | predict_result = float(predict_result) 47 | except: 48 | predict_result = extract_last_number(predict_result) 49 | if predict_result is None: 50 | predict_result = 0 51 | 52 | return predict_result 53 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/GPT2DataSet.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | class GPT2DefinedDataset(torch.utils.data.Dataset): 5 | def __init__(self, tokenizer, examples, loss_on_prefix=True): 6 | self.examples = examples 7 | self.qns = [ex["question"] for ex in self.examples] 8 | self.ans = [ex["answer"] for ex in self.examples] 9 | self.qns = tokenizer(self.qns, padding=False) 10 | self.ans = tokenizer(self.ans, padding=False) 11 | self.loss_on_prefix = loss_on_prefix 12 | self.max_len = max( 13 | [ 14 | len(self.qns["input_ids"][i]) + len(self.ans["input_ids"][i]) 15 | for i in range(len(self.examples)) 16 | ] 17 | ) 18 | print(f"Max tokens: {self.max_len}") 19 | 20 | if "label" in examples[0]: 21 | self.two_type_label = [ex["label"] for ex in self.examples] 22 | else: 23 | self.two_type_label = [] 24 | 25 | def __len__(self): 26 | return len(self.examples) 27 | 28 | def __getitem__(self, idx): 29 | qn_tokens = self.qns["input_ids"][idx] 30 | ans_tokens = self.ans["input_ids"][idx] 31 | pad_tokens = [0] * (self.max_len - len(qn_tokens) - len(ans_tokens)) 32 | tokens = qn_tokens + ans_tokens + pad_tokens 33 | mask = ( 34 | ([int(self.loss_on_prefix)] * len(qn_tokens)) 35 | + ([1] * len(ans_tokens)) 36 | + ([0] * len(pad_tokens)) 37 | ) 38 | tokens = torch.tensor(tokens) 39 | mask = torch.tensor(mask) 40 | 41 | if len(self.two_type_label) > 0: 42 | return ( 43 | dict(input_ids=tokens, attention_mask=mask), 44 | self.two_type_label[idx], 45 | ) 46 | else: 47 | return dict(input_ids=tokens, attention_mask=mask) 48 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/finetune.py: -------------------------------------------------------------------------------- 1 | # 本代码用于微调GPT-2模型,并将模型储存到本地 2 | 3 | # 代码参考https://github.com/openai/grade-school-math/blob/master/grade_school_math/train.py 4 | # https://github.com/openai/grade-school-math/blob/master/grade_school_math/dataset.py 5 | 6 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 7 | 8 | import sys 9 | 10 | sys.path.append("codes") 11 | 12 | 13 | import torch, os 14 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 15 | from transformers import GPT2Config, AdamW 16 | from transformers import get_scheduler 17 | from tqdm.auto import tqdm 18 | from torch.utils.data import DataLoader 19 | 20 | from get_data import get_data 21 | from GPT2DataSet import GPT2DefinedDataset 22 | 23 | num_threads = "32" 24 | torch.set_num_threads(int(num_threads)) 25 | os.environ["OMP_NUM_THREADS"] = num_threads 26 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 27 | os.environ["MKL_NUM_THREADS"] = num_threads 28 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 29 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 30 | 31 | 32 | import argparse 33 | 34 | parser = argparse.ArgumentParser() 35 | 36 | parser.add_argument("-dn", "--dataset_name", type=str) 37 | # 目前支持的选项: 38 | # Alg514 GSM8K 39 | 40 | parser.add_argument("-ds", "--dataset_path", type=str) 41 | # 储存数据的文件夹 42 | 43 | parser.add_argument("--language", type=str, default="en") # 使用的模型的语言,可选en/zh 44 | 45 | parser.add_argument("-cp", "--checkpoint_path", type=str) # 模型存储路径 46 | 47 | parser.add_argument("-bs", "--batch_size", type=int, default=16) 48 | parser.add_argument("-lr", "--learning_rate", type=float, default=1e-5) 49 | parser.add_argument("-e", "--num_epochs", type=int, default=2) 50 | parser.add_argument("-ws", "--warmup_steps", type=int, default=0) 51 | 52 | args = parser.parse_args() 53 | arg_dict = args.__dict__ 54 | 55 | 56 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 57 | 58 | train_examples = all_data["train"] 59 | for example in train_examples: 60 | example.update(question=example["question"] + " The answer is:" + "\n") 61 | example.update(answer=example["answer_with_reasoning"] + "<|endoftext|>") 62 | 63 | print(f"{len(train_examples)} train examples") 64 | 65 | if arg_dict["language"] == "en": 66 | gpt2path = gpt_2_english_path 67 | else: 68 | gpt2path = gpt_2_chinese_path 69 | 70 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 71 | train_dset = GPT2DefinedDataset(tokenizer, train_examples, loss_on_prefix=False) 72 | 73 | config = GPT2Config.from_pretrained(gpt2path) 74 | model = GPT2LMHeadModel.from_pretrained(gpt2path, config=config) 75 | 76 | if torch.cuda.is_available(): 77 | device = "cuda" 78 | else: 79 | device = "cpu" 80 | model.to(device) 81 | 82 | model.train() 83 | 84 | train_loader = DataLoader(train_dset, batch_size=arg_dict["batch_size"], shuffle=True) 85 | optim = AdamW(model.parameters(), lr=arg_dict["learning_rate"]) 86 | 87 | num_epochs = arg_dict["num_epochs"] 88 | num_training_steps = num_epochs * len(train_loader) 89 | lr_scheduler = get_scheduler( 90 | "linear", 91 | optimizer=optim, 92 | num_warmup_steps=arg_dict["warmup_steps"], 93 | num_training_steps=num_training_steps, 94 | ) 95 | 96 | pbar = tqdm(range(num_training_steps)) 97 | for epoch in range(num_epochs): 98 | for batch in train_loader: 99 | optim.zero_grad() 100 | batch = {k: v.to(device) for k, v in batch.items()} 101 | outputs = model(**batch, labels=batch["input_ids"]) 102 | loss = outputs[0] 103 | loss.backward() 104 | optim.step() 105 | lr_scheduler.step() 106 | pbar.update(1) 107 | pbar.set_description(f"train_loss: {loss.item():.5f}") 108 | 109 | model.save_pretrained(arg_dict["checkpoint_path"]) 110 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/finetune_w_Trainer.py: -------------------------------------------------------------------------------- 1 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 2 | 3 | import sys 4 | 5 | sys.path.append("codes") 6 | 7 | import os 8 | 9 | import torch 10 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 11 | from transformers import DataCollatorForLanguageModeling 12 | from transformers import Trainer, TrainingArguments 13 | 14 | from datasets import Dataset 15 | 16 | from get_data import get_data 17 | 18 | num_threads = "32" 19 | torch.set_num_threads(int(num_threads)) 20 | os.environ["OMP_NUM_THREADS"] = num_threads 21 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 22 | os.environ["MKL_NUM_THREADS"] = num_threads 23 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 24 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 25 | 26 | import argparse 27 | 28 | parser = argparse.ArgumentParser() 29 | 30 | parser.add_argument("-dn", "--dataset_name", type=str) 31 | # 目前支持的选项: 32 | # Alg514 GSM8K 33 | 34 | parser.add_argument("-ds", "--dataset_path", type=str) 35 | # 储存数据的文件夹 36 | 37 | parser.add_argument("--language", type=str, default="en") # 使用的模型的语言,可选en/zh 38 | 39 | parser.add_argument("-cp", "--checkpoint_path", type=str) # 模型存储路径 40 | 41 | parser.add_argument("--max_length", type=int, default=512) 42 | parser.add_argument("-bs", "--batch_size", type=int, default=16) 43 | parser.add_argument("-lr", "--learning_rate", type=float, default=1e-5) 44 | parser.add_argument("-e", "--num_epochs", type=int, default=2) 45 | parser.add_argument("-ws", "--warmup_steps", type=int, default=0) 46 | parser.add_argument("-np", "--num_proc", type=int, default=4) 47 | 48 | args = parser.parse_args() 49 | arg_dict = args.__dict__ 50 | 51 | max_seq_length = arg_dict["max_length"] 52 | num_proc = arg_dict["num_proc"] 53 | 54 | ###构建分词器 55 | if arg_dict["language"] == "en": 56 | gpt2path = gpt_2_english_path 57 | else: 58 | gpt2path = gpt_2_chinese_path 59 | 60 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 61 | tokenizer.pad_token = tokenizer.eos_token 62 | 63 | 64 | ###构建数据集 65 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 66 | 67 | 68 | def tokenize_function(examples): 69 | examples["text"] = [ 70 | line for line in examples["text"] if len(line) > 0 and not line.isspace() 71 | ] 72 | return tokenizer( 73 | examples["text"], 74 | truncation=True, 75 | max_length=max_seq_length, 76 | ) 77 | 78 | 79 | dataset_dict = {} 80 | for dataset_split in ["train", "valid"]: 81 | if dataset_split in all_data: 82 | examples = all_data[dataset_split] 83 | example_dataset = {"text": []} 84 | for example in examples: 85 | example_dataset["text"].append( 86 | example["question"] 87 | + " The answer is:\n" 88 | + example["answer_with_reasoning"] 89 | + "<|endoftext|>" 90 | ) 91 | 92 | dataset = Dataset.from_dict(example_dataset) 93 | 94 | tokenized_dataset = dataset.map( 95 | tokenize_function, 96 | batched=True, 97 | num_proc=num_proc, 98 | remove_columns=["text"], 99 | ) 100 | 101 | dataset_dict[dataset_split] = tokenized_dataset 102 | 103 | data_collator = DataCollatorForLanguageModeling( 104 | tokenizer=tokenizer, 105 | mlm=False, 106 | ) 107 | 108 | 109 | ###加载模型 110 | model = GPT2LMHeadModel.from_pretrained(gpt2path) 111 | 112 | training_args = TrainingArguments( 113 | output_dir=arg_dict["checkpoint_path"], 114 | overwrite_output_dir=True, 115 | num_train_epochs=arg_dict["num_epochs"], 116 | per_device_train_batch_size=arg_dict["batch_size"], 117 | per_device_eval_batch_size=arg_dict["batch_size"], 118 | eval_steps=400, 119 | save_steps=800, 120 | warmup_steps=arg_dict["warmup_steps"], 121 | prediction_loss_only=True, 122 | report_to="none", 123 | ) 124 | 125 | trainer_args = { 126 | "model": model, 127 | "args": training_args, 128 | "data_collator": data_collator, 129 | "train_dataset": dataset_dict["train"], 130 | } 131 | if "valid" in dataset_dict: 132 | trainer_args["eval_dataset"] = dataset_dict["valid"] 133 | 134 | trainer = Trainer(**trainer_args) 135 | trainer.train() 136 | 137 | trainer.save_model() 138 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/test.py: -------------------------------------------------------------------------------- 1 | # 本代码用于调用本地储存的checkpoint进行测试 2 | 3 | # 代码参考https://github.com/openai/grade-school-math/blob/master/grade_school_math/sample.py 4 | 5 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 6 | 7 | import sys 8 | 9 | sys.path.append("codes") 10 | 11 | 12 | import os, json 13 | from tqdm import tqdm 14 | 15 | import torch 16 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 17 | 18 | from get_data import get_data 19 | from extract_number import extract_last_number 20 | 21 | 22 | num_threads = "32" 23 | torch.set_num_threads(int(num_threads)) 24 | os.environ["OMP_NUM_THREADS"] = num_threads 25 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 26 | os.environ["MKL_NUM_THREADS"] = num_threads 27 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 28 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 29 | 30 | 31 | import argparse 32 | 33 | parser = argparse.ArgumentParser() 34 | 35 | parser.add_argument("-dn", "--dataset_name", type=str) 36 | # 目前支持的选项: 37 | # Alg514 GSM8K 38 | 39 | parser.add_argument("-ds", "--dataset_path", type=str) 40 | # 储存数据的文件夹 41 | 42 | parser.add_argument("--language", type=str, default="en") 43 | 44 | parser.add_argument("-cp", "--checkpoint_path", type=str) 45 | 46 | parser.add_argument("-rt", "--result_path", type=str) # 输出测试结果的文本文件 47 | 48 | args = parser.parse_args() 49 | arg_dict = args.__dict__ 50 | 51 | 52 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 53 | 54 | test_examples = all_data["test"] 55 | for example in test_examples: 56 | example.update(question=example["question"] + "\n") 57 | 58 | print(f"{len(test_examples)} test examples") 59 | 60 | if arg_dict["language"] == "en": 61 | gpt2path = gpt_2_english_path 62 | else: 63 | gpt2path = gpt_2_chinese_path 64 | 65 | if torch.cuda.is_available(): 66 | device = "cuda" 67 | else: 68 | device = "cpu" 69 | 70 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 71 | model = GPT2LMHeadModel.from_pretrained(arg_dict["checkpoint_path"]) 72 | model.to(device) 73 | model.eval() 74 | 75 | write_file = open(arg_dict["result_path"], "a") 76 | 77 | amount_predict_right = 0 78 | with torch.no_grad(): 79 | for sample in tqdm(test_examples): 80 | question_prompt = sample["question"] + " The answer is:" 81 | toks = tokenizer(question_prompt, padding=False, return_tensors="pt").to(device) 82 | 83 | outputs = model.generate( 84 | **toks, 85 | max_new_tokens=50, 86 | do_sample=False, 87 | pad_token_id=model.config.eos_token_id, 88 | ) 89 | output_text = tokenizer.decode(outputs[0], skip_special_tokens=True) 90 | output_text = output_text[ 91 | output_text.find(question_prompt) + len(question_prompt) : 92 | ] 93 | 94 | predict_value = extract_last_number(output_text) 95 | if predict_value is None: 96 | predict_value = 0 97 | 98 | if abs(predict_value - sample["answer"]) < threshold: 99 | amount_predict_right += 1 100 | 101 | write_file.write( 102 | json.dumps( 103 | {"model_prediction": output_text, "predict_value": predict_value}, 104 | ensure_ascii=False, 105 | ) 106 | + "\n" 107 | ) 108 | write_file.flush() 109 | 110 | print(amount_predict_right) 111 | print(amount_predict_right / len(test_examples)) 112 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/test_w_calculator.py: -------------------------------------------------------------------------------- 1 | # 本代码用于调用本地储存的checkpoint进行测试 2 | 3 | # 代码参考https://github.com/openai/grade-school-math/blob/master/grade_school_math/sample.py 4 | # https://github.com/openai/grade-school-math/blob/master/grade_school_math/calculator.py 5 | 6 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 7 | 8 | import sys 9 | 10 | sys.path.append("codes") 11 | 12 | 13 | import os, json, signal 14 | from tqdm import tqdm 15 | from contextlib import contextmanager 16 | 17 | import torch 18 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 19 | 20 | from get_data import get_data 21 | from extract_number import extract_last_number 22 | 23 | 24 | num_threads = "32" 25 | torch.set_num_threads(int(num_threads)) 26 | os.environ["OMP_NUM_THREADS"] = num_threads 27 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 28 | os.environ["MKL_NUM_THREADS"] = num_threads 29 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 30 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 31 | 32 | 33 | import argparse 34 | 35 | parser = argparse.ArgumentParser() 36 | 37 | parser.add_argument("-dn", "--dataset_name", type=str) 38 | # 目前支持的选项: 39 | # Alg514 GSM8K 40 | 41 | parser.add_argument("-ds", "--dataset_path", type=str) 42 | # 储存数据的文件夹 43 | 44 | parser.add_argument("--language", type=str, default="en") 45 | 46 | parser.add_argument("-cp", "--checkpoint_path", type=str) 47 | 48 | parser.add_argument("-rt", "--result_path", type=str) # 输出测试结果的文本文件 49 | 50 | args = parser.parse_args() 51 | arg_dict = args.__dict__ 52 | 53 | 54 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 55 | 56 | test_examples = all_data["test"] 57 | for example in test_examples: 58 | example.update(question=example["question"] + "\n") 59 | 60 | print(f"{len(test_examples)} test examples") 61 | 62 | if arg_dict["language"] == "en": 63 | gpt2path = gpt_2_english_path 64 | else: 65 | gpt2path = gpt_2_chinese_path 66 | 67 | if torch.cuda.is_available(): 68 | device = "cuda" 69 | else: 70 | device = "cpu" 71 | 72 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 73 | model = GPT2LMHeadModel.from_pretrained(arg_dict["checkpoint_path"]) 74 | model.to(device) 75 | model.eval() 76 | 77 | 78 | write_file = open(arg_dict["result_path"], "a") 79 | 80 | EQUALS_TOKENS = set([28, 796, 47505]) 81 | 82 | 83 | # 来源的来源:https://stackoverflow.com/questions/492519/timeout-on-a-function-call 84 | @contextmanager 85 | def timeout(duration, formula): 86 | def timeout_handler(signum, frame): 87 | raise Exception(f"'{formula}': timed out after {duration} seconds") 88 | 89 | signal.signal(signal.SIGALRM, timeout_handler) 90 | signal.alarm(duration) 91 | yield 92 | signal.alarm(0) 93 | 94 | 95 | def eval_with_timeout(formula, max_time=3): 96 | try: 97 | with timeout(max_time, formula): 98 | return eval(formula) 99 | except Exception as e: 100 | signal.alarm(0) 101 | print(f"Warning: Failed to eval {formula}, exception: {e}") 102 | return None 103 | 104 | 105 | def use_calculator(sample): 106 | if "<<" not in sample: 107 | return None 108 | 109 | parts = sample.split("<<") 110 | remaining = parts[-1] 111 | if ">>" in remaining: 112 | return None 113 | if "=" not in remaining: 114 | return None 115 | lhs = remaining.split("=")[0] 116 | lhs = lhs.replace(",", "") 117 | if any([x not in "0123456789*+-/.()" for x in lhs]): 118 | return None 119 | return eval_with_timeout(lhs) 120 | 121 | 122 | amount_predict_right = 0 123 | with torch.no_grad(): 124 | for sample in tqdm(test_examples): 125 | question_prompt = sample["question"] + " The answer is:" 126 | qn = question_prompt 127 | 128 | sample_len = 512 129 | for _ in range(sample_len): 130 | toks = tokenizer([qn], padding=False, return_tensors="pt").to(device) 131 | orig_len = toks["input_ids"].shape[1] 132 | 133 | out = model.generate( 134 | **toks, 135 | max_length=orig_len + 1, 136 | pad_token_id=model.config.eos_token_id, 137 | do_sample=False 138 | ) 139 | text = tokenizer.batch_decode(out)[0] 140 | 141 | if out[0, -1].item() in EQUALS_TOKENS: 142 | answer = use_calculator(text) 143 | if answer is not None: 144 | # print("Triggered calculator, answer", answer) 145 | text = text + str(answer) + ">>" 146 | 147 | qn = text 148 | if "<|endoftext|>" in qn: 149 | break 150 | 151 | qn = qn[qn.find(question_prompt) + len(question_prompt) :] 152 | 153 | predict_value = extract_last_number(qn) 154 | if predict_value is None: 155 | predict_value = 0 156 | 157 | if abs(predict_value - sample["answer"]) < threshold: 158 | amount_predict_right += 1 159 | 160 | write_file.write( 161 | json.dumps( 162 | {"model_prediction": qn, "predict_value": predict_value}, 163 | ensure_ascii=False, 164 | ) 165 | + "\n" 166 | ) 167 | write_file.flush() 168 | 169 | print(amount_predict_right) 170 | print(amount_predict_right / len(test_examples)) 171 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/verifier2_generate_verifier_train_data.py: -------------------------------------------------------------------------------- 1 | # 本代码用于通过generator生成verifier的训练数据 2 | 3 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 4 | 5 | import sys 6 | 7 | sys.path.append("codes") 8 | 9 | 10 | import os, json, signal 11 | from tqdm import tqdm 12 | from contextlib import contextmanager 13 | 14 | import torch 15 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 16 | 17 | from get_data import get_data 18 | from extract_number import extract_last_number 19 | 20 | 21 | num_threads = "32" 22 | torch.set_num_threads(int(num_threads)) 23 | os.environ["OMP_NUM_THREADS"] = num_threads 24 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 25 | os.environ["MKL_NUM_THREADS"] = num_threads 26 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 27 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 28 | 29 | 30 | import argparse 31 | 32 | parser = argparse.ArgumentParser() 33 | 34 | parser.add_argument("-dn", "--dataset_name", type=str) 35 | # 目前支持的选项: 36 | # Alg514 GSM8K 37 | 38 | parser.add_argument("-ds", "--dataset_path", type=str) 39 | # 储存数据的文件夹 40 | 41 | parser.add_argument("--language", type=str, default="en") 42 | 43 | parser.add_argument("-cp", "--checkpoint_path", type=str) 44 | 45 | parser.add_argument("-rt", "--result_path", type=str) # 输出测试结果的文本文件 46 | 47 | args = parser.parse_args() 48 | arg_dict = args.__dict__ 49 | 50 | 51 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 52 | 53 | test_examples = all_data["train"] 54 | for example in test_examples: 55 | example.update(question=example["question"] + "\n") 56 | 57 | if arg_dict["language"] == "en": 58 | gpt2path = gpt_2_english_path 59 | else: 60 | gpt2path = gpt_2_chinese_path 61 | 62 | if torch.cuda.is_available(): 63 | device = "cuda" 64 | else: 65 | device = "cpu" 66 | 67 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 68 | model = GPT2LMHeadModel.from_pretrained(arg_dict["checkpoint_path"]) 69 | model.to(device) 70 | model.eval() 71 | 72 | 73 | write_file = open(arg_dict["result_path"], "a") 74 | 75 | EQUALS_TOKENS = set([28, 796, 47505]) 76 | 77 | 78 | # 来源的来源:https://stackoverflow.com/questions/492519/timeout-on-a-function-call 79 | @contextmanager 80 | def timeout(duration, formula): 81 | def timeout_handler(signum, frame): 82 | raise Exception(f"'{formula}': timed out after {duration} seconds") 83 | 84 | signal.signal(signal.SIGALRM, timeout_handler) 85 | signal.alarm(duration) 86 | yield 87 | signal.alarm(0) 88 | 89 | 90 | def eval_with_timeout(formula, max_time=3): 91 | try: 92 | with timeout(max_time, formula): 93 | return eval(formula) 94 | except Exception as e: 95 | signal.alarm(0) 96 | print(f"Warning: Failed to eval {formula}, exception: {e}") 97 | return None 98 | 99 | 100 | def use_calculator(sample): 101 | if "<<" not in sample: 102 | return None 103 | 104 | parts = sample.split("<<") 105 | remaining = parts[-1] 106 | if ">>" in remaining: 107 | return None 108 | if "=" not in remaining: 109 | return None 110 | lhs = remaining.split("=")[0] 111 | lhs = lhs.replace(",", "") 112 | if any([x not in "0123456789*+-/.()" for x in lhs]): 113 | return None 114 | return eval_with_timeout(lhs) 115 | 116 | 117 | correct_count = 0 118 | with torch.no_grad(): 119 | for sample in tqdm(test_examples): 120 | question_prompt = sample["question"] + " The answer is:" 121 | qn = question_prompt 122 | 123 | sample_len = 512 124 | for _ in range(100): 125 | qn = question_prompt 126 | for _ in range(sample_len): 127 | toks = tokenizer([qn], padding=False, return_tensors="pt").to(device) 128 | orig_len = toks["input_ids"].shape[1] 129 | 130 | out = model.generate( 131 | **toks, 132 | max_length=orig_len + 1, 133 | pad_token_id=model.config.eos_token_id, 134 | do_sample=True, 135 | temperature=0.7, 136 | ) 137 | text = tokenizer.batch_decode(out)[0] 138 | 139 | if out[0, -1].item() in EQUALS_TOKENS: 140 | answer = use_calculator(text) 141 | if answer is not None: 142 | # print("Triggered calculator, answer", answer) 143 | text = text + str(answer) + ">>" 144 | 145 | qn = text 146 | if "<|endoftext|>" in qn: 147 | break 148 | 149 | qn = qn[qn.find(question_prompt) + len(question_prompt) :] 150 | 151 | predict_value = extract_last_number(qn) 152 | if predict_value is None: 153 | predict_value = 0 154 | 155 | if abs(predict_value - sample["answer"]) < threshold: 156 | label = 1 157 | correct_count += 1 158 | else: 159 | label = 0 160 | 161 | write_file.write( 162 | json.dumps( 163 | { 164 | "question": sample["question"], 165 | "model_prediction": qn, 166 | "label": label, 167 | }, 168 | ensure_ascii=False, 169 | ) 170 | + "\n" 171 | ) 172 | write_file.flush() 173 | 174 | write_file.close() 175 | print(correct_count) 176 | print(correct_count / (len(test_examples) * 100)) 177 | -------------------------------------------------------------------------------- /codes/finetune/gpt2/verifier3_train_verifier.py: -------------------------------------------------------------------------------- 1 | # 本代码用于训练verifier 2 | 3 | from hide_config import gpt_2_english_path, gpt_2_chinese_path 4 | 5 | import sys, json 6 | 7 | sys.path.append("codes") 8 | 9 | 10 | import torch, os 11 | from transformers import GPT2Tokenizer, GPT2LMHeadModel 12 | from transformers import AdamW 13 | from transformers import get_scheduler 14 | from tqdm.auto import tqdm 15 | import torch.nn as nn 16 | from torch.utils.data import DataLoader 17 | 18 | from GPT2DataSet import GPT2DefinedDataset 19 | 20 | num_threads = "32" 21 | torch.set_num_threads(int(num_threads)) 22 | os.environ["OMP_NUM_THREADS"] = num_threads 23 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 24 | os.environ["MKL_NUM_THREADS"] = num_threads 25 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 26 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 27 | 28 | 29 | import argparse 30 | 31 | parser = argparse.ArgumentParser() 32 | 33 | parser.add_argument("-dp", "--dataset_path", type=str) # 储存数据的文本文件 34 | 35 | parser.add_argument("--language", type=str, default="en") # 使用的模型的语言,可选en/zh 36 | 37 | parser.add_argument("-ip", "--initial_path", type=str) # generator路径 38 | parser.add_argument("-lsp", "--lm_save_path", type=str) # verifier LM存储路径 39 | parser.add_argument("-sp", "--save_path", type=str) # verifier全模型权重存储路径 40 | 41 | parser.add_argument("-bs", "--batch_size", type=int, default=8) 42 | parser.add_argument("-lr", "--learning_rate", type=float, default=1e-5) 43 | parser.add_argument("-e", "--num_epochs", type=int, default=2) # 论文值 44 | parser.add_argument("-ws", "--warmup_steps", type=int, default=0) 45 | 46 | args = parser.parse_args() 47 | arg_dict = args.__dict__ 48 | 49 | 50 | train_examples = [json.loads(x) for x in open(arg_dict["dataset_path"]).readlines()] 51 | for example in train_examples: 52 | example.update(question=example["question"] + " The answer is:" + "\n") 53 | example.update(answer=example["model_prediction"]) 54 | 55 | print(f"{len(train_examples)} train examples") 56 | 57 | if arg_dict["language"] == "en": 58 | gpt2path = gpt_2_english_path 59 | else: 60 | gpt2path = gpt_2_chinese_path 61 | 62 | tokenizer = GPT2Tokenizer.from_pretrained(gpt2path) 63 | train_dset = GPT2DefinedDataset(tokenizer, train_examples, loss_on_prefix=False) 64 | 65 | 66 | loss_fn = nn.BCEWithLogitsLoss() 67 | 68 | 69 | class Verifier(nn.Module): 70 | def __init__(self): 71 | super(Verifier, self).__init__() 72 | self.lm = GPT2LMHeadModel.from_pretrained( 73 | arg_dict["initial_path"] 74 | ) # 用generator初始化GPT-2模型 75 | 76 | self.linear = nn.Linear(50257, 1) 77 | 78 | def forward(self, input_ids, attention_mask, labels, two_type_label): 79 | lm_output = self.lm( 80 | input_ids=input_ids, attention_mask=attention_mask, labels=labels 81 | ) 82 | lm_loss = lm_output[0] 83 | classifier_output = self.linear(lm_output["logits"]).squeeze(-1) 84 | two_type_label = ( 85 | two_type_label.unsqueeze(1).expand(-1, classifier_output.size()[1]).float() 86 | ) 87 | classifier_loss = loss_fn( 88 | classifier_output, two_type_label 89 | ) # 其实这个应该mask掉prompt的,但我忘了。总之你们如果也要复现的时候记得改一下 90 | return lm_loss + classifier_loss 91 | 92 | 93 | model = Verifier() 94 | 95 | if torch.cuda.is_available(): 96 | device = "cuda" 97 | else: 98 | device = "cpu" 99 | model.to(device) 100 | 101 | model.train() 102 | 103 | train_loader = DataLoader(train_dset, batch_size=arg_dict["batch_size"], shuffle=True) 104 | optim = AdamW(model.parameters(), lr=arg_dict["learning_rate"]) 105 | 106 | num_epochs = arg_dict["num_epochs"] 107 | num_training_steps = num_epochs * len(train_loader) 108 | lr_scheduler = get_scheduler( 109 | "linear", 110 | optimizer=optim, 111 | num_warmup_steps=arg_dict["warmup_steps"], 112 | num_training_steps=num_training_steps, 113 | ) 114 | 115 | pbar = tqdm(range(num_training_steps)) 116 | 117 | for epoch in range(num_epochs): 118 | for batch in train_loader: 119 | optim.zero_grad() 120 | batch_cuda = {k: v.to(device) for k, v in batch[0].items()} 121 | outputs = model( 122 | **batch_cuda, 123 | labels=batch_cuda["input_ids"], 124 | two_type_label=batch[1].to(device), 125 | ) 126 | outputs.backward() 127 | optim.step() 128 | lr_scheduler.step() 129 | pbar.update(1) 130 | pbar.set_description(f"train_loss: {outputs.item():.5f}") 131 | 132 | model.lm.save_pretrained(arg_dict["lm_save_path"]) 133 | torch.save(model.state_dict(), arg_dict["save_path"]) 134 | -------------------------------------------------------------------------------- /codes/get_data.py: -------------------------------------------------------------------------------- 1 | import os, json 2 | 3 | 4 | def get_data(dataset_name: str, dataset_path: str) -> dict: 5 | return_json = {} 6 | 7 | if dataset_name == "Alg514" or dataset_name == "AI2": 8 | 9 | for split_type in ["train", "valid", "test"]: 10 | if dataset_name == "Alg514": 11 | file_path = f"alg514_questions_1result_{split_type}.json" 12 | 13 | else: 14 | file_path = f"{split_type}.json" 15 | 16 | return_json[split_type] = [ 17 | { 18 | "question": x["sQuestion"], 19 | "answer": float(x["lSolutions"][0]), 20 | "answer_with_reasoning": "The calculation formula for the question is:" 21 | + " ".join(x["lEquations"]) 22 | + "#### " 23 | + str(x["lSolutions"][0]), 24 | } 25 | for x in json.load(open(os.path.join(dataset_path, file_path))) 26 | ] 27 | elif dataset_name == "dolphin1878": 28 | for split_type in ["train", "valid", "test"]: 29 | file_path = f"{split_type}.json" 30 | return_json[split_type] = [ 31 | {"question": x["text"], "answer": float(x["ans_simple"][0])} 32 | for x in json.load(open(os.path.join(dataset_path, file_path))) 33 | ] 34 | elif dataset_name in ["ASDiv", "Ape210K", "SVAMP"]: 35 | for split_type in ["train", "valid", "test"]: 36 | file_path = f"{split_type}.json" 37 | return_json[split_type] = [ 38 | {"question": x["question"], "answer": x["answer"]} 39 | for x in json.load(open(os.path.join(dataset_path, file_path))) 40 | ] 41 | elif dataset_name == "Math23K": 42 | for split_type in ["train", "valid", "test"]: 43 | file_path = f"{split_type}23k_processed.json" 44 | return_json[split_type] = [ 45 | {"question": x["original_text"], "answer": float(x["answer"])} 46 | for x in json.load(open(os.path.join(dataset_path, file_path))) 47 | ] 48 | elif dataset_name == "GSM8K": 49 | for split_type in ["train", "test"]: 50 | file_path = f"{split_type}.jsonl" 51 | this_list = [] 52 | for line in open(os.path.join(dataset_path, file_path)): 53 | one_problem = json.loads(line) 54 | answer_str = one_problem["answer"] 55 | this_list.append( 56 | { 57 | "question": one_problem["question"], 58 | "answer": float( 59 | answer_str[answer_str.find("#### ") + 5 :].replace(",", "") 60 | ), 61 | "answer_with_reasoning": answer_str, 62 | } 63 | ) 64 | return_json[split_type] = this_list 65 | 66 | if dataset_name in ["Alg514", "dolphin1878", "Ape210K"]: 67 | threshold = 0.001 68 | else: 69 | threshold = 0.00001 70 | return return_json, threshold 71 | -------------------------------------------------------------------------------- /codes/infer_predict.py: -------------------------------------------------------------------------------- 1 | from hide_config import * 2 | from typing import Callable 3 | import os 4 | 5 | 6 | def get_infer(model_name: str, model_checkpoint_path: str) -> Callable[[str], str]: 7 | # 调用API 8 | if model_checkpoint_path == "GPT-3.5": 9 | import tiktoken 10 | from tenacity import ( 11 | retry, 12 | stop_after_attempt, 13 | wait_random_exponential, 14 | ) 15 | from openai import OpenAI 16 | 17 | client = OpenAI(api_key=CHATGPT3_5_API_KEY, base_url=CHATGPT3_5_base_url) 18 | 19 | def num_tokens_from_messages(messages, model): 20 | """Returns the number of tokens used by a list of messages.""" 21 | try: 22 | encoding = tiktoken.encoding_for_model(model) 23 | except KeyError: 24 | encoding = tiktoken.get_encoding("cl100k_base") 25 | num_tokens = 0 26 | for message in messages: 27 | num_tokens += 4 # every message follows {role/name}\n{content}\n 28 | for _, value in message.items(): 29 | num_tokens += len(encoding.encode(value)) 30 | num_tokens += 2 # every reply is primed with assistant 31 | return num_tokens 32 | 33 | @retry( 34 | wait=wait_random_exponential(min=20, max=600), stop=stop_after_attempt(6) 35 | ) 36 | def predict(content, max_length=None): 37 | return wrap4predict(content, max_length) 38 | 39 | def wrap4predict(content, max_length=None): 40 | messages = [{"role": "user", "content": content}] 41 | 42 | if ( 43 | num_tokens_from_messages(messages, "gpt-3.5-turbo") < 3096 44 | ): # 留1000个token给输出 45 | local_model_name = "gpt-3.5-turbo" 46 | else: 47 | local_model_name = "gpt-3.5-turbo-16k" 48 | 49 | completion_params = {"model": local_model_name, "messages": messages} 50 | 51 | if max_length is not None: 52 | completion_params["max_tokens"] = max_length 53 | 54 | completion = client.chat.completions.create(**completion_params) 55 | return completion.choices[0].message.content 56 | 57 | # 类OpenAI接口 58 | elif model_checkpoint_path in [ 59 | "yi-large", 60 | "deepseek-chat", 61 | "moonshot-v1-8k", 62 | "GLM-4", 63 | ]: 64 | temperature = 0.9 65 | 66 | # 调用openai SDK 67 | if model_checkpoint_path in [ 68 | "yi-large", 69 | "deepseek-chat", 70 | "moonshot-v1-8k", 71 | ]: 72 | from openai import OpenAI 73 | 74 | if model_checkpoint_path in ["yi-large"]: 75 | API_BASE = "https://api.lingyiwanwu.com/v1" 76 | API_KEY = Yi_key 77 | elif model_checkpoint_path == "deepseek-chat": 78 | API_BASE = "https://api.deepseek.com" 79 | API_KEY = DeepSeek_KEY 80 | temperature = 0 81 | else: 82 | API_BASE = "https://api.moonshot.cn/v1" 83 | API_KEY = Moonshot_KEY 84 | temperature = 0.3 85 | client = OpenAI(api_key=API_KEY, base_url=API_BASE) 86 | 87 | local_model_name = model_checkpoint_path 88 | 89 | # 调用原生SDK 90 | elif model_checkpoint_path == "GLM-4": 91 | from zhipuai import ZhipuAI 92 | 93 | client = ZhipuAI(api_key=Zhipu_key) 94 | 95 | local_model_name = "glm-4" 96 | 97 | def predict(content): 98 | response = client.chat.completions.create( 99 | model=local_model_name, 100 | messages=[{"role": "user", "content": content}], 101 | top_p=0.7, 102 | temperature=temperature, 103 | stream=False, 104 | max_tokens=2000, 105 | ) 106 | return response.choices[0].message.content 107 | 108 | elif model_checkpoint_path in [ 109 | "llama2-70b-4096", 110 | "mixtral-8x7b-32768", 111 | "Gemma-7b-it", 112 | ]: 113 | from groq import Groq 114 | 115 | client = Groq( 116 | api_key=groq_key, 117 | ) 118 | 119 | def predict(content): 120 | completion = client.chat.completions.create( 121 | model=model_checkpoint_path, 122 | messages=[{"role": "user", "content": content}], 123 | temperature=0.5, 124 | max_tokens=1024, 125 | top_p=1, 126 | stream=True, 127 | stop=None, 128 | ) 129 | 130 | result_str = "" 131 | for chunk in completion: 132 | result_str += chunk.choices[0].delta.content or "" 133 | 134 | # 本地服务 135 | elif model_name == "ChatGLM3": 136 | from transformers import AutoModel, AutoTokenizer 137 | 138 | model = AutoModel.from_pretrained( 139 | model_checkpoint_path, 140 | load_in_8bit=False, 141 | trust_remote_code=True, 142 | device_map="auto", 143 | ) 144 | model.eval() 145 | tokenizer = AutoTokenizer.from_pretrained( 146 | model_checkpoint_path, trust_remote_code=True 147 | ) 148 | 149 | def predict(content): 150 | response, _ = model.chat(tokenizer, content, history=[], temperature=0.01) 151 | return response 152 | 153 | elif model_name == "Meta-Llama-3-8B-Instruct": 154 | # 我只写了LLaMA3原生模型权重的版本 155 | import sys 156 | 157 | sys.path.append( 158 | llama_module_path 159 | ) # https://github.com/meta-llama/llama3 下载到本地的路径。因为要调用这里面的llama模块 160 | 161 | from llama import Dialog, Llama 162 | 163 | from typing import List 164 | 165 | generator = Llama.build( 166 | ckpt_dir=model_checkpoint_path, 167 | tokenizer_path=os.path.join(model_checkpoint_path, "tokenizer.model"), 168 | max_seq_len=8192, 169 | max_batch_size=6, 170 | ) 171 | 172 | def predict(content, max_length=1024): 173 | dialogs: List[Dialog] = [[{"role": "user", "content": content}]] 174 | results = generator.chat_completion( 175 | dialogs, 176 | max_gen_len=max_length, # 其实这地方不该这么写的,写成max_length-calculate_length(input_str)比较合适 177 | temperature=0.6, 178 | top_p=0.9, 179 | ) 180 | for _, result in zip(dialogs, results): 181 | return result["generation"]["content"] 182 | 183 | return predict 184 | -------------------------------------------------------------------------------- /codes/preprocess_data/AI2.py: -------------------------------------------------------------------------------- 1 | # 官方数据集下载地址挂了,但是可以在但是可以在代码文件(https://www.dropbox.com/s/1slbq2fi77fq7wx/Java%20code_mathproblems.zip?dl=1)里面找到Math_Word_DS2.zip文件 2 | # 以下直接使用解压文件中ALL文件夹 - ALL.json文件 3 | 4 | #Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. 2014. Learning to Solve Arithmetic Word Problems with Verb Categorization. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 523–533, Doha, Qatar. Association for Computational Linguistics. 5 | 6 | # 按照8:1:2的比例随机划分数据集 7 | import json, random 8 | 9 | with open("datasets/AI2/ALL.json") as f: 10 | data = json.load(f) 11 | 12 | random.seed(20240308) 13 | random.shuffle(data) 14 | 15 | train_val_test_list = [8, 1, 2] 16 | tvt_sum = sum(train_val_test_list) 17 | tvt_ratio_list = [i / tvt_sum for i in train_val_test_list] 18 | train_end_index = int(tvt_ratio_list[0] * len(data)) 19 | val_end_index = train_end_index + int(tvt_ratio_list[1] * len(data)) 20 | 21 | json.dump( 22 | data[:train_end_index], 23 | open("datasets/AI2/train.json", "w"), 24 | ensure_ascii=False, 25 | indent=4, 26 | ) 27 | json.dump( 28 | data[train_end_index:val_end_index], 29 | open("datasets/AI2/valid.json", "w"), 30 | ensure_ascii=False, 31 | indent=4, 32 | ) 33 | json.dump( 34 | data[val_end_index:], 35 | open("datasets/AI2/test.json", "w"), 36 | ensure_ascii=False, 37 | indent=4, 38 | ) 39 | -------------------------------------------------------------------------------- /codes/preprocess_data/alg514.py: -------------------------------------------------------------------------------- 1 | #http://groups.csail.mit.edu/rbg/code/wordprobs/questions.json 2 | # Nate Kushman, Yoav Artzi, Luke Zettlemoyer, and Regina Barzilay. 2014. Learning to Automatically Solve Algebra Word Problems. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 271–281, Baltimore, Maryland. Association for Computational Linguistics. 3 | 4 | #仅保留只有一个输出的问题。按照8:1:2的比例随机划分数据集 5 | import json,random 6 | 7 | with open("datasets/Alg514/alg514_questions.json") as f: 8 | data=json.load(f) 9 | 10 | new_data=[] 11 | for d in data: 12 | if len(d["lSolutions"])==1: 13 | new_data.append(d) 14 | 15 | random.seed(202401261353) 16 | random.shuffle(new_data) 17 | 18 | train_val_test_list=[8,1,2] 19 | tvt_sum=sum(train_val_test_list) 20 | tvt_ratio_list=[i/tvt_sum for i in train_val_test_list] 21 | train_end_index=int(tvt_ratio_list[0]*len(new_data)) 22 | val_end_index=train_end_index+int(tvt_ratio_list[1]*len(new_data)) 23 | 24 | json.dump(new_data[:train_end_index],open("datasets/Alg514/alg514_questions_1result_train.json","w"), 25 | ensure_ascii=False,indent=4) 26 | json.dump(new_data[train_end_index:val_end_index],open("datasets/Alg514/alg514_questions_1result_valid.json","w"), 27 | ensure_ascii=False,indent=4) 28 | json.dump(new_data[val_end_index:],open("datasets/Alg514/alg514_questions_1result_test.json","w"), 29 | ensure_ascii=False,indent=4) -------------------------------------------------------------------------------- /codes/preprocess_data/ape210k.py: -------------------------------------------------------------------------------- 1 | # https://github.com/Chenny0808/ape210k 2 | 3 | import json, os, re 4 | 5 | dataset_folder = "datasets/ape210k" 6 | 7 | 8 | def replace_percentage_with_decimal(string): 9 | percentages = re.findall(r"(\d*\.?\d+)%", string) 10 | 11 | for percent in percentages: 12 | decimal_value = float(percent) / 100 13 | target = percent + "%" 14 | string = string.replace(target, str(decimal_value)) 15 | 16 | return string 17 | 18 | 19 | def add_prompt(x): 20 | data = json.loads(x) 21 | return_json = {} 22 | return_json["question"] = ( 23 | "Please answer this elementary school math question. Please ensure that the obtained result is a numerical value. If the number is not divisible (whether it is a fraction or an irrational number), please retain 3 decimal places:" 24 | + " " 25 | + data["original_text"] 26 | ) 27 | data["ans"] = replace_percentage_with_decimal(data["ans"]) 28 | data["equation"] = replace_percentage_with_decimal(data["equation"]) 29 | try: 30 | return_json["answer"] = float(data["ans"]) 31 | except ValueError: 32 | try: 33 | if data["ans"].startswith("(") and data["ans"].endswith(")"): 34 | return_json["answer"] = eval( 35 | data["ans"].replace("(", "").replace(")", "") 36 | ) 37 | else: 38 | raise TypeError 39 | except TypeError: 40 | eq = data["equation"] 41 | try: 42 | return_json["answer"] = eval(eq[eq.find("=") + 1 :]) 43 | except (TypeError, SyntaxError): 44 | pass # 各种稀奇古怪的错误 45 | 46 | return return_json 47 | 48 | 49 | for split_type in ["train", "valid", "test"]: 50 | file_path = f"{split_type}.ape.json" 51 | this_data = [] 52 | for problem in open(os.path.join(dataset_folder, file_path)): 53 | processed_json = add_prompt(problem) 54 | if "answer" in processed_json: 55 | this_data.append(processed_json) 56 | 57 | json.dump( 58 | this_data, 59 | open(os.path.join(dataset_folder, split_type + ".json"), "w"), 60 | ensure_ascii=False, 61 | indent=4, 62 | ) 63 | -------------------------------------------------------------------------------- /codes/preprocess_data/aqua.py: -------------------------------------------------------------------------------- 1 | #https://github.com/deepmind/AQuA -------------------------------------------------------------------------------- /codes/preprocess_data/asdiv.py: -------------------------------------------------------------------------------- 1 | # https://github.com/chaochun/nlu-asdiv-dataset/blob/master/dataset/ASDiv.xml 2 | 3 | import json, os, random 4 | import xml.etree.ElementTree as ET 5 | 6 | all_data = [] 7 | dataset_folder = "datasets/asdiv" 8 | dataset_file = "ASDiv.xml" 9 | 10 | # 解析XML文件 11 | tree = ET.parse(os.path.join(dataset_folder, dataset_file)) 12 | root = tree.getroot() 13 | 14 | # 遍历所有的Problem元素 15 | for problem in root.find("ProblemSet").findall("Problem"): 16 | question = problem.find("Body").text + " " + problem.find("Question").text 17 | answer_text = problem.find("Answer").text 18 | try: 19 | answer_float = float(answer_text[: answer_text.find(" (")]) 20 | all_data.append({"question": question, "answer": answer_float}) 21 | except ValueError: 22 | pass 23 | 24 | 25 | random.seed(20240308) 26 | 27 | random.shuffle(all_data) 28 | 29 | train_val_test_list = [8, 1, 2] 30 | tvt_sum = sum(train_val_test_list) 31 | tvt_ratio_list = [i / tvt_sum for i in train_val_test_list] 32 | train_end_index = int(tvt_ratio_list[0] * len(all_data)) 33 | val_end_index = train_end_index + int(tvt_ratio_list[1] * len(all_data)) 34 | 35 | json.dump( 36 | all_data[:train_end_index], 37 | open(os.path.join(dataset_folder, "train.json"), "w"), 38 | ensure_ascii=False, 39 | indent=4, 40 | ) 41 | json.dump( 42 | all_data[train_end_index:val_end_index], 43 | open(os.path.join(dataset_folder, "valid.json"), "w"), 44 | ensure_ascii=False, 45 | indent=4, 46 | ) 47 | json.dump( 48 | all_data[val_end_index:], 49 | open(os.path.join(dataset_folder, "test.json"), "w"), 50 | ensure_ascii=False, 51 | indent=4, 52 | ) 53 | -------------------------------------------------------------------------------- /codes/preprocess_data/dolphin1878.py: -------------------------------------------------------------------------------- 1 | # https://www.microsoft.com/en-us/research/uploads/prod/2016/02//dolphin-number_word_std.zip 2 | # 以下直接使用解压后的文件(其实我没太看懂原数据集的结构,以后我可能会看看原论文重新处理一下) 3 | 4 | # Shuming Shi, Yuehui Wang, Chin-Yew Lin, Xiaojiang Liu, and Yong Rui. 2015. Automatically Solving Number Word Problems by Semantic Parsing and Reasoning. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1132–1142, Lisbon, Portugal. Association for Computational Linguistics. 5 | 6 | # dolphin1878只分了dev和test,我直接重新划分数据集了 7 | import json, os, random 8 | 9 | all_data = [] 10 | all_data_text = set() 11 | dataset_name = "datasets/dolphin1878" 12 | 13 | for file in ["number_word_std.dev.json", "number_word_std.test.json"]: 14 | with open(os.path.join(dataset_name, file)) as f: 15 | data = json.load(f) 16 | for d in data: 17 | if (not d["text"] in all_data_text) and (len(d["ans_simple"]) == 1) and (not "or" in d["ans"]): 18 | all_data.append(d) 19 | all_data_text.add(d["text"]) 20 | 21 | random.seed(20240308) 22 | 23 | random.shuffle(all_data) 24 | 25 | train_val_test_list = [8, 1, 2] 26 | tvt_sum = sum(train_val_test_list) 27 | tvt_ratio_list = [i / tvt_sum for i in train_val_test_list] 28 | train_end_index = int(tvt_ratio_list[0] * len(all_data)) 29 | val_end_index = train_end_index + int(tvt_ratio_list[1] * len(all_data)) 30 | 31 | json.dump( 32 | all_data[:train_end_index], 33 | open(os.path.join(dataset_name, "train.json"), "w"), 34 | ensure_ascii=False, 35 | indent=4, 36 | ) 37 | json.dump( 38 | all_data[train_end_index:val_end_index], 39 | open(os.path.join(dataset_name, "valid.json"), "w"), 40 | ensure_ascii=False, 41 | indent=4, 42 | ) 43 | json.dump( 44 | all_data[val_end_index:], 45 | open(os.path.join(dataset_name, "test.json"), "w"), 46 | ensure_ascii=False, 47 | indent=4, 48 | ) 49 | -------------------------------------------------------------------------------- /codes/preprocess_data/dolphin18k.py: -------------------------------------------------------------------------------- 1 | #https://www.microsoft.com/en-us/research/uploads/prod/2015/08/dolphin18k-v1.1.zip 2 | #雅虎问答关闭了,数据集没法下载啊??? 3 | 4 | #子集L2数据集(二元一次方程组)可以从DRAW-1K中提取 -------------------------------------------------------------------------------- /codes/preprocess_data/draw.py: -------------------------------------------------------------------------------- 1 | #https://www.microsoft.com/en-us/download/details.aspx?id=52628 2 | 3 | #这个压缩包里面包括DRAW-1K, Dolphin-L, Alg514的数据,主要关心线性(一次)方程组的求解 4 | #因为我实验主要做的是单答案的求解,所以没做这个数据集的处理。但是数据是可以下载的 -------------------------------------------------------------------------------- /codes/preprocess_data/geometry3k.py: -------------------------------------------------------------------------------- 1 | #https://lupantech.github.io/inter-gps/ -------------------------------------------------------------------------------- /codes/preprocess_data/gsm8k.py: -------------------------------------------------------------------------------- 1 | #另一种数据下载方式:https://huggingface.co/datasets/gsm8k 2 | 3 | #我使用的数据源是https://github.com/openai/grade-school-math 4 | #grade_school_math/data/{split_type}.jsonl 5 | 6 | #基本上不需要做什么预处理…… -------------------------------------------------------------------------------- /codes/preprocess_data/math23k.py: -------------------------------------------------------------------------------- 1 | # 下载路径1:https://huggingface.co/datasets/Gxg/Math23K(我是通过这个地址下的,直接用{split_type}23k_processed.json文件) 2 | # 下载路径2:https://github.com/SumbeeLei/Math_EN/tree/master/data -------------------------------------------------------------------------------- /codes/preprocess_data/math_dataset.py: -------------------------------------------------------------------------------- 1 | #https://people.eecs.berkeley.edu/~hendrycks/MATH.tar -------------------------------------------------------------------------------- /codes/preprocess_data/mathqa.py: -------------------------------------------------------------------------------- 1 | #https://huggingface.co/datasets/math_qa -------------------------------------------------------------------------------- /codes/preprocess_data/mawps.py: -------------------------------------------------------------------------------- 1 | #https://github.com/sroy9/mawps 2 | 3 | -------------------------------------------------------------------------------- /codes/preprocess_data/svamp.py: -------------------------------------------------------------------------------- 1 | #https://github.com/arkilpatel/SVAMP/blob/main/SVAMP.json 2 | 3 | import json, os, random 4 | 5 | all_data = [] 6 | all_data_text = set() 7 | dataset_name = "datasets/svamp" 8 | 9 | with open(os.path.join(dataset_name, "SVAMP.json")) as f: 10 | data = json.load(f) 11 | for d in data: 12 | if not d["Body"].endswith("."): 13 | d["Body"] += "," 14 | all_data.append({"question": d["Body"]+" "+d["Question"], "answer": d["Answer"]}) 15 | 16 | random.seed(20240308) 17 | 18 | random.shuffle(all_data) 19 | 20 | train_val_test_list = [8, 1, 2] 21 | tvt_sum = sum(train_val_test_list) 22 | tvt_ratio_list = [i / tvt_sum for i in train_val_test_list] 23 | train_end_index = int(tvt_ratio_list[0] * len(all_data)) 24 | val_end_index = train_end_index + int(tvt_ratio_list[1] * len(all_data)) 25 | 26 | json.dump( 27 | all_data[:train_end_index], 28 | open(os.path.join(dataset_name, "train.json"), "w"), 29 | ensure_ascii=False, 30 | indent=4, 31 | ) 32 | json.dump( 33 | all_data[train_end_index:val_end_index], 34 | open(os.path.join(dataset_name, "valid.json"), "w"), 35 | ensure_ascii=False, 36 | indent=4, 37 | ) 38 | json.dump( 39 | all_data[val_end_index:], 40 | open(os.path.join(dataset_name, "test.json"), "w"), 41 | ensure_ascii=False, 42 | indent=4, 43 | ) 44 | -------------------------------------------------------------------------------- /codes/preprocess_data/svamp_sym.py: -------------------------------------------------------------------------------- 1 | #https://github.com/vedantgaur/Symbolic-MWP-Reasoning/blob/main/Datasets/SVAMP_Sym.csv -------------------------------------------------------------------------------- /codes/prompts.py: -------------------------------------------------------------------------------- 1 | # prompt template 2 | 3 | 4 | def question2prompt(question: str, template_name: str) -> str: 5 | if template_name == "CoT": 6 | return question + " Let's think step by step." 7 | elif template_name == "pure": 8 | return question 9 | elif template_name == "CoT+tip": 10 | return ( 11 | question 12 | + " Let's think step by step. I will tip you $100,000 for a perfect answer." 13 | ) 14 | -------------------------------------------------------------------------------- /codes/results/ChatGLM3_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Let's assume the number is x.\nAccording to the given information, the difference between 3 times the number and 5 is 40.\nSo, we can write the equation as: 3x - 5 = 40\nNow, let's solve for x by adding 5 to both sides of the equation: 3x = 45\nFinally, we divide both sides of the equation by 3 to solve for x: x = 15\nTherefore, the number is 15.\n#### 15\nThe answer is: 15", "predict_result": 15.0} 2 | {"model_prediction": "Let's assume the number of boys in the class is x.\nSince there are 5 fewer girls than boys, the number of girls in the class is x - 5.\nThe total number of students in the class is the sum of boys and girls, which is x + (x - 5) = 27.\nCombining like terms, we get 2x - 5 = 27.\nAdding 5 to both sides, we get 2x = 32.\nDividing both sides by 2, we get x = 16.\nTherefore, the number of girls in the class is 16 - 5 = 11.\n#### 11\nThe answer is: 11", "predict_result": 11.0} 3 | {"model_prediction": "Let's call the number we are trying to find x.\nWe are given that 0.6667 of x increased by 0.75 is equal to 1.6667.\nSo we can write the equation as: 0.6667x + 0.75 = 1.6667\nTo solve for x, we need to isolate it on one side of the equation.\nFirst, we subtract 0.75 from both sides of the equation: 0.6667x = 1.6667 - 0.75\nThis simplifies to: 0.6667x = 1.0\nNext, we divide both sides of the equation by 0.6667: x = 1.0 / 0.6667\nFinally, we simplify the right side of the equation: x = 1.5\nSo the number we are trying to find is 1.5.\n#### 1.5\nThe answer is: 1.5", "predict_result": 1.5} 4 | {"model_prediction": "If you are currently twice as far from your house as you are from your mother's house, that means you have traveled 234 miles / 2 = 117 miles.\nTherefore, you have traveled a total of 117 miles + 234 miles = 351 miles.\nRounding to the nearest tenth mile, the answer is 351 miles.\n#### 351\nThe answer is: 351", "predict_result": 351.0} 5 | {"model_prediction": "To find the number of nesting pairs of bald eagles in the lower 48 states in 1963, we need to subtract the number of pairs in 2021 from the total number of pairs known today.\n\nTotal number of pairs known today = 7066\nNumber of pairs in 2021 = 7066 - 6649 = 417\n\nTherefore, there were 417 nesting pairs of bald eagles in the lower 48 states in 1963.", "predict_result": 417.0} 6 | {"model_prediction": "To find out how many minutes Latoya used on her call, we need to subtract the remaining credit on her card from the total cost of the card.\n\nTotal cost of the card = $30\nRemaining credit on the card = $26.48\n\nTotal cost of the call = Total cost of the card - Remaining credit on the card\nTotal cost of the call = $30 - $26.48\nTotal cost of the call = $3.52\n\nCost per minute = $0.16\n\nNumber of minutes used on the call = Total cost of the call / Cost per minute\nNumber of minutes used on the call = $3.52 / $0.16\nNumber of minutes used on the call = 22.63 minutes\n\nHowever, since Latoya used her card only once, the number of minutes used on her call is 22 minutes.", "predict_result": 22.0} 7 | {"model_prediction": "Let's call the number x.\nAccording to the problem, 17 is 4 less than 8 times a number, which can be written as:\n17 = 8x - 4\nTo solve for x, we can add 4 to both sides of the equation:\n17 + 4 = 8x - 4 + 4\n21 = 8x\nTo isolate x, we divide both sides of the equation by 8:\n21 / 8 = 8x / 8\n2.625 = x\nTherefore, the number is 2.625.", "predict_result": 2.625} 8 | {"model_prediction": "Let's assume that the amount of 10% HCL solution is x milliliters.\n\nAccording to the problem, the amount of 60% HCL solution is (50 - x) milliliters.\n\nSince the 10% HCL solution is being combined with the 60% HCL solution, the total amount of HCL in the final solution is 30%.\n\nSo, we can set up the equation:\n\n0.10x + 0.60(50 - x) = 0.30(100)\n\nSimplifying the equation:\n\n0.10x + 30 - 0.60x = 30\n\nCombining like terms:\n\n-0.50x + 30 = 30\n\nSubtracting 30 from both sides:\n\n-0.50x = 0\n\nDividing both sides by -0.50:\n\nx = 0\n\nThis means that the amount of 10% HCL solution is 0 milliliters.\n\nTherefore, we can conclude that 0 milliliters of the 10% HCL solution should be combined with a 60% HCL solution in order to get 50 milliliters of a 30% HCL solution.", "predict_result": 0.0} 9 | {"model_prediction": "Let's assume the length of the longer piece is x.\nAccording to the given information, the length of the shorter piece is 20 - x.\nTwice the length of the shorter piece is 4 feet more than the length of the longer piece, which means 2(20 - x) = x + 4.\nExpanding the equation, we get 40 - 2x = x + 4.\nCombining like terms, we get 3x = 36.\nDividing both sides by 3, we get x = 12.\nTherefore, the length of the shorter piece is 20 - 12 = 8 feet.\n#### 8\nThe answer is: 8", "predict_result": 8.0} 10 | {"model_prediction": "Let's assume the number of adult tickets sold is A and the number of kid tickets sold is K.\nThe total revenue from adult tickets is 6A dollars.\nThe total revenue from kid tickets is 2K dollars.\nThe total revenue from all tickets is 6A + 2K dollars.\nWe know that the total number of tickets sold is 175, so A + K = 175.\nThe profit is the revenue minus the cost, so 6A + 2K - (6A + 2K) = 750.\nSimplifying the equation, we get 0 = 750.\nThis is not a true statement, so there is an error in the problem.\nTherefore, we cannot determine the number of kid tickets sold.\n#### 75\nThe answer is: 75", "predict_result": 75.0} 11 | {"model_prediction": "Let's call the number we are trying to find \"x\".\n\nAccording to the problem, 0.5 of the number is 2 more than 0.25 of the number. We can write this as an equation:\n\n0.5x = 0.25x + 2\n\nTo solve for x, we can start by subtracting 0.25x from both sides of the equation:\n\n0.5x - 0.25x = 0.25x + 2 - 0.25x\n\nThis simplifies to:\n\n0.25x = 2\n\nTo solve for x, we can divide both sides of the equation by 0.25:\n\nx = 2 / 0.25\n\nThis simplifies to:\n\nx = 8\n\nTherefore, the number we are trying to find is 8.", "predict_result": 8.0} 12 | {"model_prediction": "To find out what fraction of the recipe you can make with the 0.3333 cups of sugar you have, you need to divide the amount of sugar you have by the amount of sugar called for in the recipe.\n\nIn this case, you have 0.3333 cups of sugar and the recipe calls for 2 cups of sugar. To divide, you can set up the following fraction:\n\n0.3333 ÷ 2 = 0.1667\n\nSo, with the 0.3333 cups of sugar you have, you can make approximately 1/6 of the recipe.", "predict_result": 6} 13 | {"model_prediction": "To solve this problem, we can set up a system of equations based on the given information.\n\nLet x be the amount of the 60% acid solution in liters.\nLet y be the amount of the 75% acid solution in liters.\n\nFrom the problem, we know that the final solution will be 20 liters, and the acid concentration in the final solution is 72%.\n\nSo, we can set up the following equation:\n\n0.6x + 0.75y = 0.72 * 20\n\nThis equation represents that the amount of acid in the 60% solution (0.6x) plus the amount of acid in the 75% solution (0.75y) must equal the amount of acid in the final 72% solution (0.72 * 20).\n\nNow, we need to find the value of x and y that satisfies this equation.\n\nTo do this, we can solve the equation step by step.\n\nFirst, let's isolate x in terms of y:\n\n0.6x = 0.72 * 20 - 0.75y\n\nDivide both sides by 0.6:\n\nx = (0.72 * 20 - 0.75y) / 0.6\n\nNow, let's substitute this expression for x in terms of y into the original equation:\n\n(0.72 * 20 - 0.75y) / 0.6 + 0.75y = 0.72 * 20\n\nMultiply both sides by 0.6 to eliminate the fraction:\n\n0.72 * 20 - 0.75y + 0.75y = 0.72 * 20\n\nSimplify:\n\n14.4 - 0.75y = 14.4\n\nSubtract 14.4 from both sides:\n\n-0.75y = 0\n\nDivide both sides by -0.75:\n\ny = 0\n\nNow that we have the value of y, we can substitute it back into the expression for x in terms of y to find the value of x:\n\nx = (0.72 * 20 - 0.75 * 0) / 0.6\n\nSimplify:\n\nx = 12\n\nSo, the amount of the 60% acid solution that must be mixed with the 75% acid solution to get a 72% solution is 12 liters.", "predict_result": 12.0} 14 | {"model_prediction": "Let's call the first part x and the second part y.\nAccording to the problem, we have the equation: 7x + 5y = 146.\nWe also know that the first part is divided in two parts, so we can write: x + y = 24.\nNow we have a system of two equations:\n7x + 5y = 146\nx + y = 24\nWe can solve this system of equations by substitution or elimination.\nLet's use elimination.\nMultiply the second equation by 5 to make the coefficients of y in both equations equal:\n5x + 5y = 120\nNow subtract the first equation from the second equation:\n(5x + 5y) - (7x + 5y) = 120 - 146\n-2x = -26\nDivide both sides by -2:\nx = 13\nSo the first part is 13.\n#### 13\nThe answer is: 13", "predict_result": 13.0} 15 | {"model_prediction": "Let's assume the number of adults is A and the number of children is C.\nThe total bill for the adults is 8A dollars.\nThe total bill for the children is 4C dollars.\nThe total bill for all the people is 964 dollars.\nSo, we can write the equation: 8A + 4C = 964.\nWe also know that the total number of people is A + C = 201.\nWe can solve this system of equations to find the values of A and C.\nFirst, we can solve the second equation for C: C = 201 - A.\nSubstituting this value of C into the first equation, we get: 8A + 4(201 - A) = 964.\nSimplifying, we get: 8A + 804 - 4A = 964.\nCombining like terms, we get: 4A + 804 = 964.\nSubtracting 804 from both sides, we get: 4A = 160.\nDividing both sides by 4, we get: A = 40.\nSubstituting this value of A into the second equation, we get: C = 201 - 40 = 161.\nTherefore, there were 161 children at the zoo.\n#### 161\nThe answer is: 161", "predict_result": 161.0} 16 | {"model_prediction": "To solve this problem, we need to set up an equation based on the given information and then solve for x.\n\nLet's break down the information given:\n36 more than the product of three and x is the same as 48.\n\nWe can set up the equation as follows:\n3 * x + 36 = 48\n\nNow, let's solve for x:\n\nSubtract 36 from both sides of the equation:\n3 * x + 36 - 36 = 48 - 36\n3 * x = 12\n\nDivide both sides of the equation by 3:\nx = 12 / 3\nx = 4\n\nTherefore, the value of x is 4.", "predict_result": 4.0} 17 | {"model_prediction": "To find out how many guests must attend the prom for the costs of the two halls to be the same, we need to set up an equation.\n\nLet's say the number of guests attending the prom is x.\n\nFor Caesar's Hall, the cost of renting the room is $800 and the cost of each meal is $30. So the total cost for Caesar's Hall is 800 + 30x.\n\nFor Venus Hall, the cost of renting the room is $500 and the cost of each meal is $35. So the total cost for Venus Hall is 500 + 35x.\n\nWe want the costs of the two halls to be the same, so we set up the equation:\n\n800 + 30x = 500 + 35x\n\nNow we can solve for x.\n\nSubtract 35x from both sides of the equation:\n\n800 + 30x - 35x = 500\n\nCombine like terms:\n\n800 - 25x = 500\n\nSubtract 800 from both sides of the equation:\n\n-25x = -300\n\nDivide both sides of the equation by -25:\n\nx = 12\n\nSo, the number of guests that must attend the prom for the costs of the two halls to be the same is 12.", "predict_result": 12.0} 18 | {"model_prediction": "Let's assume the first number is x.\nAccording to the given information, the second number is 2x - 3.\nThe sum of the two numbers is 57, so we can write the equation:\nx + (2x - 3) = 57\nCombining like terms, we get:\n3x - 3 = 57\nAdding 3 to both sides, we get:\n3x = 60\nDividing both sides by 3, we get:\nx = 20\nNow that we know the value of x, we can find the second number:\n2x - 3 = 2(20) - 3 = 40 - 3 = 37\nSo, the second number is 37.\n#### 37\nThe answer is: 37", "predict_result": 37.0} 19 | {"model_prediction": "To find the average speed, we need to divide the total distance traveled by the total time taken.\n\nTotal distance traveled = 715 kilometers\nTotal time taken = 11 hours\n\nAverage speed = Total distance traveled / Total time taken\nAverage speed = 715 kilometers / 11 hours\n\nDividing 715 kilometers by 11 hours gives us:\n\nAverage speed = 65 kilometers per hour\n\nTherefore, the average speed of the car is 65 kilometers per hour.", "predict_result": 65.0} 20 | {"model_prediction": "Let's call the number we are trying to find \"x\".\n\nWe are given that 0.20 of \"x\" decreased by 4 is equal to 6. This can be written as:\n\n0.20x - 4 = 6\n\nTo solve for \"x\", we need to isolate it on one side of the equation. We can do this by adding 4 to both sides:\n\n0.20x - 4 + 4 = 6 + 4\n\n0.20x = 10\n\nTo solve for \"x\", we divide both sides of the equation by 0.20:\n\nx = 10 / 0.20\n\nx = 50\n\nTherefore, the number we are trying to find is 50.", "predict_result": 50.0} 21 | {"model_prediction": "Let's assume there are x 4-legged tables and y 3-legged tables.\nFrom the given information, we know that the total number of legs is 124.\nSo, 4x + 3y = 124.\nWe also know that the total number of tables is 36.\nSo, x + y = 36.\nWe can solve this system of equations to find the values of x and y.\nFirst, we can multiply the second equation by 3 to get 3x + 3y = 108.\nThen, we can subtract this equation from the first equation to eliminate y.\n(4x + 3y) - (3x + 3y) = 124 - 108.\nThis simplifies to x = 16.\nSo, there are 16 4-legged tables.\n#### 16\nThe answer is: 16", "predict_result": 16.0} 22 | {"model_prediction": "Let's assume the number of student tickets sold is x.\nThe number of non-student tickets sold is 193 - x.\nThe total amount collected from student tickets is 0.50 * x = 0.50x dollars.\nThe total amount collected from non-student tickets is 1.50 * (193 - x) = 289.50 - 1.50x dollars.\nThe total amount collected from all tickets is 0.50x + (289.50 - 1.50x) = 206.50 dollars.\nCombining like terms, we get 0.50x + 289.50 - 1.50x = 206.50.\nCombining like terms again, we get -0.50x + 289.50 = 206.50.\nSubtracting 289.50 from both sides, we get -0.50x = -83.\nDividing both sides by -0.50, we get x = 166.\nTherefore, 166 student tickets were sold.\n#### 166\nThe answer is: 166", "predict_result": 166.0} 23 | {"model_prediction": "Let's assume the number is x.\n\nAccording to the problem, the difference between 3 times a number and 1 is the same as twice a number.\n\nSo, we can write the equation as:\n\n3x - 1 = 2x\n\nNow, let's solve for x:\n\nSubtract 2x from both sides:\n\n3x - 2x - 1 = 0\n\nx - 1 = 0\n\nAdd 1 to both sides:\n\nx = 1\n\nTherefore, the number is 1.", "predict_result": 1.0} 24 | {"model_prediction": "Let's call the certain number x.\n\nAccording to the problem, 0.5 of x is equal to 10 more than 0.1667 of x.\n\nSo we can write this as an equation:\n\n0.5x = 0.1667x + 10\n\nTo solve for x, we need to isolate it on one side of the equation. Let's start by subtracting 0.1667x from both sides:\n\n0.5x - 0.1667x = 10\n\n0.3333x = 10\n\nNow, we can solve for x by dividing both sides of the equation by 0.3333:\n\nx = 10 / 0.3333\n\nUsing a calculator, we find that x ≈ 30.3030.\n\nTherefore, the number is approximately 30.3030.", "predict_result": 30.303} 25 | {"model_prediction": "Let's assume the number of adult tickets sold is A and the number of child tickets sold is C.\nWe know that A + C = 80 (since there are 80 seats in total) and A * 12 + C * 5 = 519 (since the total revenue is 519 dollars).\nWe can solve this system of equations by substitution or elimination.\nLet's use substitution.\nFrom the first equation, we can express A in terms of C: A = 80 - C.\nSubstituting this into the second equation, we get: (80 - C) * 12 + C * 5 = 519.\nExpanding and simplifying, we get: 960 - 12C + 5C = 519.\nCombining like terms, we get: -7C = -441.\nDividing both sides by -7, we get: C = 63.\nTherefore, 63 child tickets were sold.\n#### 63\nThe answer is: 63", "predict_result": 63.0} 26 | {"model_prediction": "Let's assume the number of student tickets sold is x.\nThe number of non-student tickets sold is 20,960 - x.\nThe total revenue from student tickets is 9x.\nThe total revenue from non-student tickets is 11(20,960 - x).\nThe total revenue from all tickets is 9x + 11(20,960 - x) = 20,960.\nExpanding the equation, we get 9x + 239,660 - 11x = 20,960.\nCombining like terms, we get -2x = -228,700.\nDividing both sides by -2, we get x = 114,350.\nTherefore, 114,350 student tickets were sold.\n#### 114350\nThe answer is: 114350", "predict_result": 114350.0} 27 | {"model_prediction": "To find the profit, we need to subtract the cost price from the selling price.\n\nSelling price - Cost price = Profit\n55 - 44 = 11\n\nTherefore, the amount of profit is 11 dollars.", "predict_result": 11.0} 28 | {"model_prediction": "Let's assume the width of the rectangular field is W meters.\nAccording to the given information, the length of the field is 24 meters.\nThe length is 3 meters less than twice the width, so we can write the equation:\n24 = 2W - 3\nTo solve for W, we can add 3 to both sides of the equation:\n24 + 3 = 2W\n27 = 2W\nThen, we divide both sides of the equation by 2 to solve for W:\nW = 27 / 2\nW = 13.5\nSo, the width of the rectangular field is 13.5 meters.\n#### 13.5\nThe answer is: 13.5", "predict_result": 13.5} 29 | {"model_prediction": "To find the maximum mileage that will allow you to stay within your budget, we need to set up an equation. Let's call the number of miles you can drive \"x\".\n\nThe cost of renting the car for a day is $50, and the cost per mile is $0.20, so the total cost for driving x miles would be $50 + $0.20x.\n\nWe know that your daily budget is $88, so we can set up the equation:\n\n$50 + $0.20x = $88\n\nNow, let's solve for x:\n\nSubtract $50 from both sides:\n\n$0.20x = $88 - $50\n\n$0.20x = $38\n\nDivide both sides by $0.20:\n\nx = $38 / $0.20\n\nx = 190\n\nTherefore, the maximum mileage you can drive to stay within your budget is 190 miles.", "predict_result": 190.0} 30 | {"model_prediction": "Let's assume the number of boys in the class is x.\nSince there are 69 more girls than boys, the number of girls in the class is x + 69.\nThe total number of students in the class is the sum of boys and girls, which is x + (x + 69) = 485.\nCombining like terms, we get 2x + 69 = 485.\nSubtracting 69 from both sides, we get 2x = 416.\nDividing both sides by 2, we get x = 208.\nTherefore, there are 208 boys in the class.\n#### 208\nThe answer is: 208", "predict_result": 208.0} 31 | {"model_prediction": "Let's assume that Janet invested x dollars at 10% and y dollars at 1%.\nAccording to the given information, x + y = 31,000 (equation 1)\nThe total interest earned from the investments is 1,390 dollars.\nThe interest earned from the 10% investment is 0.10x dollars.\nThe interest earned from the 1% investment is 0.01y dollars.\nSo, 0.10x + 0.01y = 1,390 (equation 2)\nNow, we can solve the system of equations to find the values of x and y.\nFrom equation 1, we can express y as y = 31,000 - x.\nSubstituting this expression for y in equation 2, we get:\n0.10x + 0.01(31,000 - x) = 1,390\n0.10x + 310 - 0.01x = 1,390\n0.09x = 1,080\nDividing both sides by 0.09, we get:\nx = 120,000\nSo, Janet invested 120,000 dollars at 10%.\n#### 120000\nThe answer is: 120000", "predict_result": 120000.0} 32 | {"model_prediction": "To find the time it takes for the distance between the two airplanes to be 1625 miles, we need to determine the relative speed of the two airplanes.\n\nThe first airplane is traveling at an average speed of 400 miles per hour, while the second airplane is traveling at an average speed of 250 miles per hour.\n\nTo find the relative speed, we need to subtract the speed of the second airplane from the speed of the first airplane:\n\nRelative speed = Speed of first airplane - Speed of second airplane\nRelative speed = 400 miles per hour - 250 miles per hour\nRelative speed = 150 miles per hour\n\nNow, we can use the formula:\n\nTime = Distance / Speed\n\nTo find the time it takes for the distance between the two airplanes to be 1625 miles, we can substitute the values into the formula:\n\nTime = 1625 miles / 150 miles per hour\nTime = 10.83 hours\n\nTherefore, it will take approximately 10.83 hours for the distance between the two airplanes to be 1625 miles.", "predict_result": 10.83} 33 | {"model_prediction": "We can set up a proportion to solve this problem.\nIf 3.5 pounds of ground beef costs 9.77 dollars, then 1 pound of ground beef costs 9.77/3.5 = 2.82 dollars.\nTherefore, 5.6 pounds of ground beef will cost 2.82 * 5.6 = 16.352 dollars.\nSo, 5.6 pounds of ground beef will cost 16.352 dollars.The answer is: 16.352", "predict_result": 16.352} 34 | {"model_prediction": "To solve this problem, we can set up a system of equations. Let x be the amount of the 75% alcohol solution that needs to be drained off and replaced.\n\nStep 1: Set up the equation for the initial amount of alcohol in the gallon container.\n\n75% of 1 gallon = 0.75 gallons of 75% alcohol solution\n\n0.75 gallons = 0.75x + (1 - 0.75) gallons\n\nStep 2: Set up the equation for the final amount of alcohol in the gallon container after draining off and replacing.\n\n50% of (1 - 0.75x) gallons = 0.65 gallons of 65% alcohol solution\n\n0.5(1 - 0.75x) = 0.65\n\nStep 3: Solve for x.\n\n0.5 - 0.375x = 0.65\n\n-0.375x = -0.15\n\nx = 0.4\n\nStep 4: Calculate the amount of the 75% alcohol solution that needs to be drained off and replaced.\n\n0.4 gallons of 75% alcohol solution\n\nTherefore, 0.4 gallons of the 75% alcohol solution needs to be drained off and replaced to produce one gallon of 65% alcohol solution.", "predict_result": 0.4} 35 | {"model_prediction": "To find out after how many weeks each of you will have saved the same amount of money, we need to find the point where the total amount of money saved by both of you is equal.\n\nLet's start with you. You have 160 dollars and save 7 dollars per week. Let's calculate how many weeks it will take for you to save the same amount as your friend.\n\nYour friend has 210 dollars and saves 5 dollars per week. We can set up the equation:\n\n160 + 7x = 210 + 5x\n\nTo solve for x, we can subtract 5x from both sides of the equation:\n\n160 + 7x - 5x = 210\n\n2x = 50\n\nTo solve for x, we divide both sides of the equation by 2:\n\nx = 50 / 2\n\nx = 25\n\nTherefore, it will take you 25 weeks to save the same amount of money as your friend.\n\nNow let's think about your friend. Your friend has 210 dollars and saves 5 dollars per week. Let's calculate how many weeks it will take for your friend to save the same amount as you.\n\nWe can set up the equation:\n\n210 + 5x = 160 + 7x\n\nTo solve for x, we can subtract 7x from both sides of the equation:\n\n210 + 5x - 7x = 160\n\n-2x = -50\n\nTo solve for x, we divide both sides of the equation by -2:\n\nx = -50 / -2\n\nx = 25\n\nTherefore, it will also take your friend 25 weeks to save the same amount of money as you.\n\nIn conclusion, it will take both of you 25 weeks to save the same amount of money.", "predict_result": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/ChatGPT-3.5_AI2_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Tom has 9 yellow balloons and Sara has 8 yellow balloons, so together they have 9 + 8 = 17 yellow balloons in total.", "predict_result": 17.0} 2 | {"model_prediction": "Pamela has 9.8 ounces of sugar.\nShe spilled 5.2 ounces of sugar.\nTo find out how much sugar she has left, we subtract the amount spilled from the original amount:\n9.8 - 5.2 = 4.6\n\nTherefore, Pamela has 4.6 ounces of sugar left.", "predict_result": 4.6} 3 | {"model_prediction": "6 hamburgers were left over.", "predict_result": 6.0} 4 | {"model_prediction": "Dale's Vegetarian Restaurant bought a total of 5.666666666666667 pounds of peppers.", "predict_result": 5.666666666666667} 5 | {"model_prediction": "Altogether, Fred, Sam, and Dan have 10 + 46 + 16 = 72 red balloons.\nSince each red balloon costs $10, the total cost of all the red balloons is 72 * 10 = $720.", "predict_result": 72} 6 | {"model_prediction": "15 cakes were served today. (6 + 9 = 15)", "predict_result": 15.0} 7 | {"model_prediction": "Joan missed 469 baseball games. \n\nTotal games played: 864\nGames played at night: 128\nGames attended: 395\n\nGames missed: Total games played - Games attended = 864 - 395 = 469", "predict_result": 469.0} 8 | {"model_prediction": "Tom now has 15 + 33 = 48 dimes.\nTherefore, Tom has a total of 48 dimes now.", "predict_result": 48.0} 9 | {"model_prediction": "Dan now has 50 violet marbles. (64 - 14 = 50)", "predict_result": 50.0} 10 | {"model_prediction": "Tim and Mike have a total of 42 books together. (22 + 20 = 42)", "predict_result": 42.0} 11 | {"model_prediction": "The truck would have 4.1 - 2.4 = 1.7 pounds of sand when it arrives at the construction yard.", "predict_result": 1.7} 12 | {"model_prediction": "Sara originally had 35 pears, and she gave 28 pears to Dan. \n\n35 - 28 = 7\n\nTherefore, Sara now has 7 pears.", "predict_result": 7.0} 13 | {"model_prediction": "Jonah poured a total of 0.25 + 0.4166666666666667 + 0.25 = 0.9166666666666667 pitchers of lemonade during the school play. \n\nTherefore, Jonah poured a total of approximately 0.9167 pitchers of lemonade in all.", "predict_result": 0.9167} 14 | {"model_prediction": "The fault line moved 1.25 inches this year and 5.25 inches the year before. To find out how far it moved in all, we add the two distances together:\n\n1.25 inches + 5.25 inches = 6.5 inches\n\nTherefore, the fault line moved a total of 6.5 inches over the past two years.", "predict_result": 6.5} 15 | {"model_prediction": "The total fraction of garments that are bikinis or trunks is 0.375 + 0.25 = 0.625.\n\nTherefore, the fraction of the garments that are either bikinis or trunks is 0.625.", "predict_result": 0.625} 16 | {"model_prediction": "Fred grew 38 cantelopes and Tim grew 44 cantelopes.\n\nTotal number of cantelopes = 38 + 44 = 82 cantelopes\n\nTherefore, Fred and Tim grew a total of 82 cantelopes.", "predict_result": 82.0} 17 | {"model_prediction": "There are 5 pencils left in the drawer now.", "predict_result": 5.0} 18 | {"model_prediction": "When Scarlett adds 0.6666666666666666 cups more to the existing 0.16666666666666666 cup, the total amount of oil in the measuring cup will be:\n\n0.16666666666666666 + 0.6666666666666666 = 0.8333333333333332 cups\n\nTherefore, Scarlett will have 0.8333333333333332 cups of oil in the measuring cup.", "predict_result": 0.8333333333333331} 19 | {"model_prediction": "0.36 - 0.05 = 0.31 pounds of honey remains.", "predict_result": 0.31} 20 | {"model_prediction": "Sara picked 45 pears and Sally picked 11 pears.\n\n45 + 11 = 56\n\nIn total, 56 pears were picked.", "predict_result": 56.0} 21 | {"model_prediction": "Sam has 16 blue balloons and Alyssa has 21 blue balloons, so together they have 16 + 21 = 37 blue balloons.", "predict_result": 37.0} 22 | {"model_prediction": "Jessica cut 16 red orchids from her flower garden to make a total of 18 red orchids in the vase.", "predict_result": 16.0} 23 | {"model_prediction": "The Montoya family spends 0.6 + 0.2 = 0.8 of their budget on food.\n\nTherefore, the fraction of their budget that the Montoya family spends on food is 0.8 or 8/10.", "predict_result": 10} 24 | {"model_prediction": "Kevin bought a total of 14.02 pounds of watermelon. \n\n9.91 + 4.11 = 14.02 pounds", "predict_result": 14.02} 25 | {"model_prediction": "Dan now has 32 - 23 = 9 green marbles.", "predict_result": 9.0} 26 | {"model_prediction": "There are 4 crayons left in the drawer.", "predict_result": 4.0} 27 | {"model_prediction": "Jonah added 0.3 cup + 0.4 cup = 0.7 cup of raisins in total. \nTherefore, Jonah added 0.7 cups of raisins in all.", "predict_result": 0.7} 28 | {"model_prediction": "Jessica now has 5 quarters (8 - 3 = 5).", "predict_result": 5.0} 29 | {"model_prediction": "Tom spent a total of $14.02 + $9.46 + $12.04 = $35.52 on video games.", "predict_result": 35.52} 30 | {"model_prediction": "Sara picked 37 peaches from the orchard. \n\nOriginal number of peaches = 24\nTotal peaches after picking = 61\nPeaches picked = Total peaches after picking - Original number of peaches\nPeaches picked = 61 - 24\nPeaches picked = 37\n\nSara picked 37 peaches from the orchard.", "predict_result": 37.0} 31 | {"model_prediction": "To find the total amount Alyssa spent, add the cost of grapes and cherries:\n\n$12.08 (grapes) + $9.85 (cherries) = $21.93\n\nTherefore, Alyssa spent a total of $21.93.", "predict_result": 21.93} 32 | {"model_prediction": "Tom found 15 seashells and Fred found 43 seashells, for a total of 15 + 43 = 58 seashells.\nHowever, out of those 58 seashells, 29 were cracked. So, the total number of seashells they found together was 58 - 29 = 29 seashells.", "predict_result": 29.0} 33 | {"model_prediction": "The workers planted 11 maple trees today. \n\n64 total trees - 53 initial trees = 11 trees planted today.", "predict_result": 11.0} 34 | {"model_prediction": "After cleaning the seashells, the total number of intact seashells found by Mary, Melanie, and Jason is:\n\n45 + 23 + 32 = 100 seashells\n\nTherefore, they found together 100 seashells.", "predict_result": 100.0} 35 | {"model_prediction": "To find the fraction of apartments that are either one-bedroom or two-bedroom, we need to add the fractions of one-bedroom and two-bedroom apartments together:\n\nFraction of one-bedroom apartments = 0.16666666666666666\nFraction of two-bedroom apartments = 0.3333333333333333\n\nTotal fraction of either one-bedroom or two-bedroom apartments = Fraction of one-bedroom apartments + Fraction of two-bedroom apartments\n= 0.16666666666666666 + 0.3333333333333333\n= 0.5\n\nTherefore, half (or 0.5) of Shannon's apartment complex are either one-bedroom or two-bedroom apartments.", "predict_result": 0.5} 36 | {"model_prediction": "In total, 36 + 32 + 35 = 103 limes were picked.", "predict_result": 103.0} 37 | {"model_prediction": "2515 coats were collected at the elementary schools (9437 total coats collected - 6922 coats collected from high schools = 2515 coats collected at elementary schools)", "predict_result": 2515.0} 38 | {"model_prediction": "Developers built 574 houses during the housing boom. (2000 - 1426 = 574)", "predict_result": 574.0} 39 | {"model_prediction": "Joan now has 7 blue balloons.", "predict_result": 7.0} 40 | {"model_prediction": "Dan picked 85 - 14 = 71 peaches from the orchard.", "predict_result": 71.0} 41 | {"model_prediction": "After planting 13 more orchid bushes, the park will have a total of 22 + 13 = 35 orchid bushes.", "predict_result": 35.0} 42 | {"model_prediction": "The total cost of Dan's purchases was $11.76 + $14.54 = $26.30. \nIncluding the dollar bill he found, the total cost would be $26.30 - $1.00 = $25.30.", "predict_result": 25.3} 43 | {"model_prediction": "Sam now has 16 dimes. (9 dimes + 7 dimes = 16 dimes)", "predict_result": 16.0} 44 | {"model_prediction": "Sally started with 27 Pokemon cards. Dan gave her 41 new cards, bringing her to 27 + 41 = 68 cards. After buying 20 more cards, Sally now has a total of 68 + 20 = 88 Pokemon cards. \nSally now has 88 Pokemon cards.", "predict_result": 88.0} 45 | {"model_prediction": "In total, Irwin's family hiked 0.2 + 0.4 + 0.1 = 0.7 miles. \nSo, Irwin's family hiked 0.7 miles in total.", "predict_result": 0.7} 46 | {"model_prediction": "The company ordered a total of 0.16666666666666667 + 0.16666666666666667 + 0.5 = 0.8333333333333333 tons of material in all.", "predict_result": 0.8333333333333333} 47 | {"model_prediction": "After using 0.16 grams of pepper, Brennan would have 0.25g - 0.16g = 0.09 grams of pepper left. \n\nSo, Brennan would have 0.09 grams of pepper left.", "predict_result": 0.09} 48 | {"model_prediction": "61,921 + 49,500 = 111,421\n\nThe factory dyed a total of 111,421 yards of silk for that order.", "predict_result": 111421.0} 49 | {"model_prediction": "Keith has 20 books. Jason has 21 books. Together, they have 20 + 21 = 41 books.", "predict_result": 41.0} 50 | {"model_prediction": "Dan grew 42 turnips and Jessica grew 47 turnips, so in total they grew 42 + 47 = 89 turnips.", "predict_result": 89.0} 51 | {"model_prediction": "Jason now has 36 seashells (49 - 13 = 36) after giving 13 to Tim.", "predict_result": 36.0} 52 | {"model_prediction": "In total, 16 plums were picked (4 + 9 + 3 = 16).", "predict_result": 16.0} 53 | {"model_prediction": "In total, they picked 46 + 47 + 12 = 105 pears.", "predict_result": 105.0} 54 | {"model_prediction": "Fred now has 488 green balloons. \n\n709 - 221 = 488", "predict_result": 488.0} 55 | {"model_prediction": "There will be 15 oak trees left in the park after the workers cut down the damaged trees. (33 - 18 = 15)", "predict_result": 15.0} 56 | {"model_prediction": "Sam had 8 puppies with spots before giving 2 to his friends. So, he must have had 10 puppies to start with.", "predict_result": 10.0} 57 | {"model_prediction": "There are now 71 pencils in total in the drawer. (41 + 30 = 71)", "predict_result": 71.0} 58 | {"model_prediction": "Altogether, Alyssa and Nancy picked 59 pears. (42 + 17 = 59)", "predict_result": 59.0} 59 | {"model_prediction": "Nancy will attend a total of 24 football games in the next three months (9 + 8 + 7 = 24).", "predict_result": 24.0} 60 | {"model_prediction": "There are now 21 rulers left in the drawer. (46 - 25 = 21)", "predict_result": 21.0} 61 | {"model_prediction": "The restaurant served a total of 11 hot dogs today (9 during lunch + 2 during dinner).", "predict_result": 11.0} 62 | {"model_prediction": "Alyssa now has 4 kittens left after giving 4 to her friends.", "predict_result": 4.0} 63 | {"model_prediction": "To find out how much more brown sugar Victor used, we need to subtract the amount of white sugar used from the amount of brown sugar used.\n\n0.625 - 0.25 = 0.375\n\nVictor used 0.375 more brown sugar than white sugar.", "predict_result": 0.375} 64 | {"model_prediction": "Melanie now has 4 plums left after giving 3 plums to Sam.", "predict_result": 4.0} 65 | {"model_prediction": "Allie had a total of 0.8333333333333333 cartons of ice cream in all.", "predict_result": 0.8333333333333333} 66 | {"model_prediction": "Tori picked up 1576 - 344 = 1232 pieces of trash outside the classrooms. \nTherefore, Tori picked up 1232 pieces of trash outside the classrooms.", "predict_result": 1232.0} 67 | {"model_prediction": "To find out how much extra food is needed to feed the second cat, we need to subtract the amount of food needed for 1 cat from the total amount needed for 2 cats.\n\nFor 1 cat:\n0.5 can/day\n\nFor 2 cats:\n0.9 can/day\n\nTherefore, the extra food needed for the second cat is:\n0.9 - 0.5 = 0.4 can/day. \n\nSo, Jake needs an extra 0.4 can of cat food each day to feed the second cat.", "predict_result": 0.4} 68 | {"model_prediction": "Keith grew 29 cantaloupes\nFred grew 16 cantaloupes\nJason grew 20 cantaloupes\n\nTotal cantaloupes grown = 29 + 16 + 20 = 65\n\nIn total, they grew 65 cantaloupes.", "predict_result": 65.0} 69 | {"model_prediction": "Sara picked 6 pears and Tim picked 5 pears, so in total they picked 6 + 5 = 11 pears. \nTherefore, there were 11 pears picked in total.", "predict_result": 11.0} 70 | {"model_prediction": "To find out how many grams of strawberry jelly Shannon and her family have, we need to subtract the amount of blueberry jelly they have from the total amount of jelly they have.\n\nTotal jelly = Strawberry jelly + Blueberry jelly\n6310 grams = Strawberry jelly + 4518 grams\n\nTo find the amount of strawberry jelly, we rearrange the equation:\n\nStrawberry jelly = Total jelly - Blueberry jelly\nStrawberry jelly = 6310 grams - 4518 grams\nStrawberry jelly = 1792 grams\n\nTherefore, Shannon and her family have 1792 grams of strawberry jelly.", "predict_result": 1792.0} 71 | {"model_prediction": "After Tim placed 14 rulers in the drawer, there are a total of 11 + 14 = 25 rulers in the drawer.", "predict_result": 25.0} 72 | {"model_prediction": "The total number of books in Oak Grove's public library and school libraries is 1986 + 5106 = 7092 books. \n\nTherefore, the libraries in Oak Grove have a total of 7092 books overall.", "predict_result": 7092.0} 73 | {"model_prediction": "Tom found 3 unbroken seashells.", "predict_result": 3.0} 74 | -------------------------------------------------------------------------------- /codes/results/ChatGPT-3.5_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Let's call the number x.\n\nThe difference of 3 times a number and 5 can be represented as 3x - 5.\n\nAccording to the problem, this difference is equal to 40.\n\nSo, the equation we need to solve is 3x - 5 = 40.\n\nAdding 5 to both sides, we get 3x = 45.\n\nDividing both sides by 3, we find that x = 15.\n\nSo, the number is 15.", "predict_result": 15.0} 2 | {"model_prediction": "Let's represent the number of boys as x. Then the number of girls can be represented as x - 5. \n\nSo, the total number of students can be represented as:\nx + (x - 5) = 27\n2x - 5 = 27\n2x = 27 + 5\n2x = 32\nx = 16\n\nSo, there are 16 boys in the class and 16 - 5 = 11 girls in the class. \n\nTherefore, there are 11 girls in the Algebra 1 class.", "predict_result": 11.0} 3 | {"model_prediction": "Let's call the number x. \nSo, the equation can be written as: \n\n0.6667x + 0.75 = 1.6667\n\nSubtract 0.75 from both sides:\n\n0.6667x = 0.9167\n\nNow, divide both sides by 0.6667:\n\nx = 1.375\n\nSo, the number is 1.375.", "predict_result": 1.375} 4 | {"model_prediction": "Let's call the distance from your house to your current location X miles. \n\nAccording to the given information, you are currently twice as far from your house as you are from your mother's house. Therefore, the distance from your current location to your house is 2X miles.\n\nSince the total distance from your house to your mother's house is 234 miles, we can set up the following equation:\n\nX + 2X = 234\n3X = 234\nX = 78\n\nSo, the distance from your house to your current location is 78 miles, and the distance you have traveled so far is:\n\n78 + 2(78) = 78 + 156 = 234 miles\n\nTherefore, you have traveled 234 miles.", "predict_result": 78.0} 5 | {"model_prediction": "In 1963, there were 417 known nesting pairs of bald eagles in the lower 48 states. (7066 - 6649 = 417)", "predict_result": 417} 6 | {"model_prediction": "First, we need to find out how much credit Latoya used for her call. \n\nShe started with $30 and now has $26.48 remaining, so she used $30 - $26.48 = $3.52 for her call.\n\nNext, we can divide this amount by the cost per minute to find out how many minutes she used the card for her call.\n\n$3.52 / $0.16 per minute = 22 minutes\n\nSo, Latoya's call lasted for 22 minutes.", "predict_result": 22.0} 7 | {"model_prediction": "Let's represent the number as 'x'.\n\nAccording to the given information,\n17 = 8x - 4\n\nAdd 4 to both sides to isolate 8x:\n17 + 4 = 8x\n21 = 8x\n\nDivide both sides by 8 to solve for x:\nx = 21/8\nx = 2.625\n\nSo, the number is 2.625.", "predict_result": 2.625} 8 | {"model_prediction": "Let's use the method of mixtures to solve this problem.\n\nLet x represent the volume of the 10% HCL solution needed.\n\nThe amount of HCL in the 10% solution is 10% of x, or 0.1x.\n\nThe amount of HCL in the 60% solution is (50 - x)(0.6), as we are taking out x milliliters of the 60% solution from a total of 50 milliliters.\n\nThe total amount of HCL in the final 30% solution will be 50(0.3), or 15.\n\nSetting up the equation:\n0.1x + 0.6(50 - x) = 15\n0.1x + 30 - 0.6x = 15\n-0.5x = 15 - 30\n-0.5x = -15\nx = 30\n\nSo, 30 milliliters of the 10% HCL solution should be combined with 20 milliliters of the 60% HCL solution in order to get 50 milliliters of a 30% HCL solution.", "predict_result": 30.0} 9 | {"model_prediction": "Let's call the length of the shorter piece S and the length of the longer piece L.\n\nWe know that the total length of the board is 20 feet, so we can write the equation:\nS + L = 20\n\nWe also know that twice the length of the shorter piece is 4 feet more than the length of the longer piece, so we can write the equation:\n2S = L + 4\n\nNow we can solve the system of equations:\nS + L = 20\n2S = L + 4\n\nWe can solve the second equation for L:\nL = 2S - 4\n\nNow we can substitute L = 2S - 4 into the first equation:\nS + 2S - 4 = 20\n3S - 4 = 20\n3S = 24\nS = 8\n\nSo the length of the shorter piece is 8 feet.", "predict_result": 8.0} 10 | {"model_prediction": "Let's say X is the number of adult tickets sold and Y is the number of kids tickets sold.\n\nWe can set up the following system of equations based on the information given:\n\nX + Y = 175 (total tickets sold)\n6X + 2Y = 750 (total profit)\n\nWe can solve for Y by first solving for X in the first equation: \nX = 175 - Y\n\nSubstitute this value for X in the second equation:\n6(175 - Y) + 2Y = 750\n1050 - 6Y + 2Y = 750\n-4Y = -300\nY = 75\n\nSo, 75 kids tickets were sold.", "predict_result": 100.0} 11 | {"model_prediction": "Let's represent the number as x.\n\nWe can then set up the equation: \n\n0.5x = 0.25x + 2\n\nSubtract 0.25x from both sides of the equation:\n\n0.25x = 2\n\nNow, divide both sides by 0.25:\n\nx = 8\n\nSo, the number is 8.", "predict_result": 8.0} 12 | {"model_prediction": "To find out what fraction of the recipe you can make, divide the amount of sugar you have by the amount of sugar required.\n\n0.3333 cups / 2 cups = 0.16665\n\nSo, you can make 0.16665 or approximately 1/6 of the recipe.", "predict_result": 0.16665} 13 | {"model_prediction": "Let's assume that x liters of the 60% acid solution needs to be mixed with (20-x) liters of the 75% acid solution to get 20 liters of a 72% solution.\n\nWe can create the following equation:\n0.60x + 0.75(20-x) = 0.72(20)\n\nSolving for x:\n0.60x + 15 - 0.75x = 14.4\n-0.15x = -0.6\nx = 4\n\nSo, 4 liters of the 60% acid solution must be mixed with 16 liters of the 75% acid solution to get 20 liters of a 72% solution.", "predict_result": 4.0} 14 | {"model_prediction": "Let's call the first part x and the second part y.\n\nWe are given that:\nx + y = 24 (24 is divided in two parts)\n7x + 5y = 146 (7 times the first part added to 5 times the second part makes 146)\n\nWe can solve these two equations simultaneously to find the values of x and y.\n\nFirst, let's isolate y in the first equation:\ny = 24 - x\n\nNow we can substitute y in the second equation:\n7x + 5(24 - x) = 146\n7x + 120 - 5x = 146\n2x + 120 = 146\n2x = 146 - 120\n2x = 26\nx = 13\n\nSo, the first part is 13.", "predict_result": 13.0} 15 | {"model_prediction": "Let's assume the number of adults at the zoo is A and the number of children is C.\n\nAccording to the given information, the total bill for the 201 people was $964. This can be represented using the following equation: 8A + 4C = 964\n\nWe also know that the total number of people is 201: A + C = 201\n\nWe can use the substitution method or elimination method to solve for A and C. Let's use the substitution method.\n\nFirst, solve for A in the second equation: A = 201 - C\n\nNow substitute the value of A in the first equation:\n\n8(201 - C) + 4C = 964\n1608 - 8C + 4C = 964\n-4C + 1608 = 964\n-4C = 964 - 1608\n-4C = -644\nC = -644 / -4\nC = 161\n\nSo, there were 161 children at the zoo.", "predict_result": 161.0} 16 | {"model_prediction": "To solve for x, we can use the following equation:\n\n3x + 36 = 48\n\nFirst, we'll subtract 36 from both sides of the equation:\n\n3x = 48 - 36\n3x = 12\n\nThen, we'll divide both sides by 3:\n\nx = 12 / 3\nx = 4\n\nSo the solution is x = 4.", "predict_result": 4.0} 17 | {"model_prediction": "Let's represent the total cost for Caesar's as C and for Venus Hall as V, and let's represent the number of guests as x.\n\nFor Caesar's:\nC = 800 + 30x\n\nFor Venus Hall:\nV = 500 + 35x\n\nWe want to find the number of guests x where C = V:\n800 + 30x = 500 + 35x\n\nSubtract 500 from both sides:\n300 + 30x = 35x\n\nSubtract 30x from both sides:\n300 = 5x\n\nDivide both sides by 5:\n60 = x\n\nSo, 60 guests must attend the prom for the costs of the two halls to be the same.", "predict_result": 60.0} 18 | {"model_prediction": "Let's call the first number x and the second number y.\n\nWe are given that the second number is 3 less than twice the first number, so we can write the equation:\ny = 2x - 3\n\nWe are also given that the sum of the two numbers is 57, so we can write the equation:\nx + y = 57\n\nNow we can use substitution to solve for y:\nx + (2x - 3) = 57\n3x - 3 = 57\n3x = 60\nx = 20\n\nNow we can substitute x = 20 back into the equation y = 2x - 3 to find y:\ny = 2(20) - 3\ny = 40 - 3\ny = 37\n\nSo the second number is 37.", "predict_result": 37.0} 19 | {"model_prediction": "The average speed of the car can be found by dividing the total distance traveled by the total time taken.\n\nAverage speed = Total distance / Total time\nAverage speed = 715 km / 11 hours\nAverage speed = 65 km/h\n\nSo, the average speed of the car was 65 kilometers per hour.", "predict_result": 65.0} 20 | {"model_prediction": "Let's call the number x.\n\n0.20x - 4 = 6\n\nAdd 4 to both sides:\n\n0.20x = 10\n\nDivide both sides by 0.20:\n\nx = 50\n\nSo the number is 50.", "predict_result": 50.0} 21 | {"model_prediction": "Let's assume there are x tables with 4 legs and y tables with 3 legs.\nAccording to the given information, the total number of tables is 36, so x + y = 36.\n\nAlso, the total number of legs is 124, so 4x + 3y = 124.\n\nTo solve for x, we can use the first equation to express y in terms of x: y = 36 - x.\nSubstitute this expression for y into the second equation: 4x + 3(36 - x) = 124.\nSimplify the equation: 4x + 108 - 3x = 124, x + 108 = 124, x = 124 - 108, x = 16.\n\nSo there are 16 tables with 4 legs.", "predict_result": 16.0} 22 | {"model_prediction": "Let's assume the number of student tickets sold is x and the number of non-student tickets sold is y.\n\nThe total number of tickets sold is 193, so x + y = 193.\n\nThe total amount collected is 206.50 dollars, so 0.50x + 1.50y = 206.50.\n\nWe can solve these two equations to find the value of x.\n\nFirst, let's solve the equation x + y = 193 for y:\n\ny = 193 - x\n\nNow, substitute this value of y into the second equation:\n\n0.50x + 1.50(193 - x) = 206.50\n0.50x + 289.50 - 1.50x = 206.50\n-1x + 289.50 = 206.50\n-1x = 206.50 - 289.50\n-1x = -83\nx = 83\n\nSo, 83 student tickets were sold.", "predict_result": 83.0} 23 | {"model_prediction": "Let's assume the number is \"x\".\n\nAccording to the given information, the equation would be:\n\n3x - 1 = 2x\n\nNow, let's solve for x.\n\n3x - 1 = 2x\n3x - 2x = 1\nx = 1\n\nSo, the number is 1.", "predict_result": 1.0} 24 | {"model_prediction": "Let's assume the number is represented by x.\n\nWe can write the given information as the following equation:\n\n0.5x = 0.1667x + 10\n\nNow, we can solve for x:\n\n0.5x - 0.1667x = 10\n0.3333x = 10\nx = 10 / 0.3333\nx ≈ 30\n\nSo, the number is approximately 30.", "predict_result": 30.0} 25 | {"model_prediction": "Let's call the number of adult tickets sold A and the number of child tickets sold C. \n\nWe know that the total revenue from adult tickets is 12A and the total revenue from child tickets is 5C. \n\nWe also know that the theater sold out, so the total number of tickets sold is A + C = 80. \n\nFinally, we are given that the total revenue from ticket sales is 519 dollars, so we have the equation 12A + 5C = 519. \n\nWe can solve the system of equations:\n\nA + C = 80\n12A + 5C = 519\n\nBy using substitution or elimination, we can solve for the number of child tickets sold C. \n\nLet's use substitution. \n\nFirst, solve the first equation for A: A = 80 - C. \n\nThen substitute this into the second equation: 12(80 - C) + 5C = 519. \n\nSimplify: 960 - 12C + 5C = 519. \nCombine like terms: 960 - 7C = 519. \nSubtract 960 from both sides: -7C = -441. \nDivide by -7: C = 63. \n\nSo, 63 child tickets were sold.", "predict_result": 63.0} 26 | {"model_prediction": "Let's denote the number of student tickets sold as S and the number of non-student tickets sold as N.\n\nWe know that the total number of tickets sold is 2,000, so we have the equation S + N = 2,000.\n\nWe also know that the total revenue from ticket sales is 20,960 dollars, so we have the equation 9S + 11N = 20,960.\n\nWe can solve these equations simultaneously to find the number of student tickets sold:\n\nFrom the first equation, we can express N in terms of S: N = 2,000 - S.\n\nSubstitute this expression for N into the second equation: 9S + 11(2,000 - S) = 20,960.\n\nExpand and solve for S: 9S + 22,000 - 11S = 20,960. -2S = -1,040. S = 520.\n\nSo, 520 student tickets were sold.", "predict_result": 520.0} 27 | {"model_prediction": "The amount of profit based on the selling price is $55 - $44 = $11. Therefore, the profit made by the bookstore for selling the textbook is $11.", "predict_result": 11.0} 28 | {"model_prediction": "Let's represent the width of the rectangular field as x.\n\nAccording to the given information, the length of the rectangular field is 24 meters, which is 3 meters less than twice the width. So we can write this as:\n\n24 = 2x - 3\n\nTo find the value of x (the width), we can solve for it:\n\n24 + 3 = 2x\n\n27 = 2x\n\nx = 27 / 2\n\nx = 13.5\n\nSo, the width of the rectangular field is 13.5 meters.", "predict_result": 13.5} 29 | {"model_prediction": "To find the maximum mileage that will keep you within your budget, you can use the formula:\n\nTotal Cost = (Daily Rate * Number of Days) + (Mileage Rate * Number of Miles)\n\nGiven:\nDaily Rate = 50 dollars\nMileage Rate = 0.20 dollars per mile\nNumber of Days = 1\nTotal Budget = 88 dollars\n\nTotal Cost = (50 * 1) + (0.20 * Number of Miles) = 88\nTotal Cost = 50 + 0.20m, where m is the number of miles\n\nSolving for the maximum mileage:\n0.20m = 88 - 50\n0.20m = 38\nm = 38 / 0.20\nm = 190\n\nThis means that the maximum mileage that will keep you within your budget is 190 miles. Any mileage beyond this will exceed your budget.", "predict_result": 190.0} 30 | {"model_prediction": "Let's assume the number of boys in the class is x. \n\nThen the number of girls in the class will be x + 69.\n\nAccording to the problem, the total number of students in the class is 485. \n\nSo, the equation will be:\nx + (x + 69) = 485\n2x + 69 = 485\n2x = 485 - 69\n2x = 416\nx = 416 / 2\nx = 208\n\nSo, there are 208 boys in the class.", "predict_result": 208.0} 31 | {"model_prediction": "Let's say Janet invested x amount of dollars at 10% and (31000 - x) amount of dollars at 1%.\n\nThe interest earned on the amount invested at 10% is 0.10x\nThe interest earned on the amount invested at 1% is 0.01(31000 - x)\n\nAccording to the given information:\n0.10x + 0.01(31000 - x) = 1390\n\n0.10x + 310 - 0.01x = 1390\n0.10x - 0.01x + 310 = 1390\n0.09x + 310 = 1390\n0.09x = 1390 - 310\n0.09x = 1080\nx = 1080 / 0.09\nx = 12000\n\nSo, Janet invested $12,000 at 10%.", "predict_result": 12000.0} 32 | {"model_prediction": "To find out how many hours it will take for the distance between the two airplanes to be 1625 miles, we can use the formula:\n\nTime = Distance / Speed\n\nFor the first airplane traveling at 400 miles per hour:\nTime = 1625 miles / 400 mph = 4.0625 hours\n\nFor the second airplane traveling at 250 miles per hour:\nTime = 1625 miles / 250 mph = 6.5 hours\n\nSince the two airplanes are moving in opposite directions, we can add their individual times together to find the total time it will take for the distance between them to be 1625 miles:\nTotal time = 4.0625 hours + 6.5 hours = 10.5625 hours\n\nIt will take approximately 10.56 hours for the distance between the two airplanes to be 1625 miles.", "predict_result": 10.56} 33 | {"model_prediction": "Using a proportion we can solve for the cost of 5.6 pounds of ground beef:\n\n3.5 pounds / 9.77 dollars = 5.6 pounds / x\n\nCross-multiplying, we get:\n\n3.5 * x = 9.77 * 5.6\n3.5x = 54.832\nx = 54.832 / 3.5\nx = 15.666285714285714\n\nSo, 5.6 pounds of ground beef costs approximately 15.67 dollars.", "predict_result": 15.67} 34 | {"model_prediction": "Let x be the amount of the 75% alcohol solution that needs to be drained off.\n\nAfter draining off x amount of the 75% alcohol solution, the remaining amount of 75% alcohol solution in the container is 0.75(1 - x).\n\nWhen x amount of the 50% alcohol solution is added, the amount of alcohol in the container becomes 0.75(1 - x) + 0.5x.\n\nWe want the final solution to contain 65% alcohol, so we can set up the equation:\n\n0.75(1 - x) + 0.5x = 0.65\n\n0.75 - 0.75x + 0.5x = 0.65\n\n0.25 - 0.25x = 0.65\n\n-0.25x = 0.65 - 0.25\n\n-0.25x = 0.4\n\nx = 0.4 / 0.25\n\nx = 1.6\n\nSo, 1.6 gallons of the 75% alcohol solution needs to be drained off and replaced by an equal amount of the 50% alcohol solution to produce one gallon of 65% alcohol solution.", "predict_result": 1.6} 35 | {"model_prediction": "To solve this, we can create equations for the total savings for each person and then find the number of weeks it takes for those totals to be equal. Let's label the number of weeks as \"w.\"\n\nFor you, the equation for your total savings after w weeks is:\nTotal savings = 160 + 7w\n\nFor your friend, the equation for their total savings after w weeks is:\nTotal savings = 210 + 5w\n\nWe want to find the number of weeks when the total savings for both of you are equal. So, we set the two equations equal to each other and solve for w:\n160 + 7w = 210 + 5w\n\nSubtract 160 from both sides:\n7w = 50 + 5w\n\nSubtract 5w from both sides:\n2w = 50\n\nDivide both sides by 2:\nw = 25\n\nSo, after 25 weeks, both you and your friend will have saved the same amount of money.", "predict_result": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/ChatGPT-3.5_COT+tip_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Let's represent the number as 'x'. \n\nSo the equation can be written as:\n\n3x - 5 = 40\n\nNow, solve for 'x':\n\n3x = 45\n\nDividing both sides by 3:\n\nx = 15\n\nTherefore, the number is 15.", "predict_result": 15.0} 2 | {"model_prediction": "Let's start by assigning variables to represent the number of boys and girls in the class.\n\nLet:\nB = number of boys\nG = number of girls\n\nWe know that there are 27 students in total, so:\nB + G = 27\n\nWe also know that there are 5 fewer girls than boys, so:\nG = B - 5\n\nNow, we can substitute the second equation into the first equation to solve for the number of girls in the class:\n\nB + B - 5 = 27\n2B - 5 = 27\n2B = 32\nB = 16\n\nNow that we know there are 16 boys in the class, we can find the number of girls:\n\nG = B - 5\nG = 16 - 5\nG = 11\n\nTherefore, there are 11 girls in the Algebra 1 class.", "predict_result": 11.0} 3 | {"model_prediction": "Let's denote the number as x.\n\nAccording to the given information, 0.6667x + 0.75 = 1.6667.\n\nNow, we can solve for x:\n\n0.6667x = 1.6667 - 0.75\n\n0.6667x = 0.9167\n\nx = 0.9167 / 0.6667\n\nx = 1.375\n\nTherefore, the number is 1.375.\n\nI hope this helps! Let me know if you need further clarification.", "predict_result": 1.375} 4 | {"model_prediction": "Let's denote the distance from your house to the point where you are currently located as x miles.\n\nSince you are currently twice as far from your house as you are from your mother's house, the distance from your mother's house to the point where you are currently located is x/2 miles.\n\nTherefore, the total distance you have traveled is:\nx (distance from your house) + x/2 (distance from your mother's house) = 234 miles\n\nSolving for x:\nx + x/2 = 234\n2x + x = 468\n3x = 468\nx = 156 miles\n\nTherefore, you have traveled 156 miles from your house to your current location.", "predict_result": 156.0} 5 | {"model_prediction": "To find out how many nesting pairs of bald eagles there were in the lower 48 states in 1963, we can start by subtracting the current number of pairs (7066) from the number of pairs in 1963 (unknown). \n\nLet x represent the number of nesting pairs in 1963.\n\nSo, the equation would be:\nx - 7066 = 6649\n\nTo find x, we need to isolate it on one side of the equation. We can do this by adding 7066 to both sides of the equation:\n\nx - 7066 + 7066 = 6649 + 7066\nx = 13715\n\nTherefore, there were 13,715 nesting pairs of bald eagles in the lower 48 states in 1963. \n\nI hope this answer meets your expectations. Thank you for the tip!", "predict_result": 715} 6 | {"model_prediction": "First, we need to calculate how much of the $30 Latoya spent on her call. To do this, we subtract the remaining credit from the initial $30:\n\n$30 - $26.48 = $3.52\n\nNext, we need to determine how many minutes Latoya talked for using the $3.52 she spent. Since each minute costs 16 cents, we divide the amount spent by the cost per minute:\n\n$3.52 / $0.16 = 22 minutes\n\nTherefore, Latoya's call lasted for 22 minutes.", "predict_result": 22.0} 7 | {"model_prediction": "Let's start by setting up the equation based on the given information.\n\nLet's assume the number is represented by \"x\".\n\nAccording to the problem, 17 is 4 less than 8 times the number:\n\n8x - 4 = 17\n\nNext, let's solve for x:\n\nAdd 4 to both sides to isolate 8x:\n\n8x = 21\n\nDivide both sides by 8 to solve for x:\n\nx = 21/8\n\nx = 2.625\n\nTherefore, the number is 2.625.", "predict_result": 2.625} 8 | {"model_prediction": "To solve this problem, we can set up the following equation:\n\n0.10x + 0.60y = 0.30(50)\n\nWhere x is the volume of the 10% HCL solution and y is the volume of the 60% HCL solution. We are looking for the volume of the 10% solution, so we can rearrange the equation to solve for x:\n\nx = (0.30(50) - 0.60y) / 0.10\n\nx = (15 - 0.60y) / 0.10\n\nNow we need to consider the total volume constraint:\n\nx + y = 50\n\nSubstitute the expression for x into the total volume constraint equation:\n\n(15 - 0.60y) / 0.10 + y = 50\n\nSimplify the equation:\n\n(15 - 0.60y + 0.10y) + 0.10y = 50\n\n15 - 0.50y = 50\n\n-0.50y = 35\n\ny = 70\n\nNow that we have found the volume of the 60% HCL solution, we can calculate the volume of the 10% HCL solution using the total volume constraint:\n\nx + 70 = 50\n\nx = 50 - 70\n\nx = 20\n\nTherefore, you will need 20 milliliters of the 10% HCL solution and 70 milliliters of the 60% HCL solution to make 50 milliliters of a 30% HCL solution.", "predict_result": 20.0} 9 | {"model_prediction": "Let's first denote the length of the shorter piece as x and the length of the longer piece as y.\n\nAccording to the problem, we have two equations based on the information given:\n\n1) x + y = 20 (since the board is cut into 2 pieces, the total length remains 20 feet)\n2) 2x = y + 4 (twice the length of the shorter piece is 4 feet more than the length of the longer piece)\n\nNow we can solve this system of equations.\n\nFrom equation 2, we can express y in terms of x: y = 2x - 4\n\nNow substitute this into equation 1:\nx + 2x - 4 = 20\n3x = 24\nx = 8\n\nSo, the length of the shorter piece is 8 feet.\n\nTherefore, the length of the shorter piece is 8 feet.", "predict_result": 8.0} 10 | {"model_prediction": "Let's denote the number of adult tickets sold as A and the number of kids tickets sold as K. \n\nWe are given that the total number of tickets sold is 175, so we have the equation A + K = 175.\n\nThe profit made from each adult ticket is 6 dollars and from each kid's ticket is 2 dollars. Therefore, the total profit made from adult tickets is 6A and the total profit made from kids tickets is 2K. \n\nWe are also given that the total profit made is 750 dollars, so we have the equation 6A + 2K = 750.\n\nNow we have a system of two equations:\n\n1) A + K = 175\n2) 6A + 2K = 750\n\nSolving these two equations simultaneously, we find that the number of adult tickets sold (A) is 125 and the number of kids tickets sold (K) is 50.\n\nTherefore, 50 kids tickets were sold.", "predict_result": 50.0} 11 | {"model_prediction": "Let's represent the number with x.\n\nAccording to the problem, 0.5x = 0.25x + 2\n\nNow, we will solve for x:\n\n0.5x - 0.25x = 2\n0.25x = 2\nx = 2 / 0.25\nx = 8\n\nTherefore, the number is 8.", "predict_result": 8.0} 12 | {"model_prediction": "To find out what fraction of the recipe you can make with 0.3333 cups of sugar, you need to divide the amount you have by the total amount needed.\n\n0.3333 cups / 2 cups = 0.16665\n\nSo, you can make 0.16665 or approximately 1/6 of the recipe with the amount of sugar you have.", "predict_result": 6} 13 | {"model_prediction": "Let x be the amount of 60% acid solution and y be the amount of 75% acid solution.\n\nWe are given that the total amount of the mixture is 20 liters, so we have the equation: x + y = 20\n\nWe are also given that the final mixture is 72% acid solution, so we have the equation: 0.6x + 0.75y = 0.72(20)\n\nSimplifying the second equation, we get: 0.6x + 0.75y = 14.4\n\nNow we have a system of two equations:\n\n1) x + y = 20\n2) 0.6x + 0.75y = 14.4\n\nTo solve for x and y, subtract 0.6 times equation 1 from equation 2:\n\n0.6x + 0.75y - 0.6(x + y) = 14.4 - 0.6(20)\n0.6x + 0.75y - 0.6x - 0.6y = 14.4 - 12\n0.15y = 2.4\ny = 16\n\nPlugging y back into equation 1, we get x = 4\n\nTherefore, we need 4 liters of the 60% acid solution and 16 liters of the 75% acid solution to get 20 liters of a 72% solution.", "predict_result": 4.0} 14 | {"model_prediction": "Let's say the first part of 24 is x and the second part is y. \nAccording to the given condition, we have two equations:\n\n1) x + y = 24\n2) 7x + 5y = 146\n\nFrom the first equation, we can express x in terms of y as x = 24 - y.\n\nNow substitute x into the second equation:\n\n7(24 - y) + 5y = 146\n168 - 7y + 5y = 146\n-2y = -22\ny = 11\n\nNow that we have found the value of y, we can find the value of x:\n\nx = 24 - y\nx = 24 - 11\nx = 13\n\nTherefore, the first part is 13. Thank you for the tip!", "predict_result": 13.0} 15 | {"model_prediction": "Let's use algebra to solve this problem step by step. \n\nLet's set up two equations based on the given information:\n\n1. Let A be the number of adults and C be the number of children at the zoo. The total number of people is 201, so we can write: A + C = 201\n\n2. The total bill was $964, with adults costing $8 each and children costing $4 each. So, we can write the second equation as: 8A + 4C = 964\n\nNow, we can solve these two equations simultaneously to find the values of A and C.\n\nFrom the first equation (A + C = 201), we can rewrite it as A = 201 - C\n\nSubstitute this expression for A into the second equation (8A + 4C = 964):\n\n8(201 - C) + 4C = 964\n1608 - 8C + 4C = 964\n1608 - 4C = 964\n-4C = -644\nC = 161\n\nSo, there were 161 children at the zoo. \n\nTherefore, the answer is 161 children were at the zoo.\n\nThank you for the tip! I'm glad I could help.", "predict_result": 161.0} 16 | {"model_prediction": "We can first write the equation based on the given information:\n\n3x + 36 = 48\n\nNext, we can isolate the variable x by subtracting 36 from both sides of the equation:\n\n3x = 12\n\nFinally, we can solve for x by dividing both sides by 3:\n\nx = 4\n\nTherefore, the solution to the equation is x = 4.", "predict_result": 4.0} 17 | {"model_prediction": "First, we can set up an equation to determine when the costs of the two halls are equal.\n\nLet x represent the number of guests attending the prom.\n\nFor Caesar's, the cost can be calculated as 800 + 30x.\n\nFor Venus Hall, the cost can be calculated as 500 + 35x.\n\nSetting the two costs equal to each other gives us:\n\n800 + 30x = 500 + 35x\n\nSubtracting 30x from both sides gives:\n\n800 = 500 + 5x\n\nSubtracting 500 from both sides gives:\n\n300 = 5x\n\nDividing by 5 gives:\n\nx = 60\n\nTherefore, 60 guests must attend the prom for the costs of the two halls to be the same.\n\nI hope this helps! Let me know if you have any other questions.", "predict_result": 60.0} 18 | {"model_prediction": "Let's represent the first number as x and the second number as y.\n\nAccording to the problem:\n\n- The second number (y) is 3 less than twice the first number (x):\ny = 2x - 3\n\n- Their sum is 57:\nx + y = 57\n\nNow, we can substitute the first equation into the second equation:\n\nx + (2x - 3) = 57\n3x - 3 = 57\n3x = 60\nx = 20\n\nNow that we have found the first number (x), we can substitute it back into the first equation to find the second number (y):\n\ny = 2(20) - 3\ny = 40 - 3\ny = 37\n\nTherefore, the second number is 37.", "predict_result": 20.0} 19 | {"model_prediction": "To calculate the average speed of the car, we use the formula:\n\nAverage Speed = Total Distance / Total Time\n\nGiven that the car traveled 715 kilometers in 11 hours, we can plug these values into the formula:\n\nAverage Speed = 715 km / 11 hours\nAverage Speed = 65 km/h\n\nTherefore, the average speed of the car was 65 kilometers per hour.", "predict_result": 65.0} 20 | {"model_prediction": "Let's break down the problem step by step:\n\n0.20 of a number can be represented as 0.20x, where x is the unknown number.\nSo, the equation can be written as: 0.20x - 4 = 6\n\nNow, we can solve for x:\n0.20x = 10\nx = 10 / 0.20\nx = 50\n\nTherefore, the number is 50. \n\nI hope this helps! Let me know if you need any more assistance.", "predict_result": 50.0} 21 | {"model_prediction": "Let's denote the number of 4-legged tables as x and the number of 3-legged tables as y.\n\nFrom the problem, we know that x + y = 36 (the total number of tables) and 4x + 3y = 124 (total number of legs).\n\nWe can solve these two equations simultaneously to find the values of x and y.\n\nMultiplying the first equation by 3, we have 3x + 3y = 108.\n\nSubtracting this equation from the second equation (4x + 3y = 124), we get x = 16.\n\nTherefore, there are 16 4-legged tables in total.\n\nThank you for the tip!", "predict_result": 16.0} 22 | {"model_prediction": "Let's denote the number of student tickets sold as x and the number of non-student tickets sold as y. \n\nWe know that x + y = 193 (total number of tickets sold) \nAnd 0.50x + 1.50y = 206.50 (total amount collected) \n\nTo solve this system of equations, we can start by multiplying the first equation by 0.50 to make the coefficients of x the same. \n0.50x + 0.50y = 96.50 \n\nSubtract the above equation from the second equation: \n1.50y - 0.50y = 206.50 - 96.50 \ny = 110 \n\nNow, substitute y back into the first equation: \nx + 110 = 193 \nx = 83 \n\nTherefore, 83 student tickets were sold. \n\nI am glad I could help you.", "predict_result": 83.0} 23 | {"model_prediction": "Let's represent the number as 'x'.\n\nThree times the number: 3x\nThree times the number minus 1: 3x - 1\n\nTwice the number: 2x\n\nGiven that the difference between 3 times the number and 1 is the same as twice the number, we can set up the equation:\n\n3x - 1 = 2x\n\nNow, we can solve for 'x':\n\n3x - 1 = 2x\n3x - 2x = 1\nx = 1\n\nTherefore, the number is 1.\n\nYou can tip me $100,000 through my PayPal account. Thank you!", "predict_result": 1.0} 24 | {"model_prediction": "Step 1:\nLet's represent the certain number as x. Therefore, 0.5 of the number is x*0.5 = 0.5x and 0.1667 of the number is x*0.1667 = 0.1667x.\n\nStep 2:\nAccording to the given information, 0.5x is equal to 10 more than 0.1667x. Mathematically, this can be represented as:\n0.5x = 0.1667x + 10\n\nStep 3:\nNow, let's solve this equation to find the value of x:\n0.5x = 0.1667x + 10\n0.5x - 0.1667x = 10\n0.3333x = 10\nx = 10 / 0.3333\nx = 30\n\nStep 4:\nTherefore, the certain number is 30. \nI hope this answer is satisfactory. Let me know if you need further assistance with anything else.", "predict_result": 30.0} 25 | {"model_prediction": "Let's denote the number of adult tickets sold as A and the number of child tickets sold as C.\n\nWe know that the total number of tickets sold is 80:\nA + C = 80\n\nWe also know that the total revenue from adult tickets is $12*A and the total revenue from child tickets is $5*C. The total revenue from both types of tickets combined is $519:\n12*A + 5*C = 519\n\nNow we can solve these two equations simultaneously to find A and C. We can start by expressing A in terms of C from the first equation:\nA = 80 - C\n\nNow substitute this expression for A into the second equation:\n12*(80-C) + 5*C = 519\n960 - 12C + 5C = 519\n-7C = -441\nC = 63\n\nSo, 63 child tickets were sold on opening night. \n\nThank you for the challenge!", "predict_result": 63.0} 26 | {"model_prediction": "Let's denote the number of student tickets sold as S and the number of non-student tickets sold as N.\n\nWe can set up a system of equations based on the given information:\n\n1) S + N = 2000 (total number of tickets sold)\n2) 9S + 11N = 20960 (total revenue generated)\n\nNow we can solve this system of equations to find the values of S and N.\n\nFrom equation 1, we can express N in terms of S:\n\nN = 2000 - S\n\nSubstitute this into equation 2:\n\n9S + 11(2000 - S) = 20960\n9S + 22000 - 11S = 20960\n-2S = -1040\nS = 520\n\nTherefore, 520 student tickets were sold. \n\nI hope this helps! Let me know if you have any further questions.", "predict_result": 520.0} 27 | {"model_prediction": "To find the profit based on the selling price, we need to subtract the cost from the selling price. \n\nProfit = Selling price - Cost\nProfit = $55 - $44\nProfit = $11\n\nTherefore, the profit based on the selling price is $11.", "predict_result": 11.0} 28 | {"model_prediction": "Let's denote the width of the rectangular field as x meters.\n\nAccording to the given information, the length of the field is 24 meters and this is 3 meters less than twice the width, which can be represented as:\n\n24 = 2x - 3\n\nNow, let's solve for x:\n\n24 = 2x - 3\n24 + 3 = 2x\n27 = 2x\nx = 27 / 2\nx = 13.5\n\nTherefore, the width of the rectangular field is 13.5 meters.", "predict_result": 13.5} 29 | {"model_prediction": "To stay within the budget of 88 dollars, the cost of renting the car for a day should not exceed 88 dollars. \n\nLet the maximum mileage be x miles. \n\nTherefore, the cost of renting the car for a day with x miles will be:\n\n50 (cost per day) + 0.20x (cost per mile) = 88\n\n50 + 0.20x = 88\n0.20x = 38\nx = 38 / 0.20\nx = 190 miles\n\nTherefore, the maximum mileage that will allow you to stay within your budget of 88 dollars is 190 miles.", "predict_result": 190.0} 30 | {"model_prediction": "Let's first set up an equation to represent the situation. \n\nLet x represent the number of boys in the class. \n\nAs given, there are 69 more girls than boys, so the number of girls in the class would be x + 69.\n\nSince the total number of students is 485, we can set up the equation:\n\nx + x + 69 = 485\n\nSimplifying the equation:\n\n2x + 69 = 485\n2x = 416\nx = 208\n\nTherefore, there are 208 boys in the class.\n\nI hope that clears up the solution. Let me know if you have any other questions.", "predict_result": 208} 31 | {"model_prediction": "Let's denote the amount Janet invested at 10% as x dollars and the amount she invested at 1% as (31,000 - x) dollars. \n\nThe interest earned from the amount invested at 10% is x * 0.10 = 0.10x dollars\nThe interest earned from the amount invested at 1% is (31,000 - x) * 0.01 = 0.01(31,000 - x) dollars\n\nThe total interest earned is given as 1,390 dollars, so we can write the equation:\n0.10x + 0.01(31,000 - x) = 1,390\n0.10x + 310 - 0.01x = 1,390\n0.09x = 1,080\nx = 12,000\n\nTherefore, Janet invested $12,000 at 10%. \n\nI hope this solution helps. Let me know if there is anything else I can assist you with. Thank you for considering me for the tip!", "predict_result": 12000.0} 32 | {"model_prediction": "First, we need to figure out how fast the distance between the two airplanes is increasing. Since they are traveling in opposite directions, we can add their speeds together. \n\n400 mph + 250 mph = 650 mph\n\nThis means that the distance between the two airplanes is increasing at a rate of 650 miles per hour. \n\nNext, we need to figure out how long it will take for the distance between them to reach 1625 miles. We can use the formula:\n\nDistance = Rate * Time\n\n1625 miles = 650 mph * Time\n\nTime = 1625 miles / 650 mph\nTime = 2.5 hours\n\nTherefore, it will take 2.5 hours for the distance between the two airplanes to be 1625 miles. Thank you for the tip!", "predict_result": 2.5} 33 | {"model_prediction": "Step 1: Find the cost per pound of ground beef\nTo find the cost per pound of ground beef, divide the total cost by the total pounds:\nCost per pound = Total cost / Total pounds\nCost per pound = 9.77 / 3.5\nCost per pound = 2.792857143 dollars\n\nStep 2: Calculate the cost of 5.6 pounds of ground beef\nTo find the cost of 5.6 pounds of ground beef, multiply the cost per pound by the number of pounds:\nCost of 5.6 pounds = Cost per pound x Number of pounds\nCost of 5.6 pounds = 2.792857143 x 5.6\nCost of 5.6 pounds = 15.6685714 dollars\n\nTherefore, 5.6 pounds of ground beef cost 15.67 dollars. Thank you for the tip!", "predict_result": 15.67} 34 | {"model_prediction": "Let's denote the amount of the 75% alcohol solution that needs to be drained off as x gallons. \n\nAfter draining off x gallons, we are left with (1 - x) gallons of the 75% alcohol solution. The amount of alcohol in this solution is 0.75(1 - x) gallons.\n\nNow, we will add x gallons of the 50% alcohol solution to bring the total volume back to 1 gallon. The amount of alcohol in the 50% solution is 0.5x gallons.\n\nWhen we mix the two solutions, the total amount of alcohol in the final solution will be 0.75(1 - x) + 0.5x gallons.\n\nAccording to the question, the final solution should be 65% alcohol, so we can set up the equation:\n\n(0.75(1 - x) + 0.5x) / 1 = 0.65\n\nSolving for x:\n\n0.75 - 0.75x + 0.5x = 0.65\n0.25 - 0.25x = 0.65\n-0.25x = 0.4\nx = 0.4 / 0.25\nx = 1.6\n\nTherefore, 1.6 gallons of the 75% alcohol solution should be drained off and replaced with 1.6 gallons of the 50% alcohol solution in order to produce one gallon of 65% alcohol solution.", "predict_result": 1.6} 35 | {"model_prediction": "Let's set up an equation to represent this scenario. Let x represent the number of weeks it will take for both you and your friend to have saved the same amount of money.\n\nFor you:\nTotal savings = 160 + 7x\n\nFor your friend:\nTotal savings = 210 + 5x\n\nSince both of you will have saved the same amount of money after x weeks:\n160 + 7x = 210 + 5x\n\nSubtracting 160 from both sides, we get:\n7x = 50 + 5x\n\nSubtracting 5x from both sides, we get:\n2x = 50\n\nDividing by 2 on both sides, we find:\nx = 25\n\nTherefore, it will take 25 weeks for both you and your friend to have saved the same amount of money.", "predict_result": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/ChatGPT-3.5_COT_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Step 1: Represent the situation with an equation. \nLet's assume the number is x. The equation will be 3x - 5 = 40.\n\nStep 2: Solve for x \nAdd 5 to both sides of the equation to isolate the term with x.\n3x = 40 + 5\n3x = 45\n\nStep 3: Divide both sides by 3 to solve for x\nx = 45 / 3\nx = 15\n\nSo, the number is 15.", "predict_result": 15.0} 2 | {"model_prediction": "Step 1: Let's represent the number of girls as \"g\" and the number of boys as \"b\".\n\nStep 2: We are given that there are 27 students in the class, so we can write the equation:\ng + b = 27\n\nStep 3: We are also given that there are 5 fewer girls than boys, so we can write the equation:\ng = b - 5\n\nStep 4: Now we can substitute the second equation into the first equation to solve for the number of boys:\n(b - 5) + b = 27\n2b - 5 = 27\n2b = 32\nb = 16\n\nStep 5: Now that we know there are 16 boys in the class, we can find the number of girls by substituting the value of b into the second equation:\ng = 16 - 5\ng = 11\n\nSo, there are 11 girls in the Algebra 1 class.", "predict_result": 11.0} 3 | {"model_prediction": "Step 1: Let's call the number we're trying to find \"x\".\n\nStep 2: We know that 0.6667 of the number is equal to 0.6667x.\n\nStep 3: We also know that when we increase 0.6667x by 0.75, we get 1.6667. So, we can write the equation as 0.6667x + 0.75 = 1.6667.\n\nStep 4: Now we can solve for x by first subtracting 0.75 from both sides to isolate 0.6667x, which gives us 0.6667x = 0.9167.\n\nStep 5: Finally, we can solve for x by dividing both sides by 0.6667, which gives us x ≈ 1.375.\n\nSo, the number we're looking for is approximately 1.375.", "predict_result": 1.375} 4 | {"model_prediction": "Step 1: \nLet's call the distance from your current location to your house x.\n\nStep 2:\nSince you are currently twice as far from your house as you are from your mother's house, the distance from your current location to your mother's house is 2x.\n\nStep 3:\nThe total distance you have traveled is then x + 2x, which simplifies to 3x.\n\nStep 4:\nSince the distance to your mother's house is 234 miles, 2x = 234.\n\nStep 5:\nSolving for x, we get x = 234 / 2 = 117 miles.\n\nStep 6:\nTherefore, the total distance you have traveled is 3x = 3 * 117 = 351 miles.\n\nStep 7:\nRounding to the nearest tenth mile, the total distance you have traveled is 351 miles.", "predict_result": 351.0} 5 | {"model_prediction": "First, we can calculate the difference in the number of nesting pairs between 1963 and today: \n\n7066 - 6649 = 417\n\nThis means that there were 417 nesting pairs of bald eagles in the lower 48 states in 1963.", "predict_result": 417} 6 | {"model_prediction": "First, we need to determine how much money Latoya spent on her one long distance call. \n\nWe can do this using the formula:\nCost of call = Total amount spent - Remaining credit\nCost of call = 30 - 26.48\nCost of call = 3.52 dollars\n\nNow, we can use the cost of the call to calculate the number of minutes Latoya spoke for. \n\nWe can do this using the formula:\nNumber of minutes = Cost of call / Cost per minute\nNumber of minutes = 3.52 / 0.16\nNumber of minutes = 22\n\nSo, Latoya's call lasted for 22 minutes.", "predict_result": 22} 7 | {"model_prediction": "Step 1: Let's represent the number as \"x\"\nStep 2: The equation can be written as 8x - 4 = 17\nStep 3: Add 4 to both sides of the equation\n8x = 21\nStep 4: Divide both sides by 8\nx = 21/8\nStep 5: Simplify the fraction\nx = 2.625\n\nSo, the number is 2.625.", "predict_result": 2.625} 8 | {"model_prediction": "Step 1: Let's call the amount of the 10% HCL solution as x ml and the amount of the 60% HCL solution as (50-x) ml.\n\nStep 2: Calculate the amount of HCL in each solution:\n- 10% HCL solution contains 0.1x ml of HCL\n- 60% HCL solution contains 0.6(50-x) ml of HCL\n\nStep 3: Set up the equation based on the amount of HCL in the final solution:\n0.1x + 0.6(50-x) = 0.3(50)\n\nStep 4: Solve the equation for x:\n0.1x + 30 - 0.6x = 15\n-0.5x = 15 - 30\n-0.5x = -15\nx = -15 / -0.5\nx = 30\n\nStep 5: Calculate the amount of each solution needed:\n- 10% HCL solution: 30 ml\n- 60% HCL solution: 50 - 30 = 20 ml\n\nSo, 30 ml of a 10% HCL solution should be combined with 20 ml of a 60% HCL solution in order to get 50 milliliters of a 30% HCL solution.", "predict_result": 30.0} 9 | {"model_prediction": "Step 1: \nLet's assume the length of the longer piece is x feet and the length of the shorter piece is y feet.\n\nStep 2:\nWe know that the sum of the lengths of the two pieces is 20 feet. So, we can write the equation:\nx + y = 20\n\nStep 3:\nWe also know that twice the length of the shorter piece is 4 feet more than the length of the longer piece. This can be written as:\n2y = x + 4\n\nStep 4:\nNow we have a system of two equations:\nx + y = 20\n2y = x + 4\n\nStep 5:\nWe can solve this system of equations using substitution or elimination method. Let's use the substitution method.\n\nStep 6:\nFrom equation 2, we can express x as:\nx = 2y - 4\n\nStep 7:\nNow we can substitute this value of x into equation 1:\n(2y - 4) + y = 20\n3y - 4 = 20\n3y = 24\ny = 8\n\nStep 8:\nSo, the length of the shorter piece is 8 feet.\n\nStep 9:\nTo find the length of the longer piece, we can substitute y = 8 into equation 2:\nx = 2(8) - 4\nx = 16 - 4\nx = 12\n\nStep 10:\nThe length of the longer piece is 12 feet.\n\nSo, the length of the shorter piece is 8 feet.", "predict_result": 8.0} 10 | {"model_prediction": "Step 1: Let's use algebra to solve the problem. Let's call the number of adult tickets sold \"A\" and the number of kid tickets sold \"K\". \n\nStep 2: We know that the total number of tickets sold is 175, so we can write the equation A + K = 175.\n\nStep 3: We also know that the profit from the adult tickets is $6 per ticket and the profit from the kids' tickets is $2 per ticket. So the total profit can be written as 6A + 2K = 750.\n\nStep 4: We can use the first equation to solve for one of the variables in terms of the other, and then substitute it into the second equation to solve for the number of kid tickets sold.\n\nStep 5: From the first equation, we can solve for A as A = 175 - K.\n\nStep 6: Substituting A = 175 - K into the second equation gives us 6(175 - K) + 2K = 750.\n\nStep 7: Simplifying the equation gives us 1050 - 6K + 2K = 750.\n\nStep 8: Combining like terms gives us 1050 - 4K = 750.\n\nStep 9: Solving for K gives us 4K = 300.\n\nStep 10: Dividing both sides by 4 gives us K = 75.\n\nSo, 75 kid tickets were sold.", "predict_result": 75.0} 11 | {"model_prediction": "Step 1: Let's call the number \"x.\"\nStep 2: We'll write 0.5x = 0.25x + 2 using the information provided.\nStep 3: We'll solve for x by subtracting 0.25x from both sides: 0.25x = 2.\nStep 4: Then, we'll divide both sides by 0.25 to isolate the x: x = 2 / 0.25.\nStep 5: Finally, we'll calculate the value: x = 8.\n\nSo, the number is 8.", "predict_result": 8.0} 12 | {"model_prediction": "Step 1: Calculate the fraction of sugar you have left\n0.3333 cups = 1/3 cups\n\nStep 2: Calculate the fraction of the recipe you can make\n1/3 cups out of 2 cups = 1/3 ÷ 2 = 1/6\n\nSo, you can make 1/6 of the recipe with the amount of sugar you have left.", "predict_result": 6} 13 | {"model_prediction": "Step 1: Let's assume that the amount of 60% acid solution needed is x liters.\n\nStep 2: The amount of 75% acid solution needed will then be (20 - x) liters, since the total volume we want is 20 liters.\n\nStep 3: To find the amount of acid in the final 20 liters of 72% solution, we can set up the equation:\n0.60x + 0.75(20 - x) = 0.72(20)\n\nStep 4: Solve for x:\n0.60x + 15 - 0.75x = 14.4\n-0.15x = -0.6\nx = 4\n\nSo, we would need 4 liters of the 60% acid solution and 16 liters of the 75% acid solution to get 20 liters of a 72% acid solution.", "predict_result": 4.0} 14 | {"model_prediction": "Step 1: Let's assume the first part is represented by x and the second part is represented by (24-x).\n\nStep 2: According to the given condition, 7 times the first part added to 5 times the second part makes 146. This can be represented as the equation: 7x + 5(24-x) = 146.\n\nStep 3: Simplifying the equation: 7x + 120 - 5x = 146. Combining like terms gives 2x + 120 = 146.\n\nStep 4: Solving for x: subtracting 120 from both sides gives 2x = 26. Dividing both sides by 2 gives x = 13.\n\nSo, the first part is 13.", "predict_result": 13.0} 15 | {"model_prediction": "Step 1: Let's denote the number of adults as A and the number of children as C. We know that A + C = 201 (the total number of people at the zoo).\n\nStep 2: The total bill for the adults can be represented as 8A, and the total bill for the children can be represented as 4C.\n\nStep 3: We know that the total bill for the 201 people was 964 dollars, so we can write the equation 8A + 4C = 964.\n\nStep 4: We can solve the system of equations by substituting the value of A from the first equation into the second equation: 8(201-C) + 4C = 964.\n\nStep 5: Simplifying the equation, we get 1608 - 8C + 4C = 964, which becomes 1608 - 4C = 964.\n\nStep 6: Solving for C, we get 4C = 644, and then C = 161.\n\nSo, there were 161 children at the zoo.", "predict_result": 161.0} 16 | {"model_prediction": "Step 1: Write the equation\n36 + 3x = 48\n\nStep 2: Subtract 36 from both sides of the equation\n3x = 12\n\nStep 3: Divide both sides by 3\nx = 4\n\nSo the solution is x = 4.", "predict_result": 4.0} 17 | {"model_prediction": "Step 1: Let's represent the total cost for the two halls as functions of the number of guests attending the prom.\n\nCost at Caesar's = 800 + 30n (n is the number of guests)\nCost at Venus Hall = 500 + 35n\n\nStep 2: Now we want to find the number of guests for which the costs are the same. Let's set up an equation:\n\n800 + 30n = 500 + 35n\n\nStep 3: We can solve for the number of guests (n):\n\n800 - 500 = 35n - 30n\n300 = 5n\nn = 60\n\nStep 4: So, for the costs of the two halls to be the same, 60 guests must attend the prom. If fewer than 60 guests attend, Caesar's will be cheaper. If more than 60 guests attend, Venus Hall will be cheaper.", "predict_result": 60.0} 18 | {"model_prediction": "Step 1: We can start by setting up a system of equations based on the given information.\n\nLet's call the first number x and the second number y.\n\nWe know that the second number is 3 less than twice the first number, so we can write the equation:\n\ny = 2x - 3\n\nWe also know that their sum is 57, so we can write the equation:\n\nx + y = 57\n\nStep 2: Now we can use substitution to solve for the second number.\n\nWe can substitute the expression for y from the first equation into the second equation:\n\nx + (2x - 3) = 57\n\n3x - 3 = 57\n\nStep 3: Add 3 to both sides of the equation to isolate the term with 3x:\n\n3x = 60\n\nStep 4: Divide both sides by 3 to solve for x:\n\nx = 20\n\nStep 5: Now that we have found the value of x, we can substitute it back into the first equation to solve for y:\n\ny = 2(20) - 3\n\ny = 40 - 3\n\ny = 37\n\nSo the second number is 37.", "predict_result": 20.0} 19 | {"model_prediction": "Step 1: Write down the given information\nDistance traveled: 715 kilometers\nTime taken: 11 hours\n\nStep 2: Use the formula for average speed\nAverage Speed = Distance / Time\n\nStep 3: Substitute the given values into the formula\nAverage Speed = 715 km / 11 hours\n\nStep 4: Calculate the average speed\nAverage Speed = 65 km/h\n\nSo, the average speed of the car was 65 kilometers per hour.", "predict_result": 65.0} 20 | {"model_prediction": "Step 1: Let's assume the number is x.\nStep 2: 0.20x - 4 = 6\nStep 3: Add 4 to both sides of the equation to isolate 0.20x\nStep 4: 0.20x = 10\nStep 5: Now, divide both sides of the equation by 0.20 to solve for x\nStep 6: x = 50\nSo, the number is 50.", "predict_result": 50.0} 21 | {"model_prediction": "Step 1: \nLet's assume the number of tables with 4 legs as x and the number of tables with 3 legs as y.\n\nStep 2: \nWe know that x + y = 36 (total number of tables)\n\nStep 3: \nWe also know that 4x + 3y = 124 (total number of legs)\n\nStep 4: \nNow we can use substitution to solve for x. \nFrom the first equation, we can express y as y = 36 - x.\n\nStep 5: \nSubstitute y = 36 - x into the second equation: \n4x + 3(36 - x) = 124 \n4x + 108 - 3x = 124 \nx + 108 = 124 \nx = 124 - 108 \nx = 16\n\nStep 6: \nSo, there are 16 tables with 4 legs.", "predict_result": 16.0} 22 | {"model_prediction": "Step 1: Let's assume the number of student tickets sold is x and the number of non-student tickets sold is y.\n\nStep 2: We can create the following two equations based on the given information:\nx + y = 193 (equation for total number of tickets sold)\n0.50x + 1.50y = 206.50 (equation for total amount collected)\n\nStep 3: Multiply the first equation by 0.50 to match the coefficients of x in both equations:\n0.50x + 0.50y = 96.50\n\nStep 4: Subtract the above equation from the second equation to eliminate x:\n0.50x + 1.50y - (0.50x + 0.50y) = 206.50 - 96.50\ny = 110\n\nStep 5: Substitute the value of y back into the first equation to solve for x:\nx + 110 = 193\nx = 193 - 110\nx = 83\n\nStep 6: Therefore, 83 student tickets were sold.", "predict_result": 83.0} 23 | {"model_prediction": "Step 1: Let's represent the number as \"x\".\n \nStep 2: The difference between 3 times the number and 1 can be represented as 3x - 1.\n\nStep 3: Twice the number can be represented as 2x.\n\nStep 4: According to the given information, the difference between 3 times the number and 1 is the same as twice the number, so we can write the equation as:\n\n3x - 1 = 2x\n \nStep 5: Now, let's solve for x:\n \n3x - 2x = 1\nx = 1\n\nSo, the number is 1.", "predict_result": 1.0} 24 | {"model_prediction": "Step 1: Let's assume the number is represented by the variable x.\n\nStep 2: We are given that 0.5 of the number is 10 more than 0.1667 of the number. This can be represented as the equation:\n0.5x = 0.1667x + 10\n\nStep 3: Subtract 0.1667x from both sides of the equation to isolate 0.5x:\n0.5x - 0.1667x = 10\n\nStep 4: Simplify the equation:\n0.3333x = 10\n\nStep 5: Divide both sides by 0.3333 to solve for x:\nx = 10 / 0.3333\nx = 30\n\nSo, the number is 30.", "predict_result": 30.0} 25 | {"model_prediction": "Step 1: Let's assume the number of adult tickets sold is A and the number of child tickets sold is C.\n\nStep 2: We know that the total revenue from adult tickets is 12A and the total revenue from child tickets is 5C.\n\nStep 3: We also know that the total revenue from all tickets is 519 dollars, so we can write the equation: 12A + 5C = 519.\n\nStep 4: We also know that the total number of tickets sold is A + C, and since the theater has 80 seats, we can write the equation: A + C = 80.\n\nStep 5: Now we have a system of two equations:\n 12A + 5C = 519\n A + C = 80\n\nStep 6: Now we can use substitution or elimination to solve for A and C. Let's choose to solve for A in the second equation: A = 80 - C.\n\nStep 7: Now we can substitute the expression for A in the first equation: \n 12(80 - C) + 5C = 519\n 960 - 12C + 5C = 519\n 960 - 7C = 519\n -7C = 519 - 960\n -7C = -441\n C = -441 / -7\n C = 63\n\nStep 8: So, the number of child tickets sold is 63.", "predict_result": 63.0} 26 | {"model_prediction": "Step 1: Let's represent the number of student tickets sold as \"S\" and the number of non-student tickets sold as \"N\".\n\nStep 2: We know that the total number of tickets sold is 2,000. So, we can write the equation S + N = 2,000.\n\nStep 3: We also know that the total revenue from ticket sales is 20,960 dollars. We can write the equation 9S + 11N = 20,960.\n\nStep 4: Now we have a system of two equations:\nS + N = 2,000\n9S + 11N = 20,960\n\nStep 5: We can solve this system of equations using substitution or elimination. I will use the substitution method to solve for S.\n\nStep 6: Solve the first equation for N: N = 2,000 - S\n\nStep 7: Substitute the expression for N in the second equation: 9S + 11(2,000 - S) = 20,960\n\nStep 8: Simplify the equation: 9S + 22,000 - 11S = 20,960\n\nStep 9: Combine like terms: -2S + 22,000 = 20,960\n\nStep 10: Solve for S: -2S = 20,960 - 22,000\n -2S = -1,040\n S = 520\n\nStep 11: So, 520 student tickets were sold.", "predict_result": 520.0} 27 | {"model_prediction": "Step 1: Calculate the profit per textbook\nProfit = Selling Price - Cost Price\nProfit = 55 - 44\nProfit = 11 dollars\n\nStep 2: The profit made is 11 dollars for every textbook sold.", "predict_result": 11.0} 28 | {"model_prediction": "Step 1: Let's denote the width of the rectangular field as W meters.\n\nStep 2: According to the given information, the length of the rectangular field is 24 meters, which is 3 meters less than twice the width. This can be represented as:\n\nLength = 2W - 3\n\nStep 3: We also know that the length of the rectangular field is 24 meters. So, we can write the equation as:\n\n24 = 2W - 3\n\nStep 4: We can solve for the width by adding 3 to both sides of the equation:\n\n24 + 3 = 2W\n27 = 2W\n\nStep 5: Now, we can solve for the width by dividing both sides of the equation by 2:\n\n27 / 2 = W\nW = 13.5\n\nSo, the width of the rectangular field is 13.5 meters.", "predict_result": 13.5} 29 | {"model_prediction": "Step 1: Calculate the maximum amount you can spend on the car rental \nTotal budget - daily rental cost = maximum mileage \n88 - 50 = 38\n\nStep 2: Divide the maximum amount by the per mile cost \n38 / 0.20 = 190 \n\nSo the maximum mileage that will allow you to stay within your budget is 190 miles. Any mileage over that would exceed your budget.", "predict_result": 190.0} 30 | {"model_prediction": "Step 1: Let's call the number of boys in the class \"B\" and the number of girls \"G\".\n\nStep 2: We know that the total number of students in the class is 485, so we can write the equation B + G = 485.\n\nStep 3: We also know that there are 69 more girls than boys, so we can write the equation G = B + 69.\n\nStep 4: Now we can substitute the value of G from the second equation into the first equation: B + (B + 69) = 485.\n\nStep 5: Simplify the equation: 2B + 69 = 485.\n\nStep 6: Subtract 69 from both sides: 2B = 416.\n\nStep 7: Divide both sides by 2: B = 208.\n\nSo, there are 208 boys in the class.", "predict_result": 208.0} 31 | {"model_prediction": "Let's call the amount Janet invested at 10% x dollars and the amount she invested at 1% y dollars.\n\nWe know that the total amount she invested is 31,000 dollars, so we can write the equation:\nx + y = 31,000\n\nWe also know that the total interest at the end of the year is 1,390 dollars. We can write the equation for the total interest:\n0.10x + 0.01y = 1,390\n\nNow we can use these two equations to solve for x, the amount Janet invested at 10%.\n\nFirst, let's solve for y in the first equation:\ny = 31,000 - x\n\nNow we can substitute y in the second equation:\n0.10x + 0.01(31,000 - x) = 1,390\n0.10x + 310 - 0.01x = 1,390\n0.09x + 310 = 1,390\n0.09x = 1,390 - 310\n0.09x = 1,080\nx = 1,080 / 0.09\nx = 12,000\n\nSo, Janet invested 12,000 dollars at 10%.", "predict_result": 0} 32 | {"model_prediction": "Step 1: Calculate the combined speed of the two airplanes\n\n400 mph + 250 mph = 650 mph\n\nStep 2: Use the formula distance = speed × time to calculate the time it will take for the distance between the airplanes to be 1625 miles\n\n1625 miles = 650 mph × time\n\nStep 3: Solve for time\n\ntime = 1625 miles / 650 mph\ntime = 2.5 hours\n\nSo, it will take 2.5 hours for the distance between the airplanes to be 1625 miles.", "predict_result": 2.5} 33 | {"model_prediction": "Step 1: Find the cost per pound of ground beef\n9.77 dollars ÷ 3.5 pounds = 2.79 dollars per pound\n\nStep 2: Use the cost per pound to find the cost of 5.6 pounds\n2.79 dollars per pound × 5.6 pounds = 15.62 dollars\n\nSo, 5.6 pounds of ground beef costs 15.62 dollars.", "predict_result": 15.62} 34 | {"model_prediction": "Step 1: Let's assume that x gallons of the 75% alcohol solution needs to be drained off.\n\nStep 2: After draining off x gallons, we will have (1 - x) gallons of the 75% alcohol solution left in the container.\n\nStep 3: Now, we will add the 50% alcohol solution to the container. Let's assume y gallons of the 50% alcohol solution needs to be added.\n\nStep 4: After adding y gallons of the 50% alcohol solution, the total volume of the solution in the container will be (1 - x) + y gallons.\n\nStep 5: Since we want the final solution to be one gallon, we can set up the equation:\n\n(1 - x) + y = 1\n\nStep 6: We need to calculate the amount of alcohol in the final solution. The total amount of alcohol in the 75% solution is 0.75 * (1 - x) and the total amount of alcohol in the 50% solution is 0.50 * y.\n\nStep 7: The total amount of alcohol in the final solution should be 0.65 * 1 (since we want a 65% solution).\n\nStep 8: We can set up the equation:\n\n0.75 * (1 - x) + 0.50 * y = 0.65\n\nNow, we have a system of two equations:\n\n(1 - x) + y = 1\n\n0.75 * (1 - x) + 0.50 * y = 0.65\n\nWe can solve this system of equations to find the values of x and y. After calculating, we get x ≈ 0.44 and y ≈ 0.56.\n\nSo, approximately 0.44 gallons of the 75% alcohol solution must be drained off and replaced by 0.56 gallons of the 50% alcohol solution to produce one gallon of the 65% alcohol solution.", "predict_result": 0.44} 35 | {"model_prediction": "Step 1: Start by setting up an equation to represent the amount of money each person has saved over time.\n\nFor yourself, the amount of money saved over time can be represented as 7w + 160, where w is the number of weeks.\n\nFor your friend, the amount of money saved over time can be represented as 5w + 210, where w is the number of weeks.\n\nStep 2: Set the two equations equal to each other to find the number of weeks it will take for both of you to have saved the same amount of money.\n\n7w + 160 = 5w + 210\n\nStep 3: Solve for w to find the number of weeks it will take for both of you to have saved the same amount of money.\n\nSubtract 5w from both sides:\n\n7w - 5w + 160 = 210\n\n2w + 160 = 210\n\nSubtract 160 from both sides:\n\n2w = 50\n\nDivide both sides by 2:\n\nw = 25\n\nAfter 25 weeks, both you and your friend will have saved the same amount of money.", "predict_result": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/LLaMA3-8B-Instruct_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "Let's call the number \"x\". The problem states that 3 times the number minus 5 is equal to 40. We can write this as:\n\n3x - 5 = 40\n\nTo solve for x, we can add 5 to both sides of the equation:\n\n3x = 40 + 5\n3x = 45\n\nThen, we can divide both sides by 3:\n\nx = 45/3\nx = 15\n\nSo, the number is 15!", "predict_value": 15.0} 2 | {"model_prediction": "Let's say the number of boys is x. Then the number of girls is x - 5. The total number of students is 27. So x + (x - 5) = 27. Combining like terms, we get 2x - 5 = 27. Adding 5 to both sides, we get 2x = 32. Dividing both sides by 2, we get x = 16. So there are 16 boys. There are 16 - 5 = 11 girls. The answer is 11.", "predict_value": 11.0} 3 | {"model_prediction": "Let the number be x. Then 0.6667x + 0.75 = 1.6667. Subtract 0.75 from both sides: 0.6667x = 1.6667 - 0.75 = 0.9167. Divide by 0.6667: x = 0.9167 / 0.6667 = 1.37.\nFinal Answer: The final answer is 1.37. I hope it is correct.", "predict_value": 1.37} 4 | {"model_prediction": "Let's break this down step by step!\n\nLet the distance from your current location to your mother's house be x miles.\n\nSince you are currently twice as far from your house as you are from your mother's house, the distance from your current location to your house is 2x miles.\n\nThe total distance you need to travel to reach your mother's house is the sum of the distance from your current location to your mother's house and the distance from your current location to your house:\n\nTotal distance = x + 2x = 3x miles\n\nYou know that the total distance is 234 miles, so you can set up the equation:\n\n3x = 234\n\nTo solve for x, divide both sides by 3:\n\nx = 234 / 3\nx = 78 miles\n\nSo, the distance from your current location to your mother's house is 78 miles.\n\nSince you are currently twice as far from your house as you are from your mother's house, the distance from your current location to your house is 2x = 2(78) = 156 miles.\n\nTo find the distance you have traveled, subtract the distance from your current location to your mother's house from the distance from your current location to your house:\n\nDistance traveled = Distance from current location to house - Distance from current location to mother's house\n= 156 - 78\n= 78 miles\n\nRounded to the nearest tenth mile, the distance you have traveled is 78.0 miles.", "predict_value": 78.0} 5 | {"model_prediction": "There are 7066 nesting pairs today. There are 6649 more than in 1963. So if you subtract 6649 from 7066, you get the number of nesting pairs in 1963. 7066 - 6649 is 417. The answer is 417.", "predict_value": 417.0} 6 | {"model_prediction": "Latoya started with 30 dollars. She ended with 26.48 dollars. So she spent 30 - 26.48 = 3.52 dollars. Since calls cost 16 cents a minute, 3.52 / 0.16 = 22 minutes. The answer is 22.", "predict_value": 22.0} 7 | {"model_prediction": "Let's say the number is x. Then 8x - 4 = 17. We can add 4 to both sides to get 8x = 21. Then we can divide both sides by 8 to get x = 21/8 = 2.5.\n#### 2.5", "predict_value": 2.5} 8 | {"model_prediction": "Let $x$ be the number of milliliters of the 10 % HCL solution. Then, the number of milliliters of the 60 % HCL solution is $50-x$. The 30 % HCL solution is the combination of the 10 % and 60 % HCL solutions, so we have that $\\frac{x}{50} \\cdot 10 + \\frac{50-x}{50} \\cdot 60 = 30$. Solving this equation, we have that $2x + 30 = 90$, which implies $x = 30$. Therefore, the number of milliliters of the 10 % HCL solution is 30.\nFinal Answer: The final answer is 30. I hope it is correct.", "predict_value": 30.0} 9 | {"model_prediction": "Let's call the length of the shorter piece x. Then the length of the longer piece is 20 - x. Twice the length of the shorter piece is 2x. The length of the longer piece is 20 - x. So we have 2x = 20 - x + 4. Solving for x, we get x = 6. The answer is 6.", "predict_value": 6.0} 10 | {"model_prediction": "The profit is the amount of money earned after all expenses. So the amount of money earned is the amount of money taken in minus the cost of the tickets. The cost of the tickets is the number of adult tickets sold times the cost of an adult ticket, plus the number of kid tickets sold times the cost of a kid ticket. So the total amount of money earned is 6 * (175 - number of kid tickets) + 2 * number of kid tickets. The total amount of money earned is also 750. So we can set up the equation 6 * (175 - number of kid tickets) + 2 * number of kid tickets = 750. Solving this equation, we find that 173 - 4 * number of kid tickets = 0. So number of kid tickets = 43. The answer is 43.", "predict_value": 43.0} 11 | {"model_prediction": "Let the number be x. 0.5x = 0.25x + 2. 0.5x - 0.25x = 2. 0.25x = 2. x = 2 / 0.25. x = 8. The answer is 8.", "predict_value": 8.0} 12 | {"model_prediction": "You can make $\\frac{0.3333}{2}=\\boxed{\\frac{1}{6}}$ of the recipe.\nFinal Answer: The final answer is \\frac{1}{6}. I hope it is correct.", "predict_value": 6.0} 13 | {"model_prediction": "Let $x$ be the number of liters of 60% acid solution. Then, $20 - x$ is the number of liters of 75% acid solution. We have that\n\\begin{align*}\n0.6x\\cdot 0.4 + 0.75(20-x)\\cdot 0.25 &= 0.72\\cdot 20 \\\\\n0.24x + 1.875 - 0.75x &= 14.4 \\\\\n0.24x - 0.75x &= 14.4 - 1.875 \\\\\n-0.51x &= 12.525 \\\\\nx &= 12.525 / -0.51 = \\boxed{24.5}\n\\end{align*}\nFinal Answer: The final answer is 24.5. I hope it is correct.", "predict_value": 60.0} 14 | {"model_prediction": "Let the two parts be x and y. 7x + 5y = 146. 7x = 146 - 5y. x = (146 - 5y) / 7. 7x + 5y = 146. (146 - 5y) / 7 + 5y = 146. (146 - 5y) + 35y = 7 * 146. 35y = 7 * 146 - 146. 35y = 7 * 100. y = 100 / 7. y = 14. x = (146 - 5 * 14) / 7. x = 22. The answer is 22.", "predict_value": 22.0} 15 | {"model_prediction": "Let's say the number of children was c. Then the number of adults was 201 - c. The total bill was 964 dollars. The total bill was also 8 * (201 - c) + 4 * c. 964 = 8 * 201 - 8c + 4c. 964 = 1608 - 4c. 4c = 644. c = 161. The answer is 161.", "predict_value": 161.0} 16 | {"model_prediction": "A nice simple algebra problem!\n\nLet's break it down step by step:\n\nWe are given: 36 + 3x = 48\n\nOur goal is to solve for x.\n\nFirst, let's subtract 36 from both sides of the equation to get:\n\n3x = 12\n\nNext, let's divide both sides of the equation by 3 to get:\n\nx = 12/3\n\nx = 4\n\nSo, the value of x is 4!", "predict_value": 4.0} 17 | {"model_prediction": "Caesar's charges 800 dollars to rent the room. Venus Hall charges 500 dollars to rent the room. So Caesar's charges 800 - 500 = 300 dollars more to rent the room. For each meal, Caesar's charges 30 dollars and Venus Hall charges 35 dollars. So Venus Hall charges 5 dollars more per meal. So to make the costs equal, Caesar's would need to charge the same rent and have fewer meals. 300 / 5 = 60. The answer is 60.", "predict_value": 60.0} 18 | {"model_prediction": "Let the first number be x. The second number is 3 less than twice the first number, which is 2x - 3. Their sum is 57, so x + 2x - 3 = 57. This simplifies to 3x - 3 = 57. This simplifies to 3x = 60. This simplifies to x = 20. The second number is 2x - 3, which is 2 * 20 - 3, which is 40 - 3, which is 37. The answer is 37.", "predict_value": 37.0} 19 | {"model_prediction": "715 kilometers in 11 hours is the same as 715 / 11 = 65 kilometers per hour.\n#### 65 km/h", "predict_value": 65.0} 20 | {"model_prediction": "Let the number be x. Then 0.2x - 4 = 6. So 0.2x = 10. So x = 50. The answer is 50.", "predict_value": 50.0} 21 | {"model_prediction": "Let's call the number of 4 legged tables x. Then the number of 3 legged tables are 36 - x. The number of legs on the 4 legged tables are 4x. The number of legs on the 3 legged tables are 3(36 - x). So we have 4x + 3(36 - x) = 124. 4x + 108 - 3x = 124. x = 16. The answer is 16.", "predict_value": 16.0} 22 | {"model_prediction": "Let's say x student tickets were sold. Then the number of non-student tickets sold is 193 - x. The total amount of money collected is 0.5x + 1.5(193 - x) = 206.5. Solving for x, we get 145. The answer is 145.", "predict_value": 145.0} 23 | {"model_prediction": "A nice algebraic puzzle!\n\nLet's say the number is x.\n\nThe difference between 3 times a number and 1 is the same as twice a number means:\n\n3x - 1 = 2x\n\nWe can simplify this equation by adding 1 to both sides:\n\n3x = 2x + 1\n\nSubtracting 2x from both sides gives us:\n\nx = 1\n\nSo, the number is 1!", "predict_value": 1.0} 24 | {"model_prediction": "Let's call the number x. 0.5x = 0.1667x + 10. So 0.5x - 0.1667x = 10. 0.3333x = 10. So x = 10/0.3333 = 30. The answer is 30.", "predict_value": 30.0} 25 | {"model_prediction": "Let's say the number of adult tickets sold is A and the number of child tickets sold is C. Then the total amount of money made is 12A + 5C. We know that the total number of tickets sold is 80, so A + C = 80. We also know that the total amount of money made is 519, so 12A + 5C = 519. We can solve these equations simultaneously to find the number of child tickets sold. First, we can solve the first equation for A: A = 80 - C. Then we can substitute this expression for A into the second equation: 12(80 - C) + 5C = 519. Simplifying this equation, we get 960 - 12C + 5C = 519. This simplifies to -7C = -441, or C = 63. Therefore, the number of child tickets sold is 63.", "predict_value": 63.0} 26 | {"model_prediction": "The total cost of the tickets is 20,960 dollars. The non-student tickets were 11 dollars each. The student tickets were 9 dollars each. The total cost of the non-student tickets is 11x, where x is the number of non-student tickets. The total cost of the student tickets is 9y, where y is the number of student tickets. So 11x + 9y = 20,960. The number of non-student tickets is 2,000 - y, since the total number of tickets is 2,000. So 11(2,000 - y) + 9y = 20,960. 22,000 - 11y + 9y = 20,960. 22,000 - 2y = 20,960. 2y = 1,040. y = 520. The answer is 520.", "predict_value": 520.0} 27 | {"model_prediction": "A simple profit problem!\n\nLet's break it down:\n\n**Cost Price**: The bookstore buys the textbook for $44.\n\n**Selling Price**: The bookstore sells the textbook for $55.\n\n**Profit**: The difference between the selling price and the cost price is the profit.\n\nTo find the profit, subtract the cost price from the selling price:\n\nProfit = Selling Price - Cost Price\n= $55 - $44\n= $11\n\nSo, the bookstore makes a profit of $11 on each textbook sold, based on the selling price of $55.", "predict_value": 11.0} 28 | {"model_prediction": "Let the width be x. Then the length is 24, which is 2x - 3. So 2x - 3 = 24. 2x = 24 + 3. 2x = 27. x = 27/2. x = 13.5. The answer is 13.5.", "predict_value": 13.5} 29 | {"model_prediction": "Let's break down the cost of the car rental:\n\n* Daily rate: $50\n* Mileage rate: 20 cents per mile = $0.20 per mile\n\nYour daily budget is $88. Since you've already spent $50 on the daily rate, you have $88 - $50 = $38 left for mileage.\n\nTo find the maximum mileage you can drive while staying within your budget, divide the amount left for mileage ($38) by the mileage rate ($0.20):\n\n$38 ÷ $0.20 = 190 miles\n\nSo, you can drive up to 190 miles while staying within your daily budget of $88.", "predict_value": 190.0} 30 | {"model_prediction": "Let's say there are B boys. Then there are B + 69 girls. So B + (B + 69) = 485. 2B + 69 = 485. 2B = 416. B = 208. The answer is 208.", "predict_value": 208.0} 31 | {"model_prediction": "Let x be the amount invested at 10%. Then 31000 - x is the amount invested at 1%. The interest on the 10% part is 0.1x and the interest on the 1% part is 0.01(31000 - x). The total interest is 1390. So we have 0.1x + 0.01(31000 - x) = 1390. We can solve for x as follows: 0.1x + 310 - 0.01x = 1390 0.09x = 1380 x = 1380 / 0.09 = 15400 The answer is 15400.", "predict_value": 15400.0} 32 | {"model_prediction": "The distance between them will increase at a rate of 400 + 250 = 650 miles per hour. To find how many hours it takes for the distance between them to be 1625 miles, we need to divide 1625 by 650. 1625 divided by 650 is 2.5. The answer is 2.5.", "predict_value": 2.5} 33 | {"model_prediction": "First, we need to find the cost per pound of ground beef. We can do this by dividing the cost by the weight. 9.77 / 3.5 = 2.79. Now we can multiply this by 5.6 to find the cost of 5.6 pounds of ground beef. 2.79 * 5.6 = 15.58.\n#### 15.58", "predict_value": 15.58} 34 | {"model_prediction": "We need to get to 65% alcohol. We have 75% alcohol. To get from 75% to 65%, we need to dilute the solution. So we need to replace some of the 75% solution with a 50% solution. To do this, we need to replace 75% with 50%. So we need to replace 75 - 65 = 10%. So we need to replace 10% of the solution.", "predict_value": 10.0} 35 | {"model_prediction": "You start with 160 dollars. Your friend starts with 210 dollars. You save 7 dollars per week. Your friend saves 5 dollars per week. So each week, you gain 7 dollars and your friend gains 5 dollars. So each week, your friend gains 7 - 5 = 2 dollars less than you. To catch up, your friend needs to save 210 - 160 = 50 dollars more. To save 50 dollars, your friend will need 50 / 2 = 25 weeks. The answer is 25.", "predict_value": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/Yi_large_preview_Alg_result.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolarisRisingWar/Math_Word_Problem_Collection/697e9cb90f02c90d9791333ae01166b145eadcfa/codes/results/Yi_large_preview_Alg_result.txt -------------------------------------------------------------------------------- /codes/results/deepseek-chat_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": " Let's denote the unknown number as $x$. According to the problem, we have the equation:\n\n$3x - 5 = 40$\n\nTo solve for $x$, we first add 5 to both sides of the equation:\n\n$3x - 5 + 5 = 40 + 5$\n\nwhich simplifies to:\n\n$3x = 45$\n\nThen, we divide both sides of the equation by 3:\n\n$\\frac{3x}{3} = \\frac{45}{3}$\n\nwhich gives us:\n\n$x = 15$\n\nSo, the number is $\\boxed{15}$.", "predict_value": 15.0} 2 | {"model_prediction": " Let's assume the number of boys is x.\nThen the number of girls is x - 5.\nThe total number of students is x + (x - 5) = 2x - 5.\nWe know that the total number of students is 27, so 2x - 5 = 27.\nAdding 5 to both sides, we get 2x = 32.\nDividing both sides by 2, we get x = 16.\nSo the number of girls is x - 5 = 16 - 5 = 11.\nThe answer is: 11", "predict_value": 11.0} 3 | {"model_prediction": " Let's call the number we're looking for \"x\".\nAccording to the problem, 0.6667 of the number increased by 0.75 is equal to 1.6667.\nSo, we can write the equation as: 0.6667x + 0.75 = 1.6667\nTo solve for x, we need to isolate x on one side of the equation.\nFirst, let's subtract 0.75 from both sides of the equation: 0.6667x = 1.6667 - 0.75\nSimplifying the right side, we get: 0.6667x = 0.9167\nTo isolate x, we divide both sides of the equation by 0.6667: x = 0.9167 / 0.6667\nCalculating the division, we find that x = 1.375\nSo, the number we're looking for is 1.375.\nThe answer is: 1.375", "predict_value": 1.375} 4 | {"model_prediction": " Let's denote the distance you have traveled as x. According to the problem, you are currently twice as far from your house as you are from your mother's house. This means that the distance from your house to your current location is 2 * 234 = 468 miles.\n\nThe total distance from your house to your mother's house is 468 + 234 = 702 miles.\n\nSince you have traveled x miles, the remaining distance to your mother's house is 702 - x.\n\nWe know that the remaining distance is equal to the distance you have traveled, so we can set up the equation:\n\n702 - x = x\n\nSolving for x, we get:\n\n2x = 702\n\nx = 702 / 2\n\nx = 351\n\nSo, you have traveled 351 miles. Rounding to the nearest tenth, the answer is 351.0 miles.", "predict_value": 351.0} 5 | {"model_prediction": " If there are 7066 known nesting pairs of bald eagles in the lower 48 states today, and this is 6649 more pairs than in 1963, then we can set up the equation:\n7066 = x + 6649\nwhere x represents the number of nesting pairs in 1963.\nSubtracting 6649 from both sides of the equation, we get:\nx = 7066 - 6649\nx = 417\nSo, there were 417 nesting pairs of bald eagles in the lower 48 states in 1963.\nThe answer is: 417", "predict_value": 417.0} 6 | {"model_prediction": " Latoya started with a credit of 30 dollars on her phone card.\nAfter making her call, she had 26.48 dollars remaining.\nSo, the cost of her call was 30 - 26.48 = 3.52 dollars.\nSince long distance calls cost 16 cents a minute, or 0.16 dollars a minute, we can find the number of minutes by dividing the cost of the call by the cost per minute.\nSo, the number of minutes in her call was 3.52 / 0.16 = 22 minutes.\nThe answer is: 22", "predict_value": 22.0} 7 | {"model_prediction": " Let's denote the unknown number as x. According to the problem, we have the equation:\n\n17 = 8x - 4\n\nTo solve for x, we first add 4 to both sides of the equation:\n\n17 + 4 = 8x - 4 + 4\n\n21 = 8x\n\nThen, we divide both sides by 8:\n\n21 / 8 = 8x / 8\n\nx = 21 / 8\n\nSo, the number is 21/8 or 2.625.", "predict_value": 2.625} 8 | {"model_prediction": " Let's denote the volume of the 10% HCl solution as $x$ milliliters, and the volume of the 60% HCl solution as $y$ milliliters.\nWe know that the total volume of the mixture is 50 milliliters, so we have the equation:\n$x + y = 50$.\n\nWe also know that the concentration of the mixture is 30%, which is the average of the concentrations of the two solutions.\nSo we have the equation:\n$\\frac{10\\% \\cdot x + 60\\% \\cdot y}{x + y} = 30\\%$.\n\nMultiplying both sides of the equation by $x + y$, we get:\n$0.10x + 0.60y = 0.30(x + y)$.\n\nExpanding the right side, we get:\n$0.10x + 0.60y = 0.30x + 0.30y$.\n\nSubtracting $0.10x$ and $0.30y$ from both sides, we get:\n$0.30y = 0.20x$.\n\nDividing both sides by $0.30$, we get:\n$y = \\frac{0.20}{0.30}x = \\frac{2}{3}x$.\n\nSubstituting this value of $y$ into the first equation, we get:\n$x + \\frac{2}{3}x = 50$.\n\nCombining like terms, we get:\n$\\frac{5}{3}x = 50$.\n\nMultiplying both sides by $\\frac{3}{5}$, we get:\n$x = \\frac{3}{5} \\cdot 50 = 30$.\n\nSubstituting this value of $x$ into the equation $y = \\frac{2}{3}x$, we get:\n$y = \\frac{2}{3} \\cdot 30 = 20$.\n\nSo, we need to combine 30 milliliters of the 10% HCl solution with 20 milliliters of the 60% HCl solution to get 50 milliliters of a 30% HCl solution.\nThe answer is: 30", "predict_value": 30.0} 9 | {"model_prediction": " Let's denote the length of the shorter piece as $x$ and the length of the longer piece as $y$. We know that the total length of the board is 20 feet, so we have the equation:\n\n$x + y = 20$\n\nWe also know that twice the length of the shorter piece is 4 feet more than the length of the longer piece, which gives us the equation:\n\n$2x = y + 4$\n\nNow we have a system of two equations, and we can solve it step by step.\n\nFirst, let's substitute the second equation into the first one:\n\n$x + (2x - 4) = 20$\n\nThis simplifies to:\n\n$3x - 4 = 20$\n\nAdding 4 to both sides gives:\n\n$3x = 24$\n\nFinally, dividing both sides by 3 gives the length of the shorter piece:\n\n$x = 8$\n\nSo the length of the shorter piece is $\\boxed{8}$ feet.", "predict_value": 8.0} 10 | {"model_prediction": " Let's denote the number of adult tickets sold as A and the number of kid tickets sold as K.\n\nWe know that the total number of tickets sold is 175, so we have the equation:\n\nA + K = 175\n\nWe also know that the profit from the tickets was 750 dollars. The profit from each adult ticket is 6 dollars and from each kid ticket is 2 dollars. So we have another equation:\n\n6A + 2K = 750\n\nNow we have a system of two equations, and we can solve it step by step.\n\nFirst, let's multiply the first equation by 2:\n\n2A + 2K = 350\n\nNow, let's subtract this equation from the second one:\n\n6A + 2K - (2A + 2K) = 750 - 350\n\nThis simplifies to:\n\n4A = 400\n\nSo, A = 400 / 4 = 100\n\nNow we know that 100 adult tickets were sold. We can substitute A = 100 into the first equation to find out how many kid tickets were sold:\n\n100 + K = 175\n\nSo, K = 175 - 100 = 75\n\nTherefore, 75 kid tickets were sold.\n\nSo the answer is $\\boxed{75}$.", "predict_value": 75.0} 11 | {"model_prediction": " Let's denote the number as $x$. According to the problem, we have the equation:\n\n$0.5x = 0.25x + 2$\n\nTo solve this equation, we first subtract $0.25x$ from both sides:\n\n$0.5x - 0.25x = 0.25x + 2 - 0.25x$\n\nThis simplifies to:\n\n$0.25x = 2$\n\nThen, we divide both sides by $0.25$ to solve for $x$:\n\n$x = \\frac{2}{0.25} = 8$\n\nSo, the number is $\\boxed{8}$.", "predict_value": 8.0} 12 | {"model_prediction": " The recipe calls for 2 cups of sugar, and you have 0.3333 cups of sugar left.\nTo find the fraction of the recipe you can make, we need to divide the amount of sugar you have by the amount of sugar the recipe calls for.\nSo, the fraction is $\\frac{0.3333}{2}$.\nTo simplify this fraction, we can multiply both the numerator and denominator by 3 to get rid of the decimal.\nThis gives us $\\frac{0.3333 \\times 3}{2 \\times 3} = \\frac{1}{6}$.\nTherefore, you can make $\\boxed{\\frac{1}{6}}$ of the recipe.\nThe answer is: \\frac{1}{6}", "predict_value": 6.0} 13 | {"model_prediction": " Let $x$ be the number of liters of the 60% acid solution and $y$ be the number of liters of the 75% acid solution.\nWe have the following equations:\n$x + y = 20$ (since the total volume is 20 liters)\n$0.6x + 0.75y = 0.72(20)$ (since the total amount of acid is 72% of 20 liters)\nSimplifying the second equation, we get:\n$0.6x + 0.75y = 14.4$\nMultiplying the first equation by 0.6, we get:\n$0.6x + 0.6y = 12$\nSubtracting this equation from the second equation, we get:\n$0.15y = 2.4$\nDividing both sides by 0.15, we get:\n$y = 16$\nSubstituting this value into the first equation, we get:\n$x + 16 = 20$\n$x = 4$\nTherefore, we need 4 liters of the 60% acid solution and 16 liters of the 75% acid solution.\nThe answer is: 4", "predict_value": 4.0} 14 | {"model_prediction": " Let's assume the first part is x and the second part is 24 - x (since the total is 24).\nAccording to the given information, 7 times the first part added to 5 times the second part makes 146.\nSo, we have the equation: 7x + 5(24 - x) = 146.\nSimplifying the equation, we get: 7x + 120 - 5x = 146.\nCombining like terms, we get: 2x + 120 = 146.\nSubtracting 120 from both sides, we get: 2x = 26.\nDividing both sides by 2, we get: x = 13.\nTherefore, the first part is 13.\nThe answer is: 13", "predict_value": 13.0} 15 | {"model_prediction": " Let's assume the number of adults is A and the number of children is C.\nWe know that A + C = 201 (total number of people)\nWe also know that 8A + 4C = 964 (total bill)\nWe can multiply the first equation by 4 to get 4A + 4C = 804\nNow we can subtract this equation from the second equation to get 4A = 160\nDividing both sides by 4, we get A = 40\nSubstituting this value into the first equation, we get 40 + C = 201\nSubtracting 40 from both sides, we get C = 161\nTherefore, there were 161 children at the zoo.\nThe answer is: 161", "predict_value": 161.0} 16 | {"model_prediction": " To solve for x, we need to set up an equation based on the given information and then solve for x.\nThe equation is: 3x + 36 = 48\nTo solve for x, we subtract 36 from both sides of the equation:\n3x + 36 - 36 = 48 - 36\n3x = 12\nTo isolate x, we divide both sides of the equation by 3:\n3x / 3 = 12 / 3\nx = 4\nThe value of x is 4.\nThe answer is: 4", "predict_value": 4.0} 17 | {"model_prediction": " Let's denote the number of guests as x.\n\nFor Caesar's, the total cost is 800 (for the room) + 30x (for each meal).\n\nFor Venus Hall, the total cost is 500 (for the room) + 35x (for each meal).\n\nWe want to find the number of guests x when the costs of the two halls are the same. So we set the two costs equal to each other:\n\n800 + 30x = 500 + 35x\n\nTo solve for x, we first subtract 30x from both sides of the equation:\n\n800 = 500 + 5x\n\nThen, we subtract 500 from both sides:\n\n300 = 5x\n\nFinally, we divide both sides by 5 to solve for x:\n\nx = 300 / 5 = 60\n\nSo, 60 guests must attend the prom for the costs of the two halls to be the same.\n\nSo the answer is $\\boxed{60}$.", "predict_value": 60.0} 18 | {"model_prediction": " Let's denote the first number as $x$ and the second number as $y$.\n\nAccording to the problem, we have two equations:\n\n1. The second number is 3 less than twice the first number, which can be written as: $y = 2x - 3$.\n2. Their sum is 57, which can be written as: $x + y = 57$.\n\nNow, we can substitute the first equation into the second equation to solve for $x$:\n\n$x + (2x - 3) = 57$\n\nThis simplifies to:\n\n$3x - 3 = 57$\n\nAdding 3 to both sides gives:\n\n$3x = 60$\n\nDividing both sides by 3 gives:\n\n$x = 20$\n\nNow that we have the value of $x$, we can substitute it into the first equation to find the value of $y$:\n\n$y = 2(20) - 3 = 40 - 3 = 37$\n\nSo, the second number is $\\boxed{37}$.", "predict_value": 37.0} 19 | {"model_prediction": " To find the average speed, we need to divide the total distance traveled by the total time taken.\nThe total distance traveled is 715 kilometers.\nThe total time taken is 11 hours.\nSo, the average speed is 715 kilometers / 11 hours = 65 kilometers per hour.\nThe answer is: 65", "predict_value": 65.0} 20 | {"model_prediction": " Let's denote the number we are looking for as x. According to the problem, we have the equation:\n\n0.20x - 4 = 6\n\nTo solve for x, we first add 4 to both sides of the equation:\n\n0.20x - 4 + 4 = 6 + 4\n0.20x = 10\n\nThen, we divide both sides of the equation by 0.20 to find x:\n\n0.20x / 0.20 = 10 / 0.20\nx = 50\n\nSo, the number we are looking for is 50.", "predict_value": 50.0} 21 | {"model_prediction": " Let's assume the number of 4-legged tables is x and the number of 3-legged tables is y.\nWe know that the total number of tables is 36, so we have the equation x + y = 36.\nWe also know that the total number of legs is 124, so we have the equation 4x + 3y = 124.\nWe can solve these two equations simultaneously to find the values of x and y.\nMultiplying the first equation by 3, we get 3x + 3y = 108.\nSubtracting this equation from the second equation, we get x = 16.\nTherefore, there are 16 4-legged tables.\nThe answer is: 16", "predict_value": 16.0} 22 | {"model_prediction": " Let's assume the number of student tickets sold is x.\nThe number of non-student tickets sold is 193 - x.\nThe total amount collected from student tickets is 0.50x dollars.\nThe total amount collected from non-student tickets is 1.50(193 - x) dollars.\nThe total amount collected is 206.50 dollars.\nSo, we can set up the equation: 0.50x + 1.50(193 - x) = 206.50.\nSimplifying the equation, we get: 0.50x + 289.50 - 1.50x = 206.50.\nCombining like terms, we get: -1.00x + 289.50 = 206.50.\nSubtracting 289.50 from both sides, we get: -1.00x = -83.\nDividing both sides by -1.00, we get: x = 83.\nTherefore, 83 student tickets were sold.\nThe answer is: 83", "predict_value": 83.0} 23 | {"model_prediction": " Let's denote the number we are looking for as $x$.\n\nAccording to the problem, the difference between 3 times a number and 1 is the same as twice a number. This can be written as an equation:\n\n$3x - 1 = 2x$\n\nTo solve for $x$, we first subtract $2x$ from both sides of the equation:\n\n$3x - 2x - 1 = 2x - 2x$\n\nThis simplifies to:\n\n$x - 1 = 0$\n\nThen, we add 1 to both sides of the equation to isolate $x$:\n\n$x - 1 + 1 = 0 + 1$\n\nThis gives us:\n\n$x = 1$\n\nSo, the number we are looking for is $\\boxed{1}$.", "predict_value": 1.0} 24 | {"model_prediction": " Let's denote the number we're looking for as $x$.\n\nAccording to the problem, we have two equations:\n\n1. $0.5x = 10 + 0.1667x$\n2. $0.5x - 0.1667x = 10$\n\nWe can simplify the second equation by subtracting $0.1667x$ from both sides:\n\n$0.5x - 0.1667x = 10$\n\n$0.3333x = 10$\n\nNow, we can solve for $x$ by dividing both sides of the equation by $0.3333$:\n\n$x = \\frac{10}{0.3333} \\approx 30$\n\nSo, the number we're looking for is approximately 30.\n\nThe answer is $\\boxed{30}$.", "predict_value": 30.0} 25 | {"model_prediction": " Let's assume the number of adult tickets sold is A and the number of child tickets sold is C.\nWe know that the total number of seats is 80, so A + C = 80.\nWe also know that the total revenue from ticket sales is 519 dollars, so 12A + 5C = 519.\nWe can solve these two equations to find the values of A and C.\nMultiplying the first equation by 5, we get 5A + 5C = 400.\nSubtracting this equation from the second equation, we get 7A = 119.\nDividing both sides by 7, we get A = 17.\nSubstituting this value into the first equation, we get 17 + C = 80.\nSolving for C, we get C = 63.\nTherefore, 63 child tickets were sold.\nThe answer is: 63", "predict_value": 63.0} 26 | {"model_prediction": " Let's assume the number of student tickets sold is x.\nThe number of non-student tickets sold is 2000 - x.\nThe total revenue from student tickets is 9x.\nThe total revenue from non-student tickets is 11(2000 - x).\nThe total revenue from all tickets is 9x + 11(2000 - x) = 20,960.\nSimplifying the equation, we get 9x + 22000 - 11x = 20,960.\nCombining like terms, we get -2x + 22000 = 20,960.\nSubtracting 22000 from both sides, we get -2x = -1040.\nDividing both sides by -2, we get x = 520.\nTherefore, 520 student tickets were sold.\nThe answer is: 520", "predict_value": 520.0} 27 | {"model_prediction": " The profit is calculated by subtracting the cost price from the selling price.\nSo, the profit is 55 - 44 = 11 dollars.\nThe answer is: 11", "predict_value": 11.0} 28 | {"model_prediction": " Let's denote the width of the rectangular field as W. According to the problem, the length of the field is 24 meters, and this is 3 meters less than twice the width. We can express this relationship as an equation:\n\nLength = 2W - 3\n\nSubstituting the given length into the equation, we get:\n\n24 = 2W - 3\n\nTo solve for W, we first add 3 to both sides of the equation:\n\n24 + 3 = 2W - 3 + 3\n\n27 = 2W\n\nThen, we divide both sides of the equation by 2 to find the width:\n\n27 / 2 = 2W / 2\n\nW = 13.5 meters\n\nSo, the width of the rectangular field is 13.5 meters.", "predict_value": 13.5} 29 | {"model_prediction": " The cost of renting the car is $50 per day.\nThe cost of mileage is $0.20 per mile.\nTo stay within your budget of $88, the total cost of renting the car and mileage should not exceed $88.\nLet's assume the maximum mileage is x miles.\nThe total cost of renting the car and mileage is $50 + $0.20x.\nWe want to find the maximum value of x that satisfies the equation $50 + $0.20x ≤ $88.\nSubtracting $50 from both sides of the equation, we get $0.20x ≤ $38.\nDividing both sides of the equation by $0.20, we get x ≤ 190.\nTherefore, the maximum mileage that will allow you to stay within your budget is 190 miles.\nThe answer is: 190", "predict_value": 190.0} 30 | {"model_prediction": " Let's assume the number of boys in the class is x.\nThen the number of girls in the class is x + 69.\nThe total number of students in the class is x + (x + 69) = 2x + 69.\nWe know that the total number of students is 485, so we can set up the equation 2x + 69 = 485.\nSubtracting 69 from both sides of the equation, we get 2x = 416.\nDividing both sides of the equation by 2, we get x = 208.\nTherefore, there are 208 boys in the class.\nThe answer is: 208", "predict_value": 208.0} 31 | {"model_prediction": " Let's assume the amount Janet invested at 10% is x dollars.\nThen the amount she invested at 1% is (31,000 - x) dollars.\nThe interest earned from the 10% investment is 0.10x dollars.\nThe interest earned from the 1% investment is 0.01(31,000 - x) dollars.\nThe total interest earned is 0.10x + 0.01(31,000 - x) = 1,390 dollars.\nSimplifying the equation, we get 0.10x + 310 - 0.01x = 1,390.\nCombining like terms, we get 0.09x + 310 = 1,390.\nSubtracting 310 from both sides, we get 0.09x = 1,080.\nDividing both sides by 0.09, we get x = 12,000.\nTherefore, Janet invested 12,000 dollars at 10%.\nThe answer is: 12000", "predict_value": 12000.0} 32 | {"model_prediction": " The two airplanes are traveling in opposite directions, so the total distance between them is the sum of the distances each airplane travels.\nLet's call the time it takes for the distance between them to be 1625 miles \"t\".\nThe distance the first airplane travels is 400t, and the distance the second airplane travels is 250t.\nSo, the total distance between them is 400t + 250t = 1625.\nCombining like terms, we get 650t = 1625.\nDividing both sides by 650, we get t = 1625/650 = 2.5.\nTherefore, it will take 2.5 hours for the distance between the two airplanes to be 1625 miles.\nThe answer is: 2.5", "predict_value": 2.5} 33 | {"model_prediction": " The cost of 3.5 pounds of ground beef is 9.77 dollars.\nTo find the cost of 5.6 pounds of ground beef, we need to find the cost per pound.\nThe cost per pound is 9.77 dollars / 3.5 pounds = 2.79142857 dollars per pound.\nSo, the cost of 5.6 pounds of ground beef is 2.79142857 dollars per pound * 5.6 pounds = 15.63199999 dollars.\nRounding to the nearest cent, the cost is 15.63 dollars.\nThe answer is: 15.63", "predict_value": 15.63} 34 | {"model_prediction": " Let's denote the amount of the 75% alcohol solution that needs to be drained off as $x$ gallons. After draining off $x$ gallons, the remaining amount in the container will be $(1-x)$ gallons of the 75% alcohol solution.\n\nWe then add $x$ gallons of the 50% alcohol solution to the container. So, the total amount in the container is still 1 gallon.\n\nThe amount of alcohol in the 75% solution that remains in the container is $0.75(1-x)$ gallons. The amount of alcohol in the 50% solution that we add is $0.5x$ gallons.\n\nThe total amount of alcohol in the container after mixing should be 65% of 1 gallon, which is $0.65(1) = 0.65$ gallons.\n\nSo, we can set up the following equation to represent the total amount of alcohol:\n\n$0.75(1-x) + 0.5x = 0.65$\n\nSolving this equation will give us the value of $x$.\n\nFirst, distribute the $0.75$ in the first term:\n\n$0.75 - 0.75x + 0.5x = 0.65$\n\nCombine like terms:\n\n$0.75 - 0.25x = 0.65$\n\nSubtract $0.75$ from both sides:\n\n$-0.25x = -0.10$\n\nFinally, divide both sides by $-0.25$ to solve for $x$:\n\n$x = \\frac{-0.10}{-0.25} = 0.4$\n\nSo, $0.4$ gallons of the 75% alcohol solution must be drained off and replaced by the 50% alcohol solution.\n\nThe answer is $\\boxed{0.4}$.", "predict_value": 0.4} 35 | {"model_prediction": " Let's denote the number of weeks as x.\nFor you, the total amount of money saved after x weeks is 7x.\nFor your friend, the total amount of money saved after x weeks is 5x.\nWe want to find the number of weeks when the total amount of money saved is the same for both of you.\nSo, we can set up the equation: 160 + 7x = 210 + 5x.\nSimplifying the equation, we get: 2x = 50.\nDividing both sides by 2, we get: x = 25.\nTherefore, after 25 weeks, both of you will have saved the same amount of money.\nThe answer is: 25", "predict_value": 25.0} 36 | -------------------------------------------------------------------------------- /codes/results/gpt2_AI2_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "The calculation formula for the question is:X = 9 + 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 2 | {"model_prediction": "he calculation formula for the question is:X = 9.8 + 5.2#### 5.2#### 0.8#### 0.8#### 0.8#### 0.8#### 0.8#### 0.8#### 0.8", "predict_value": 0.8} 3 | {"model_prediction": "he calculation formula for the question is:X = 9 + 4#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3", "predict_value": 3.0} 4 | {"model_prediction": "e calculation formula for the question is:X = 2.8333333333333335 + 2.8333333333333335#### 2.8333333333333335#### 2.8333333333333335#### 2.8333333333333335", "predict_value": 2.8333333333333335} 5 | {"model_prediction": " calculation formula for the question is:X = 10 + 46#### 16#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 6 | {"model_prediction": "The calculation formula for the question is:X = 6 + 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9#### 9", "predict_value": 9.0} 7 | {"model_prediction": " calculation formula for the question is:X = 864 + 128#### 487#### 487#### 487#### 487#### 487#### 487#### 487#### 487#### 487#### 487#### 487#### 48", "predict_value": 48.0} 8 | {"model_prediction": "he calculation formula for the question is:X = 27 + 33#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47", "predict_value": 47.0} 9 | {"model_prediction": "he calculation formula for the question is:X = 64 + 14#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48#### 48", "predict_value": 48.0} 10 | {"model_prediction": "he calculation formula for the question is:X = 22 + 20#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22#### 22", "predict_value": 22.0} 11 | {"model_prediction": "The calculation formula for the question is:X = 4.1 + 2.4#### 2.4#### 2.4#### 2.4#### 2.4#### 2.4#### 2.4#### 2.4#### 2.4", "predict_value": 2.4} 12 | {"model_prediction": "he calculation formula for the question is:X = 35 + 28#### 27#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28#### 28", "predict_value": 28.0} 13 | {"model_prediction": "calculation formula for the question is:X = 0.25 + 0.416#### 0.416#### 0.416#### 0.416#### 0.416#### 0.416#### 0.416#### 0.416#### 0.416", "predict_value": 0.416} 14 | {"model_prediction": "e calculation formula for the question is:X = 5.25 + 1.25#### 5.25#### 5.25#### 5.25#### 5.25#### 5.25#### 5.25#### 5.25#### 5.25", "predict_value": 5.25} 15 | {"model_prediction": "e calculation formula for the question is:X = 0.375 + 0.25#### 0.375#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25", "predict_value": 0.25} 16 | {"model_prediction": "he calculation formula for the question is:X = 38 + 44#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38#### 38", "predict_value": 38.0} 17 | {"model_prediction": "he calculation formula for the question is:X = 9 + 4#### 4#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 18 | {"model_prediction": "e calculation formula for the question is:X = 0.16666666666666666 - 0.16666666666666666#### 0.16666666666666666#### 0.16666666666666666#### 0.16666666666666666#### 0.1666666666", "predict_value": 0.1666666666} 19 | {"model_prediction": "he calculation formula for the question is:X = 0.36 + 0.05#### 0.05#### 0.05#### 0.05#### 0.05#### 0.05#### 0.05#### 0.05#### 0.05", "predict_value": 0.05} 20 | {"model_prediction": "The calculation formula for the question is:X = 45 + 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11#### 45#### 11", "predict_value": 11.0} 21 | {"model_prediction": "he calculation formula for the question is:X = 16 + 21#### 16#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21", "predict_value": 21.0} 22 | {"model_prediction": "e calculation formula for the question is:X = 18 + 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18", "predict_value": 18.0} 23 | {"model_prediction": "he calculation formula for the question is:X = 0.6 + 0.2#### 0.2#### 0.2#### 0.2#### 0.2#### 0.2#### 0.2#### 0.2#### 0.2", "predict_value": 0.2} 24 | {"model_prediction": "e calculation formula for the question is:X = 9.91 + 4.11#### 4.11#### 3.11#### 3.11#### 3.11#### 3.11#### 3.11#### 3.11#### 3.11", "predict_value": 3.11} 25 | {"model_prediction": "e calculation formula for the question is:X = 32 - 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23", "predict_value": 23.0} 26 | {"model_prediction": "he calculation formula for the question is:X = 7 + 3#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7", "predict_value": 7.0} 27 | {"model_prediction": "The calculation formula for the question is:X = 0.3 + 0.4#### 0.3#### 0.4#### 0.4#### 0.4#### 0.4#### 0.4#### 0.4#### 0.4", "predict_value": 0.4} 28 | {"model_prediction": "he calculation formula for the question is:X = 8 + 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3", "predict_value": 3.0} 29 | {"model_prediction": "e calculation formula for the question is:X = 14.02 + 9.46#### 12.04#### 12.04#### The calculation formula for the question is:X = 14.02 + 9.46#### 12.04#### 12", "predict_value": 12.0} 30 | {"model_prediction": "e calculation formula for the question is:X = 24 + 37#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6#### 6", "predict_value": 6.0} 31 | {"model_prediction": " calculation formula for the question is:X = 12.08 + 9.85#### 13.08#### 13.08#### 13.08#### 13.08#### 13.08#### 13.08#### 13.08#### 13.08", "predict_value": 13.08} 32 | {"model_prediction": "e calculation formula for the question is:X = 15 + 43#### 29#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23", "predict_value": 23.0} 33 | {"model_prediction": "e calculation formula for the question is:X = 53 - 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64#### 53#### 64", "predict_value": 64.0} 34 | {"model_prediction": "calculation formula for the question is:X = 45 + 23#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31#### 31", "predict_value": 31.0} 35 | {"model_prediction": "e calculation formula for the question is:X = 0.16666666666666666 + 0.3333333333333333#### 0.3333333333333333#### 0.3333333333333333#### 0.3333333333333333#### 0.33333333", "predict_value": 0.33333333} 36 | {"model_prediction": " calculation formula for the question is:X = 36 - 36#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18", "predict_value": 18.0} 37 | {"model_prediction": " calculation formula for the question is:X = 9437 + 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922#### 6922####", "predict_value": 6922.0} 38 | {"model_prediction": " calculation formula for the question is:X = 1426 + 2000#### 1426 + 1426#### 1426#### 1426#### 1426#### 1426#### 1426#### 1426#### 1426#### 1426#### 1426#### 14", "predict_value": 14.0} 39 | {"model_prediction": "The calculation formula for the question is:X = 9 + 2#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 40 | {"model_prediction": "e calculation formula for the question is:X = 85 + 14#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 41 | {"model_prediction": "he calculation formula for the question is:X = 22 + 40#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13", "predict_value": 13.0} 42 | {"model_prediction": " calculation formula for the question is:X = 11.76 + 14.54#### 11.76#### 14.54#### 11.76#### 14.54#### 11.76#### 14.54#### 11.76#### 14.54", "predict_value": 14.54} 43 | {"model_prediction": "he calculation formula for the question is:X = 9 + 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7#### 9#### 7", "predict_value": 7.0} 44 | {"model_prediction": "e calculation formula for the question is:X = 27 + 41#### 20#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21", "predict_value": 21.0} 45 | {"model_prediction": "ulation formula for the question is:X = 0.2 + 0.4#### 0.1#### 0.2#### 0.3#### 0.4#### 0.5#### 0.6#### 0.7#### 0.8", "predict_value": 0.8} 46 | {"model_prediction": "e calculation formula for the question is:X = 0.16666666666666666#### 0.16666666666666666#### 0.16666666666666666#### 0.16666666666666666#### 0.16666666666666666#### 0.1666666666", "predict_value": 0.1666666666} 47 | {"model_prediction": "he calculation formula for the question is:X = 0.25 + 0.16#### 0.16#### 0.16#### 0.16#### 0.16#### 0.16#### 0.16#### 0.16#### 0.16", "predict_value": 0.16} 48 | {"model_prediction": "he calculation formula for the question is:X = 61921 + 49500#### 49500#### 80500#### 80500#### 80500#### 80500#### 80500#### 80500#### 80500", "predict_value": 80500.0} 49 | {"model_prediction": "he calculation formula for the question is:X = 20 + 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21#### 21", "predict_value": 21.0} 50 | {"model_prediction": "he calculation formula for the question is:X = 42 + 38#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47#### 47", "predict_value": 47.0} 51 | {"model_prediction": "he calculation formula for the question is:X = 49 + 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13", "predict_value": 13.0} 52 | {"model_prediction": "e calculation formula for the question is:X = 4 + 9#### 3#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2#### 2", "predict_value": 2.0} 53 | {"model_prediction": "e calculation formula for the question is:X = 46 + 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12#### 12", "predict_value": 12.0} 54 | {"model_prediction": "he calculation formula for the question is:X = 709 + 221#### 709 + 221#### 709 + 221#### 709 + 221#### 709 + 221#### 709 + 221#### 709 + 221#### 709 + 221", "predict_value": 221.0} 55 | {"model_prediction": "he calculation formula for the question is:X = 33 - 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18#### 18", "predict_value": 18.0} 56 | {"model_prediction": " calculation formula for the question is:X = 8 + 6#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 57 | {"model_prediction": "he calculation formula for the question is:X = 41 + 30#### 31#### 32#### 33#### 34#### 35#### 36#### 37#### 38#### 39#### 40#### 41#### 42#### 43#### 44#### 45#### 46#### 47#### 48", "predict_value": 48.0} 58 | {"model_prediction": "The calculation formula for the question is:X = 42 + 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17#### 42#### 17", "predict_value": 17.0} 59 | {"model_prediction": " calculation formula for the question is:X = 9 + 3#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7#### 7", "predict_value": 7.0} 60 | {"model_prediction": "he calculation formula for the question is:X = 46 + 25#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46#### 46", "predict_value": 46.0} 61 | {"model_prediction": "he calculation formula for the question is:X = 9 + 5#### 2#### 3#### 4#### 5#### 6#### 7#### 8#### 9#### 10#### 11#### 12#### 13#### 14#### 15#### 16#### 17#### 18#### 19", "predict_value": 19.0} 62 | {"model_prediction": "e calculation formula for the question is:X = 8 + 4#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8#### 8", "predict_value": 8.0} 63 | {"model_prediction": "he calculation formula for the question is:X = 0.625 + 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25#### 0.25", "predict_value": 0.25} 64 | {"model_prediction": "he calculation formula for the question is:X = 7 + 4#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3#### 3", "predict_value": 3.0} 65 | {"model_prediction": " calculation formula for the question is:X = 0.3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333", "predict_value": 0.3333333333333333} 66 | {"model_prediction": " calculation formula for the question is:X = 1576 + 344#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 1404#### 14", "predict_value": 14.0} 67 | {"model_prediction": " calculation formula for the question is:X = 0.9 + 0.9#### 0.9#### 0.9#### 0.9#### 0.9#### 0.9#### 0.9#### 0.9#### 0.9", "predict_value": 0.9} 68 | {"model_prediction": "e calculation formula for the question is:X = 29 + 20#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23#### 23", "predict_value": 23.0} 69 | {"model_prediction": "The calculation formula for the question is:X = 6 + 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5#### 5", "predict_value": 5.0} 70 | {"model_prediction": "calculation formula for the question is:X = 6310 + 4518#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345#### 1345####", "predict_value": 1345.0} 71 | {"model_prediction": "he calculation formula for the question is:X = 11 + 34#### 14#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13#### 13", "predict_value": 13.0} 72 | {"model_prediction": " calculation formula for the question is:X = 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 + 5106 +", "predict_value": 5106.0} 73 | {"model_prediction": "The calculation formula for the question is:X = 7 + 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4#### 7#### 4", "predict_value": 4.0} 74 | -------------------------------------------------------------------------------- /codes/results/gpt2_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "\n\nThe number is the number of times the number is given.\n\nThe number is the number of times the number is given.\n\nThe number is the number of times the number is given.\n\nThe number is the number of", "predict_value": 0} 2 | {"model_prediction": "\n\nThe number of girls in the class is the same as the number of boys.\n\nThe number of boys is the same as the number of girls.\n\nThe number of girls is the same as the number of boys.\n\n", "predict_value": 0} 3 | {"model_prediction": "\n\n1.6667 = 1.6667\n\nThe number is:\n\n1.6667 = 1.6667\n\nThe number is:\n\n1.6667 = 1.6667\n\nThe number is", "predict_value": 1.6667} 4 | {"model_prediction": "\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\n", "predict_value": 0} 5 | {"model_prediction": "\n\nThe number of nesting pairs of bald eagles in the lower 48 states is approximately 6649 more than in 1963.\n\nThe number of nesting pairs of bald eagles in the lower 48 states is approximately 6649 more than in 1963.", "predict_value": 1963.0} 6 | {"model_prediction": "\n\nLatoya bought a prepaid phone card for 30 dollars. Long distance calls cost 16 cents a minute using this card. Latoya used her card only once to make a long distance call. If the remaining credit on her card is 26.48", "predict_value": 26.48} 7 | {"model_prediction": "\n\nThe number is the number of times the number is less than 8 times a number.\n\nThe answer is:\n\nThe number is the number of times the number is less than 8 times a number.\n\nThe answer is:", "predict_value": 8.0} 8 | {"model_prediction": " no. The solution must be mixed with the solution of the milliliters of the solution.\n\nThe solution must be mixed with the solution of the milliliters of the solution. The solution must be mixed with the solution of the millilit", "predict_value": 0} 9 | {"model_prediction": "\n\nThe length of the board is the length of the board.\n\nThe length of the board is the length of the board.\n\nThe length of the board is the length of the board.\n\nThe length of the board is", "predict_value": 0} 10 | {"model_prediction": " 1,000. \nThe answer is: 1,000. \nThe answer is: 1,000. \nThe answer is: 1,000. \nThe answer is: 1,000. \nThe answer is:", "predict_value": 0.0} 11 | {"model_prediction": "\n\n1. The number is 2.\n\n2. The number is 3.\n\n3. The number is 4.\n\n4. The number is 5.\n\n5. The number is 6.\n\n6. The", "predict_value": 6.0} 12 | {"model_prediction": " 1/2 cup.\n\nThe recipe calls for 2 cups of sugar. You find that you only have 0.3333 cups of sugar left. What fraction of the recipe can you make? The answer is: 1/2 cup. The recipe", "predict_value": 2.0} 13 | {"model_prediction": " no.\n\nThe pH of the solution is determined by the pH of the water. The pH of the solution is determined by the pH of the water.\n\nThe pH of the solution is determined by the pH of the water.\n\n", "predict_value": 0} 14 | {"model_prediction": "\n\nThe first part is the sum of the parts of the first part.\n\nThe second part is the sum of the parts of the second part.\n\nThe third part is the sum of the parts of the third part.\n\n", "predict_value": 0} 15 | {"model_prediction": " 1,000.\n\nThe zoo is a private zoo in the heart of the city of San Francisco. It is located in the heart of the city, in the heart of the city, and it is the largest zoo in the world. The", "predict_value": 0.0} 16 | {"model_prediction": "\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\n", "predict_value": 0} 17 | {"model_prediction": " no. The prom is a private event. The prom is not a public event. The prom is a private event. The prom is not a public event. The prom is not a public event. The prom is not a public event. The prom", "predict_value": 0} 18 | {"model_prediction": "\n\nThe second number is 3 less than twice the first number. Their sum is 57. Find the second number.\n\nThe answer is:\n\nThe second number is 3 less than twice the first number. Their sum is 57. Find", "predict_value": 57.0} 19 | {"model_prediction": " It was about 715 kilometers per hour.\n\nThe car was traveling at a speed of about 715 kilometers per hour.\n\nThe car was traveling at a speed of about 715 kilometers per hour.\n\nThe car was traveling at", "predict_value": 715.0} 20 | {"model_prediction": "\n\n1. The number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the", "predict_value": 1.0} 21 | {"model_prediction": "\n1. The number of legs is not known.\n\n2. The number of legs is not known.\n\n3. The number of legs is not known.\n\n4. The number of legs is not known.\n\n", "predict_value": 4.0} 22 | {"model_prediction": "  The number of tickets sold is not known.  The number of tickets sold is not known.  The number of tickets sold is not known.  The number of tickets sold is not known.  The number of tickets", "predict_value": 0} 23 | {"model_prediction": " 1.\n\n2.\n\n3.\n\n4.\n\n5.\n\n6.\n\n7.\n\n8.\n\n9.\n\n10.\n\n11.\n\n12.\n\n13.", "predict_value": 13.0} 24 | {"model_prediction": "\n\nThe number is 10 more than 0.1667 of a certain number is 10 more than 0.1667 of a number. Find the number.\n\nThe answer is:\n\nThe number is 10 more than 0.1667", "predict_value": 0.1667} 25 | {"model_prediction": "he theater is a small theater with a small seating capacity. The theater is not a large theater. The theater is a small theater with a small seating capacity. The theater is not a large theater. The theater is a small theater with a small", "predict_value": 0} 26 | {"model_prediction": " 1,000. \n\nThe number of students who attended the concert was not reported. \n\nThe number of students who attended the concert was not reported. \n\nThe number of students who attended the concert was not reported. ", "predict_value": 0.0} 27 | {"model_prediction": "\n\nThe price of a book is the price of the book.\n\nThe book is the price of the book.\n\nThe book is the price of the book.\n\nThe book is the price of the book.\n\nThe", "predict_value": 0} 28 | {"model_prediction": "\n\nThe width of a rectangular field is 24 meters. This is 3 meters less than twice the width. Find the width.\n\nThe answer is:\n\nThe width of a rectangular field is 24 meters. This is 3 meters less than", "predict_value": 3.0} 29 | {"model_prediction": "\n\nThe maximum mileage is the maximum amount of time you can stay within your budget.\n\nThe maximum amount of time you can stay within your budget. The maximum amount of time you can stay within your budget. The maximum amount of time you", "predict_value": 0} 30 | {"model_prediction": " about 1,000.\n\nThe average age of a student in the class is 18.\n\nThe average age of a student in the class is 18.\n\nThe average age of a student in the class is 18.\n\nThe", "predict_value": 18.0} 31 | {"model_prediction": "she invested at 10 %.\n\nThe answer is: she invested at 10 %.\n\nThe answer is: she invested at 10 %.\n\nThe answer is: she invested at 10 %.\n\nThe answer is: she invested", "predict_value": 10.0} 32 | {"model_prediction": " 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is:", "predict_value": 1625.0} 33 | {"model_prediction": "\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:", "predict_value": 0} 34 | {"model_prediction": "\n\nThe amount of alcohol solution needed to produce one gallon of 65 % alcohol solution is:\n\nThe amount of alcohol solution needed to produce one gallon of 65 % alcohol solution is:\n\nThe amount of alcohol solution needed to produce one gallon", "predict_value": 65.0} 35 | {"model_prediction": " no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.", "predict_value": 0} 36 | -------------------------------------------------------------------------------- /codes/results/gpt2_direct_Alg_result.txt: -------------------------------------------------------------------------------- 1 | {"model_prediction": "\n\nThe number is the number of times the number is given.\n\nThe number is the number of times the number is given.\n\nThe number is the number of times the number is given.\n\nThe number is the number of", "predict_value": 0} 2 | {"model_prediction": "\n\nThe number of girls in the class is the same as the number of boys.\n\nThe number of boys is the same as the number of girls.\n\nThe number of girls is the same as the number of boys.\n\n", "predict_value": 0} 3 | {"model_prediction": "\n\n1.6667 of a number increased by 0.75 is 1.6667 of a number increased by 0.75 is 1.6667 of a number increased by 0.75 is 1.6667 of a number increased by", "predict_value": 1.6667} 4 | {"model_prediction": " You are traveling to your mothers house that is 234 miles away. If you are currently twice as far from your house as you are from your mothers house how far have you traveled? Round to the nearest tenth mile.\n\nIf you are traveling to", "predict_value": 234.0} 5 | {"model_prediction": " there were only 7,000 bald eagles in the lower 48 states in 1963.\n\nThe number of bald eagles in the lower 48 states is about the same as in 1963.\n\nThe number of bald eagles in the lower 48", "predict_value": 48.0} 6 | {"model_prediction": "\n\nLatoya bought a prepaid phone card for 30 dollars. Long distance calls cost 16 cents a minute using this card. Latoya used her card only once to make a long distance call. If the remaining credit on her card is 26.48", "predict_value": 26.48} 7 | {"model_prediction": "\n\nThe number is the number of times the number is less than 8 times a number.\n\nThe answer is:\n\nThe number is the number of times the number is less than 8 times a number.\n\nThe answer is:", "predict_value": 8.0} 8 | {"model_prediction": " no. The solution must be mixed with the solution of the milliliters of the solution.\n\nThe solution of the milliliters of the solution must be mixed with the solution of the milliliters of the solution. The solution must be", "predict_value": 0} 9 | {"model_prediction": "\n\nThe length of the board is the length of the board.\n\nThe length of the board is the length of the board.\n\nThe length of the board is the length of the board.\n\nThe length of the board is", "predict_value": 0} 10 | {"model_prediction": " 1,000. \nThe average ticket price for a movie is $1.50. \nThe average ticket price for a movie is $1.50. \nThe average ticket price for a movie is $1.50. ", "predict_value": 1.5} 11 | {"model_prediction": "\n\n1. The number is 2 more than 0.25 of the number.\n\n2. The number is 2 more than 0.25 of the number.\n\n3. The number is 2 more than 0.25 of the number", "predict_value": 0.25} 12 | {"model_prediction": " 1/2 cup.\n\nThe recipe calls for 2 cups of sugar. You find that you only have 0.3333 cups of sugar left. What fraction of the recipe can you make? The answer is: 1/2 cup. The recipe", "predict_value": 2.0} 13 | {"model_prediction": " no.\n\nThe pH of the solution is determined by the ratio of the pH of the solution to the pH of the water. The pH of the solution is determined by the ratio of the pH of the solution to the pH of the water.", "predict_value": 0} 14 | {"model_prediction": "\n\nThe first part is the sum of the parts of the first part.\n\nThe second part is the sum of the parts of the second part.\n\nThe third part is the sum of the parts of the third part.\n\n", "predict_value": 0} 15 | {"model_prediction": " 1,000.\n\nThe zoo is a private zoo in the heart of the city of San Francisco. It is located in the heart of the city, in the heart of the city, and it is the largest private zoo in the world.", "predict_value": 0.0} 16 | {"model_prediction": "\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\nThe answer is:\n\n", "predict_value": 0} 17 | {"model_prediction": " no. The prom is a private event. The prom is not a public event. The prom is a private event. The prom is not a public event. The prom is not a public event. The prom is not a public event. The prom", "predict_value": 0} 18 | {"model_prediction": "\n\nThe second number is 3 less than twice the first number. Their sum is 57. Find the second number.\n\nThe answer is:\n\nThe second number is 3 less than twice the first number. Their sum is 57. Find", "predict_value": 57.0} 19 | {"model_prediction": " It was about 715 kilometers per hour.\n\nThe car was traveling at a speed of about 715 kilometers per hour.\n\nThe car was traveling at a speed of about 715 kilometers per hour.\n\nThe car was traveling at", "predict_value": 715.0} 20 | {"model_prediction": "\n\n1. The number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the number of the", "predict_value": 1.0} 21 | {"model_prediction": "\n1. The number of legs in a table is the number of legs in the table.\n\n2. The number of legs in a table is the number of legs in the table.\n\n3. The number of legs in a", "predict_value": 3.0} 22 | {"model_prediction": "\nThe total number of tickets sold was:\nThe total number of tickets sold was:\nThe total number of tickets sold was:\nThe total number of tickets sold was:\nThe total number of tickets sold was:\nThe total number of", "predict_value": 0} 23 | {"model_prediction": " 1.\n\n2.\n\n3.\n\n4.\n\n5.\n\n6.\n\n7.\n\n8.\n\n9.\n\n10.\n\n11.\n\n12.\n\n13.", "predict_value": 13.0} 24 | {"model_prediction": "\n\nThe number is 10 more than 0.1667 of a certain number. Find the number.\n\nThe answer is:\n\nThe number is 10 more than 0.1667 of a certain number. Find the number.\n\n", "predict_value": 0.1667} 25 | {"model_prediction": ",000.\n\nThe theater is located in the heart of the city of Chicago. It is located in the heart of the city of Chicago. It is located in the heart of the city of Chicago. It is located in the heart of", "predict_value": 0.0} 26 | {"model_prediction": " 1,000. \n\nThe number of students who attended the concert was not reported. \n\nThe number of students who attended the concert was not reported. \n\nThe number of students who attended the concert was not reported. ", "predict_value": 0.0} 27 | {"model_prediction": "\nThe price of a book is the price of the book. \nThe book is the price of the book. \nThe book is the price of the book. \nThe book is the price of the book. \nThe book", "predict_value": 0} 28 | {"model_prediction": "\n\nThe width of a rectangular field is 24 meters. This is 3 meters less than twice the width. Find the width.\n\nThe answer is:\n\nThe width of a rectangular field is 24 meters. This is 3 meters less than", "predict_value": 3.0} 29 | {"model_prediction": "\n\nThe maximum mileage you can stay within your budget is 88 miles.\n\nThe maximum mileage you can stay within your budget is 88 miles. The maximum mileage you can stay within your budget is 88 miles. The maximum mileage you can stay within", "predict_value": 88.0} 30 | {"model_prediction": " about 1,000.\n\nThe average age of a student in the class is 18.\n\nThe average age of a student in the class is 18. The average age of a student in the class is 18. The average age of a", "predict_value": 18.0} 31 | {"model_prediction": "she invested at 10 %.\n\nThe question is: how much did she invest at 10 %? \n\nThe answer is: she invested at 10 %.\n\nThe answer is: she invested at 10 %.\n\nThe answer", "predict_value": 10.0} 32 | {"model_prediction": " 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is: 1625 miles.\n\nThe answer is:", "predict_value": 1625.0} 33 | {"model_prediction": "\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:\nThe answer is:", "predict_value": 0} 34 | {"model_prediction": "\n\nThe amount of alcohol in a gallon of water is the amount of alcohol in the container.\n\nThe amount of alcohol in a gallon of water is the amount of alcohol in the container. The amount of alcohol in a gallon of water is", "predict_value": 0} 35 | {"model_prediction": " no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.\n\nThe answer is: no.", "predict_value": 0} 36 | -------------------------------------------------------------------------------- /codes/zero_shot_infer.py: -------------------------------------------------------------------------------- 1 | import os, json, time 2 | from alive_progress import alive_bar 3 | 4 | import torch 5 | 6 | from get_data import get_data 7 | from prompts import question2prompt 8 | from infer_predict import get_infer 9 | from extract_number import extract_number_from_prediction 10 | 11 | num_threads = "32" 12 | torch.set_num_threads(int(num_threads)) 13 | os.environ["OMP_NUM_THREADS"] = num_threads 14 | os.environ["OPENBLAS_NUM_THREADS"] = num_threads 15 | os.environ["MKL_NUM_THREADS"] = num_threads 16 | os.environ["VECLIB_MAXIMUM_THREADS"] = num_threads 17 | os.environ["NUMEXPR_NUM_THREADS"] = num_threads 18 | 19 | import argparse 20 | 21 | parser = argparse.ArgumentParser() 22 | 23 | # 具体支持的选项可参考 codes/README.md 24 | 25 | parser.add_argument( 26 | "-mc", "--model_checkpoint_path", type=str 27 | ) # 本地:预训练模型名或本地目录;API:模型名称 28 | 29 | parser.add_argument("-mn", "--model_name", type=str) 30 | # 本地:模型名称 31 | 32 | parser.add_argument("-dn", "--dataset_name", type=str) 33 | 34 | parser.add_argument("-ds", "--dataset_path", type=str) 35 | # train/valid/test json储存的文件夹 36 | 37 | parser.add_argument("-pt", "--prompt_template", type=str, default="CoT") 38 | # 目前支持的选项: 39 | # CoT: 在问题后面加“Let's think step by step.” 40 | # pure:不加任何东西 41 | # CoT+tip: 在问题后面加“Let's think step by step. I will tip you $100,000 for a perfect answer.” 42 | 43 | parser.add_argument( 44 | "-rt", "--result_txt_path", type=str 45 | ) # 输出结果储存文件(将直接追加写入) 46 | 47 | args = parser.parse_args() 48 | arg_dict = args.__dict__ 49 | 50 | # 数据预处理 51 | all_data, threshold = get_data(arg_dict["dataset_name"], arg_dict["dataset_path"]) 52 | test_data = all_data["test"] 53 | 54 | 55 | # 构建模型 56 | predict = get_infer(arg_dict["model_name"], arg_dict["model_checkpoint_path"]) 57 | 58 | # 运行模型 59 | result_file = open(arg_dict["result_txt_path"], "a") 60 | 61 | amount_predict_right = 0 62 | with alive_bar(len(test_data)) as bar: 63 | for i in range(len(test_data)): 64 | if arg_dict["model_checkpoint_path"] == "moonshot-v1-8k": # 说是RPM=3,但是我sleep 20秒也会超,不理解了真是 65 | time.sleep(60) 66 | model_prediction = predict( 67 | question2prompt(test_data[i]["question"], arg_dict["prompt_template"]) 68 | ) 69 | 70 | predict_value = extract_number_from_prediction( 71 | predict, test_data[i]["question"], model_prediction 72 | ) 73 | 74 | if abs(predict_value - test_data[i]["answer"]) < threshold: 75 | amount_predict_right += 1 76 | 77 | result_file.write( 78 | json.dumps( 79 | { 80 | "model_prediction": model_prediction, 81 | "predict_value": predict_value, 82 | }, 83 | ensure_ascii=False, 84 | ) 85 | + "\n" 86 | ) 87 | result_file.flush() 88 | 89 | bar() 90 | # break 91 | 92 | result_file.close() 93 | 94 | print(amount_predict_right) 95 | print(amount_predict_right / len(test_data)) 96 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | torch 2 | transformers 3 | alive-progress --------------------------------------------------------------------------------