Introduction
While Large Language Models (LLMs) have shown remarkable capabilities in general tasks, they often struggle with complex, multi-step reasoning in specialized domains like mathematics and physics. A common strategy to mitigate this is "tool-augmented generation," where models generate code to solve sub-problems. However, existing automated tool-creation methods often produce "ad-hoc" tools—temporary functions tailored to a single problem that lack reusability and fail to cover the diverse range of logic required for broader datasets.
To address these limitations, we present the Knowledge-grounded Tool Creation with Evolution (KTCE) framework. KTCE shifts the paradigm from creating problem-specific scripts to building libraries of "distilled knowledge"—executable, atomic units of domain logic designed for broad applicability and robustness.
Methodology: The KTCE Framework
KTCE operates through a two-stage process that bridges the gap between specific problem instances and general-purpose tools.
Stage 1: Knowledge-based Tool Craft
Rather than generating tools directly from problem prompts, KTCE first constructs a hierarchical Knowledge Tree (KT). The framework uses an LLM to extract "knowledge triplets" (Topic, Concept, Key Points) from training data. These triplets are then clustered using semantic embeddings into a structured hierarchy (e.g., Algebra → Ratios → Length ratio). Finally, the LLM generates atomic Python functions for each cluster, ensuring that tools are grounded in fundamental mathematical or scientific concepts rather than the surface-level details of a single question.
Stage 2: Tool Evolutionary Search
To refine the initial toolset, KTCE employs a bio-inspired evolutionary search. This non-gradient optimization process uses the LLM as an evolutionary engine to perform three key operations:
- Selection: Pruning ineffective or redundant tools based on performance metrics.
- Mutation: Hardening code by adding error handling (e.g., division-by-zero checks) and addressing edge cases.
- Crossover: Merging logic from successful tools to create more powerful, hybrid functions.
Experimental Evaluation
We evaluated KTCE across several rigorous reasoning benchmarks, including MATH (competition-level mathematics), TabMWP (tabular math word problems), and SCIBENCH (college-level science). The framework was also tested on GSM8K to assess cross-dataset generalizability.
Key Results and Insights
- Superior Accuracy: KTCE achieved significant reasoning accuracy improvements, ranging from 6.23% to 18.49% over state-of-the-art baselines like CRAFT and TROVE. On TabMWP, it was the only method to surpass 90% accuracy.
- Enhanced Coverage and Reusability: The framework achieved over 60% task coverage, nearly tripling the tool usage frequency of previous methods. This confirms that the tools created are more generalizable and less "ad-hoc."
- Performance Scaling with Difficulty: A critical finding is that KTCE’s performance advantage increases as problem difficulty rises. As shown in the analysis of the MATH dataset, the gap between KTCE and baseline methods like TROVE widens significantly from Level 1 to Level 5 difficulty.
- Code Simplicity: By abstracting logic into a well-defined toolset, the final solution code becomes simpler. Evaluation of Cyclomatic Complexity (CC) showed that KTCE solutions have fewer branching paths and lower cognitive load compared to standard Program-of-Thought (PoT) approaches.
Conclusion
The KTCE framework demonstrates that grounding tool creation in structured domain knowledge and refining them through evolutionary search produces a more robust, reusable, and effective toolset for LLM reasoning. Future work will explore extending this framework to multi-modal tools and more advanced agentic workflows for tool retrieval and execution.
Summary updated