arXiv:2510.08489cs.DBcs.LG2025-10被引 4

用批量提示提升语义连接效率,减少大模型调用次数

Implementing Semantic Join Operators Efficiently

  • 将两张表的多行合并成一个提示,一次调用大模型识别所有匹配对
  • 通过上下文窗口限制推导最优批处理大小,降低计算开销
  • 适合需要高效语义查询的数据库系统,尤其适用于大模型驱动的场景

语义查询处理引擎常支持语义连接,使用户能匹配满足自然语言条件的行。此类连接条件可通过无需任务特定训练的大语言模型(LLM)评估。当前多数系统采用嵌套循环,对每对行调用一次LLM。本文提出一种受传统数据库块嵌套循环启发的新算法:将来自两个输入表的多行批量整合为单一提示,目标是让一次LLM调用识别当前输入中的所有匹配行对。论文给出公式以优化行批大小,考虑了大模型上下文窗口对输入和输出长度的限制。还提出一种自适应变体,适用于输出大小难以预估的情况。形式化渐进成本分析及实证结果表明,该方法显著降低处理成本,性能优于近期语义查询引擎中使用的连接实现。

原文摘要 · Abstract (English)

Semantic query processing engines often support semantic joins, enabling users to match rows that satisfy conditions specified in natural language. Such join conditions can be evaluated using large language models (LLMs) that solve novel tasks without task-specific training. Currently, many semantic query processing engines implement semantic joins via nested loops, invoking the LLM to evaluate the join condition on row pairs. Instead, this paper proposes a novel algorithm, inspired by the block nested loops join operator implementation in traditional database systems. The proposed algorithm integrates batches of rows from both input tables into a single prompt. The goal of the LLM invocation is to identify all matching row pairs in the current input. The paper introduces formulas that can be used to optimize the size of the row batches, taking into account constraints on the size of the LLM context window (limiting both input and output size). An adaptive variant of the proposed algorithm refers to cases in which the size of the output is difficult to estimate. A formal analysis of asymptotic processing costs, as well as empirical results, demonstrates that the proposed approach reduces costs significantly and performs well compared to join implementations used by recent semantic query processing engines.

语义连接大模型数据库批量推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。