TL;DR
While inference-time scaling (allocating more compute during testing) has supercharged LLM performance on unstructured tasks like mathematics, it remains largely unexplored for structured outputs. This paper introduces ToolPRM, a fine-grained process reward model that evaluates individual decisions within a function call (such as choosing a function name or filling a specific argument). By pairing ToolPRM with a tailored beam search strategy, the authors achieve massive performance gains on function-calling benchmarks, effectively allowing smaller models to punch well above their weight class.
What Problem Does This Paper Address?
When large language models (LLMs) interact with external tools via function calling, they typically output structured data like JSON. Current methods for improving these outputs at inference time are coarse-grained: they generate multiple full responses and use an Outcome Reward Model (ORM) to pick the best one (a "Best-of-N" approach).
However, structured outputs are incredibly brittle. If a model hallucinates an argument name or messes up a syntax token early in a JSON string, the entire trajectory is ruined and cannot be recovered. Coarse-grained models waste computational budget by fully generating incorrect paths. This paper addresses the lack of fine-grained, step-by-step verification mechanisms specifically designed for the internal structure of function calls.
Methods
The authors propose a fine-grained inference-scaling framework consisting of two main components:
- ToolPRM (Process Reward Model): Instead of scoring a complete function-calling response, ToolPRM evaluates the correctness of each intermediate decision. The function-calling process is broken down into a dynamic state transition mechanism with five states:
- State #0: Initial State
- State #1: Selecting the Function Name (
<FUNC_NAME>) - State #2: Selecting the Parameter Name
- State #3: Filling in the Parameter Value (
<ARG_VALUE>) - State #4: Terminated State
- Fine-Grained Beam Search: Guided by ToolPRM, the framework prunes incorrect partial trajectories early.
The authors introduce a core principle for structured output search: "Explore more, but retain less." In practice, this means increasing the beam width ($M$) to explore a wide variety of potential next tokens, but keeping the number of active retained beams ($N$) small. Because early errors in JSON are unrecoverable, keeping a large number of active beams open simply wastes compute on fundamentally broken paths.
Datasets
To train ToolPRM, the authors built the first fine-grained intra-call supervision dataset. They used xlam-function-calling-60k and xlam-irrelevance-7.5k as foundations and applied a function masking technique (replacing real function and parameter names with random strings) to force the model to learn from contextual descriptions rather than simple name memorization.
The final dataset contains over 5.1 million step-level training labels. For evaluation, they tested their framework across three major benchmarks:
- BFCL (Berkeley Function Calling Leaderboard)
- ToolAlpaca
- API-Bank
Key Insights and Ideas
- The "Explore More, But Retain Less" Paradigm: This is the most striking conceptual takeaway. In mathematical reasoning, models can often correct an early mistake later in the chain of thought, meaning it helps to retain a diverse set of candidate paths (larger $N$). In structured generation, the opposite is true. Early errors are fatal, so aggressive pruning (smaller $N$) combined with wide immediate exploration (larger $M$) yields the best results.
- Hierarchical Label Redundancy Helps: Even though some step labels seem redundant (e.g., checking if a single argument is correct vs. checking if all parameters are finished), this hierarchical structure provides a stronger regularization effect, helping the reward model generalize better.
- Post-Hoc Reflection Fails for JSON: The authors showed that even advanced reasoning models struggle to fix structural errors via self-reflection after the fact, proving that token-by-token, test-time intervention is necessary.
Key Results
ToolPRM demonstrated superior predictive accuracy and significant test-time performance boosts:
- High Accuracy: ToolPRM achieved a 99.11% step-level accuracy and 99.38% trajectory-level accuracy, outperforming standard ORMs and coarser process reward models.
- Compute-Equivalent Scaling:
- A small Hammer2.1-1.5B model equipped with ToolPRM achieved performance on par with the baseline 3B model.
- The Hammer2.1-3B model with ToolPRM elevated its performance to match the baseline 7B model.
- The Hammer2.1-7B model combined with ToolPRM achieved an average accuracy of 89.52% on BFCL, outperforming much larger state-of-the-art models like Qwen2.5-32B-Instruct (87.21%).
Limitations and Future Work
- Discretized Step Assumption: ToolPRM assumes a rigid, step-wise view of decision-making (Function Name $\rightarrow$ Parameter Name $\rightarrow$ Value). This might not capture more implicit reasoning patterns or latent uncertainties within the model.
- No Global Optimality Guarantee: Because the model prunes paths greedily based on local step rewards, it cannot strictly guarantee that the final complete tool choice is globally optimal.
- Static Hyperparameters: The optimal trade-off between exploration ($M$) and retention ($N$) is currently fixed. The authors note that future work should explore adaptive strategies that dynamically calibrate these parameters based on the complexity of the input query or the confidence scores of ToolPRM.
Summary updated