arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.34817cs.SEcs.AI
收藏

隐蔽且代价高昂:LLM智能体中提示缓存的错误集成特征与检测

Silent and Costly: Characterizing and Detecting Prompt-Caching Mis-Integration in LLM Agents

Wake Forest University(韦克森林大学);Griffith University(格里菲斯大学);Nanyang Technological University(南洋理工大学);University of New South Wales(新南威尔士大学);Southern University of Science and Technology(南方科技大学)

Ying Zhang, Ruoqi Guo, Yi Liu, Gelei Deng, Yuekang Li, Yepang Liu, Leo Zhang

AI总结:

本研究通过对10个开源智能体系统的120个相关拉取请求开展实证研究,发现LLM智能体中提示缓存的错误集成隐蔽且代价高昂,设计的CACHELINT工具可有效检测此类错误集成,已获开发者确认并促成上游修复。

摘要:

大型语言模型(LLM)服务处理海量用户请求,产生大量推理成本。为降低成本与延迟,服务提供商推出了提示缓存技术。然而,由于不同提供商的API存在差异,且缓存语义不断演变,正确集成提示缓存并非易事。为探究下游应用中提示缓存的错误集成问题,我们对10个流行开源智能体系统中与提示缓存相关的120个拉取请求开展了首次实证研究。研究发现,提示缓存的错误集成既出现在请求端的错误配置中,也出现在读取端的使用计数错误里。更重要的是,大多数错误集成会隐蔽发生,不会引发可观测的运行时故障。基于这些发现,我们设计了CACHELINT,该工具将提示缓存的错误集成建模为调用点及正确缓存集成所需的前置条件。CACHELINT通过CodeQL定位缓存调用点,并针对每个前置条件,要么对照过时的提供商能力预言机进行验证,要么通过LLM守卫检查完成验证。在识别10个研究智能体系统中的120个标注错误集成时,CACHELINT的准确率达0.71,召回率达0.78。我们的评估进一步证明了CACHELINT在实际场景中的有效性,在571个智能体项目中识别出32个错误集成,准确率达0.86。这些发现已获得21位开发者的确认,并促成了18个上游修复,其中包括Anthropic官方SDK中的一处修复。

英文摘要:

Large language model (LLM) services process massive volumes of user requests, resulting in substantial inference costs. To reduce both cost and latency, providers have introduced prompt caching. However, correctly integrating prompt caching is non-trivial due to heterogeneous provider-specific APIs and continuously evolving caching semantics. To understand prompt-caching mis-integration in downstream applications, we conduct the first empirical study of 120 prompt-caching-related pull requests from 10 popular open-source agent systems. Our findings show that prompt-caching mis-integrations arise in both request-side misconfiguration and read-side usage miscount. More importantly, most mis-integrations fail silently without causing observable runtime failures. Motivated by these findings, we design CACHELINT, which models a prompt-caching mis-integration as an invocation site together with the preconditions required for correct cache integration. CACHELINT locates caching invocation sites with CodeQL and discharges each precondition either against a dated provider capability oracle or with an LLM guard check. CACHELINT achieves 0.71 precision and 0.78 recall in identifying the 120 labeled mis-integrations across the 10 studied agent systems. Our evaluation further demonstrates the effectiveness of CACHELINT in real-world settings, identifying 32 mis-integrations across 571 agent projects with 0.86 precision. These findings have received 21 developer confirmations and led to 18 upstream fixes, including one in Anthropic's official SDK.

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

↑