GEAR: Augmenting Language Models with Generalizable and Efficient Tool Resolution

Yining Lu, Haoping Yu, Daniel Khashabi

TL;DR

This paper introduces GEAR, a novel algorithm that significantly improves how Large Language Models (LLMs) use external tools. GEAR achieves this by delegating the complex task of tool selection to smaller, more efficient language models (SLMs), leading to better generalization across tasks and tools while drastically reducing computational costs.

What Problem Does This Paper Address?

Modern LLMs are increasingly being augmented with external tools (like calculators, search engines, or APIs) to enhance their capabilities. However, existing methods for teaching LLMs to use these tools often rely on task-specific demonstrations or extensive fine-tuning. This approach is computationally expensive, limits scalability to large tool libraries, and hinders the model's ability to generalize to new, unseen tools or tasks. The core challenge is to enable LLMs to efficiently and reliably select and use tools for a wide range of tasks without requiring extensive task-specific training data.

Methods

GEAR tackles this problem with a two-module approach:

  1. Query-Tool Grounding: This module is the heart of GEAR's innovation. Instead of relying on LLMs for tool selection, GEAR uses smaller language models (SLMs) to perform this task. It computes a "grounding score" by combining two key factors:
  2. Semantic Similarity: Measures how well the query aligns with the tool's natural language description.
  3. Pattern Similarity: Compares a preliminary answer generated by the SLM to the potential output of a tool, looking for matching patterns (e.g., numbers, English words, symbols). This helps assess if the tool's output format is likely to match the expected answer format. This scoring mechanism allows GEAR to generalize to new tools and tasks without needing specific demonstrations.

  4. Execution: Once the most appropriate tool is identified by the grounding module, a powerful LLM is used to generate the actual API call for that tool and obtain the final response.

This division of labor allows GEAR to leverage the efficiency of SLMs for the computationally intensive task of tool selection while using LLMs for their superior reasoning and execution capabilities.

Datasets

The authors evaluated GEAR on 14 datasets across 6 downstream tasks. These include:

  • Arithmetic: ASDiv, GSM8K, SVAMP
  • Machine Translation (MT): IWSLT-2017 (covering Chinese, Arabic, German, French, Japanese, Korean)
  • Open-domain QA (ODQA): NQ-Open, WebQS, TriviaQA
  • Commonsense QA (CSQA): CommonsenseQA, COPA, SocialIQA
  • Multilingual QA (MLQA): A challenging benchmark requiring translation and QA across multiple languages.
  • Timezone Conversion: A newly created dataset for testing time zone conversions.

They also mention using SQuAD and Trex datasets for some experiments.

Key Insights and Ideas

  • SLMs are sufficient for tool grounding: The paper demonstrates that smaller, more efficient SLMs can effectively select the correct tools, even when they produce incorrect preliminary answers. The key is their ability to generate outputs with patterns that align with the query's expected format.
  • Combined semantic and pattern similarity is crucial: Neither semantic similarity alone nor pattern similarity alone is sufficient. Their combination provides a robust signal for accurate tool grounding, especially in complex or open-ended tasks.
  • Generalization is key: GEAR's design allows it to generalize to novel tasks and tools without task-specific fine-tuning or demonstrations, a significant advantage over prior methods.
  • Efficiency gains are substantial: By offloading tool selection to SLMs, GEAR drastically reduces the number of calls to expensive LLMs, leading to significant computational savings.

Key Results

  • Improved Downstream Accuracy: GEAR-augmented GPT-J and GPT-3 consistently outperformed baseline models (zero-shot, few-shot, and ART) across various downstream tasks, often by a significant margin. For example, GEAR-augmented GPT-J achieved higher accuracy than few-shot baselines on the ODQA task.
  • Strong Generalization: GEAR demonstrated strong performance on novel tasks and large tool libraries. It maintained high grounding accuracy even when the tool library size increased from 4 to 10 tools.
  • Efficiency: GEAR reduces LLM calls by up to 4x compared to methods like ART, leading to reduced computational cost (FLOPS) while achieving higher accuracy.
  • Robustness to SLM Size: GEAR's performance is less sensitive to the size of the SLM used for grounding. Even smaller SLMs like GPT-Neo achieved comparable grounding accuracy to larger LLMs, highlighting the effectiveness of the GEAR framework.
  • Chatbot Integration: When integrated into a chatbot, GEAR significantly improved user satisfaction and perceived helpfulness, with 76% of users finding the tool-augmented chatbot more useful.

Limitations and Future Work

  • Tool Pipeline Construction: GEAR currently lacks support for automatic tool pipeline construction. Future work could combine GEAR with reasoning and task decomposition techniques to enable more complex multi-tool interactions.
  • Non-Textual Returns: While GEAR theoretically supports tools with non-textual returns via mock responses, further exploration in embodied AI and robotics could leverage this capability more extensively.
  • Mock Response Effectiveness: The paper suggests that mock responses can enhance efficiency and generalizability, but further research could explore their full potential.
  • LLM for Execution: While GEAR uses SLMs for grounding, it still relies on LLMs for final API call generation and response synthesis. Further research could explore more efficient or specialized models for this stage.

Summary updated

BibTeX
@inproceedings{lu2024gear,
  author = {Yining Lu and Haoping Yu and Daniel Khashabi},
  title = {{GEAR: Augmenting Language Models with Generalizable and Efficient Tool Resolution}},
  booktitle = {EACL},
  year = {2024},
  doi = {10.18653/v1/2024.eacl-long.7},
}
Figure