[论文解读] CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsets
CRAFT 构建针对任务的可执行代码片段工具集,通过多视图匹配检索来增强大模型而不进行微调,从而提升在视觉-语言、表格与数学推理任务上的性能。
Large language models (LLMs) are often augmented with tools to solve complex tasks. By generating code snippets and executing them through task-specific Application Programming Interfaces (APIs), they can offload certain functions to dedicated external modules, such as image encoding and performing calculations. However, most existing approaches to augment LLMs with tools are constrained by general-purpose APIs and lack the flexibility for tailoring them to specific tasks. In this work, we present CRAFT, a general tool creation and retrieval framework for LLMs. It creates toolsets specifically curated for the tasks and equips LLMs with a component that retrieves tools from these sets to enhance their capability to solve complex tasks. For each task, we collect specific code solutions by prompting GPT-4 to solve the training examples. Following a validation step ensuring the correctness, these solutions are abstracted into code snippets to enhance reusability, and deduplicated for higher quality. At inference time, the language model retrieves snippets from the toolsets and then executes them or generates the output conditioning on the retrieved snippets. Our method is designed to be flexible and offers a plug-and-play approach to adapt off-the-shelf LLMs to unseen domains and modalities, without any finetuning. Experiments on vision-language, tabular processing, and mathematical reasoning tasks show that our approach achieves substantial improvements compared to strong baselines. In addition, our in-depth analysis reveals that: (1) consistent performance improvement can be achieved by scaling up the number of tools and the capability of the backbone models; (2) each component of our approach contributes to the performance gains; (3) the created tools are well-structured and reliable with low complexity and atomicity. The code is available at https://github.com/lifan-yuan/CRAFT.
研究动机与目标
- 需要将大模型针对专业领域定制为使用 curated 工具而非通用 API 的动机。
- 提出一个离线工具创建、验证与去重的完整流程,以生成高质量、可重复使用的工具。
- 开发一个多视图检索机制,根据问题文本、 API 名称与文档字符串选择工具以引导推理。
- 展示无参数微调的适配能力,并在多样化任务上评估以展示可扩展性与鲁棒性。
提出的方法
- 离线构建一个工具集,通过对问题进行采样、用 GPT-4 生成可执行的 Python 方案并仅保留正确的。
- 通过重命名变量和对输入进行封装,将方案抽象为通用、可重复使用的工具,以促进跨领域适用性。
- 通过在原问题上测试抽象函数来验证工具,淘汰失败项。
- 通过按函数名和输入数量进行分组来去重工具,并在每组中选择最通用的工具。
- 在推理时通过对 (问题、函数名、文档字符串) 进行多视图匹配(基于 SimCSE 的相似度)检索工具,并通过多数表决组装给定任务的最终工具集。
- 在提示中实例化检索到的工具为可执行代码片段,使在解题过程中能够调用工具。
- 在端到端评估中使用 GPT-3.5-Turbo(以及在二次分析中使用 GPT-4),覆盖 VQA、表格处理和代数推理,并与各种基线进行比较。
实验结果
研究问题
- RQ1一个大型、经过筛选的可执行工具集合是否能在无需模型微调的情况下提升需要外部工具的任务的 LLM 性能?
- RQ2多视图检索策略(问题文本、API 名称、文档字符串)是否优于更简单的检索方法在选择相关工具方面?
- RQ3工具创建、抽象、验证和去重各自对整体性能的贡献是什么?
- RQ4工具集规模和骨干模型能力如何影响来自 CRAFT 的增益?
- RQ5生成的工具集的特征(复杂性、多样性)及其如何影响可靠性?
主要发现
- CRAFT 在强基线上实现显著提升,在视觉-语言任务上表现尤为突出。
- 随着工具数量和骨干能力的提升,性能提升持续。
- 每个组件(抽象、问题/名称/文档字符串匹配)均有贡献;去掉任意一个视图都会降低性能。
- 创建的工具通常具有较低的圈复杂度和较高的多样性,表明其可靠性和广泛的适用性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。