超越线性LLM调用:一种高效且有效的语义过滤范式
Beyond Linear LLM Invocation: An Efficient and Effective Semantic Filter Paradigm
AI总结:
本文提出CSV框架,通过语义聚类、采样和投票策略,将LLM调用次数降低至次线性复杂度,提升语义过滤效率。
摘要:
大型语言模型(LLMs)越来越多地用于在大规模语料库上进行语义查询处理。一组源自关系代数的语义运算符已被提出,以提供统一的接口来表达此类查询,其中语义过滤运算符是核心。给定一个带有自然语言谓词e的表T,对于每个元组,在关系中的执行过程是通过构建一个结合谓词e与其内容的输入提示,查询LLM,并获得二元决策。然而,这种元组逐个评估需要对表进行完整的线性扫描,导致可观的延迟和令牌成本。尽管最近的工作试图优化语义过滤,但仍无法突破线性LLM调用的障碍。为此,我们提出Clustering-Sampling-Voting(CSV),一种新的框架,将LLM调用减少到次线性复杂度,同时提供误差保证。CSV将元组嵌入到语义簇中,对小的子集进行LLM评估,并通过两种提出的投票策略推断簇级标签:UniVote,它均匀地聚合标签,以及SimVote,它根据语义相似性加权投票。此外,CSV在模糊簇上触发重新聚类,以确保在多样化数据集上的鲁棒性。在真实世界数据集上的结果表明,CSV将LLM调用次数减少了1.28-355倍,同时在准确率和F1分数方面保持了可比的有效性。
英文摘要:
Large language models (LLMs) are increasingly used for semantic query processing over large corpora. A set of semantic operators derived from relational algebra has been proposed to provide a unified interface for expressing such queries, among which the semantic filter operator serves as a cornerstone. Given a table T with a natural language predicate e, for each tuple in the relation, the execution of a semantic filter proceeds by constructing an input prompt that combines the predicate e with its content, querying the LLM, and obtaining the binary decision. However, this tuple-by-tuple evaluation necessitates a complete linear scan of the table, incurring prohibitive latency and token costs. Although recent work has attempted to optimize semantic filtering, it still does not break the linear LLM invocation barriers. To address this, we propose Clustering-Sampling-Voting (CSV), a new framework that reduces LLM invocations to sublinear complexity while providing error guarantees. CSV embeds tuples into semantic clusters, samples a small subset for LLM evaluation, and infers cluster-level labels via two proposed voting strategies: UniVote, which aggregates labels uniformly, and SimVote, which weights votes by semantic similarity. Moreover, CSV triggers re-clustering on ambiguous clusters to ensure robustness across diverse datasets. The results conducted on real-world datasets demonstrate that CSV reduces the number of LLM calls by 1.28-355x compared to the state-of-the-art approaches, while maintaining comparable effectiveness in terms of Accuracy and F1 score.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。