TL;DR
FunPRM introduces a tailored Process Reward Model (PRM) for code generation that treats individual functions as logical reasoning steps via "Chain-of-Function" prompting. To overcome the noisy labels typical of intermediate code states, it uses a novel bi-level meta-learning framework that leverages clean, unit-test-validated final solutions to correct and denoise partial-solution rewards. This approach achieves state-of-the-art performance on competitive coding benchmarks while inherently producing cleaner, more modular code.
What Problem Does This Paper Address?
Process Reward Models (PRMs) have recently supercharged LLM performance in mathematical reasoning by evaluating intermediate steps rather than just the final output. However, translating PRMs to code generation introduces two major roadblocks:
- Lack of Natural Steps: Unlike math problems, which naturally break down into sequential lines of text under Chain-of-Thought prompting, code lacks clear step boundaries. Treating every single line of code as a step is computationally prohibitive and semantically noisy.
- Noisy Intermediate Labels: Training a PRM requires knowing whether a partial solution is on the right track. Usually, researchers estimate this using Monte Carlo (MC) rollouts (sampling multiple completions to see if they eventually pass). However, MC sampling is notoriously noisy, which degrades PRM training quality.
FunPRM tackles both challenges by redefining what a "step" means in code and finding a clever way to clean up intermediate reward signals.
Methods
FunPRM consists of two core components:
1. Chain-of-Function (CoF) Prompting
Instead of letting the LLM generate a monolithic block of code, FunPRM prompts the model to decompose its logic into separate, modular functions. High-level orchestrating functions (like main()) are generated first, followed by helper functions, each equipped with descriptive docstrings. FunPRM treats each individual function as a single reasoning step for the PRM.
2. Meta-Learning-Based Reward Correction
While you cannot easily run unit tests on an incomplete, partial function, you can reliably run unit tests on the final compiled program. FunPRM exploits this asymmetry using a bi-level optimization loop:
- Inner Loop: The PRM is initially trained on noisy, MC-sampled rewards for partial solutions.
- Outer Loop: The updated PRM is evaluated on clean, ground-truth rewards obtained from executing final solutions against actual unit tests.
- Meta-Update: The gradient of the final solution loss is backpropagated to optimize a lightweight, learnable reward-correction table ($g_\theta$). This table learns to add a corrective residual to denoise the partial rewards, ensuring the PRM trains on high-quality signals.
Datasets
The authors trained and evaluated FunPRM using several prominent benchmarks:
- LiveCodeBench (LCB): Used 601 problems (pre-August 2024) for training and 454 problems (post-August 2024) for testing. A smaller subset of 131 problems (post-February 2025) was used for the competitive leaderboard evaluation.
- BigCodeBench (BCB): Features challenging, tool-use heavy tasks. Used 800 problems for training and 340 for testing (292 easy, 48 hard).
- HumanEval+ & MBPP+: Used strictly to test domain generalization without any additional fine-tuning.
Key Insights and Ideas
- Functions are the Ideal Abstraction for Code Steps: Shifting the PRM granularity from lines of code to entire functions drastically reduces the step count (saving compute) while aligning perfectly with software engineering best practices.
- Using the Future to Correct the Past: The core "aha moment" is using the absolute certainty of a final unit test to retroactively clean up the fuzzy, uncertain probabilities of intermediate code blocks.
- The Readability Side-Effect: Because the model is forced to write modular code to satisfy the PRM's step structure, the resulting code is inherently more readable, reusable, and maintainable for human developers.
Key Results
FunPRM was evaluated under a Best-of-$N$ ($N=8$) selection strategy and demonstrated significant performance gains:
- State-of-the-Art Leaderboard Status: When paired with OpenAI O4-mini (High), FunPRM achieved 80.9% pass@1 on LiveCodeBench, outperforming the base O4-mini model (77.1%), Gemini-2.5-Pro (72.5%), and DeepSeek-R1 (68.7%).
- Consistency Across Base Models: FunPRM consistently beat standard Outcome Reward Models (ORMs) and existing coding PRMs (like Skywork-PRM) across four different open-weight and proprietary base models (including GPT-4o-mini and Qwen2.5-7B-Coder).
- Human Preference: In a blind study, human evaluators significantly preferred FunPRM's modular code structure over baseline monolithic code for both correct solutions (readability) and incorrect solutions (ease of debugging).
Limitations and Future Work
- Varying Step Complexity: The authors observed that even for some "Hard" problems, the model occasionally generates only a single, highly complex function. In these cases, the function-level abstraction fails to break down the problem into finer reasoning steps.
- Training Overhead: The meta-learning framework requires an initial round of computationally expensive Monte Carlo sampling to initialize the reward parameters before the denoising process can begin.
Future work could explore dynamic step decomposition within single complex functions or extending this meta-correction framework to multi-turn agentic coding workflows.
Summary updated