MetaMath Documentation

repository·main·Indexed 19 days ago

https://github.com/meta-math/metamath

A framework for bootstrapping mathematical questions to improve LLM reasoning capabilities. It includes the MetaMathQA and GSM8K_Backward datasets, pre-trained models, and a data generation pipeline featuring stages such as AnsAug, Rephrasing, Self-Verification, and FOBAR.

Tokens
850
Snippets
6
Records
7
Agent score
66%

What's inside MetaMath

  1. Run the MetaMath data generation pipeline stages

    main

    The MetaMath data generation process is divided into several stages. Each stage is executed by navigating to the code directory and running a specific shell script.

    Pipeline Stages:

    1. Create backward questions: Generates backward questions.
    2. AnsAug: Performs Answer Augmentation.
    3. Rephrasing: Performs question rephrasing.
    4. Self-Verification: Performs self-verification.
    5. FOBAR: Runs the FOBAR procedure (backward generation).
    # 0. Create backward questions
    cd code
    bash -x run_create_backward_questions.sh
    
    # 1. AnsAug
    cd code
    bash -x run_forward.sh
    
    # 2. Rephrasing
    cd code
    bash -x run_rephrase.sh
    
    # 3. Self-Verification
    cd code
    bash -x run_sv.sh
    
    # 4. FOBAR
    cd code
    bash -x run_backward.sh
  2. Install MetaMath

    main

    To set up MetaMath, clone the repository and install the required Python dependencies using pip.

    If you encounter issues with ray installation, manually upgrade ray and pyarrow, and install pandas.

    git clone https://github.com/meta-math/MetaMath.git
    cd MetaMath
    pip install -r requirements.txt

    If you encounter a Ray installation problem, run:

    pip install --upgrade ray
    pip install --upgrade pyarrow
    pip install pandas
  3. Access the MetaMathQA training dataset

    main

    The full MetaMathQA dataset is available on Hugging Face. You can access the training data files directly from the MetaMathQA repository to bootstrap mathematical questions for LLM training.

    https://huggingface.co/datasets/meta-math/MetaMathQA/tree/main
  4. Use generation arguments for controlling output and continuity

    main

    When running the data generation scripts, you can use the following arguments to control the behavior of the generation process:

    • --num_repeat: Specifies the number of outputs to generate from ChatGPT for each input using temperature sampling.
    • --part: Use this argument to specify a part number to avoid overwriting previously generated data.
    • --cont: Use this argument to continue a previous generation procedure. If this is not used, the script will re-fetch data.