Skip to main content
QUICK REVIEW

[论文解读] Harnessing LLMs for API Interactions: A Framework for Classification and Synthetic Data Generation

Chunhui Tao, Xiaojing Fan|arXiv (Cornell University)|Sep 18, 2024
Business Process Modeling and Analysis被引用 8
一句话总结

本文提出一个框架,使用大语言模型将自然语言输入分类为 API 调用,并为在多种大语言模型上评估 API 分类性能生成合成数据集。GPT-4 在被测试的模型中在 API 分类任务中达到最高准确率。

ABSTRACT

As Large Language Models (LLMs) advance in natural language processing, there is growing interest in leveraging their capabilities to simplify software interactions. In this paper, we propose a novel system that integrates LLMs for both classifying natural language inputs into corresponding API calls and automating the creation of sample datasets tailored to specific API functions. By classifying natural language commands, our system allows users to invoke complex software functionalities through simple inputs, improving interaction efficiency and lowering the barrier to software utilization. Our dataset generation approach also enables the efficient and systematic evaluation of different LLMs in classifying API calls, offering a practical tool for developers or business owners to assess the suitability of LLMs for customized API management. We conduct experiments on several prominent LLMs using generated sample datasets for various API functions. The results show that GPT-4 achieves a high classification accuracy of 0.996, while LLaMA-3-8B performs much worse at 0.759. These findings highlight the potential of LLMs to transform API management and validate the effectiveness of our system in guiding model testing and selection across diverse applications.

研究动机与目标

  • 推动为 API 交互启用自然语言界面,以降低技术门槛。
  • 开发一个端到端系统,将 NL 提示分类为 API 调用并执行它们。
  • 创建一个合成数据生成管道,用于基准测试和比较在 API 分类任务上的大语言模型。
  • 提供一种可扩展的评估方法,用于评估模型在定制化 API 管理中的适用性。

提出的方法

  • 两部分组成的系统:(1) API 检索/分类管线,将 NL 提示映射到带有定义的 API 层次结构的调用;(2) 数据集生成管线,生成用于 API 函数的带标签的合成 NL 提示。
  • 数据集生成使用批量提示(每批 100 个合成查询)来创建多样化、带标签的 JSON 提示,并以 99.9% 的准确率进行人工标签验证。
  • 评估使用多种 LLMs(GPT-4、GPT-4o-mini、GPT-3.5-turbo、LLaMA3-70B、LLaMA3-8B、Gemini-1.5)将查询分类到 API 模块和函数。
  • 评估指标包括模块级分类准确度(MLC-Acc)和函数级分类准确度(FLC-Acc)。
  • 数据集覆盖六个 API 模块:Calculator、Notes、Weather、Email、Notification、Calendar,以及用于测试无效调用的 Routes-Not-Exist 模块。

实验结果

研究问题

  • RQ1最先进的 LLMs 将自然语言提示准确分类到预定义的 API 模块和函数的能力有多高?
  • RQ2模型规模与架构对跨越多样 API 模块的 API 分类性能有何影响?
  • RQ3合成数据生成是否能够为 API 管理任务提供可靠的基准测试和模型选择?
  • RQ4所提出的框架在简单与复杂的 API 任务中的表现如何?
  • RQ5对于为定制化 API 管理任务选择 LLMs 可以提供哪些指导?

主要发现

  • GPT-4 在整体模块/函数分类性能方面达到最高(MLC-Acc 约为 0.99,FLC-Acc 接近 0.996,在报道结果中)。
  • LLaMA-3-70B 也显示出强劲的表现(在各模块中具备高的 MLC-Acc 和 FLC-Acc)。
  • 较小的模型(如 GPT-4o-mini、LLaMA3-8B)在准确率上明显下降,尤其是在较复杂的模块上,表明模型规模显著影响任务性能。
  • 数据集生成框架使对多种 LLM 在 API 分类任务上的快速、自动化基准测试成为可能,并有助于在用例层面识别最合适的模型。
  • 该系统展示了高质量的合成数据生成与人工验证能力,使 API 分类能力的可扩展评估成为可能。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。