---
# System prepended metadata

title: Tool Retrieval

---

# ToolCalling: A Retrieval-Based Plug-In for LLMs
## Motivation
Use retrieval and inherent topology to enhance the tool calling ability of LLM.

## Scenario

The agent provides a set of APIs for users to offer various services. Each API has $<A_i, Des_i>$, where $Des_i$ is the description of the API naming $A_i$. A user will query to the agent for services with $T_u$, where $T_u$ is the query text.

Each session will have multiple rounds of dialogue, one round of dialogue consists of a user query and an API call. The multiple rounds within each session may be self-related or independent.

## Problems
1. Tool Call Awareness
2. **One-Step Query**
- Similar tool selection.
    - Distinguishment finetune 
        - Similar tool groups detection.
        - Improve distinguishment among similar tools by contrastive learning, training with reweighting, etc.
3. **Multi-Step Queries** （Explicit）
- Non-Markovian.
    - Decoupled memory bank for history remembering.
- Inherent topology.
    - Pre-planing: let LLMs first give an overall plan.
    - Path/Graph construction.
4. Hybrid Query. （Implicit）
- Task Decomposition


## Methodology
1. Textual Embedding.
- BGE https://huggingface.co/BAAI/bge-large-zh-v1.5
2. Q-A pair knowledge base.
3. Distinguishment pretrain.
4. Decoupled memory bank for multi-step queries.

![Uploading file..._x30uu1tg5]()

## Dataset & Related Work
1. https://github.com/HowieHwong/MetaTool
2. https://github.com/JohnnyPeng18/APIBench
3. https://arxiv.org/abs/2304.08244