NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Declarative Recursive Computation on an RDBMS

Dimitrije Jankov, Shangyu Luo, Binhang Yuan, Zhuhua Cai, Jia Zou, Chris Jermaine, Zekai J. Gao

Abstract

Modern machine learning frameworks often struggle with model parallelism when model sizes exceed single-device memory limits. Researchers from Rice University propose SimSQL, a system that leverages Relational Database Management Systems (RDBMS) to handle massive models. By extending SQL with recursive capabilities and implementing a novel "frame-based" execution strategy, SimSQL enables the training of neural networks that surpass the memory constraints of industry standards like TensorFlow.

Introduction: The Challenge of Model Parallelism

Most contemporary machine learning (ML) platforms, such as TensorFlow and PyTorch, are optimized for data parallelism. In this paradigm, the model is replicated across multiple GPUs, each processing a distinct batch of data. However, this approach encounters a "RAM wall" when the model itself—specifically its parameters and weights—is too large to fit into the memory of a single machine. This is a common occurrence with massive neural networks or high-dimensional embeddings.

Addressing this requires model parallelism, where the model's components are partitioned across a cluster. Manually implementing this in standard frameworks is notoriously complex and often inefficient. The authors argue that RDBMS technology is naturally suited for this task: model components can be represented as tables, and computations can be expressed as declarative SQL queries. The primary hurdles were the lack of efficient recursion for deep learning "loops" and the inability of standard optimizers to handle the resulting massive execution graphs.

Methods: Bridging Databases and Deep Learning

To transform an RDBMS into a viable ML platform, the researchers introduced several innovations within the SimSQL system.

SQL Extensions and Declarative Logic

The system introduces multi-dimensional, array-like indices to database tables (e.g., A[i][j]). This allows developers to define neural network layers and their dependencies declaratively. Instead of writing complex imperative loops, a programmer specifies how one version of a table (a layer) depends on another.

Declarative definition of activation layers using array-like indices, showing how weighted inputs and biases contribute to the current iteration's activation.

Frame-Based Execution and GQAP Optimization

Recursive SQL definitions are "unrolled" into a Directed Acyclic Graph (DAG) of relational algebra operations. For deep networks, these graphs can contain tens of thousands of operators, overwhelming standard database optimizers. SimSQL solves this through frame-based execution, which partitions the massive graph into manageable "frames."

The frame-based execution strategy involves iteratively cutting the execution graph into frames to optimize processing and resource allocation.

To determine the optimal points to "cut" the graph, the authors formulated the task as a Generalized Quadratic Assignment Problem (GQAP). The objective is to minimize "pipeline breakers"—instances where data must be written to disk or transmitted over the network—while ensuring each frame is small enough for the optimizer to process efficiently.

Evaluation and Key Results

The system was evaluated using a Wikipedia dump of 4.86 million documents across three tasks: a Feed-Forward Neural Network (FFNN), Word2Vec embeddings, and Latent Dirichlet Allocation (LDA).

Overcoming the RAM Wall

The most significant finding was SimSQL's ability to scale. While TensorFlow crashed on FFNN models exceeding 40,000 hidden neurons due to GPU memory limits, SimSQL successfully trained models with 160,000 neurons. This required managing a weight matrix of approximately 102 GB, which SimSQL handled by utilizing system RAM and disk as buffers.

Efficiency in Sparse Models

For models with sparse updates like Word2Vec and LDA, SimSQL's use of high-performance joins proved superior to the "parameter server" approach used by TensorFlow. At an embedding dimension of 1,000 for Word2Vec, SimSQL completed iterations in 17 minutes, compared to over an hour for TensorFlow. Similarly, SimSQL outperformed both TensorFlow and Spark on LDA tasks as the number of topics scaled to 100,000.

Discussion and Future Work

SimSQL demonstrates that the declarative power of SQL can simplify model parallelism. By specifying what to compute rather than how to distribute it, developers can leverage the RDBMS's ability to optimize data movement and storage based on hardware availability.

However, the current implementation has limitations. Built on Java and Hadoop MapReduce, SimSQL faces high startup latencies, making it less competitive for smaller models that fit on a single GPU. Furthermore, it does not yet exploit the raw computational speed of GPUs as effectively as specialized frameworks. Future research aims to integrate these recursive capabilities into faster database engines not tied to the Hadoop stack, potentially making RDBMS-based machine learning a standard for both large-scale and general-purpose tasks.

Summary updated

BibTeX
@article{jankov2019declarative,
  author = {Dimitrije Jankov and Shangyu Luo and Binhang Yuan and Zhuhua Cai and Jia Zou and Chris Jermaine and Zekai J. Gao},
  title = {{Declarative Recursive Computation on an RDBMS}},
  journal = {Proc. VLDB Endow.},
  year = {2019},
  doi = {10.14778/3317315.3317323},
}
Figure