An Empirical Analysis of Compute-Optimal Inference for Problem-Solving with Language Models

Yangzhen Wu, Zhiqing Sun, Shanda Li, Sean Welleck, Yiming YangSubmission to NeurIPS 2024 · Rejected

TL;DR

While training-time compute scaling (e.g., Chinchilla laws) is well-understood, how to optimally spend compute during inference remains an open question. This paper explores "compute-optimal inference" for mathematical reasoning, introducing REBASE (Reward Balanced Search)—a lightweight tree-search algorithm guided by a process reward model. The authors show that smaller models paired with smart search can match or outperform 4× larger models while consuming roughly 2× fewer FLOPs.

What Problem Does This Paper Address?

Techniques like Best-of-$N$ sampling, majority voting, and Monte Carlo Tree Search (MCTS) improve LLM reasoning at the expense of extra test-time compute. However, standard MCTS generates many intermediate branches that never lead to final solutions, making it computationally wasteful. Conversely, parallel sampling ignores intermediate step verification and quickly plateaus.

Given a fixed inference FLOP budget $C$, what is the optimal split between model size $N$ and generated tokens/search steps $T$? This work establishes an empirical and theoretical foundation for compute-optimal inference in multi-step problem solving.

Methods

The authors analyze various test-time strategies: Greedy Decoding, Best-of-$N$ (rejection sampling), Majority Voting, Weighted Majority Voting (weighting answers by reward scores), standard MCTS, and their proposed search method:

  • REBASE (REward BAlanced SEarch): A tree-search decoding method designed to fix the inefficiencies of MCTS. Instead of running expensive child rollouts to estimate node values, REBASE uses a step-level Process Reward Model (PRM) to score intermediate reasoning steps directly. At each tree depth $i$, REBASE allocates its remaining sample budget $B_i$ across candidate nodes proportionally via a softmax over their PRM rewards: $$W_j = \text{Round}\left(B_i \frac{\exp(R(n_j)/T_b)}{\sum_k \exp(R(n_k)/T_b)}\right)$$ This balances pruning bad steps with exploiting promising paths while ensuring candidate solutions reach completion for downstream voting.

  • Theoretical Upper Bounds: The authors prove that both standard majority voting and weighted voting inevitably saturate as the number of samples $N \to \infty$. However, as long as the reward model ranks correct answers above incorrect ones in expectation, weighted voting converges to a strictly higher accuracy bound.

Datasets

The authors evaluate on standard math reasoning benchmarks:

  • Evaluation Benchmarks:
  • MATH500: A 500-problem challenging competition-level math benchmark subset.
  • GSM8K: Grade-school math word problems testing multi-step arithmetic.
  • Training / Fine-Tuning Datasets:
  • MetaMath: Used for full-parameter supervised fine-tuning (SFT) of policy models (formatted into stepwise rationales).
  • Math-Shepherd: A synthetic step-level process supervision dataset used to train the 34B Process Reward Model (PRM).
  • Note: No new datasets were introduced.

Key Insights and Ideas

  • Smaller Models + Advanced Search Can Beat Larger Models: A 7B model utilizing REBASE matches or outperforms a 34B model running standard decoding while requiring ~2× fewer total inference FLOPs.
  • MCTS Underperforms Naive Sampling under Compute Constraints: Standard LLM-MCTS wastes too much compute evaluating abandoned paths, yielding fewer complete solutions for voting and worse overall Pareto efficiency than simple sampling.
  • Weaker Models Gain More from Search: Improvements from tree search over naive sampling are inversely proportional to base model strength. On MATH, Mistral-7B, Llemma-7B, and Llemma-34B gained +5.3%, +3.3%, and +2.6% accuracy, respectively.
  • Inference Compute Scaling Law: By fitting power-law curves ($N_{opt} \propto C^a$, $T_{opt} \propto C^b$), the authors find $a \approx 1.0$ and $b \approx 0.0$. Once inference search hits its saturation threshold (e.g., 32–64 samples), further test-time compute is inefficient; additional compute budget should instead be directed toward scaling the model size $N$.

Key Results

  • Pareto-Optimal Trade-offs (MATH500):
  • Llemma-7B + REBASE (32 samples) achieves 46.8% accuracy at $1.48 \times 10^{14}$ FLOPs, beating Llemma-7B + Sampling (256 samples) (45.5% at $10.0 \times 10^{14}$ FLOPs)—nearly a 7× FLOP reduction for higher accuracy.
  • Llemma-7B + REBASE (32 samples) (46.8%) matches the much larger Llemma-34B + Sampling (64 samples) (46.7%), while using nearly 8× fewer FLOPs ($1.48 \times 10^{14}$ vs. $12.1 \times 10^{14}$).
  • Llemma-34B + REBASE (32 samples) achieves the highest overall accuracy on MATH500 at 49.2%.
  • GSM8K:
  • Mistral-7B + REBASE + Weighted Voting (32 samples) achieves 89.8%, surpassing 32-sample standard sampling (89.1%).
  • Voting Comparison: Weighted Majority Voting consistently dominates Best-of-$N$ and unweighted Majority Voting across models, though REBASE substantially closes the gap between unweighted and weighted voting because candidate traces are already pre-filtered for quality.

Limitations and Future Work

  • Domain Restriction: Empirical validation is limited exclusively to math problem solving; applicability to code generation, planning, or general open-ended generation is untested.
  • Limited Scale Exploration: Experiments only evaluated 7B and 34B models. Finer-grained scaling (e.g., 1B, 3B, 13B, 70B+) is necessary to establish precise scaling coefficients across diverse architectures.
  • Single Training Corpus: Generators were fine-tuned primarily on MetaMath; future work should explore how different pre-training and alignment distributions affect inference compute efficiency.

Summary updated

Abstract

The optimal training configurations of large language models (LLMs) with respect to model sizes and compute budgets have been extensively studied. But how to optimally configure LLMs during inference has not been explored in sufficient depth. We study compute-optimal inference: designing models and inference strategies that optimally trade off additional inference-time compute for improved performance. As a first step towards understanding and designing compute-optimal inference methods, we assessed the effectiveness and computational efficiency of multiple inference strategies such as Greedy Search, Majority Voting, Best-of-N, Weighted Voting, and their variants on two different Tree Search algorithms, involving different model sizes (e.g., 7B and 34B) and computational budgets. We found that a smaller language model with a novel tree search algorithm typically achieves a Pareto-optimal trade-off. These results highlight the potential benefits of deploying smaller models equipped with more sophisticated decoding algorithms in end-devices to enhance problem-solving accuracy. For instance, we show that the Llemma-7B model can achieve competitive accuracy to a Llemma-34B model on MATH500 while using 2× less FLOPs. Our findings could potentially apply to any generation task with a well-defined measure of success.
BibTeX
@misc{wu2024empirical,
  author = {Yangzhen Wu and Zhiqing Sun and Shanda Li and Sean Welleck and Yiming Yang},
  title = {{An Empirical Analysis of Compute-Optimal Inference for Problem-Solving with Language Models}},
  year = {2024},
  eprint = {2408.00724},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.00724},
}

Loading related content...

Figure