Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2023 Apr 24;35(10):10295-10308.
doi: 10.1109/TKDE.2023.3269592. eCollection 2023 Oct 1.

Pushing ML Predictions Into DBMSs

Affiliations

Pushing ML Predictions Into DBMSs

Matteo Paganelli et al. IEEE Trans Knowl Data Eng. .

Abstract

In the past decade, many approaches have been suggested to execute ML workloads on a DBMS. However, most of them have looked at in-DBMS ML from a training perspective, whereas ML inference has been largely overlooked. We think that this is an important gap to fill for two main reasons: (1) in the near future, every application will be infused with some sort of ML capability; (2) behind every web page, application, and enterprise there is a DBMS, whereby in-DBMS inference is an appealing solution both for efficiency (e.g., less data movement), performance (e.g., cross-optimizations between relational operators and ML) and governance. In this article, we study whether DBMSs are a good fit for prediction serving. We introduce a technique for translating trained ML pipelines containing both featurizers (e.g., one-hot encoding) and models (e.g., linear and tree-based models) into SQL queries, and we compare in-DBMS performance against popular ML frameworks such as Sklearn and ml.net. Our experiments show that, when pushed inside a DBMS, trained ML pipelines can have performance comparable to ML frameworks in several scenarios, while they perform quite poorly on text featurization and over (even simple) neural networks.

Keywords: MLOPs; SQL; machine learning.

PubMed Disclaimer

Figures

Fig. 1.
Fig. 1.
A typical ML workflow. Rectangles are used to identify data artifacts (e.g., input data, or trained models); ellipses determine computations (e.g., data preparation and serving).
Fig. 2.
Fig. 2.
MASQ applied to an ML predictive pipeline.
Fig. 3.
Fig. 3.
Parsing of the pipeline of Example 1. The pipeline (top) is parsed on a container DAG (bottom). Each container stores a reference to the operator, its signature and extractor.
Fig. 4.
Fig. 4.
Scaling and linear model in SQL.
Fig. 5.
Fig. 5.
One-hot encoding in SQL.
Fig. 6.
Fig. 6.
SQL workflow for the one-hot encoding sparse implementation.
Fig. 7.
Fig. 7.
Pipeline with OHE followed by a linear regression executed in MASQ with TRO and partitioning.
Fig. 8.
Fig. 8.
How tree ensembles over triplet are translated in MASQ.
Fig. 9.
Fig. 9.
Throughput for Sklearn, ml.net (on CSV, MySQL and SQL Server) and MASQ (on MySQL and SQL Server).
Fig. 10.
Fig. 10.
Scalability of the different frameworks, over MySQL, as we change the batch size.
Fig. 11.
Fig. 11.
Latency numbers over a single record (MySQL).
Fig. 12.
Fig. 12.
Operator breakdown for P7 and P8.
Fig. 13.
Fig. 13.
Operator breakdown for P9 (Criteo) and P10 (FlightDelay). For P9 we also compare GBDT vs SDCA.
Fig. 14.
Fig. 14.
Latency breakdown for MASQ, ml.net (ML.) and Sklearn (SK.), for pipelines P7, P8, P9 and P10. The time spent is divided into three buckets: load, computation, and write.
Fig. 15.
Fig. 15.
Performance comparison with indexing (MySQL).
Fig. 16.
Fig. 16.
Operator fusion (OHE + GBDT) for P9 and P10.
Fig. 17.
Fig. 17.
Comparison of different tree implementation methods (MySQL).
Fig. 18.
Fig. 18.
Comparison of single intermediate data and multi-way join strategy for OHE + linear models.
Fig. 19.
Fig. 19.
Comparison of tree ensembles performance with variable number of leaves on P8.
Fig. 20.
Fig. 20.
Left hand-side: Sentiment Analysis over textual features. Right hand-side: an MLP model applied on CreditCard.

References

    1. Dean J., “The deep learning revolution and its implications for computer architecture and chip design,” Nov. 2019, arXiv:1911.05289.
    1. Ahmed Z. et al., “Machine learning at microsoft with ML.NET,” in Proc. ACM SIGKDD Int. Conf. Knowl. Discov. Data Mining, 2019, pp. 2448–2458.
    1. Abadi M. et al., “TensorFlow: A system for large-scale machine learning,” in Proc. 12th USENIX Symp. Operating Syst. Des. Implementation, 2016, pp. 265–283. [Online]. Available: https://www.usenix.org/system/files/conference/osdi16/osdi16-abadi.pdf
    1. Paszke A., “PyTorch: An Imperative Style, High-Performance Deep Learning Library,” Dec. 2019, arXiv:1912.01703.
    1. Sergeev A. and Del Balso M., “Horovod: Fast and easy distributed deep learning in TensorFlow,” Feb. 2018, arXiv:1802.05799.

LinkOut - more resources