Abstract
Small Language Models (SLMs) often fail at tool-use tasks because they "hallucinate" tool names that align with their pretraining data rather than the provided instructions. This phenomenon, termed schema misalignment, significantly hinders the deployment of SLMs in multi-agent systems. We introduce PA-Tool (Pretraining-Aligned Tool Schema Generation), a training-free method that renames tool components to match a model's internalized knowledge. By utilizing "peakedness" as a signal of model familiarity, PA-Tool improves tool-use performance by up to 17% and reduces naming errors by 80%. Our results demonstrate that a 7B-parameter model using PA-Tool can rival state-of-the-art models like Claude 3.5 Sonnet in tool selection accuracy.
Introduction
The trend toward multi-agent systems and edge computing has increased the demand for efficient Small Language Models (SLMs, <10B parameters). Despite their efficiency, SLMs struggle with tool-use, specifically in selecting the correct API and identifying parameters. Research identifies schema misalignment as a primary failure mode: SLMs frequently ignore provided schemas in favor of familiar naming conventions from their pretraining corpus. For example, a model might hallucinate get_user_id when the instruction specifies get_customer_id, leading to execution failure.
Methodology: PA-Tool
PA-Tool addresses misalignment by adapting the tool schema to the model's "preferred" vocabulary. The core of this method is peakedness, a metric that measures how consistently a model generates a specific output across multiple samples, indicating high familiarity.
The PA-Tool framework operates in three distinct stages:
- Candidate Generation: The model generates $N$ potential names for a tool based on its description using temperature-controlled sampling.
- Peakedness Computation: The system calculates a peakedness score for each candidate by measuring the density of similar names using Levenshtein edit distance.
- Representative Name Selection: The name with the highest peakedness is selected as the new, aligned tool name.
Evaluation and Results
We evaluated PA-Tool across several benchmarks: MetaTool, RoTBench, API-Bank, and $\tau$-Bench.
- Accuracy and Error Reduction: PA-Tool improved performance on MetaTool by up to 17% and reduced schema misalignment errors by 80%.
- Model Parity: A Qwen2.5-7B model equipped with PA-Tool matched or exceeded the performance of Claude 3.5 Sonnet on specific tool selection tasks.
- Synergy: The method is complementary to constrained generation and retrieval-based correction, providing additive performance gains.
Discussion
SLMs are inherently "opinionated," being pulled toward patterns established during pretraining. Aligning the interface to these patterns reduces cognitive load and improves contextual understanding. As a training-free approach, PA-Tool avoids the risks of catastrophic forgetting and the high costs associated with fine-tuning.
Limitations and Future Work
The benefits of PA-Tool diminish for larger models (e.g., GPT-4), which possess superior instruction-following capabilities. Additionally, the reliance on character-level edit distance for peakedness may require adjustment for non-Latin languages. Future research will explore applying this alignment philosophy to other structured outputs like code generation.
Summary updated