Teaching LLMs to Learn Tool Trialing and Execution through Environment Interaction

Xingjie Gao, Pengcheng Huang, Zhenghao Liu, Yukun Yan, Shuo Wang +4 more
1/19/2026
cs.SEcs.AI

Official code: NEUIR/ToolMaster (7 stars, MIT, last commit 2026-01-21).

Abstract

Equipping Large Language Models (LLMs) with external tools enables them to solve complex real-world problems. However, the robustness of existing methods remains a critical challenge when confronting novel or evolving tools. Existing trajectory-centric paradigms primarily rely on memorizing static solution paths during training, which limits the ability of LLMs to generalize tool usage to newly introduced or previously unseen tools. In this paper, we propose ToolMaster, a framework that shifts tool use from imitating golden tool-calling trajectories to actively learning tool usage through interaction with the environment. To optimize LLMs for tool planning and invocation, ToolMaster adopts a trial-and-execution paradigm, which trains LLMs to first imitate teacher-generated trajectories containing explicit tool trials and self-correction, followed by reinforcement learning to coordinate the trial and execution phases jointly. This process enables agents to autonomously explore correct tool usage by actively interacting with environments and forming experiential knowledge that benefits tool execution. Experimental results demonstrate that ToolMaster significantly outperforms existing baselines in terms of generalization and robustness across unseen or unfamiliar tools. All code and data are available at https://github.com/NEUIR/ToolMaster.

View on arXivView PDF

Code Implementations(1)

NEUIR/ToolMasterOfficial100%
MIT

Source code for our paper ''Teaching LLMs to Learn Tool Trialing and Execution through Environment Interaction''

70Shell, PythonJan 12, 20269 months agoMIT

Similar Papers

Cite this paper

@article{gao2026teaching,
  title  = {Teaching LLMs to Learn Tool Trialing and Execution through Environment Interaction},
  author = {Xingjie Gao and Pengcheng Huang and Zhenghao Liu and Yukun Yan and Shuo Wang and Zulong Chen and Chen Qian and Ge Yu and Yu Gu},
  year   = {2026},
  eprint = {2601.12762},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.12762v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.12762.svg)](https://codeofpaper.com/paper/2601.12762)

Discussion