LLMs for Test Input Generation for Semantic Caches
作者: Zafaryab Rasool, Scott Barnett, David Willie, Stefanus Kurniawan, Sherwin Balugo, Srikanth Thudumu, Mohamed Abdelrazek
分类: cs.SE, cs.AI
发布日期: 2024-01-16
备注: Accepted in International Conference on AI Engineering Software Engineering (CAIN 2024)
💡 一句话要点
提出VaryGen以解决语义缓存测试输入生成问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 语义缓存 大型语言模型 测试输入生成 查询相似性 自然语言处理
📋 核心要点
- 现有的语义缓存技术在处理相似查询时容易出现错误,影响用户对系统的信任。
- VaryGen利用大型语言模型生成相似问题,通过推理能力适应领域和合成查询变化,解决测试输入生成的难题。
- 实验结果表明,生成的查询对相似性满足人类期望,并揭示了语义缓存的失败案例,具有实际应用价值。
📝 摘要(中文)
大型语言模型(LLMs)为软件系统提供了先进的语义能力,但其计算成本高昂,影响用户体验。为了解决这一问题,语义缓存技术被引入,以避免频繁访问LLM服务。然而,现有的语义缓存技术依赖于查询嵌入,容易出现错误,影响用户信心。本文提出VaryGen,一种利用LLMs生成测试输入的方法,能够从非结构化文本中生成相似问题。该方法通过LLMs的推理能力,适应领域、合成查询的细微变化,并评估生成的数据集。通过对学生问答系统的实验,结果表明生成的查询对满足人类的相似性期望,并展示了语义缓存的失败案例。
🔬 方法详解
问题定义:本文旨在解决语义缓存测试输入生成的问题,现有方法在生成相似查询时缺乏有效的测试集,导致缓存效果难以评估。
核心思路:VaryGen利用大型语言模型的推理能力,生成与原始查询相似的变体,确保生成的数据集能够有效测试语义缓存的性能。
技术框架:该方法的整体架构包括三个主要模块:1) 查询适应模块,2) 查询变体合成模块,3) 数据集评估模块,确保生成的查询具有高相似性和有效性。
关键创新:VaryGen的创新在于利用LLMs的推理能力生成细微变化的查询,这一方法与传统的基于规则或模板的生成方法有本质区别。
关键设计:在参数设置上,VaryGen通过调整LLMs的温度和最大生成长度来控制生成的查询多样性,确保生成的查询既有相似性又具备一定的变化性。损失函数设计上,采用了基于相似度的评估标准,以优化生成结果的质量。
🖼️ 关键图片
📊 实验亮点
实验结果显示,生成的查询对人类的相似性期望有很好的满足,且在与开源语义缓存的实证案例研究中,成功揭示了语义缓存的失败案例,表明该方法在测试输入生成方面具有显著的实用价值。
🎯 应用场景
该研究的潜在应用领域包括智能问答系统、搜索引擎优化和语义理解等。通过生成高质量的测试输入,VaryGen能够帮助开发者更好地评估和优化语义缓存的性能,从而提升用户体验。未来,该方法还可以扩展到其他需要生成相似输入的语义应用场景中。
📄 摘要(原文)
Large language models (LLMs) enable state-of-the-art semantic capabilities to be added to software systems such as semantic search of unstructured documents and text generation. However, these models are computationally expensive. At scale, the cost of serving thousands of users increases massively affecting also user experience. To address this problem, semantic caches are used to check for answers to similar queries (that may have been phrased differently) without hitting the LLM service. Due to the nature of these semantic cache techniques that rely on query embeddings, there is a high chance of errors impacting user confidence in the system. Adopting semantic cache techniques usually requires testing the effectiveness of a semantic cache (accurate cache hits and misses) which requires a labelled test set of similar queries and responses which is often unavailable. In this paper, we present VaryGen, an approach for using LLMs for test input generation that produces similar questions from unstructured text documents. Our novel approach uses the reasoning capabilities of LLMs to 1) adapt queries to the domain, 2) synthesise subtle variations to queries, and 3) evaluate the synthesised test dataset. We evaluated our approach in the domain of a student question and answer system by qualitatively analysing 100 generated queries and result pairs, and conducting an empirical case study with an open source semantic cache. Our results show that query pairs satisfy human expectations of similarity and our generated data demonstrates failure cases of a semantic cache. Additionally, we also evaluate our approach on Qasper dataset. This work is an important first step into test input generation for semantic applications and presents considerations for practitioners when calibrating a semantic cache.