Tool-REX (Tool Retrieval with EXpansion) is a benchmark and framework that enhances tool retrieval by systematically enriching tool documentation using Large Language Models (LLMs).
Note: Tool-REX was previously known as Tool-DE (as referred to in our initial research). We have rebranded the project to Tool-REX (Tool Retrieval with EXpansion) to better reflect its core mechanism and framework capabilities.
Tool-REX is a new benchmark and framework that enhances tool retrieval by systematically enriching tool documentation using Large Language Models (LLMs). Existing benchmarks (e.g., ToolBench, ToolACE, ToolRet) reveal a key bottleneck — incomplete and inconsistent tool documentation hinders retrieval quality.
To address this, Tool-REX introduces an LLM-driven document expansion pipeline that generates structured fields such as function_description, when_to_use, limitations, and tags.
We further release two models built upon this data:
- Tool-Embed – a dense retriever trained on 50k expanded documents
- Tool-Rank – an LLM-based reranker trained on 200k pairs
Tool-REX achieves new state-of-the-art results on both ToolRet and its own benchmark, setting a foundation for data-centric tool retrieval research.
Benchmark
Training Datasets
Tool-Embed
Tool-Rank
Tested with Python 3.10+ and CUDA-enabled GPUs for large models.
Install dependencies:
conda env create -f requirements.yml
conda activate tool-rexAll examples assume you are in the repository root.
Use eval_retrieval in tool_de/eval.py or run the example script.
python example/embedding.pyDirect call:
from tool_de.eval import eval_retrieval
results = eval_retrieval(
model_name="Lux1997/Tool-Embed-0.6B",
tasks="all",
category="all",
batch_size=8,
output_file="./results/output_embed_0.6b.json",
top_k=100,
is_inst=False,
is_print=True
)ToolRank uses eval_toolrank in tool_de/eval.py.
python example/rerank_single_task.pyDirect call:
from tool_de.eval import eval_toolrank
output, results = eval_toolrank(
model_name="Lux1997/Tool-Rank-4B",
tasks="all",
instruct=True,
from_top_k=100,
batch_size=4,
context_size=32000,
num_gpus=1,
force_rethink=0,
retrieval_results_path="./results/output/your_retrieval_output.json"
)You can change models in two ways:
- Pass a different
model_nameat runtime:
eval_retrieval(model_name="Lux1997/Tool-Embed-4B", ...)
eval_toolrank(model_name="Lux1997/Tool-Rank-8B", ...)- Update defaults in
tool_de/config.py:
_EMBEDDING_MODEL_RERANKING_MODEL_QUERY_REPO/_TOOL_REPO
- Reranking requires retrieval outputs first. Provide the retrieval output path via
retrieval_results_path. - Datasets are loaded from Hugging Face via the dataset IDs in
tool_de/config.py.
@inproceedings{
lu2026tools,
title={Tools are under-documented: Simple Document Expansion Boosts Tool Retrieval},
author={Xuan Lu and Haohang Huang and Rui Meng and Yaohui Jin and Wenjun Zeng and Xiaoyu Shen},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
url={https://openreview.net/forum?id=g9D9MgG7iW}
}Part of the code is adapted from tool-retrieval-benchmark.