Large language models (LLMs) have demonstrated strong coding capabilities but still struggle to solve competitive programming problems correctly in a single attempt. Execution-based re-ranking offers a promising test-time scaling strategy, yet existing methods are constrained by either difficult test case generation or inefficient random input sampling. To address this limitation, we propose Agentic Verifier, an execution-based agent that actively reasons about program behaviors and searches for highly discriminative test inputs that expose behavioral discrepancies among candidate solutions. Through multi-turn interaction with code execution environments, the verifier iteratively refines the candidate input generator and produces targeted counterexamples rather than blindly sampling inputs. We train the verifier to acquire this discriminative input generation capability via a scalable pipeline combining large-scale data synthesis, rejection fine-tuning, and agentic reinforcement learning. Extensive experiments across five competitive programming benchmarks demonstrate consistent improvements over strong execution-based baselines, achieving up to +10-15% absolute gains in Best@K accuracy. Further analysis reveals clear test-time scaling behavior and highlights the verifier's broader potential beyond reranking.
翻译:大型语言模型(LLM)已展现出强大的代码生成能力,但在单次尝试中正确解决竞争性编程问题仍存在困难。基于执行的重排序提供了一种有前景的测试时扩展策略,然而现有方法受限于难以生成测试用例或采用低效的随机输入采样。为应对这一局限,我们提出智能验证器(Agentic Verifier),这是一种基于执行的智能体,能够主动推理程序行为,并搜索具有高度区分性的测试输入,以揭示候选解决方案之间的行为差异。通过与代码执行环境进行多轮交互,验证器迭代优化候选输入生成器,并产生有针对性的反例,而非盲目采样输入。我们通过结合大规模数据合成、拒绝微调和智能体强化学习的可扩展流程,训练验证器获得这种区分性输入生成能力。在五个竞争性编程基准上的大量实验表明,该方法相较于强大的基于执行的基线模型取得了持续改进,在Best@K准确率上实现了高达+10-15%的绝对提升。进一步分析揭示了清晰的测试时扩展行为,并凸显了验证器在重排序之外的更广泛潜力。