ReST-MCTS*: LLM Self-Training via Process Reward Guided Tree Search

Dan Zhang, Sining Zhoubian, Ziniu Hu, Yisong Yue, Yuxiao Dong, Jie Tang

Introduction

Large Language Models (LLMs) are mostly trained on human-generated data. But as we approach the point where most available high-quality human-produced text on the web has been crawled and used for LLM training , the research focus has shifted towards using LLM-generated content to conduct self-training . Similar to most Reinforcement Learning (RL) problems, LLM self-training requires a reward signal. Most existing reinforced self-improvement approaches (e.g., STaR , RFT , ReSTEM\text{ReST}^{\text{EM}} , V-STaR ) assume to have access to a ground-truth reward model (labels from supervised dataset, or a pre-trained reward model). These approaches use an LLM to generate multiple samples for each question, and assume the one that leads to high reward (correct solution) is the high-quality sample, and later train on these samples (hence self-training). Such procedures can be effective in improving LLM performance, in some cases solving reasoning tasks that the base LLM cannot otherwise solve .

However, a key limitation of the above procedure is that even if a reasoning trace results in a correct solution, it does not necessarily imply that the entire trace is accurate. LLMs often generate wrong or useless intermediate reasoning steps, while still finding the correct solution by chance . Consequently, a self-training dataset can often contain many false positives — intermediate reasoning traces or plans are incorrect, but the final output is correct — which limits the final performance of LLM fine-tuning for complex reasoning tasks . One way to tackle this issue is to use a value function or reward model to verify reasoning traces for correctness (which then serves as a learning signal for self-training) . However, training a reliable reward model to verify every step in a reasoning trace generally depends on dense human-generated annotations (per reasoning step) , which does not scale well. Our research aims to address this gap by developing a novel approach that automates the acquisition of reliable reasoning traces while effectively utilizing reward signals for verification purposes. Our key research question is: How can we automatically acquire high-quality reasoning traces and effectively process reward signals for verification and LLM self-training?

In this paper, we propose ReST-MCTS∗, a framework for training LLMs using model-based RL training. Our proposed approach utilizes a modified Monte Carlo Tree Search (MCTS) algorithm as the reasoning policy, denoted MCTS∗, guided by a trained per-step process reward (value) model. A key aspect of our method is being able to automatically generate per-step labels for training per-step reward models, by performing a sufficient number of rollouts. This labeling process effectively filters out the subset of samples with the highest quality, without requiring additional human intervention. Table 1 summarizes the key distinctions between our approach and previous approaches. We validate experimentally that ReST-MCTS∗ outperforms prior work in discovering good reasoning traces, such as Self-Consistency (SC) and Best-of-N (BoN) under the same search budget on the SciBench and MATH benchmarks, which consequently leads to improved self-training.

We propose ReST-MCTS∗, a self-training approach that generates process rewards searched by MCTS. A key step is to automatically annotate the process reward of each intermediate node via sufficient times of rollouts, using MCTS∗. We validate multiple reasoning benchmarks and find that ReST-MCTS∗ outperforms existing self-training approaches (e.g., ReSTEM{}^{\text{EM}} and Self-Rewarding) as shown in Table 2 and reasoning policies (e.g., CoT and ToT) as shown in Table 4.

The reward generator in ReST-MCTS∗ leads to a higher-quality process reward model compared to previous process reward generation techniques, e.g., MATH-SHEPHERD, as shown in Table 3.

Given the same search budget, the search algorithm (MCTS∗) in ReST-MCTS∗ achieves higher accuracy than Self-Consistency and Best-of-N, as shown in Figure 2.

Background on Reasoning & Self-Training

We follow the standard setup in LLM-based reasoning. We start with a policy, denoted by π\pi, that is instantiated using a base LLM. Given an input problem QQ, in the simplest case, π\pi can generate an output sequence, or trace, of reasoning steps (s1,s2,⋯ ,sK)∼π(⋅∣Q)(s_{1},s_{2},\cdots,s_{K})\sim\pi(\cdot|Q) by autoregressively predicting the next token. For simplicity, we assume a reasoning step comprises a single sentence (which itself comprises multiple tokens). We also assume the last output sKs_{K} is the final step. LLMs can also be prompted or conditioned to bias the generation along certain traces. For a prompt cc, we can write the policy as π(⋅∣Q,c)\pi(\cdot|Q,c). This idea was most famously used in chain-of-thought (CoT) .

Self-Consistency (SC). Self-Consistency samples multiple reasoning traces from π\pi and chooses the final answer that appears most frequently.

Tree-Search & Value Function. Another idea is to use tree-structured reasoning traces , that branch from intermediate reasoning steps. One key issue in using a so-called tree-search reasoning algorithm is the need to have a value function to guide the otherwise combinatorially large search process . Two common value functions include Outcome Reward Models (ORMs) , which are trained only on the correctness of the final answer, and Process Reward Models (PRMs) , which are trained on the correctness of each reasoning step. We assume rskr_{s_{k}} is the PRM’s output sigmoid score at kk-th step. Our ReST-MCTS∗ approach uses tree-search to automatically learn a good PRM.

Best-of-N. As an alternative to Self-Consistency, one can also use a learned value function (PRM or ORM) to select the reasoning trace with the highest value .

Self-Training. At a high level, there are two steps to self-training . The first step is generation, where we sample multiple reasoning traces using π\pi (in our case, tree-structured traces). The second step is improvement, where a learning signal is constructed on the reasoning traces, which is then used to fine-tune π\pi. The process can repeat multiple iterations.

Limitation of Prior Works. The main challenge in doing reliable self-training is the construction of a useful learning signal. Ideally, one would want a dense learning signal on the correctness of every intermediate reasoning step, which is given by a PRM. Otherwise, with sparse learning signals, one suffers from a credit assignment similar to that in reinforcement learning. Historically, the main challenge with learning a PRM is the lack of supervised annotations per reasoning step. This is the principal challenge that our ReST-MCTS∗ approach seeks to overcome. We describe detailed preliminaries in Appendix A.

The ReST-MCTS∗ Method

Our approach, ReST-MCTS∗, is outlined in Figure 1 and developed using four main components.

MCTS∗ which performs a tree search with sufficient rollout time under the guidance of the PRM.

Process Reward Model (PRM) which evaluates any partial solution’s quality and guides MCTS.

Policy Model which generates multiple intermediate reasoning steps for each question.

LLM Self-Training, which uses MCTS∗ to collect reasoning traces, trains policy model on positive samples, and trains process reward model on all generated traces.

Quality Value vkv_{k} for a Partial Solution. The value or process reward vkv_{k} of the partial solution pk=[s1,s2,⋯ ,sk]p_{k}=[s_{1},s_{2},\cdots,s_{k}] should satisfy the following basic qualities:

Limited range: vkv_{k} is constrained within a specific range. This restriction ensures that the values of vkv_{k} are bounded and do not exceed a certain limit.

Reflecting probability of correctness: vkv_{k} serves as a reflection of the probability that a partial solution is a complete and correct answer. Higher values of vkv_{k} indicate better quality or a higher likelihood of being closer to a correct answer.

Reflecting correctness and contribution of solution steps: vkv_{k} incorporates both the correctness and contribution of each solution step. When starting from a partial solution, a correct next step should result in a higher vkv_{k} compared to false ones. Additionally, a step that makes more correct deductions toward the final answer should lead to a higher vkv_{k} value. This property ensures that vkv_{k} captures the incremental progress made towards the correct solution and rewards steps that contribute to the overall correctness of the solution.

Reasoning Distance mkm_{k} for a Partial Solution. To estimate the progress of a solution step, we define the reasoning distance mkm_{k} of pkp_{k} as the minimum reasoning steps a policy model requires to reach the correct answer, starting from pkp_{k}. Reasoning distance reflects the progress made as well as the difficulty for a policy to figure out a correct answer based on current steps, thus it can be further used to evaluate the quality of pkp_{k}. However, we point out that mkm_{k} can not be directly calculated. It is more like a hidden variable that can be estimated by performing simulations or trace sampling starting from pkp_{k} and finding the actual minimum steps used to discover the correct answer.

Weighted Reward wskw_{s_{k}} for a Single Step. Based on the desired qualities for evaluating partial solutions, we introduce the concept of a weighted reward to reflect the quality of the current step sks_{k}, denoted as wskw_{s_{k}}. Based on the common PRM reward rskr_{s_{k}}, wskw_{s_{k}} further incorporates the reasoning distance mkm_{k} as a weight factor, reflecting the incremental progress sks_{k} makes.

Representations for quality value and weighted reward. To determine the quality value vkv_{k} of a partial solution at step kk, we incorporate the previous quality value and the weighted reward of the current step. By considering the previous quality value, we account for the cumulative progress and correctness achieved up to the preceding step. Therefore, the vkv_{k} can be iteratively updated as:

The weighted reward wskw_{s_{k}} of the current step provides a measure of the quality and contribution of that specific step towards the overall solution. Based on mkm_{k} (where mk=K−km_{k}=K-k and KK is the total number of reasoning steps of a solution ss), previous quality value vk−1v_{k-1}, and rskr_{s_{k}}, we can update the definition of the weighted reward wskw_{s_{k}} iteratively as follows:

As kk increases, mkm_{k} decreases, indicating that fewer reasoning steps are needed to reach the correct answer. This leads to a higher weight placed on the weighted reward of the current step. We can also derive that wskw_{s_{k}} and vkv_{k} satisfy the expected boundedness shown in the theorem below.

If rskr_{s_{k}} is a sigmoid score ranged between $,then, thenw_{s_{k}}andandv_{k}definedasabovesatisfyfollowingboundedness:defined as above satisfy following boundedness:w_{s_{k}}\leq 1-v_{k-1},,v_{k}\in$.

Derivation. Please refer to the detailed derivation in Appendix B.1.

Therefore, we can conclude that wskw_{s_{k}} and vkv_{k} has following properties that match our expectations:

If a reasoning route starting from pkp_{k} requires more steps to get to the correct answer, then the single-step weighted reward wskw_{s_{k}} is lower. {observation} wskw_{s_{k}} decreases as the PRM’s predicted sigmoid score rskr_{s_{k}} rises. Thus, wskw_{s_{k}} has a positive correlation with the PRM’s prediction of a step’s correctness. {observation} vk→1  ⟺  rsk→0, mk=0v_{k}\to 1\iff r_{s_{k}}\to 0,\ m_{k}=0, i.e. vkv_{k} converges to upper bound 11 only when sks_{k} reaches the correct answer. Based on the features of vkv_{k} and wskw_{s_{k}}, we can directly predict the quality value of partial solutions and guide search once we have a precise PRM and accurate prediction of mkm_{k}. In our approach, instead of separately training models to predict rskr_{s_{k}} and mkm_{k}, we simply train a process reward model VθV_{\theta} to predict vkv_{k}, serving as a variant of common PRM. With reward incorporated in the calculation of vkv_{k}, there is no need to separately train a reward model, saving considerable effort for answer selection.

Process reward model guided tree search MCTS∗. Tree search methods like and require a value function VθV_{\theta} and outcome reward model rϕr_{\phi} to prune branches, evaluate final solutions and backup value. However, using ORM to evaluate final solutions and backpropagate means every search trace must be completely generated, which is costly and inefficient. Recent work suggests using a learned LLM value function in MCTS so the backup process can happen in the intermediate step, without the need for complete generations. Their work greatly improves search efficiency but still relies on an ORM to select the final answer. Drawing inspiration from these works, we further propose a new variant of MCTS, namely MCTS∗, which uses quality value vkv_{k} as a value target for a trained LLM-based process reward model and guidance for MCTS as well.

Given the above properties, we can directly use the process reward model VθV_{\theta} to evaluate the quality of any partial solution, select, and backpropagate in intermediate nodes. Aside from the use of quality value, we also incorporate a special Monte Carlo rollout method and self-critic mechanism to enhance efficiency and precision, which are explained detailedly in Appendix C.1. We express MCTS∗ as an algorithm that comprises four main stages in each iteration, namely node selection, thought expansion, greedy MC rollout, and value backpropagation. Similar to common MCTS settings, the algorithm runs on a search tree TqT_{q} for each single science reasoning question qq. Every tree node CC represents a series of thoughts or steps, where a partial solution pCp_{C}, number of visits nCn_{C}, and corresponding quality value vCv_{C} are recorded. For simplicity, we denote each node as a tuple C=(pC,nC,vC)C=(p_{C},n_{C},v_{C}). An overall pseudo-code for MCTS∗ is presented in Algorithm 2.

2 Self-Training ReST-MCTS∗ Pipeline

As shown in Figure 1, based on the proposed tree search algorithm MCTS∗, we perform self-improvement on the reasoning policy and process reward model. After initialization of the policy π\pi and process reward model VθV_{\theta}, we iteratively employ them and utilize the search tree TqT_{q} generated in the process to generate high-quality solutions for specific science or math questions and conduct a self-improvement process, called ReST-MCTS∗. Our work draws inspiration from the MuZero framework and applies it to the training of LLMs which we term “MuZero-style learning of LLMs”.

Instruction Generation. In this stage, initialization starts from an original dataset D0D_{0} for the training process reward model VθV_{\theta}.

∙\bullet Collect process reward for process reward model. The extraction of new value data is relatively more complex, we derive the target quality value of partial solutions of every tree node near a correct reasoning path on the pruned search tree Tq′T_{q}^{{}^{\prime}}. We first calculate mkm_{k} for every tree node CC that is on at least one correct reasoning trace (including the root) according to its minimum reasoning steps required to get to a correct answer in Tq′T_{q}^{{}^{\prime}}. Then, we use the hard estimation in Eq. (13) in to calculate rskr_{s_{k}}, i.e. rsk=1−rskHEr_{s_{k}}=1-r_{s_{k}}^{\text{HE}}, which means a reasoning step is considered correct if it can reach a correct answer in Tq′T_{q}^{{}^{\prime}}. Using mkm_{k} and rskr_{s_{k}}, we are able to derive the value of the partial solution of every node on or near one correct reasoning trace. For each node CC (with partial solution pC=[s1,s2,⋯ ,sk−1]p_{C}=[s_{1},s_{2},\cdots,s_{k-1}]) on at least one correct trace and a relevant forward step sks_{k}, we can derive the value vkv_{k} using Eq. (3) and weighted reward wkw_{k} using Eq. (4), with mkm_{k} set to the same as mk−1m_{k-1} if rskHE=0r_{s_{k}}^{\text{HE}}=0 in Eq. (13). A concrete and detailed example of this inferring process is shown in Figure 3. We update all these rewards and values starting from the root and collect all (Q,p,v)(Q,p,v) pairs to form DViD_{V_{i}} in ii-th iteration, which is used for training a process reward model in the next iteration.

∙\bullet Collect reasoning traces for policy model. As shown in Figure 4, the search process produces a search tree TqT_{q}, consisting of multiple reasoning traces. We first prune all the unfinished branches (branches that do not reach a final answer). Then we verify other traces’ final answers acquired in the tree search according to their correctness through simple string matching or LLM judging and select the correct solutions. These verified reasoning traces, as DGi(Aj=a∗)∣j=1ND_{G_{i}(A_{j}=a^{*})|_{j=1}^{N}} (where NN is the number of sampling solutions, AjA_{j} is the jj-th solution, and a∗a^{*} is the final correct answer) in ii-th iteration, are then used for extracting new training data for policy self-improvement. This process is followed by Eq. (15) (i≥1i\geq 1) to execute the policy self-training.

Mutual self-training for process reward model and policy model. Compared to previous work like ReSTEM{}^{\text{EM}} , which only concerns self-training for the policy and demonstrates that the policy can improve by iteratively generating new traces and learning from the high-reward ones generated by itself, our work simultaneously improves the process reward model and policy model self-training. With the process reward model’s training set DV0D_{V_{0}} initialized and new problem set DGD_{G} given, we can start the iterative self-training process upon VθV_{\theta} and π\pi. We use π\pi to perform MCTS∗ and generate solutions for DGD_{G}, with implement details illustrated in Section 3.1. In the ii-th (i=1,2,⋯ )i=1,2,\cdots) iteration, we train VθV_{\theta} with DVi−1D_{V_{i-1}} to obtain ViV_{i} and train policy model πSi−1\pi_{S_{i-1}} on DGiD_{G_{i}} to generate new generator πSi\pi_{S_{i}}. At the same time, DGiD_{G_{i}} drives the update of ViV_{i} to Vi+1V_{i+1}. We present iterative self-training that the process reward model and policy model complement each other in Algorithm 1.

Experiments

We validate ReST-MCTS∗ from three perspectives:

∙\bullet Self-Training approaches which use generated samples and evaluated for multiple iterations, such as ReSTEM{}^{\text{EM}} and Self-Rewarding, on in-distribution and out-of-distribution benchmarks under three LLM backbones, as shown in Table 2. ReST-MCTS∗ outperforms existing approaches in each iteration and continuously self-improves by data generated by itself.

∙\bullet Process Reward models which are compared with the state-of-the-art techniques, such as MATH-SHEPHERD (MS) and SC + MS on GSM8K and MATH500, as shown in Table 3. Results indicate ReST-MCTS∗ learns a good PRM and our reward model implements higher accuracy.

∙\bullet Tree-Search Policy which are compared on college-level scientific reasoning benchmark under three LLMs, such as CoT and ToT, as shown in Table 4. We also evaluated under the same search budget on MATH and SciBench, such as SC and Best-of-N, as shown in Figure 2. Results show the ReST-MCTS∗ significantly outperforms other baselines despite insufficient budget.

To obtain accurate feedback from the environment, we build the value model’s initial train set DV0D_{V_{0}} from a set of selected science or math questions D0D_{0} using process reward (value) inference, with no human labeling process required. Then, we finetune the ChatGLM3-6B and Mistral-7B model on this dataset, respectively, obtaining initial value models that, as variants of PRM, guide the LLM tree search for higher-quality solutions upon both math and science questions.

Fine-grained dataset for science and math. Aiming to gather value train data for science, we integrate questions of a lean science dataset DsciD_{sci} within SciInstruct into D0D_{0}. This dataset consists of 11,554 questions, where each question is paired with a correct step-by-step solution. For each question q(i)(i=1,2,⋯ ,N)q^{(i)}(i=1,2,\cdots,N) and corresponding solution s(i)=s1,2,⋯ ,Ki(i)s^{(i)}=s^{(i)}_{1,2,\cdots,K_{i}} in DsciD_{sci}, we extract all partial solutions to form samples dk(i)=[q(i),s1,2,⋯ ,k(i)(pk(i))](k=1,2,⋯ ,Ki)d_{k}^{(i)}=[q^{(i)},s^{(i)}_{1,2,\cdots,k}(p_{k}^{(i)})](k=1,2,\cdots,K_{i}). To make the value model distinguish false steps, we also employ a LLM policy (ChatGLM2) that is basically incompetent for reasoning tasks of this difficulty to generate single steps sk+1(i)′s_{k+1}^{(i)^{\prime}} given q(i)q^{(i)} and pk(i)p_{k}^{(i)}, obtaining new partial solutions pk+1(i)′=[s1,2,⋯ ,k(i),sk+1(i)′]p_{k+1}^{(i)^{\prime}}=[s_{1,2,\cdots,k}^{(i)},s_{k+1}^{(i)^{\prime}}] and new samples dk,j(i)=[q(i),s1,2,⋯ ,k(i),sk+1,j(i)′](j=1,2,3)d^{(i)}_{k,j}=[q^{(i)},s^{(i)}_{1,2,\cdots,k},s_{k+1,j}^{(i)^{\prime}}](j=1,2,3). For simplicity, the generated steps are regarded as incorrect. Afterward, we derive target quality values for all samples dk,j(i)d^{(i)}_{k,j} and dk(i)d_{k}^{(i)} and use them to construct DV0D_{V_{0}}, which is illustrated in Appendix B.1. We adopt an alternative method to generate value train data for math, as shown in Appendix B.1.

2 Evaluating Self-Improvement of ReST-MCTS∗

In order to thoroughly examine the influence of ReST-MCTS∗ self-training on varied backbones, we execute 2 iterations of self-training and compare two representative self-training approaches, ReSTEM{}^{\text{EM}}, which compares outcome reward with ground-truth answer, and Self-Rewarding, which judges outcome reward by LLMs, upon 3 different base models, namely LLaMA-3-8B-Instruct , Mistral-7B: MetaMATH and SciGLM-6B . Concerning the dataset for sample generation, since we are primarily interested in the continuous improvement ability of ReST-MCTS∗ in a specific domain, we mainly include math questions in the dataset. For simplicity, we use the same dataset DGD_{G} in each iteration. It involves questions selected from a train set of well-known benchmarks including MATH, GSM8K, and TheoremQA . With the policy and value model trained simultaneously on samples generated from DGD_{G}, we observe that our self-training paradigm enables continuous enhancement of the capabilities of both models on in-distribution and out-of-distribution benchmarks, regardless of which backbone is used.

∙\bullet Iterative performance improvement on policy model. Previous LLM self-training approaches mostly rely on the generating responses of LLM and assume each question with the correct solution is a high-quality sample while the intermediate reasoning steps are wrong or useless in many cases. Therefore, we compare the ReST-MCTS∗ with recent self-training paradigms by generating new samples under different reward (value) supervision strategies. For ReSTEM{}^{\text{EM}} and Self-Rewarding, the default sampling strategy is generating CoT data, with generated data refined according to ground truth or reward provided by the policy, respectively. In comparison, ReST-MCTS∗ generates data samples via MCTS∗, with data refined referring to quality value and ground truth. The results in Table 2 show that all three backbones can be continuously self-improved by data generated by itself, using ReST-MCTS∗ as a paradigm. ReST-MCTS∗ significantly outperforms previous self-training methods ReSTEM{}^{\text{EM}} and Self-Rewarding basically in each iteration. This means the ReST-MCTS∗ can screen out self-generated data of higher quality for better self-improvement.

∙\bullet Iterative performance improvement on reward model. We also compare how our iterative trained policy and value model can improve the overall search results under the same token usage on the test set of MATH . See implementation details in Appendix D.3. We show results in Figure 2 (a), where ReST-MCTS∗ (Iter #1) greatly outperforms most baselines but does not completely surpass Self-Consistency. In comparison, after more iterations of self-train, verification based on the enhanced value model basically outperforms Self-Consistency on every point, achieving the highest accuracy of 48.5%48.5\% that significantly exceeds the 42.5%42.5\% of Self-Consistency. This indicates the effectiveness of our self-training pipeline.

3 Evaluating Reward Guidance and Reasoning Policy of ReST-MCTS∗

Our main hypothesis in this paper is that a better search policy getting higher-quality traces can improve self-training. In this section, we mainly focus on whether our process reward guided MCTS∗ can gain improvement to get better samples over different reasoning tasks. We first evaluate the effectiveness of the value model itself standalone in Table 3 and then evaluate the performance of different reasoning policies in Table 4.

Performance comparison of various verification models. As suggested, different value models or reward models vary in accuracy and fineness. We perform tests on the questions of the GSM8K and MATH500 using multiple rewards (value) models and verification methods. It is worth noting that we include the same experiment settings of MATH-SHEPHERD (MS) as a comparison since it also adopts an automatic train data generation method for reward models. For SC+ReST-MCTS∗, we utilize the same CoT-based sampling strategy as MS, except that SC is performed according to our own value model’s output rather than the reward model of MS, which makes this a direct comparison of different reward model training approaches. We record the model accuracy of Mistral-7B: MetaMATH on the selected test set, which is as shown in Table 3. Results indicate that compared to MS and SC+MS, SC+ReST-MCTS∗ (Value) exhibits higher improvement in solution accuracy on both GSM8K and MATH. This confirms the effectiveness of our value model, further indicating that our definitions of quality value and weighted reward are valid or possibly even better.

Performance comparison under the same search budget. Though the MCTS-based search methods demonstrate significant improvement in model performance, they often require a considerable amount of token input and completion, which makes it quite costly in some circumstances. Therefore, we conduct more experiments to investigate the relationship between search token budget and model performance on science questions selected from SciBench comparing ReST-MCTS∗ and the same baselines employed for MATH, which are elaborated in Appendix D.3. Since our self-training procedure is primarily conducted on math data, so we do not consider the effects of self-training in this case. However, we point out that this can still be further investigated as a study of transfer learning for self-training paradigms. Figure 2 (b) shows the accuracy of different approaches when the completion budget changes. Results indicate that the ReST-MCTS∗ greatly outperforms other baselines despite insufficient budget. We notice that although CoT-based methods can improve greatly by increasing the sample budget, they tend to quickly converge to a limited accuracy, which is not as satisfying as the ReST-MCTS∗.

Performance comparison of different reasoning policies on benchmarks. To evaluate the effectiveness of ReST-MCTS∗, we perform benchmark experiments on SciBench in Tabel 4 and SciEval in Table 7. All benchmark setups are illustrated in Appendix D.2. For the backbone of models, large-scale models GLM4 and GPT-3.5-turbo (both API), as well as a small-scale model LLaMA2-13B-Chat are included. As shown in Table 4, with the experiment repeated for 22 times, we report the average accuracy scores (%) of 33 methods on 1010 subjects. Concerning overall accuracy, the ReST-MCTS∗ outperforms other baselines for all 33 models, with GLM4 improved over 4.0% and GPT-3.5-turbo over 3.1%. On specific subjects such as chemmc, quan, and stat, the ReST-MCTS∗ achieves significant improvement over 5.0%, indicating its great potential in discovering accurate solutions. Besides, we notice that our ToT baseline also performs well on many subjects, sometimes even surpassing ReST-MCTS∗. This reflects that our value model can provide appropriate guidance for tree-search-based methods. We also discovered that for LLaMA2-13B-Chat, the improvement is not very prominent. This reveals that small-scale policies may face difficulties when adopting complex tree search approaches since their capability for step-wise inference is relatively low.

Related Work

Large Language Models (LLMs) have emerged as a notable success in various natural language tasks. Recent studies focus on improving the reasoning capabilities of LLMs, including collecting high-quality or larger domain-specific data , designing elaborate prompting , or training supervised learning or reinforcement learning (RL) . When LLMs are trained with the RL algorithm, the generation of LLMs can be naturally expressed as the Markov Decision Process (MDP) and optimized for specific objectives. According to this formula, InstructGPT has achieved remarkable success in optimizing LLMs to align human preferences by utilizing RL from Human Feedback (RLHF) . RLAIF then uses AI feedback to extend RL from human feedback .

2 Large Language Model Reasoning

LLM reasoning algorithms include prompt-based chain-of-thought (CoT) , planning-based represented by tree-of-thought (ToT) . Scientific reasoning has several categories to mine the potential of existing large language models, resulting from different performances for problem-solving. Previous studies have attempted to outperform the direct generation. For example, in this paper , an approach for generating solutions in a step-by-step manner is proposed, another model or function is used to select the top-ranked answers, and hallucination is avoided by limiting the output to a narrower set. presents a maieutic prompting inference method, which can generate abductive explanations of various hypotheses explained by recursion, eliminate contradicting candidates, and achieve logically consistent reasoning. Chain-of-thoughts (CoT) imitates the thought process like humans to provide step-by-step solutions given a question. Self-Consistency CoT improves the reliability and Self-Consistency of answers by sampling multiple interpretations from LM and then selecting the final answer that appears most frequently. Tree-of-Thoughts (ToT) further generalizes the CoT methodology by considering multiple different reasoning paths in the tree and exploring coherent units of thought to execute thoughtful decision-making. In our work, we benchmark hard science reasoning tasks against .

Conclusion

In this paper, we propose ReST-MCTS∗, self-training both policy and process reward model by high-quality samples generated by reward guided tree search. Inferred rewards from the previous iteration are able to refine the process reward model and self-train the policy model with high-quality traces. Experimental results show that the ReST-MCTS∗ outperforms other self-training paradigms and achieves higher accuracy than previous reasoning baselines under the same search budget.

Limitation: We discussed limitation in detail at Section G in Appendix. In summary, we need to show the ReST-MCTS∗ can generalize to other reasoning tasks outside of math (like coding, agent, etc); and tasks without ground-truth (dialogue, SWE-Bench , etc). We also need to scale up the proposed value model and further improve the data filtering techniques. One potential idea is to incorporate online RL algorithms that can help perform better self-training for value models and policy models.

References

Part I Appendix

In this section, we briefly describe LLM reasoning, reward verification, and LLM self-training. The definitions for notations are in Table 5 and model comparison in Figure 6.

The use of reasoning approaches can significantly improve LLM problem-solving abilities . Given a policy model, π\pi (an autoregressive pre-trained language model) and an input problem QQ, π\pi can autoregressive generate an output sequence s=(s1,s2,⋯ ,sK)s=(s_{1},s_{2},\cdots,s_{K}) by predicting the next token. The conditional probability distribution of generating the complete output sequence is:

Any problem can be reasoned by zero-shot prompting, few-shot prompting , chain-of-thought (CoT) , Self-Consistency CoT or best-of-N (BoN) selection , tree-of-though (ToT) , Monte Carlo tree search (MCTS) , graph-of-thought (GoT) , amongst other approaches. Generally, recent studies represented by CoT aim to improve the overall performance as follows:

We often call each trajectory (s1,s2,⋯ ,sK)(s_{1},s_{2},\cdots,s_{K}) a reasoning trace. P(A=a∗∣s0,s1…,sK,Q)P(A=a^{*}\mid s_{0},s_{1}\dots,s_{K},Q) is the probability to get correct answer a∗a^{*} given a problem QQ and a reasoning trace ss. Given a original training dataset D={Q1,Q2,⋯ ,QM}D=\{Q_{1},Q_{2},\cdots,Q_{M}\}, a new dataset can be produced by sampling π\pi NN times per problem Q using the above-mentioned reasoning strategies:

As shown in Table 1, STaR , RFT , ReSTEM\text{ReST}^{\text{EM}} , V-STaR , and Self-Rewarding adopt CoT prompting. Step-by-step and MATH-SHEPHERD leverage the best-of-N selection as a reasoning evaluation strategy. TS-LLM utilizes MCTS as a reasoning policy to fully generate traces. Our work similarly seeks a correct reasoning path to maximize the expected cumulative PP.

A.2 Reward Verification

In the context of LLMs, we assume that the reasoning trajectory is derived from the policy model π\pi sampling. The common first step of self-training methods is fine-tuning the base model π\pi on the original dataset DS0D_{S_{0}} and obtaining a new generator πS0\pi_{S_{0}}. Besides, a reward rr is considered to evaluate the value of the history trace. The objective of reinforcement learning (RL) with reward r(Q,s)r(Q,s) is:

Recent works , through PRMs and ORMs, model the objective of reasoning as a search to find the highest cumulative reward trajectory ss to a problem QQ and infer the final answer AA.

where AsA_{s} is the golden answer (As=1A_{s}=1 if ss is correct else As=0A_{s}=0) and rsr_{s} is the ORM’s output sigmoid score. STaR , RFT , and ReSTEM\text{ReST}^{\text{EM}} consider the outcome reward as value label AsA_{s} compared with ground truth answer. In V-STaR , its outcome reward is generated by multi-iteration LLMs, and reward rr is defined via verifier πV\pi_{V} and LLM generator πS0\pi_{S_{0}} as follows:

β\beta is the hyper-parameter that controls the proximity of the reference policy πS0\pi_{S_{0}}. Different from V-STaR, the outcome rewards rr in self-rewarding is generated through LLM-as-a-Judge prompting using dataset DS0D_{S_{0}} and policy model πS0\pi_{S_{0}}. In both V-STaR and self-rewarding, collected DVERD_{\text{VER}} is built for training verifiers as follows:

dd is the number of preference pairs. However, previous works suggested PRMs demonstrate better supervision than ORMs among false positive solutions and provide more reliable feedback.

where AskA_{s_{k}} is the golden answer (Ask=1A_{s_{k}}=1 if sks_{k} is correct else Ask=0A_{s_{k}}=0) of sks_{k} and rskr_{s_{k}} is the PRM’s output sigmoid score. Specifically, regards PRM training as a three-class classification with costly human annotations. Similarly, MATH-SHEPHERD collects random rollout trajectories via BoN reasoning policy and synthesizes process rewards to construct the PRM training dataset autonomously. MATH-SHEPHERD defines the automated quality rskr_{s_{k}}, the potential to deduce the correct answer, for each reasoning step sks_{k} through hard estimation (HE) and soft estimation (SE), which are,

A.3 LLM Self-Training

Generation. Given a new training dataset DGD_{G}, self-training methods use generator πS0\pi_{S_{0}} to generate reasoning steps ss and final answer AA per problem QQ. In each iteration ii (i≥1i\geq 1), STaR, RFT, and ReSTEM{}^{\text{EM}} check the generated solutions DGiD_{G_{i}} with the binary correctness label zz and keeps the correct solutions (Aj=a∗)∣j=1N(A_{j}=a^{*})|_{j=1}^{N} as DGi(Aj=a∗)∣j=1ND_{G_{i}(A_{j}=a^{*})|_{j=1}^{N}}. Based on the continuous iteration on positive samples, V-STaR and Self-Rewarding keep the correct and incorrect generated solutions per problem QQ and train preference data pairs on constructed verifier data DVERD_{\text{VER}} with all data DGiD_{G_{i}}, so the πV\pi_{V} can learn the error patterns produced by a generator in each iteration ii. Then, the generator πSi−1\pi_{S_{i-1}}, here is πS0\pi_{S_{0}}, is fine-tuned on new generated dataset DGi(Aj=a∗)∣j=1ND_{G_{i}(A_{j}=a^{*})|_{j=1}^{N}} and again is updated as generator πSi\pi_{S_{i}}. This process is continuously running in subsequent iterations. Their iterative process and reward value are as follows:

where i=1i=1 for RFT and i≥1i\geq 1 for STaR, ReSTEM{}^{\text{EM}}, V-STaR, and Self-Rewarding.

Improvement. The practical way to accomplish reasoning tasks on DS0D_{S_{0}} is supervised fine-tuning (SFT) that trains a policy model by minimizing the negative log-likelihood loss on the training dataset:

Recent offline preference learning methods replace LLM verifiers (before being trained on LLM generator and binary classification) with DPO . The training DPO objective for a verifier πV\pi_{V} is described as follows:

Appendix B Deduction Demonstration

Weighted Value. Recall the definition of the weighted reward:

And we know that rsk∈r_{s_{k}}\in. Now, let’s examine the maximum possible value of the term (1−2rsk)(1-2r_{s_{k}}). Since rsk∈r_{s_{k}}\in, the maximum value of (1−2rsk)(1-2r_{s_{k}}) occurs when rsk=0r_{s_{k}}=0. In this case, (1−2rsk)=1(1-2r_{s_{k}})=1. Therefore, we can conclude that −1≤(1−2rsk)≤1-1\leq(1-2r_{s_{k}})\leq 1.

Next, let’s consider the denominator, (mk+1)(m_{k}+1). Since mk=K−km_{k}=K-k, and K>=kK>=k, we have mk>=0m_{k}>=0 and mk+1>=1m_{k}+1>=1. Therefore, we can conclude that (mk+1)>=1(m_{k}+1)>=1.

Combining these results, we can rewrite the weighted reward as follows:

Hence, we deduce that wsk≤∣1−vk−1∣w_{s_{k}}\leq|1-v_{k-1}|, which indicates that the weighted reward is bounded by the absolute value of the difference between 1 and the previous quality value.

Quality Value. Recall that the quality value vkv_{k} is determined by incorporating the previous quality value vk−1v_{k-1} and the weighted reward wskw_{s_{k}} of the current step. The specific definition of vkv_{k} may depend on the context or specific formulation, but let’s consider a general case.

Assuming the weighted reward wskw_{s_{k}} is also bounded within the range $(whichisareasonableassumptionforaqualitymeasure),wecananalyzethepotentialrangeof(which is a reasonable assumption for a quality measure), we can analyze the potential range ofv_{k}$ as follows:

Lower Bound: Since vkv_{k} is calculated based on the weighted reward, and the weighted reward is non-negative (wsk≥0w_{s_{k}}\geq 0), it follows that vkv_{k} cannot be smaller than the previous quality value vk−1v_{k-1}.

Upper Bound: If we assume that the weighted reward can be at most 1 (wsk≤1w_{s_{k}}\leq 1), then the maximum value of vkv_{k} would be obtained when wsk=1w_{s_{k}}=1. In this case, vkv_{k} can be at most 1+vk−11+v_{k-1}.

Combining these bounds, we can conclude that vkv_{k} is confined within the range [vk−1,1+vk−1][v_{k-1},1+v_{k-1}]. However, since vk−1v_{k-1} itself is confined within $(assuming(assumingv_{k-1}iswithinthevalidrange),wecanfurtherrefinetherangeofis within the valid range), we can further refine the range ofv_{k}toto$.

Therefore, based on the properties of the weighted reward and the definition of the quality value, we can deduce that vkv_{k} is indeed confined within the range $$.

Fine-grained dataset for math. We adopt an alternative method to generate value train data for math. For this method, we only demand a correct final answer a∗a_{*} for each question qq, which is simpler to satisfy. Specifically, we integrate the MATH train set into D0D_{0}. For each question q(i)q^{(i)} and answer a∗(i)a^{(i)}_{*}, we use Mistral-7B: MetaMATH as a policy to generate solution traces in a simple Breadth-first-search (BFS) manner, obtaining a search tree Tq(i)T_{q}^{(i)} similar to the one of the self-training process. Subsequently, we verify the obtained answers of all leaf nodes of Tq(i)T_{q}^{(i)} according to a∗(i)a_{*}^{(i)}. The verified search trees are then used to derive data samples with target values for DV0D_{V_{0}}.

∙\bullet Construction of value model training set. Previous approaches like that employ PRMs usually require human annotation to initialize a train set, which is quite costly. In comparison, our value model’s initial training set can be constructed at a lower expense.

For math data, we deploy the same approach mentioned in section 3.2 to infer process rewards and quality values of partial solutions within the verified search tree Tq(i)T_{q}^{(i)}. While for science data, this value-inferring process is slightly different. We still derive the target value of pk(i)p_{k}^{(i)} based on the definition in Eq. (3) and Eq. (4). Under the assumption that original solutions are reliable and concise, we can simply regard s(i)s^{(i)} as the globally optimal reasoning path for q(i)q^{(i)}. Therefore, we derive that:

Derivation. Please refer to the detailed derivation for Eq. (20) in Appendix B.2.

In contrast, for generated false samples, we set rsk+1(i)′=1r_{s_{k+1}}^{(i)^{\prime}}=1, mk+1(i)′=Ki−km_{k+1}^{(i)^{\prime}}=K_{i}-k (since still Ki−kK_{i}-k correct reasoning steps required to reach final answer). Considering that vk(i)=kKiv_{k}^{(i)}=\frac{k}{K_{i}}, we have:

Derivation. Please refer to the detailed derivation for Eq. (21) and Eq. (22) in Appendix B.2.

Collecting all samples and their corresponding derived quality values, we acquire the initial training set DV0D_{V_{0}} for value model VθV_{\theta}, as described in Appendix D.1.

B.2 Detailed Deduction for Weighted Value and Quality Value

Here, we deduce the weighted reward using Eq. (4) and quality value using Eq. (3):

Then, we deduce the Eq. (21) and Eq. (22):

Appendix C Algorithm Detail and Process Example

Node selection. Similar to , we propose to start each selection process from the initial root, since this allows backtracking. Within each iteration, the node selection stage is first executed, where a leaf node CselectC_{select} is hierarchically selected starting from the initial root. To incorporate the quality value of nodes, we use UCB as the criterion to select a child rather than the UCT , which is as follows:

where nparentn_{parent} is the number of visits of the parent node of CC, ϵ\epsilon is a exploration constant. For each intermediate node, we select its child with maximum UCB. This criterion considers both quality value and visit count, thus it encourages the exploration of high-quality nodes while leaving some opportunity for underexplored nodes.

Thought expansion. Secondly, the value of the selected node CselectC_{select} is compared with a threshold ll (in our experiments, ll it is set to 0.90.9). If the vCselect>=lv_{C_{select}}>=l, the node’s recorded partial solution pCselect=[s1,s2,⋯ ,sk]p_{C_{select}}=[s_{1},s_{2},\cdots,s_{k}] is deemed acceptable as a final solution (since vCv_{C} get close to 11 only when CC is close to correct final answer), which is then directly returned as output, terminating the algorithm. This is different from the method adopted by since no reward model estimation is required. Otherwise, the expansion stage is initiated, where new solution steps sk+1,i(i=1,2,⋯ ,b)s_{k+1,i}(i=1,2,\cdots,b) are sampled by prompting the policy πS0\pi_{S_{0}}, i.e. sk+1,i∼πS0(s1,2,⋯ ,k∣q)s_{k+1,i}\sim\pi_{S_{0}}(s_{1,2,\cdots,k}|q), bb is the number of samples or branches. Subsequently, new nodes Ci=([s1,s2,⋯ ,sk,sk+1,i],0,vCi)C_{i}=([s_{1},s_{2},\cdots,s_{k},s_{k+1,i}],0,v_{C_{i}}) are added to TqT_{q} with vCiv_{C_{i}} assigned by the value model, vCi←Vθ(pCi∣q)v_{C_{i}}\leftarrow V_{\theta}(p_{C_{i}}|q). Note that we also incorporate a self-critic mechanism into this expansion process, which will be illustrated later.

Greedy MC rollout. and use a simplified three-stage iteration that doesn’t include a simulation process on leaf nodes. In contrast, we believe that a simulation process still brings about useful information for value estimation, despite the rise in generation and time cost. In this stage, we propose to simulate a few steps upon the new node CiC_{i} with maximum predicted value. Reasoning steps starting from this node will be sampled step-by-step and evaluated, while only the most valuable path is further explored, until a step limit mm is reached. The highest quality value acquired in the sampling process vmaxv_{max} is recorded and used to update vCiv_{C_{i}} with a weight parameter α\alpha following:

Besides, the visit count nCin_{C_{i}} is also updated by nCi←nCi+1n_{C_{i}}\leftarrow n_{C_{i}}+1.

Value backpropagation. Finally, we conduct value backup starting from CselectC_{select}. The value of every parent node of CselectC_{select} is updated using a weighted average method. For every node CC on the trace from root to CselectC_{select}, we update its nCn_{C} and vCv_{C} as follows:

where Ci(i=1,2,⋯ ,b)C_{i}(i=1,2,\cdots,b) are the children of CC. This actually updates the value of CC according to its children’s value expectation.

Determine termination via self-critic. Although the value model provides accurate evaluation for partial solutions, it cannot consistently signal logical termination, especially when the inference model reaches a false conclusion. Consequently, even when a false final answer is generated, further exploration beneath this node may still be conducted, leading to reduced search efficiency. Therefore, we propose to use self-critic to provide extra timely signals of logical termination that avoid unwise exploration as well as insight into deeper search. Specifically, we prompt the inference model to generate an End of Inference (EoI) signal or offer advice oo on following exploration steps based on existing partial solutions pp before each expansion stage. The expansion and MC rollout stage will be skipped if an EoI signal is received. Otherwise, the advice will be utilized in the following expansion stage as part of the inference prompt, so πS0\pi_{S_{0}} generates new steps based on both oo and pp. An overall pseudo-code for ReST-MCTS∗ is presented in Algorithm 2.

C.2 Data Generation Process and Specific Example for Reward Inference

The data generation process of our self-training approach consists of mainly 44 stages, namely search, prune, verify, and reward inference, which is demonstrated in Figure 4. For reward inference, a detailed example is shown in Figure 3.

Appendix D Experimental Details

Initialization of value model. We split DV0D_{V_{0}} and use the train set to finetune ChatGLM3-6B and Mistral-7B to predict the value of partial solutions. We simply add a linear layer to the model to directly transform probabilities to a scalar value. Moreover, we use the AdamW optimizer and MSE loss in Eq. (37) to optimize, eventually obtaining an initial value model VθV_{\theta} that can evaluate the correctness and completeness of step-by-step solutions. Note that the learning rate is set to 1e-6 in this process. The MSE training loss is shown below:

Evaluation of value model. We use the test set containing 14k data samples to evaluate the value model with an absolute tolerance of 0.10.1:

where tt is the number of test data samples, qiq_{i} is the question of sample ii, pip_{i} is the partial solution of sample ii and vi∗v_{i}^{*} is the target value of sample ii. Our initial value model achieves an accuracy of 69.3%, which means it is reliable in most situations. We also conducted a study to measure the value model’s performance on science benchmark SciBench compared to outcome-supervised reward models and self-critic methods in Table 6.

D.2 Benchmark Setup

To compare the performance of different search methods, we construct a standardized benchmark test that can be generally used on labeled science or math datasets like MATH, SciBench, and SciEval. Aside from the ReST-MCTS∗, we incorporate two other baselines: chain-of-thought (CoT) and tree-of-thought (ToT). For each method, specialized prompts PP are designed to execute the search process. Besides, an inference model π\pi and value model VV are deployed to provide deduction and feedback. Concerning the CoT baseline, we use Self-Consistency to calculate accuracy. For the ToT baseline, we use a simple greedy depth-first search (DFS) algorithm with node values assigned by the value model. The algorithm stops exploitation when a max depth of 1010 is reached and ends when a node value exceeds the threshold 0.90.9. For ReST-MCTS∗, self-critic is used and the ending threshold is also set to 0.90.9. The rollout step limit mm is set to 22, α\alpha is set to 0.50.5, and the number of iterations TT is set to 5050 by default. Moreover, both tree search algorithms use b=3b=3 by default, where bb is the number of samples generated in the expansion process as mentioned in the former sections. After the search process, the policy is prompted to extract the final answer based on the obtained solution, which is then compared with the ground truth to determine correctness. The results of these methods on benchmarks are illustrated in Section 4.3.

D.3 Baselines of Search Verification

The basic settings of relevant verification baselines are illustrated as follows:

ORM+Best-of-N For simplicity, we employ the ORM used by , which is trained on SciInstruct. For each question, we sample NN solutions and select the solution with the highest ORM score as output. NN is used to control token usage.

ReST-MCTS∗ Implementation of ReST-MCTS∗, using the value model VθV_{\theta} as PRM to guide MCTS∗. The variable controlling token usage is the iteration number TT and branch parameter bb.

Self-Consistency NN solutions are generated for each question using a simple CoT prompt. Their final answers are then extracted and classified, with the most frequently occurring answer selected as the final output. NN is used to control token usage.

PRM+Best-of-N With value model VθV_{\theta} used as PRM, we perform DFS-based tree search. Every selected solution ss is evaluated by a PRM score rPRM=Πi=1Kvir_{PRM}=\Pi_{i=1}^{K}v_{i}. The one with the highest PRM score among all NN solutions is regarded as the final output. Under this setting, bb is set to 33, while NN is used to control token usage.

D.4 Value model of ReST-MCTS∗ on SciBench

We employ the reward model obtained by (which is used as a classifier for SciGLM) as the ORM and our fine-grained value model as PRM to provide the outcome reward and step-wise value respectively. We also include the Self-Rewarding method, where the policy model itself is instructed to provide step-wise value. For all methods, the number of samples for each step is set to 33. Using this setting, we record the model accuracy of GLM4 and GPT-3.5-turbo on the selected questions, which are as shown in Table 6. Results indicate that compared to ORM and Self-Rewarding, PRM-based methods exhibit higher accuracy. This confirms the effectiveness of our value model. In addition, Figure 5 concerns the total consumption of the token budget, including all prompt tokens and completion tokens. However, we still have to note that the total token usage (especially prompt tokens) of the ReST-MCTS∗ increases rapidly as hyper-parameters bb and TT rise.

D.5 ReST-MCTS∗ on SciEval

SciEval. Similar to SciBench, we perform benchmark tests on SciEval. Results are shown in Table 7. For both GLM4 and GPT-3.5-turbo, ReST-MCTS∗ again outperforms other baselines in overall accuracy, with an accuracy of 79.87%79.87\% and 62.31%62.31\% respectively. However, we notice that though tree-search-based methods demonstrate an advantage on average, they fail to improve the performance of the CoT baseline on some parts of SciEval. We examine the data distribution and discover that these parts are basically all single-choice questions. As they are less difficult compared to other types of questions, the Self-Consistency CoT approach may already be competent. Besides, these questions often require few reasoning steps, which may be the main reason why tree search methods do not perform as well as expected.

Appendix E Prompt and Instruction Examples

We present some instruction examples used in ReST-MCTS∗ and self-training process in this section, including:

Inference instruction This instruction is used in tree search for the policy to generate new steps based on previous self-critic information.

Self-critic instruction Used for generating the EoI signal or advice for further search.

LLM verify instruction This instruction is employed in the data generation process of self-training when an answer needs verification by LLM (GPT-4 for our case).

This is an example of inference instruction.

Instruction: Given a science or math problem, a corresponding solution that may be incomplete as well as some advice on solving this problem, your task is to generate a new solution step based on the advice and existing steps.

Problem: Let aa and bb satisfy ab=7ab=7 and a+b=5a+b=5. What is the value of a2+b2a^{2}+b^{2}?.

Step 1: From a+b=5a+b=5, we can know that (a+b)2=25(a+b)^{2}=25.

Advice: From step 2 we know the value of a2+2ab+b2a^{2}+2ab+b^{2}. Since we also know the value of abab, we can derive a2+b2a^{2}+b^{2}.

Policy Output: Since a2+2ab+b2=25a^{2}+2ab+b^{2}=25 and ab=7ab=7, we derive a2+b2=(a2+2ab+b2)−2ab=25−14=11a^{2}+b^{2}=(a^{2}+2ab+b^{2})-2ab=25-14=11.

This is an example of self-critic instruction.

Instruction: Given a science or math problem and a corresponding solution that may be incomplete, your task is to judge whether the solution has already reached a final answer or conclusion for the problem. If the solution has already reached a final answer or conclusion, you should directly output "Final answer reached". Otherwise, you should give some advice on how to solve the problem based on current steps or what to consider next.

Problem: Let aa and bb satisfy ab=7ab=7 and a+b=5a+b=5. What is the value of a2+b2a^{2}+b^{2}?.

Step 1: From a+b=5a+b=5, we can know that (a+b)2=25(a+b)^{2}=25.

Policy Output: The solution has not reached a final answer. Advice: From step 2 we know the value of a2+2ab+b2a^{2}+2ab+b^{2}. Since we also know the value of abab, we can derive a2+b2a^{2}+b^{2}.

This is an example of LLM verify instruction.

Instruction: Given a science or math problem, a corresponding step-by-step solution, and the true answer of the problem, your task is to verify the answer obtained in the solution with the real answer. If the answer obtained in the solution is equivalent to the real one, output ’1’, otherwise output ’0’.

Problem: Let aa and bb satisfy ab=7ab=7 and a+b=5a+b=5. What is the value of a2+b2a^{2}+b^{2}?.

Step 1: From a+b=5a+b=5, we can know that (a+b)2=25(a+b)^{2}=25.

Step 3: Since ab=7ab=7, we can derive that a2+b2=(a2+2ab+b2)−2ab=25−14=11a^{2}+b^{2}=(a^{2}+2ab+b^{2})-2ab=25-14=11. So the answer is 1111.

Real Answer: The value of a2+b2a^{2}+b^{2} is 1111.

Appendix F Further Preliminaries of MCTS and LLM Reasoning with MCTS

MCTS is a search algorithm for optimal decision-making in large and complex combinatorial spaces. This algorithm represents search spaces as search trees and works on the principle of the best-first search based on the evaluations of stochastic simulations. This technique has been widely employed in multiple gaming scenarios and achieved tremendous success, such as AlphaGo and AlphaZero for computer Go Game. The basic MCTS algorithm involves iteratively search process with four steps for building a search tree:

(1) Selection. The agent, starting from an empty tree’s root node, traverses the search tree’s visited nodes and selects the next node according to the given selection strategy until the scalable node or leaf node is reached.

(2) Expansion. If this algorithm arrives at an expandable node, it expands the search tree by selecting an unvisited child node.

(3) Simulation. After finishing the expansion, if the current node is in a non-terminal state, the algorithm will conduct one or multiple independent simulations from the current node until it reaches the terminal state. In this process, the actions are chosen at random.

(4) Backpropagation. The node statistics on the path from the current node to the root are updated based on the search results. Note that the scores assessed are based on the termination state achieved.

To trade off the less tested paths with the best strategy identified so far, MCTS maintains a proper balance between exploration and exploitation by maximizing the Upper Confidence Bounds for Trees (UCT) when a child node kk is selected as follows, UCT=X‾k+2Cp2ln⁡nnkUCT=\overline{X}_{k}+2C_{p}\sqrt{\frac{2\ln n}{n_{k}}}: where the first term, X‾k\overline{X}_{k}, is the average reward form arm kk and this term encourages the exploitation of higher-reward choices. It is generally understood that X‾k\overline{X}_{k} to be within . In the second exploration term, Cp>0C_{p}>0 is a constant to satisfy the Hoeffding inequality with rewards in the range . nn is the number of times the current node has been visited and nkn_{k} is the number of times child kk has been visited. Generally, nk=0n_{k}=0 produces a UCT value of ∞\infty, so that all children of a node have a non-zero probability and are considered.

F.2 LLM Reasoning with Monte Carlo Tree Search

LLMs have been invented, used in the past for autoregressive text generation, and are now very great at reasoning. Reasoning algorithms include prompt-based chain-of-thought (CoT) , planning-based represented by tree-of-thought (ToT) , which successfully achieved the LLMs’ reasoning performance improvement. ToT combines the power of tree search (e.g., depth/breadth-first search) as an algorithm and LLMs’ power as a heuristic to tradeoff evaluation and generation. Reasoning via Planning (RAP) with Monto Carlo Tree Search (MCTS) performs reasoning exploration and obtains reward reasoning paths.

Recent studies present that Monte Carlo Tree Search (MCTS) agents benefit from task-specific extension and expansion of the research tree. Specifically, the MCTS agents provide appropriate selection strategies for the state of the visit to guide the upcoming search based on the evaluation results (e.g., rewards and number of times the node has been visited) produced by the rollout and backpropagation process. Its mechanism coordinates exploration and thought exploitation within search space, which is superior to traditional depth-first search (DFS) or breadth-first search (BFS) algorithms based on the Tree of Thought (ToT). Building on MCTS, some studies have also explored the ability of the reasoning agent to provide search guidance. In catalyst design, proposed Monte Carlo Thought Search, using LLM for complex scientific reasoning queries. presents Reasoning via Planning (RAP), which adopts MCTS as a planning algorithm and repurposes the LLM as both a world model and a reasoning agent. Others like experiment using the value function, a byproduct of the Proximal Policy Optimization (PPO) process, to guide the token-level decoding based on MCTS. In general, these approaches improve LLM’s reasoning ability, whereas their performance on some challenging science tasks remains unsatisfying. In addition, this series of methods differs from our contribution, where we propose a value model approach as reward functions for optimizing the reasoning path and improving model output.

Appendix G Limitations

In this section, we discuss some limitations of the ReST-MCTS∗.

Generalization to other tasks, especially those without labels. Similar to many existing self-training works, ReST-MCTS∗ also relies on ground-truth oracle labels in a supervised dataset to filter the responses in the first place; in the future, we need to show ReST-MCTS∗ can generalize to other reasoning tasks outside of math (like coding, agent, conversation, etc); in addition, for those very complicated tasks that require multistep planning and reasoning (like implementing the whole software like SWE-Agent), which does not have ground-truth answers, we need to propose a better way to collect reward feedback (from few human labeling and symbolic execution or solver), and train a generalizable reward model that can work and help for a wider range of tasks.

Scale and diversity of proposed value model. Although we trained a value model based on Mistral-7B: MetaMATH that performs better than the most advanced value model MATH-SHEPHERD, a larger scale value model backbone is still needed for better PRM training. In addition, the initial training set of the training proposal PRM was generated by SciGLM, a model that focuses on mathematical and scientific reasoning tasks but still lacks generality. While the current PRM achieves the best results on multiple mathematical and scientific reasoning tasks, such as MATH and SciBench, it’s worth exploring more diverse training sets to expand into various fields in the future, such as code generation and agent planning.

Self-training data filtering techniques. As we mentioned in Section 1, the quality of reasoning trajectory affects the effectiveness of self-training, and generating a high-quality training set plays an important role. Therefore, we train the iterative process reward model to guide the tree search direction to obtain high-quality trajectories. On the other hand, since well-trained value models can help filter out the top-k generated trajectories with the highest process values, we also expect that a stronger and larger LLM model as the backbone of the value model might help to gain more.

Appendix H Broader Impact

ReST-MCTS∗ aims to introduce a general self-training approach that uses MCTS∗ to automatically label and generate process rewards, which will help generate high-quality datasets and improve the reasoning capabilities of LLMs. Fine-tuning a variety of LLMs on synthesized high-quality datasets can directly improve the performance of value models and generators and help to avoid the cost of manually generating process rewards during the training process reward model. The disadvantage is that a single reward model cannot be scaled to multiple domains, and we can solve this problem by training various reward models together on various reasoning domains. We believe that on the whole, the advantages outweigh the disadvantages.

Appendix I Reproducibility

We have made significant efforts to ensure the reproducibility of our all experimental results. The training code, tree search algorithm, and the evaluation details for the ReST-MCTS∗ are public in our repository.

Training. Detailed training information about the value model, self-training backbones, and experimental settings can be found in Section 4.1.

Tree Search Algorithm. Regarding the enhanced tree search algorithm MCTS∗, please refer to the Algorithm 1 and public code.

Evaluation. We organized all evaluations, including the iterative self-training and value model, a variety of value models, performance comparison under the same search budget, and different reasoning policies. All details can be found in Section 4.2 for self-improvement evaluation and Section 4.3 for value models and reasoning policies comparison.