arXiv:2502.12468cs.LGcs.AI2025-02被引 33

用树搜索提升代码评估的可靠性,效果远超现有方法。

MCTS-Judge: Test-Time Scaling in LLM-as-a-Judge for Code Correctness Evaluation

  • 引入蒙特卡洛树搜索,分步多视角分析代码
  • 准确率从41%提升至80%,用3倍少的token超越o1模型
  • 适合需要深度推理的代码质量评估场景

LLM作为评判者在生成内容评估中展现出潜力,但在编程等推理密集型任务中仍缺乏可靠性。受近期推理模型进展和缩放定律变化启发,我们首次将测试时计算引入LLM-as-a-Judge,提出MCTS-Judge——一种资源高效的、类系统2思维的代码正确性评估框架。该方法利用蒙特卡洛树搜索(MCTS)将问题分解为更简单的多视角评估。通过结合当前轨迹历史动作的自我评估与基于先前回溯的置信上界(UCB),MCTS-Judge平衡全局优化与当前路径细化。我们还设计了高精度的单元测试级奖励机制,促使大语言模型进行逐行分析。在三个基准数据集和五种LLM上的实验表明,MCTS-Judge将基线模型准确率从41%提升至80%,且仅需o1系列模型3倍的令牌数即实现超越。进一步评估验证了其推理轨迹在逻辑性、分析深度、完备性和整体质量上的优势,并揭示了LLM-as-a-Judge范式的测试时缩放规律。

原文摘要 · Abstract (English)

The LLM-as-a-Judge paradigm shows promise for evaluating generative content but lacks reliability in reasoning-intensive scenarios, such as programming. Inspired by recent advances in reasoning models and shifts in scaling laws, we pioneer bringing test-time computation into LLM-as-a-Judge, proposing MCTS-Judge, a resource-efficient, System-2 thinking framework for code correctness evaluation. MCTS-Judge leverages Monte Carlo Tree Search (MCTS) to decompose problems into simpler, multi-perspective evaluations. Through a node-selection strategy that combines self-assessment based on historical actions in the current trajectory and the Upper Confidence Bound for Trees based on prior rollouts, MCTS-Judge balances global optimization and refinement of the current trajectory. We further designed a high-precision, unit-test-level reward mechanism to encourage the Large Language Model (LLM) to perform line-by-line analysis. Extensive experiments on three benchmarks and five LLMs demonstrate the effectiveness of MCTS-Judge, which improves the base model's accuracy from 41% to 80%, surpassing the o1-series models with 3x fewer tokens. Further evaluations validate the superiority of its reasoning trajectory in logic, analytics, thoroughness, and overall quality, while revealing the test-time scaling law of the LLM-as-a-Judge paradigm.

代码评估强化学习推理增强MCTS

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。