ToolPRM: Fine-Grained Inference Scaling of Structured Outputs for Function Calling

Jianghao Lin, Yuanyuan Shi, Xin Peng, Renjie Ding, Hairui Wang, Yuxuan Peng, Bizhe Bai, Weixi Song, Fengshuo Bai, Huacan Chai, Weinan Zhang, Fei Huang, Ying Wen · OpenReview

TL;DR

This paper introduces ToolPRM, a novel framework for improving the performance of large language models (LLMs) in structured function calling tasks by scaling inference. ToolPRM uses a fine-grained process reward model to evaluate each step within a function call, leading to better decision-making and improved accuracy. The authors also propose a key principle for structured inference scaling: "explore more, but retain less."

What Problem Does This Paper Address?

Large language models (LLMs) are becoming increasingly capable of interacting with the real world through tools and APIs, a process often referred to as function calling. To get the best results from these models, researchers have developed "inference scaling" techniques. These methods involve using more computational power during inference to explore multiple possibilities and refine the output, rather than just taking the single most likely prediction. However, most existing inference scaling research has focused on unstructured outputs, like generating text for math problems. The problem this paper addresses is the lack of effective inference scaling strategies for structured outputs, specifically function calling, where errors in early steps can be difficult or impossible to correct later. This makes it challenging to leverage the full potential of LLMs for complex tool-use scenarios.

Methods

The core of the proposed solution is ToolPRM (Tool Process Reward Model). Unlike previous methods that might evaluate an entire function call as a single unit, ToolPRM breaks down the function calling process into fine-grained, semantically meaningful steps. These steps include selecting the correct function name and then identifying and filling in the appropriate parameters and their values.

To train ToolPRM, the authors created a novel, fine-grained intra-call process supervision dataset. This dataset was built by:

  1. Function Masking: Selectively replacing function names and parameter identifiers with random strings in existing function calling datasets. This forces the LLM to rely on the descriptions of tools rather than just memorizing names, making it more robust.
  2. Rollout Collection: Using policy models to generate function calls based on user queries and masked tool candidates.
  3. Step-Level Annotation: Manually labeling each decision point (e.g., selecting a function, filling a parameter) as correct or incorrect.

ToolPRM is then trained using this dataset to predict the correctness of each step. This fine-grained reward signal is integrated with beam search, a common inference scaling technique. The key idea is to use ToolPRM to guide the beam search, pruning incorrect trajectories early and focusing computational resources on promising paths.

Datasets

The paper utilizes two existing datasets for training and annotation:

  • xlam-function-calling-60k: A dataset for function calling.
  • xlam-irrelevance-7.5k: A dataset for irrelevant function calls.

The authors introduce a newly constructed, fine-grained intra-call process supervision dataset derived from these sources through their function masking and annotation process. This dataset is crucial for training ToolPRM.

For evaluation, the paper uses the following benchmarks:

  • BFCL (Berkeley Function Calling Leaderboard)
  • ToolAlpaca
  • API-Bank

Key Insights and Ideas

  • Structured outputs are brittle: Unlike unstructured text generation where early errors might be corrected later, a single mistake in a function call (e.g., wrong function name, incorrect parameter value) can invalidate the entire sequence. This makes early error detection and correction critical.
  • "Explore More, But Retain Less": This is the central principle for inference scaling in structured outputs. It means widening the search space (more exploration, e.g., higher beam width) but aggressively pruning less promising or incorrect trajectories (less retention, e.g., fewer beams). This contrasts with unstructured tasks where retaining more candidates might be beneficial.
  • Fine-grained supervision is key: Evaluating each step within a function call provides much more effective guidance than evaluating the entire call or just the final outcome. This fine-grained feedback helps the LLM learn to make better decisions at each stage.
  • Function masking improves robustness: Masking function names and parameters during training forces the LLM to understand tool descriptions and context, leading to more reliable performance.

Key Results

  • ToolPRM outperforms baselines: ToolPRM significantly outperforms outcome reward models (ORM) and coarse-grained process reward models (C-PRM) in predictive accuracy for function calling steps.
  • Improved inference scaling: When integrated with beam search, ToolPRM-guided inference scaling consistently improves the performance of various LLM backbones (e.g., Hammer2.1 series) across multiple benchmarks (BFCL, ToolAlpaca, API-Bank).
  • Performance gains for smaller models: The performance uplift from ToolPRM is particularly pronounced for smaller LLMs, making it valuable for resource-constrained environments. For instance, Hammer2.1-1.5B augmented with ToolPRM achieved performance comparable to a larger baseline 3B model.
  • "Explore More, Retain Less" validated: Experiments show that increasing the beam width (exploration) while keeping the number of retained beams fixed leads to better performance than the other way around, supporting the proposed principle.

Limitations and Future Work

  • Discretized view: ToolPRM assumes a step-wise view of decision making, which might not fully capture all forms of implicit reasoning or latent uncertainty in complex scenarios.
  • Global optimality: While ToolPRM rewards intermediate consistency, it doesn't guarantee global optimality of the final tool choice or argument specification in every case.
  • Additional components: The framework introduces extra components like masking design and state definitions, which require careful implementation and might affect behavior.

Future work could explore adaptive strategies that dynamically adjust exploration and retention based on input complexity or ToolPRM's confidence, moving beyond fixed trade-offs.

Summary updated

Abstract

Large language models (LLMs) are increasingly demonstrating strong capabilities as autonomous agents, with function calling serving as a core mechanism for interaction with the environment. Meanwhile, inference scaling has become a cutting-edge technique to enhance LLM performance by allocating more computational resources during the inference process. However, current research on inference scaling primarily focuses on unstructured output generation tasks, leaving its application in structured outputs, like function calling, largely underexplored. To bridge this gap, we propose an inference scaling framework that combines fine-grained beam search with a process reward model, ToolPRM, which scores the internal steps of each single function call. To train ToolPRM, we construct the first fine-grained intra-call process supervision dataset, automatically annotated with function-masking techniques to provide step-level rewards for structured tool-use reasoning. Extensive experiments demonstrate that ToolPRM beats the coarse-grained and outcome reward models in terms of predictive accuracy, indicating its stronger capability in supervising the function calling inference process. Inference scaling technique equipped with ToolPRM also significantly improves the backbone model performance across various function calling tasks and benchmarks. More importantly, we reveal a key principle for applying inference scaling techniques to structured outputs: "explore more but retain less" due to the unrecoverability characteristics of structured function calling generation.
BibTeX
@inproceedings{lin2026toolprm,
  author = {Jianghao Lin and Yuanyuan Shi and Xin Peng and Renjie Ding and Hairui Wang and Yuxuan Peng and Bizhe Bai and Weixi Song and Fengshuo Bai and Huacan Chai and Weinan Zhang and Fei Huang and Ying Wen},
  title = {{ToolPRM: Fine-Grained Inference Scaling of Structured Outputs for Function Calling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.855},
}
Figure