Skip to main content
QUICK REVIEW

[论文解读] Extending Relational Query Processing with ML Inference

Konstantinos Karanasos, Matteo Interlandi|arXiv (Cornell University)|Nov 1, 2019
Advanced Database Systems and Queries参考文献 19被引用 16
一句话总结

Raven 通过将 ONNX Runtime 与统一中间表示(IR)集成,实现了机器学习推理在 SQL Server 中的深度集成,支持关系型与机器学习操作之间的交叉优化。通过利用原生执行和高级查询优化,该方法相比独立的推理框架实现了高达 24 倍的性能提升。

ABSTRACT

The broadening adoption of machine learning in the enterprise is increasing the pressure for strict governance and cost-effective performance, in particular for the common and consequential steps of model storage and inference. The RDBMS provides a natural starting point, given its mature infrastructure for fast data access and processing, along with support for enterprise features (e.g., encryption, auditing, high-availability). To take advantage of all of the above, we need to address a key concern: Can in-RDBMS scoring of ML models match (outperform?) the performance of dedicated frameworks? We answer the above positively by building Raven, a system that leverages native integration of ML runtimes (i.e., ONNX Runtime) deep within SQL Server, and a unified intermediate representation (IR) to enable advanced cross-optimizations between ML and DB operators. In this optimization space, we discover the most exciting research opportunities that combine DB/Compiler/ML thinking. Our initial evaluation on real data demonstrates performance gains of up to 5.5x from the native integration of ML in SQL Server, and up to 24x from cross-optimizations--we will demonstrate Raven live during the conference talk.

研究动机与目标

  • 为解决在企业关系型数据库管理系统(RDBMS)环境中实现高性能、安全且可管理的机器学习推理所面临的挑战。
  • 探究在 RDBMS 内部执行的机器学习推理是否能够与专用机器学习框架在性能上持平或更优。
  • 扩展关系代数与查询优化机制,原生支持机器学习评分与模型流水线。
  • 通过与企业级数据库功能(如安全控制、审计与高可用性)的完整集成,实现使用标准 SQL 的无缝部署与执行。
  • 探索在统一执行框架中,关系型操作(如连接、聚合)与机器学习操作(如推理、特征工程)之间的新型交叉优化。

提出的方法

  • Raven 使用静态分析器将 SQL 查询与 Python 机器学习流水线捕获为统一的中间表示(IR),其中包含关系型与机器学习操作。
  • 系统在 IR 中应用新型跨操作优化(如将机器学习推理下推至扫描与连接操作),以最小化数据移动并提升效率。
  • Raven 原生集成 ONNX Runtime 到 SQL Server 中,实现低开销、进程内执行 ONNX 兼容模型,延迟极低。
  • 对于不支持的模型流水线,Raven 回退至通过外部语言运行时(如 Python/R)或通过 Docker 容器与 REST 端点的外部进程执行。
  • 优化后的 IR 在 SQL Server 上被编译并执行,利用其原生并行执行与查询执行引擎,同时处理数据与模型计算。
  • 性能在不同数据规模与模型类型下进行测量,与独立的 ONNX Runtime 及外部执行方式对比。

实验结果

研究问题

  • RQ1在 RDBMS 内部执行机器学习模型评分是否能够实现与专用机器学习推理框架相当或更优的性能?
  • RQ2关系型操作与机器学习操作之间的交叉优化在降低端到端推理延迟方面的有效性如何?
  • RQ3将机器学习推理原生集成到关系型数据库引擎中会引入多大的性能开销?
  • RQ4原生数据库特性(如查询优化、缓存与并行执行)在多大程度上能提升机器学习推理性能?
  • RQ5统一的 IR 如何实现对多种机器学习框架与数据处理流水线的优化?

主要发现

  • Raven 在 SQL Server 中原生集成 ONNX Runtime,相比独立的 ONNX Runtime 执行,性能最高提升 5.5 倍。
  • 关系型操作与机器学习操作之间的交叉优化可实现高达 24 倍的性能提升,尤其在大规模数据处理场景下表现显著。
  • 对于小数据集(如 100 个元组),由于 SQL Server 中的模型与会话缓存机制,Raven 相比独立的 ONNX Runtime 最高提升 10 倍。
  • 对于大规模数据集(100 万至 1000 万个元组),Raven 通过 SQL Server 自动并行化扫描与 PREDICT 操作,相比 ORT 实现约 5 倍的性能提升。
  • 外部进程执行(Raven Ext)的开销约为每次调用 0.5 秒,但对不支持的流水线仍具备可行性。
  • Raven 的批处理推理相比逐元组推理实现数量级的性能提升,最优批处理大小是关键调优参数。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。