Manuscript Offprint

arXiv:2608.24571

Joint Optimization of Tool Creation and Use for Large Language Model Agents

Zhi Rui Tam, Chieh-Yen Lin, Yun-Nung Chen, Shao-Hua Sun, Hung-yi Lee

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Zhi Rui Tam1,2^{1,2}, Chieh-Yen Lin1^{1}, Yun-Nung Chen2^{2}, Shao-Hua Sun1,2^{1,2} and Hung-yi Lee2^{2}

1^{1}Appier AI Research, 2^{2}National Taiwan University

Tool-augmented language models are bounded by the APIs humans bothered to write; existing tool-creation systems patch this by prompting a frozen LLM at inference time, leaving the model that writes a tool decoupled from the one that uses it, with no signal that the schemas it produces are schemas it can invoke. We propose SMITH (Schema-grounded Multi-task Iterative Tool Honing), a reinforcement learning framework that jointly trains tool creation and tool use inside a single policy. Each rollout is either a build task (write a tool from a few examples) or a use task (invoke a pooled tool on a held-out question). Three separate reward axes catch schema, code, and outcome failures independently, so each failure mode contributes its own gradient. A 4B Qwen3 trained with SMITH on 13 procedural reasoning tasks with exact verifiers reaches 79.8 macro-average accuracy on held-out tasks, the best across all evaluated methods and ahead of an untrained 30B-A3B tool-writer. It also reaches 40.4 on TabMWP-Hard and 42.6 on out-of-domain GQA (+7.6 over the best same-backbone inference-time baseline), without any visual or tabular training data. Tools written by our 4B models also lifted the performance of LFM-2.5-350M and Qwen3-30B-A3B under same reasoning tasks.

Code Project Page

1. Introduction

Human progress depends on accumulated tools. Rather than solving every problem from first principles, people rely on instruments refined over generations [4, 11]. Large Language Models (LLMs) face a similar limitation: relying only on parametric memory restricts their ability to perform exact computation [5], access up-to-date knowledge [3], and carry out reliable symbolic reasoning [9]. Tool-augmented LLMs were introduced to overcome these limits [12, 26, 27]. By invoking external interfaces such as calculators, code interpreters, and search engines, models can solve problems beyond what is encoded in their frozen weights.

However, existing tool-augmented systems still rely on fixed, human-designed toolsets. Such predefined APIs may be incomplete, poorly matched to new tasks, or entirely unavailable, placing a hard limit on model capability. This motivates a shift from static tool use to dynamic tool creation, where models synthesize reusable callable functions on demand. LATM [2] first explored this direction by prompting GPT-4 to generate JSON-schema tools from demonstrations, and later work incorporated retrieval, verification, and multi-stage generation pipelines [17, 31, 35]. Despite this progress, existing methods do not explicitly optimize for tool quality or reusability during training of LLMs. Moreover, they separate tool creation from tool use: a stronger model writes the tool while a weaker model invokes it [2, 35]. As a result, the tool creator is never incentivized to design schemas it can reliably use itself. A key open problem is therefore how to train a single model to become both a better tool creator and a better tool user.

Corresponding author(s): ray.tam@appier.com

Reinforcement learning provides a natural framework for this objective [1, 23, 34]: a model can create a tool, apply it to held-out queries, and directly optimize against answer correctness. Yet, training under this paradigm introduces two major challenges. First, reward decomposition: a generated tool contains both a schema (e.g., function name, parameters, and types) and a backend implementation (e.g., executable Python code). Failures in these two components require different corrective signals, making reward assignment nontrivial. Second, circular evaluation: evaluating tool quality requires a judge, but self-evaluation is inherently unreliable [19], while fixed external evaluators raise questions about trustworthiness and alignment [36]. In addition, a competent evaluator must itself understand tool use well enough to assess whether a schema is practically callable and reusable across harder downstream queries.

To address these challenges, we propose SMITH (Schema-grounded Multi-task Iterative Tool Honing), a reinforcement learning framework that jointly trains tool creation and tool use within a single policy. SMITH disentangles schema and implementation failures through three complementary reward signals: execution accuracy, LLM-as-judge quality, and format consistency. To reduce circular evaluation, the judge is periodically synchronized from the evolving policy rather than sharing live training weights, enabling the evaluator to improve alongside the policy while maintaining stability. Finally, SMITH evaluates tools created on simpler tasks using harder downstream queries, explicitly rewarding reusable abstractions rather than task-specific shortcuts.

We train SMITH on 13 procedural task families from Reasoning-Gym [25] and evaluate both in-domain generalization and zero-shot transfer to unseen benchmarks. Our 4B model achieves the best overall held-out Reasoning-Gym performance (79.8% macro accuracy), outperforming inference-time tool-writing frameworks such as LATM [2], CRAFT [35], Trove [31], and KTCE [17], as well as models distilled from substantially larger teachers. Despite using far fewer decoding tokens, SMITH also surpasses a 30B inference-time tool writer on unseen tasks. Beyond procedural reasoning, SMITH transfers zero-shot to entirely new modalities: it achieves state-of-the-art performance on TabMWP-Hard and improves GQA visual question answering by up to +7.6 points over same-backbone baselines, despite never being trained on tabular or visual data. The learned tools further generalize across models: tools written by our 4B policy enable a frozen 350M model to match the performance of a 30B tool writer. Finally, the same training recipe consistently improves both Qwen3-8B and Granite-3.3-8B, suggesting that jointly optimizing tool creation and tool use under structured rewards is a scalable path toward reusable and transferable tool-building capabilities.

References (38)