LLaMA-Berry: Pairwise Optimization for Olympiad-level Mathematical Reasoning via O1-like Monte Carlo Tree Search

Di Zhang, Jianbo Wu, Jingdi Lei, Tong Che, Jiatong Li, Tong Xie, Xiaoshui Huang, Shufei Zhang, Marco Pavone, Yuqiang Li, Wanli Ouyang, Dongzhan Zhou

TL;DR

LLaMA-Berry is a novel framework that enhances LLM mathematical reasoning by combining Monte Carlo Tree Search with Self-Refine (SR-MCTS). It uses a pairwise preference reward model (PPRM) and Enhanced Borda Count (EBC) to globally evaluate and optimize reasoning paths, achieving state-of-the-art performance on challenging Olympiad-level math problems.

What Problem Does This Paper Address?

Mathematical reasoning, especially at the Olympiad level (e.g., AIME, AMC), remains a significant challenge for Large Language Models (LLMs). While methods like Chain-of-Thought (CoT) break down problems into steps, they can suffer from inefficient exploration and lack comprehensive feedback. Approaches like Self-Refine improve solutions through iterative rewriting but can get stuck in local optima due to flawed feedback. Furthermore, evaluating the quality of generated reasoning paths is difficult due to scoring variability and non-independent distributions of solutions. This paper aims to address these limitations by developing a more efficient and robust method for optimizing mathematical reasoning paths.

Methods

The core of LLaMA-Berry is SR-MCTS (Self-Refine Monte Carlo Tree Search). This approach treats entire solutions as states in a Markov Decision Process (MDP) and uses Self-Refine (critiquing and rewriting) as an action to optimize these states. SR-MCTS integrates Monte Carlo Tree Search (MCTS) to explore the solution space more effectively, balancing exploration and exploitation using the UCT algorithm.

To guide the search, LLaMA-Berry introduces the Pairwise Preference Reward Model (PPRM). Instead of assigning absolute scores, PPRM learns to predict pairwise preferences between solutions (e.g., "is solution A better than solution B?"). This is trained using Reinforcement Learning from Human Feedback (RLHF) and framed as a question-answering task.

Finally, the Enhanced Borda Count (EBC) method is used to aggregate these pairwise preferences into global quantile scores. EBC leverages the transitive closure of preferences and a re-ranking stage to create a robust global ranking, overcoming the limitations of local pairwise comparisons.

Datasets

The paper utilizes existing datasets for training and evaluation:

  • GSM8K: A dataset of grade-school math word problems.
  • MATH: A dataset of challenging competition mathematics problems.
  • GaoKao2023En, College Math, OlympiadBench: Benchmarks for general mathematical reasoning across different difficulty levels.
  • AIME24, AMC23, Math Odyssey, GPQA diamond: Olympiad-level benchmarks.
  • OpenMathInstruct-1: Used for synthesizing pairs for comparative analysis based on outcome quality.
  • PRM800K: Used for constructing reasoning paths and comparative analysis based on step-wise process quality.

Key Insights and Ideas

  • Pairwise Preferences over Absolute Scores: The shift from absolute scoring to learning pairwise preferences (PPRM) is crucial for handling the subtle differences in mathematical reasoning and reducing scoring variability.
  • MCTS for Solution Space Exploration: Integrating MCTS with Self-Refine (SR-MCTS) provides a structured and efficient way to explore the vast solution space, preventing LLMs from getting stuck in suboptimal reasoning paths.
  • Global Ranking from Local Preferences: EBC's ability to synthesize local pairwise comparisons into a global ranking is key to providing a cohesive and reliable evaluation of solutions.
  • LLaMA-Berry's Effectiveness on Small Models: The framework significantly boosts the performance of even smaller LLMs (like LLaMA-3.1-8B), making them competitive with much larger or proprietary models on complex tasks.

Key Results

LLaMA-Berry demonstrates significant improvements across various benchmarks.

  • On Olympiad-level benchmarks like AIME24 and AMC23, LLaMA-Berry achieves superior performance compared to existing open-source and closed-source methods. For instance, it boosts the solving rate on AIME2024 from 2/30 to 8/30 for the base LLaMA-3.1-8B model.
  • It outperforms baseline approaches like ToT and rStar in both search efficiency and accuracy.
  • LLaMA-Berry makes the LLaMA-3.1-8B model comparable to proprietary models like GPT-4 Turbo on Olympiad-level mathematical reasoning without additional training.
  • The framework shows superior search efficiency and performance, particularly on complex Olympiad-level benchmarks.

Limitations and Future Work

  • Computational Cost: SR-MCTS and Self-Refine methods have high computational costs, which may limit deployment in resource-constrained environments.
  • Narrow Benchmark Scope: Current evaluations are primarily focused on mathematical reasoning.
  • Limited Testing on Larger Models: Most experiments used relatively small open-source models.

Future work includes:

  • Developing a learning-based summarizer to improve search efficiency.
  • Expanding evaluation to broader domains like general knowledge, symbolic logic, and multimodal applications.
  • Investigating the framework's performance on larger models and addressing scaling challenges.
  • Enhancing multimodal capabilities for tasks involving visual, auditory, or tactile perception.
  • Integrating AI safety mechanisms and developing safety-trained PPRMs.

Summary updated

BibTeX
@inproceedings{zhang2025llama,
  author = {Di Zhang and Jianbo Wu and Jingdi Lei and Tong Che and Jiatong Li and Tong Xie and Xiaoshui Huang and Shufei Zhang and Marco Pavone and Yuqiang Li and Wanli Ouyang and Dongzhan Zhou},
  title = {{LLaMA-Berry: Pairwise Optimization for Olympiad-level Mathematical Reasoning via O1-like Monte Carlo Tree Search}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.375},
}
Figure