Home

Awesome

Scaling Relationship on Learning Mathematical Reasoning with Large Language Models

The code and data used for reproducing results of Scaling Relationship on Learning Mathematical Reasoning with Large Language Models and Query and Response Augmentation Cannot Help Out-of-domain Math Reasoning Generalization.

Setting7B7B-213B13B-233B65B70B-2
ICL-8shot11.0/18.114.6/-17.8/29.328.7/-35.6/53.150.9/69.756.8/-
SFT35.9/48.741.6/55.443.0/55.250.0/61.754.6/-59.3/-63.2/-
RFT k=10041.7/52.747.5/58.749.1/59.954.8/65.454.5/---
RFT-U13B49.3/61.850.3/65.652.1/66.255.4/69.156.5/-59.0/-62.3/-
RFT-U33B49.1/61.651.2/64.151.4/66.355.3/69.157.9/-59.7/-64.8/-

Metrics are maj1@1 and maj1@100.

Findings from the paper

fig1 fig2

SFT Training

If you cannot reproduce our results, please try using Transformers <= 4.29 and test with batch size=1.

Use train_xb.sh for fine-tuning LLaMA and LLaMA-2.

bash train_xb.sh ./data/train_use.jsonl SAVE_PATH 3

RFT Inference

LLaMA 7B / 13B

bash group_sample_7b_13b.sh SAVE_PATH

LLaMA 30B

bash group_sample_30b.sh SAVE_PATH

Filter reasoning paths

python collect_rejection_sampling.py

RFT Training

For RFT using LLaMA-7B/7B-2/13B/13B-2/33B generated samples with k=100.

bash train_xb.sh ./data/rft/llama_yb.jsonl SAVE_PATH 3

For RFT using U13B.

bash train_xb.sh ./data/rft/u13b.jsonl SAVE_PATH 3

For RFT using U33B.

bash train_xb.sh ./data/rft/u33b.jsonl SAVE_PATH 3

Evaluation

We use greedy decode for the test set.

For evaluate 7B/13B models:

bash test_7b_13b.sh SAVE_PATH

For evaluate 30B models:

bash single_test_30b.sh SAVE_PATH 0 ./data/test_jsonl.sh

For evaluate 65B / 70B models:

bash single_test_65b.sh SAVE_PATH 0,1 ./data/test_jsonl.sh

Use eval.py to obtain the scores, and it also supports maj1@K.

GPU Usage

7B / 13B33B65B / 70B
SFT / RFT81632
Minimal Inference112
Group Inference888

Checkpoints

7B7B213B13B233B
RFT k = 100OFA-Sys/gsm8k-rft-llama7b-sample100
RFT U13BOFA-Sys/gsm8k-rft-llama7b-u13bOFA-Sys/gsm8k-rft-llama7b2-u13bOFA-Sys/gsm8k-rft-llama13b-u13bOFA-Sys/gsm8k-rft-llama13b2-u13b
RFT U33BOFA-Sys/gsm8k-rft-llama33b-u33b

Query and Response Augmentation Cannot Help Out-of-domain Math Reasoning Generalization

Model Details

MuggleMATH is fully fine-tuned on the AugGSM8K and AugMATH datasets(https://github.com/OFA-Sys/gsm8k-ScRel/tree/main/data/MuggleMATH) and based on the LLaMA-2 Models.

Model Usage

prompting template: ''' "Below is an instruction that describes a task. " "Write a response that appropriately completes the request.\n\n" "### Instruction:\n{instruction}\n\n### Response:" ''' We recommend using vllm to accelerate inference.

Experiment

ModelGSM8KMATH
MuggleMATH-7B69.825.8
MuggleMATH-13B74.330.7
MuggleMATH-70B82.535.6

Checkpoints

ModelCheckpoints
MuggleMATH-7Bhttps://huggingface.co/OFA-Sys/MuggleMath_7B
MuggleMATH-13Bhttps://huggingface.co/OFA-Sys/MuggleMath_13B
MuggleMATH-70Bhttps://huggingface.co/OFA-Sys/MuggleMath_70B

Citation

@misc{yuan2023scaling,
      title={Scaling Relationship on Learning Mathematical Reasoning with Large Language Models}, 
      author={Zheng Yuan and Hongyi Yuan and Chengpeng Li and Guanting Dong and Keming Lu and Chuanqi Tan and Chang Zhou and Jingren Zhou},
      year={2023},
      eprint={2308.01825},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
@article{li2023query,
  title={Query and response augmentation cannot help out-of-domain math reasoning generalization},
  author={Li, Chengpeng and Yuan, Zheng and Dong, Guanting and Lu, Keming and Wu, Jiancan and Tan, Chuanqi and Wang, Xiang and Zhou, Chang},
  journal={arXiv preprint arXiv:2310.05506},
  year={2023}
}