arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.09481cs.SEcs.AIcs.CL
收藏

通过自动化测试生成评估LLMs的顺序API调用

Evaluating LLMs on Sequential API Call Through Automated Test Generation

The University of Tokyo(东京大学);Macau University of Science and Technology(澳门科技大学);Shandong University(山东大学);Hong Kong University of Science and Technology(香港科技大学);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Alberta(阿尔伯塔大学)

Yuheng Huang, Jiayang Song, Da Song, Zhenlan Ji, Wenhan Wang, Shuai Wang, Lei Ma

AI总结:

本文提出StateGen框架,通过自动化测试生成评估LLMs在顺序API调用中的性能,构建了包含120个测试用例的StateEval基准测试,揭示了当前LLM在API整合方面的改进方向。

摘要:

通过整合外部API工具,大型语言模型(LLMs)在复杂的现实任务中扩展了其有前途的能力。然而,LLM工具使用的测试、评估和分析仍处于早期阶段。现有的大多数基准测试依赖于手动收集的测试用例,其中许多无法自动检查语义正确性,而是依赖静态方法如字符串匹配。此外,这些基准测试往往忽略了连续API调用之间的复杂交互,这在现实应用中很常见。为了填补这一空白,本文介绍了一个名为StateGen的自动化框架,旨在生成涉及连续API交互的多样化编码任务。StateGen结合了基于状态机的API约束求解和验证、能量基采样和控制流注入,以生成可执行程序。这些程序随后通过两个LLM代理的协作转换为类人自然语言任务描述。利用StateGen,我们构建了StateEval基准测试,包含120个经过验证的测试用例,涵盖三个代表性场景:会话服务、张量操作和ElevenLabs MCP。实验结果证实,StateGen能够有效生成具有挑战性和现实的API导向任务,突显了当前LLM在结合API时的改进领域。我们公开了我们的框架和基准测试,以支持未来的研究。

英文摘要:

By integrating tools from external APIs, Large Language Models (LLMs) have expanded their promising capabilities in a diverse spectrum of complex real-world tasks. However, testing, evaluation, and analysis of LLM tool use remain in their early stages. Most existing benchmarks rely on manually collected test cases, many of which cannot be automatically checked for semantic correctness and instead depend on static methods such as string matching. Additionally, these benchmarks often overlook the complex interactions that occur between sequential API calls, which are common in real-world applications. To fill the gap, in this paper, we introduce StateGen, an automated framework designed to generate diverse coding tasks involving sequential API interactions. StateGen combines state-machine-based API constraint solving and validation, energy-based sampling, and control-flow injection to generate executable programs. These programs are then translated into human-like natural language task descriptions through a collaboration of two LLM agents. Utilizing StateGen, we construct StateEval, a benchmark encompassing 120 verified test cases spanning across three representative scenarios: Session Service, Tensor Operation, and ElevenLabs MCP. Experimental results confirm that StateGen can effectively generate challenging and realistic API-oriented tasks, highlighting areas for improvement in current LLMs incorporating APIs.We make our framework and benchmark publicly available to support future research.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑