Semantic operators abstract large language model (LLM) calls in SQL clauses. It is gaining traction as an easy method to analyze semi-structured, unstructured, and multimodal datasets. While a plethora of recent works optimize various semantic operators, existing methods for semantic ORDER BY (full sort) and LIMIT K (top-K) remain lackluster. Our ListK framework improves the latency of semantic ORDER BY ... LIMIT K at no cost to accuracy. Motivated by the recent advance in fine-tuned listwise rankers, we study several sorting algorithms that best combine partial listwise rankings. These include: 1) deterministic listwise tournament (LTTopK), 2) Las Vegas and embarrassingly parallel listwise multi-pivot quickselect/sort (LMPQSelect, LMPQSort), and 3) a basic Monte Carlo listwise tournament filter (LTFilter). Of these, listwise multi-pivot quickselect/sort are studied here for the first time. The full framework provides a query optimizer for combining the above physical operators based on the target recall to minimize latency. We provide theoretical analysis to easily tune parameters and provide cost estimates for query optimizers. ListK empirically dominates the Pareto frontier, halving latency at virtually no cost to recall and NDCG compared to prior art.
翻译:语义运算符将大型语言模型(LLM)调用抽象为SQL子句。作为一种便捷分析半结构化、非结构化及多模态数据集的方法,该技术正日益受到关注。尽管近期大量研究致力于优化各类语义运算符,现有针对语义ORDER BY(全排序)与LIMIT K(前K项筛选)的方法仍存在不足。本文提出的ListK框架在保持准确性的前提下,显著提升了语义ORDER BY ... LIMIT K操作的延迟性能。受近期微调列表式排序器进展的启发,我们研究了多种能最优整合局部列表式排序结果的算法,包括:1)确定性列表式锦标赛排序(LTTopK);2)拉斯维加斯式且可高度并行的列表式多枢轴快速选择/排序(LMPQSelect、LMPQSort);3)基础蒙特卡洛列表式锦标赛过滤器(LTFilter)。其中,列表式多枢轴快速选择/排序算法系首次在本文中被探讨。完整框架提供查询优化器,可根据目标召回率组合上述物理运算符以最小化延迟。我们通过理论分析为参数调优提供便利,并为查询优化器提供成本估算。实验表明,ListK在帕累托边界上具有显著优势,在召回率与NDCG指标几乎无损的前提下,将延迟降低至现有最佳方法的一半。