Evaluating LLMs on Sequential API Call Through Automated Test Generation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Huang, Yuheng, Song, Jiayang, Song, Da, Ji, Zhenlan, Wang, Wenhan, Wang, Shuai, Ma, Lei
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866911297434550272
author Huang, Yuheng
Song, Jiayang
Song, Da
Ji, Zhenlan
Wang, Wenhan
Wang, Shuai
Ma, Lei
author_facet Huang, Yuheng
Song, Jiayang
Song, Da
Ji, Zhenlan
Wang, Wenhan
Wang, Shuai
Ma, Lei
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2507_09481
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Evaluating LLMs on Sequential API Call Through Automated Test Generation
Huang, Yuheng
Song, Jiayang
Song, Da
Ji, Zhenlan
Wang, Wenhan
Wang, Shuai
Ma, Lei
Software Engineering
Artificial Intelligence
Computation and Language
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.
title Evaluating LLMs on Sequential API Call Through Automated Test Generation
topic Software Engineering
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2507.09481