Self-Guided Function Calling in Large Language Models via Stepwise Experience Recall (2025)

Abstract: Function calling enables large language models (LLMs) to interact with external systems by leveraging tools and APIs. When faced with multi-step tool usage, LLMs still struggle with tool selection, parameter generation, and tool-chain planning. Existing methods typically rely on manually designing task-specific demonstrations, or retrieving from a curated library. These approaches demand substantial expert effort and prompt engineering becomes increasingly complex and inefficient as tool diversity and task difficulty scale. To address these challenges, we propose a self-guided method, Stepwise ExperiencE Recall (SEER), which performs fine-grained, stepwise retrieval from a continually updated experience pool. Instead of relying on static or manually curated library, SEER incrementally augments the experience pool with past successful trajectories, enabling continuous expansion of the pool and improved model performance over time. Evaluated on the ToolQA benchmark, SEER achieves an average improvement of 6.1% on easy and 4.7% on hard questions. We further test SEER on \tau -bench, which includes two real-world domains. Powered by Qwen2.5-7B and Qwen2.5-72B models, SEER demonstrates substantial accuracy gains of 7.44% and 23.38%, respectively.

## introduction large language models (llms) demonstrated remarkable capabilities through pretraining on largescale corpora @xcite @xcite @xcite . however, due to the inherent limitations of neural network architecture, llms are unable to interact directly with the real world-an issue that cannot be resolved simply by scaling up the training data or model size. function calling foot_0 @xcite serves as a fundamental mechanism that enables llms to interact with external systems. by invoking external tools, llms can integrate upto-date knowledge and execute real-world tasks, thereby expanding the boundaries of llm-based ai agents and driving advancements across various domains @xcite @xcite . in-context learning @xcite enhances llm reasoning by embedding task-specific examples in prompts, enabling adaptation to new tasks without training. however, this approach faces significant challenges in multi-step tool-use scenarios. limited by the maximum token length, prompts cannot include examples that comprehensively cover all tools and problem types. moreover, the relevance and complexity of the demonstrations directly impact the model's performance @xcite @xcite . this raises the critical question: how can we dynamically select examples tailored to the specific problem at hand, especially when the task involves multiple steps and complex tool interactions? existing methods @xcite typically rely on coarse-grained retrieval strategies, which fail to account for the nuanced relationships between tool usage patterns and user objectives in multi-step function calling. these approaches emphasize task similarity while overlooking the critical role of tool-chain alignment in achieving accurate and efficient outcomes. additionally, several approaches @xcite depend on manually curated or precollected task-specific demonstrations. however, this reliance not only limits scalability but also incurs substantial offline costs, making it inefficient when addressing a wide range of diverse tasks. we introduce stepwise experience recall (seer) 2 , a novel approach that enhances the multistep tool-use capabilities of llms through fine-grained retrieval. it selects relevant trajectories by jointly considering task similarity, toolchain coverage, and intent alignment. seer incrementally expands the experience pool by incorporating successful task trajectories, improving model performance over time. for tasks without explicit success signals, we adopt an llm-as-a-judge mechanism @xcite to assess task completion. this enables continuous online updates to the pool, allowing seer to adapt to new tasks and evolving user demands. our main contributions are: ## method in this section, we present stepwise experience recall (seer), a novel approach that retrieves prior successful trajectories as in-context examples. seer consists of three core components: trajectory experience extraction, stepwise experience recall, and continual experience accumulation, which together enable dynamic and efficient demonstration selection. the framework is illustrated in figure 1 . we first present the notation and problem formulation, then detail each seer component. ## experiments we conducted extensive experiments to evaluate the performance of seer on two benchmarks: toolqa algorithm 2: experience pool update input: current interaction history h t , llm evaluator e, experience pool d output: updated experience pool ## conclusion in this paper, we proposed seer, a self-guided approach for tool-augmented llms. seer introduces a stepwise experience recall mechanism to retrieve relevant past experiences and guide multistep tool usage. it continually updates its experience pool with successful trajectories, enabling iterative self-improvement during deployment. by conducting extensive experiments, we demonstrated that seer significantly outperforms existing methods on both multi-step and multi-turn benchmarks. we also validated the self-improvement capability of seer through intermediate batch accuracy evaluations. additionally, we performed ablation studies to assess the contributions of seer's components. overall, the experiments show some key findings: (1) seer is effective in improving the performance of llms on complex function calling tasks; (2) seer's self-guided mechanism enables continual self-improvement; (3) the multidimensional retrieval strategy enhances the model's ability across different task scenarios; (4) the number of demonstrations plays a crucial role, with a moderate number yielding the best results.