Introduction
For decades, database management systems (DBMS) have treated Machine Learning (ML) as an external "guest," accessed through isolated scripts or specialized User-Defined Functions (UDFs). This separation creates significant friction: unstructured data like video, audio, and sensor logs do not naturally fit the relational model, and the overhead of moving data between databases and ML frameworks is often prohibitive.
The Tensor Data Platform (TDP) proposes a fundamental shift: rebuilding the database engine on a tensor-based foundation. By replacing the traditional relational core with a tensor abstraction powered by PyTorch, TDP enables SQL queries to handle multi-modal data natively and allows for "trainable queries" that leverage automatic differentiation to learn directly from data.
Architecture and Methods
TDP is implemented entirely in Python, sitting atop the PyTorch runtime. This integration allows the system to leverage hardware acceleration (GPUs/TPUs) and modern tensor computation innovations. Its architecture is defined by three core pillars:
- Tensor-First Storage: Unlike traditional systems that store data in rows and columns, TDP stores data as multidimensional tensors. This allows a single "column" to represent anything from a simple vector of integers to a 4D tensor containing a batch of RGB images.
- SQL-to-PyTorch Compilation: TDP compiles standard SQL queries into a sequence of PyTorch models. Every relational operator—such as
JOINorGROUP BY—is executed as a high-performance tensor operation. - Probability Encoding (PE): To maintain information through the query pipeline, TDP uses a specialized encoding scheme that passes classification probabilities (e.g., the likelihood an image contains a specific object) through SQL operators.
Differentiable SQL Operators
The most significant innovation in TDP is the introduction of Differentiable SQL Operators. Traditional SQL operations like COUNT or GROUP BY are discrete and non-differentiable, making them incompatible with backpropagation. TDP introduces "soft" versions of these operators using approximations like Softmax.
This makes the entire query pipeline end-to-end differentiable. A user can train an embedded neural network (e.g., an image classifier) simply by providing the expected output of a SQL query. For instance, in the MNISTGrid task shown in Figure 1, the system can learn to recognize digits by backpropagating the error from the final COUNT aggregate back to the initial "Digit Parser" weights.
Experimental Evaluation
The researchers evaluated TDP across several benchmarks, including MNISTGrid, the Adult Income dataset for Learning from Label Proportions (LLP), and multi-modal searches over email attachments and OCRed documents.
Performance and Efficiency
A key advantage of TDP is its ability to avoid "bulk conversion." In traditional systems, querying data trapped in images (like OCRed tables) requires processing the entire dataset before loading it into a searchable table. TDP, by contrast, only runs expensive ML models on the data relevant to the query.
As shown in Figure 3, TDP achieved a speedup of two orders of magnitude over a traditional pipeline for OCR-based document queries. Furthermore, multi-modal queries on TDP ran 5x faster on GPUs compared to CPU-based execution.
Learning and Generalization
On the MNISTGrid task, the TDP "neurosymbolic" approach—decomposing the problem into a SQL query with embedded models—converged significantly faster than monolithic deep learning models like ResNet-18. Remarkably, a digit classifier trained solely via aggregate counts in a SQL query achieved 98.15% accuracy on the standard MNIST test set, demonstrating that the platform can effectively learn sub-tasks through relational logic.
Conclusion
TDP represents a bridge between neural pattern recognition and symbolic relational logic. By making the database differentiable, it enables a new class of applications where the database itself participates in the training loop. While currently focused on analytical (OLAP) workloads, future work aims to integrate transactional features and advanced vector indexing to further solidify TDP as a truly AI-centric database system.
Summary updated