Structured Query Language (SQL) has remained the standard query language for databases. SQL is highly optimized for processing structured data laid out in relations. Meanwhile, in the present application development landscape, it is highly desirable to utilize the power of learned models to perform complex tasks. Large language models (LLMs) have been shown to understand and extract information from unstructured textual data. However, SQL as a query language and accompanying relational database systems are either incompatible or inefficient for workloads that require leveraging learned models. This results in complex engineering and multiple data migration operations that move data between the data sources and the model inference platform. In this paper, we present iPDB, a relational system that supports in-database machine learning (ML) and large language model (LLM) inferencing using extended SQL syntax. In iPDB, LLMs and ML calls can function as semantic projects, as predicates to perform semantic selects and semantic joins, or for semantic grouping in group-by clauses. iPDB has a novel relational predict operator and semantic query optimizations that enable users to write and efficiently execute semantic SQL queries, outperforming the state-of-the-art.
翻译:结构化查询语言(SQL)始终是数据库的标准查询语言。SQL针对关系型结构化数据处理进行了高度优化。然而,在当前应用开发环境中,利用学习模型执行复杂任务的需求日益迫切。大型语言模型(LLMs)已被证明能够理解和提取非结构化文本数据中的信息。但SQL作为查询语言及其配套的关系型数据库系统,在需要利用学习模型的工作负载上存在不兼容或效率低下的问题,这导致需要在数据源与模型推理平台之间进行复杂的数据迁移操作。本文提出iPDB——一种支持通过扩展SQL语法实现库内机器学习(ML)与大型语言模型(LLM)推理的关系型系统。在iPDB中,LLMs与ML调用可作为语义投影、执行语义选择与语义连接的谓词,或用于分组子句中的语义分组。iPDB引入了新颖的关系型预测运算符及语义查询优化技术,使用户能够编写并高效执行语义SQL查询,其性能优于现有最优方案。