# The Duck's Brain: Training and Inference of Neural Networks in Modern Database Engines

arXiv: https://arxiv.org/abs/2312.17355 · HTML: https://mlsanity.com/paper/2312.17355/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Builds on 18 of its 62 references that are in the map.
- First posted on arXiv 28 Dec 2023.

## Builds on (most cited first, 18 of 18)

- [SystemDS: A Declarative Machine Learning System for the End-to-End Data Science Lifecycle](https://mlsanity.com/paper/1909.02976/) (2019)
- [On Optimizing Operator Fusion Plans for Large-Scale Machine Learning in SystemML](https://mlsanity.com/paper/1801.00829/) (2018)
- [Optimizing Machine Learning Inference Queries with Correlative Proxy Models](https://mlsanity.com/paper/2201.00309/) (2022)
- [Declarative Recursive Computation on an RDBMS, or, Why You Should Use a Database For Distributed Machine Learning](https://mlsanity.com/paper/1904.11121/) (2019)
- [A Layered Aggregate Engine for Analytics Workloads](https://mlsanity.com/paper/1906.08687/) (2019)
- [Query Processing on Tensor Computation Runtimes](https://mlsanity.com/paper/2203.01877/) (2022)
- [A Critical Analysis of Recursive Model Indexes](https://mlsanity.com/paper/2106.16166/) (2021)
- [Optimizing Tensor Programs on Flexible Storage](https://mlsanity.com/paper/2210.06267/) (2022)
- [NuPS: A Parameter Server for Machine Learning with Non-Uniform Parameter Access](https://mlsanity.com/paper/2104.00501/) (2021)
- [Share the Tensor Tea: How Databases can Leverage the Machine Learning Ecosystem](https://mlsanity.com/paper/2209.04579/) (2022)
- [Improving Matrix-vector Multiplication via Lossless Grammar-Compressed Matrices](https://mlsanity.com/paper/2203.14540/) (2022)
- [Zero-Shot Cost Models for Distributed Stream Processing](https://mlsanity.com/paper/2207.03823/) (2022)
- [Compiling PL/SQL Away](https://mlsanity.com/paper/1909.03291/) (2019)
- [Extensible Database Simulator for Fast Prototyping In-Database Algorithms](https://mlsanity.com/paper/2204.09819/) (2022)
- [In-Machine-Learning Database: Reimagining Deep Learning with Old-School SQL](https://mlsanity.com/paper/2004.05366/) (2020)
- [High-Level ETL for Semantic Data Warehouses -- Full Version](https://mlsanity.com/paper/2006.07180/) (2020)
- [Density-optimized Intersection-free Mapping and Matrix Multiplication for Join-Project Operations (extended version)](https://mlsanity.com/paper/2206.04995/) (2022)
- [Auto-Differentiation of Relational Computations for Very Large Scale Machine Learning](https://mlsanity.com/paper/2306.00088/) (2023)

## Built on by (most cited first, 2 of 2)

- [TranSQL+: Serving Large Language Models with SQL on Low-Resource Hardware](https://mlsanity.com/paper/2502.02818/) (2025)
- [Automated Tensor-Relational Decomposition for Large-Scale Sparse Tensor Computation](https://mlsanity.com/paper/2603.08957/) (2026)

## Abstract (arXiv)

Although database systems perform well in data access and manipulation, their relational model hinders data scientists from formulating machine learning algorithms in SQL. Nevertheless, we argue that modern database systems perform well for machine learning algorithms expressed in relational algebra. To overcome the barrier of the relational model, this paper shows how to transform data into a relational representation for training neural networks in SQL: We first describe building blocks for data transformation, model training and inference in SQL-92 and their counterparts using an extended array data type. Then, we compare the implementation for model training and inference using array data types to the one using a relational representation in SQL-92 only. The evaluation in terms of runtime and memory consumption proves the suitability of modern database systems for matrix algebra, although specialised array data types perform better than matrices in relational representation.
