Source-linked AI summary

AlphaMath Almost Zero: Process Supervision without Process

Guoxin Chen, Minpeng Liao, Chengxi Li, Kai Fan

arXiv:2405.03553v3cs.CLcs.AI

TL;DR

LLMs need costly expert- or GPT-4-annotated process supervision for difficult mathematical reasoning, despite potentially containing relevant mathematical knowledge. AlphaMath uses MCTS with a value model to generate supervision autonomously and adds step-level beam search for efficient inference. It remains competitive with or surpasses state-of-the-art methods on in-domain and out-of-domain datasets without human or GPT-4 process annotations.

  • Problem

    Complex symbolic multi-step mathematical reasoning commonly relies on expensive, labor-intensive process-supervised data from domain experts or GPT-4.

  • Method

    AlphaMath combines a pretrained LLM policy with a value model and MCTS to generate solution paths, process supervision, and step-level evaluation signals, then uses step-level beam search for efficient inference.

  • Results

    AlphaMath remains competitive with or surpasses state-of-the-art performance on both in-domain and out-of-domain mathematical reasoning datasets without GPT-4 or human-annotated process supervision.

  • Takeaways & Limitations

    The results indicate that a well-pretrained LLM can autonomously enhance mathematical reasoning when appropriately stimulated by search and value-based path selection.

  • Takeaways & Limitations

    The value model sometimes incorrectly judges an incorrect solution as correct, producing a failure mode near Q-values of 1.

Abstract

from arXiv · show

Although recent advancements in large language models (LLMs) have significantly improved their performance on various tasks, they still face challenges with complex and symbolic multi-step reasoning, particularly in mathematical reasoning. To bolster the mathematical reasoning capabilities of LLMs, most existing efforts concentrate on seeking assistance from either domain experts or GPT-4 for high-quality process-supervised data, which is not only expensive but also labor-intensive. In our study, we propose an innovative framework, AlphaMath, that bypasses the need for process annotations (from humans or GPTs) by leveraging Monte Carlo Tree Search (MCTS). This framework focuses on unleashing the potential of a well-pretrained LLM to autonomously enhance its mathematical reasoning. Specifically, we integrate a value model with the LLM, automatically generating both process supervision and step-level evaluation signals in MCTS. Furthermore, we propose an efficient inference strategy, step-level beam search, where the value model is crafted to assist the policy model (i.e., LLM) in navigating more effective reasoning paths, rather than solely relying on prior probabilities. The experimental results on both in-domain and out-of-domain datasets demonstrate that even without GPT-4 or human-annotated process supervision, our AlphaMath framework achieves comparable or superior results to previous state-of-the-art methods.

1 Introduction

AlphaMath addresses the cost and labor of obtaining process-supervised mathematical reasoning data by using MCTS to help pretrained LLMs generate and evaluate solutions autonomously. It also introduces step-level beam search, and experiments show competitive or better performance without human or GPT-4 process annotations.

  • Existing mathematical-reasoning methods often fine-tune LLMs on high-quality process-supervised solutions annotated by domain experts or GPT-4.These annotations provide external knowledge but are costly and labor-intensive.
  • AlphaMath combines a pretrained LLM with MCTS to autonomously generate high-quality reasoning solutions and process supervision without professional human annotations.The framework is designed to stimulate knowledge already present in the LLM.
  • Step-level beam search uses a lightweight value model to assess intermediate reasoning steps and guide the LLM toward more effective solution paths.Unlike reliance on prior probabilities alone, the strategy evaluates step quality during inference at minimal cost.
  • AlphaMath achieves better or comparable task performance on in-domain and out-of-domain mathematical reasoning datasets without process annotations.The framework was evaluated across domain-specific, general-purpose, and supervised fine-tuned LLMs.

2 Preliminary

The paper models mathematical problem solving as reinforcement learning over partial solutions, with an LLM policy producing reasoning steps and a value model estimating their expected returns. Rewards are assigned only at terminal answers, while intermediate steps receive zero reward.

  • A mathematical solution is represented as T reasoning steps, with each partial solution treated as a state and its next reasoning step as an action.The policy is an LLM, and state transitions occur deterministically by concatenating the selected action to the current state.
  • The step-level value model Vϕ(s) estimates expected returns from a partial solution to guide selection of subsequent reasoning steps.Its role is to help the LLM choose more reasonable continuations.
  • Rewards are 0 for non-terminal reasoning steps and ±1 for correct or incorrect final answers.This reward definition supplies the signal used to train the value model.
  • Monte Carlo evaluation estimates value-model training signals from simulated future actions, states, and final rewards.The regression target is constructed for each partial solution from simulation outcomes.

3 AlphaMath

AlphaMath uses MCTS to explore solution paths with an LLM policy and value model, then trains both models from correct and incorrect paths with step-level value estimates. To reduce MCTS inference cost, step-level beam search removes backup and ranks dynamically generated children by value.

  • MCTS Evaluation: MCTS reuses simulations to grow a search tree whose nodes represent promising partial solutions and whose state-action values guide exploration.Selection uses a PUCT variant combining stored Q-values, visit counts, and policy priors.
  • MCTS Evaluation: MCTS evaluates expanded nodes using terminal rewards when available and the value model otherwise, balancing empirical outcomes with model estimates.During inference, terminal correctness cannot be directly verified, so the value model evaluates nodes.
  • Iterative Training: The policy and value models share most parameters, while the value model adds an auxiliary tanh-activated linear head.The value head is randomly initialized in the first training round.
  • Iterative Training: MCTS-generated trees provide correct and incorrect terminal solution paths plus node-value estimates for joint policy and value-model training.The updated models are used in the next iterative MCTS round.
  • MCTS Evaluation: After simulations, AlphaMath selects solution paths by repeatedly retaining the top-B1 children according to their Q-values.The procedure ranks children top-down after the complete tree has been built.
  • Inference: Step-level beam search eliminates MCTS backup and avoids constructing the entire tree, dynamically selecting promising children during expansion.This simplification addresses MCTS’s computational intensity for production inference.

4 Experiments

Experiments evaluate AlphaMath using only GSM8K and MATH question-answer pairs, comparing it with strong proprietary, open-source, and process-supervised baselines. Results show competitive performance without human or GPT-4 solution annotations, while inference analyses identify a trade-off between MCTS accuracy and computational efficiency.

  • Experimental Setup: Training uses only 15k GSM8K and MATH question-answer pairs, omitting human-annotated solution processes.MCTS generates correct and incorrect solution processes for iterative training.
  • Experimental Setup: AlphaMath is evaluated on GSM8K, MATH, and the more challenging out-of-distribution datasets GaoKao2023 and OCWCourses.The evaluation includes domain-specific, general-purpose, and supervised fine-tuned model types.
  • Main Results: Performance improves by about 20 points on challenging MATH, GaoKao2023, and OCWCourses problems and by more than 10 points on grade-school math problems.These gains are reported relative to the initial designed-prompt study, whose baseline uses 2-shot prompting.
  • Main Results: AlphaMath remains competitive with or surpasses state-of-the-art performance on 7B LLMs without human- or GPT-4-annotated solution processes.The comparison includes models trained with high-quality process-supervised seed data and external Python tools.
  • Performance Across Rounds: Across training rounds, MCTS solves increasingly challenging MATH problems and improves performance on in-domain and out-of-domain test sets.The reported pattern supports incremental improvement in self-generated training-data quality, though gains on the test set are not uniform across all difficulty levels and subjects.
  • Inference Strategies: Step-level beam search improves over greedy decoding and offers similar accuracy to MCTS with lower computational cost.MCTS requires the longest solving time and most intermediate steps under the 40-simulation configuration, whereas larger beam sizes can reduce duration by reducing average steps.
  • Value Model: Q-values for correct solutions are concentrated near 1, while incorrect solutions show density toward −1 and a second mode near 1 from value-model errors.The latter mode represents cases where the value model incorrectly judges an incorrect solution as correct.

5 Related Works

Prior mathematical-reasoning methods rely on costly expert or GPT-4 process annotations, while value and reward models add annotation requirements and inference latency. AlphaMath instead uses MCTS state values as supervision and integrates a value model for efficient decoding.

  • Existing mathematical-reasoning approaches commonly obtain high-quality process-supervised solutions from domain experts or GPT-4, limiting scalability and increasing expense.
  • Value models support decoding, whereas reward models provide reinforcement-learning training signals, but both typically require annotated process-supervised data.
  • AlphaMath uses MCTS state values as supervision signals aligned with solutions, eliminating process-annotation costs.
  • AlphaMath integrates its value model with generation to navigate more effective reasoning paths through step-level beam search or MCTS.

6 Conclusion

AlphaMath is an iterative MCTS-based training paradigm that enables a well-pretrained LLM to improve mathematical reasoning autonomously. Step-level beam search uses a value model to guide solution paths, and experiments show competitive or superior performance without GPT-4 or human process annotations.

  • AlphaMath combines iterative training with MCTS to autonomously enhance mathematical reasoning in a well-pretrained LLM.
  • Step-level beam search lets a value model help the policy model select more reasonable solution paths instead of relying only on prior probabilities.
  • AlphaMath matches or surpasses state-of-the-art methods on in-domain and out-of-domain datasets without GPT-4 or human-annotated process supervision.

A.1 Limitation

AlphaMath performs comparably or better without annotated process-supervised data, but it still requires actual answers as reward signals. Reusing only 15k question-answer pairs across iterations also limits the framework’s potential.

  • AlphaMath achieves comparable or superior results without annotated high-quality process-supervised data.
  • Mathematical reasoning requires actual answers as rewards because final board-state supervision from games such as Go does not transfer directly.
  • This reliance on actual answers prevents AlphaMath from being a fully unsupervised “really from zero” algorithm.
  • Each iteration reuses the same 15k question-answer pairs, limiting the framework’s potential and motivating automatic acquisition of new pairs.
  • On OCWCourses, inference-strategy performance differs somewhat from three other datasets because the dataset covers physics and chemistry, although the method still improves reasoning overall.

B.2 More Analysis of Value Model

Figure 8 examines value-model predictions for intermediate and final steps on training and test sets. The distributions indicate strong separation between correct and incorrect solutions, supporting value-guided step-level beam search.

  • Figure 8 compares fitted state-value distributions for intermediate and final steps on training and test sets.
  • On the training set, correct solutions receive values skewed toward 1 while incorrect solutions receive values skewed toward -1.
  • The value model distinguishes correct from incorrect test-set solutions, supporting why step-level beam search outperforms greedy inference.
  • The value model guides the policy model toward efficient solutions instead of relying solely on prior probabilities.

B.3 More Analysis of Problem Solving Rate of MCTS in Each Round

MCTS improves its ability to solve harder training-set problems over successive rounds, but test-set gains are uneven and decline for easier problems by round 3.

  • MCTS solves more challenging training-set problems in later rounds.The training-set rate counts problems solved along any path within 10 constructed trees.
  • Later rounds enable MCTS to solve a broader range of subjects on the training set.
  • Round 3 does not improve every MATH test-set difficulty level or subject, despite slightly higher overall accuracy.
  • Round 3 performance declines on easier test-set problems, motivating termination of iterative training after that round.

B.4 Problem Solving Rate for Each LLM in Training Set

The training-set analysis compares AlphaMath across model types and describes how its filtering and MCTS pipeline generates training signals from solution paths.

  • Problem-solving rates: MATH problem-solving rates increase across iterations, whereas GSM8K rates are already high in the first round.
  • Model comparison: MARIO performs best, while DeepseekMath-base outperforms the general-purpose Llama3 model.The paper attributes these differences to instruction-following ability and specialized mathematical knowledge, respectively.
  • Model comparison: AlphaMath improves existing models without GPT-4- or human-annotated high-quality process data.
  • MCTS representation: Each MCTS node stores one reasoning step together with its value estimate, state-action value, depth, and visit count.
  • MCTS representation: C-steps combine model-generated analysis and code with interpreter outputs, while A-steps typically appear at the end.
  • Solution filtering: Algorithm 3 removes duplicates and solutions with persistent code errors, then categorizes correct solutions into three levels.
  • Value modeling: The value model is integrated with the policy model through an appended linear layer and uses the final token to represent each reasoning step.

C.5 Datasets Details

The paper evaluates AlphaMath on multiple mathematical reasoning datasets and illustrates its MCTS solution-generation process across training rounds.

  • Datasets: The dataset suite includes GSM8K, MATH, and GaoKao2023, covering grade-school, competitive, and entrance-examination mathematics.
  • Solution generation: In round 1, MCTS uses policy and value models to grow a tree of candidate solution states and identifies correct and incorrect paths.
  • Solution generation: By round 3, generated solutions become more correct and contain more comprehensive code annotations.

E Error Analysis

The error analysis identifies numerical, logical, and other failure modes in mathematical code reasoning, including precision mistakes, overlooked requirements, and answer-key inaccuracies.

  • Numerical errors: Numerical errors account for 53% of the analyzed errors and commonly arise from incorrect generated code or numerical precision issues.
  • Numerical errors: A sequence example shows correct reasoning and code producing a wrong numeric answer because floating-point computation lacks sufficient precision.The paper recommends symbolic simplification with SymPy for this case.
  • Logical errors: Logical errors account for 45% of errors and occur when the model overlooks details required by the question.
  • Other errors: Other errors account for 2% and may result from ambiguous questions or inaccurate reference answers.
  • Reasoning format: The prompting format requires stepwise Thought, Action, Action Input, and Observation components, followed by final analysis and an answer.
Loading 2405.03553v3…