Abstract
The increasing demand for deep neural inference within database environments has driven the emergence of AI-native DBMSs. However, existing solutions either rely on model-centric designs requiring developers to manually select, configure, and maintain models, resulting in high development overhead, or adopt task-centric AutoML approaches with high computational costs and poor DBMS integration. We present MorphingDB, a task-centric AI-native DBMS that automates model storage, selection, and inference within PostgreSQL. To enable flexible, I/O-efficient storage of deep learning models, we first introduce specialized schemas and multi-dimensional tensor data types to support BLOB-based all-in-one and decoupled model storage. Then we design a transfer learning framework for model selection in two phases, which builds a transferability subspace via offline embedding of historical tasks and employs online projection through feature-aware mapping for real-time tasks. To further optimize inference throughput, we propose pre-embedding with vectoring sharing to eliminate redundant computations and DAG-based batch pipelines with cost-aware scheduling to minimize the inference time. Implemented as a PostgreSQL extension with LibTorch, MorphingDB outperforms AI-native DBMSs (EvaDB, Madlib, GaussML) and AutoML platforms (AutoGluon, AutoKeras, AutoSklearn) across nine public datasets, encompassing series, NLP, and image tasks. Our evaluation demonstrates a robust balance among accuracy, resource consumption, and time cost in model selection and significant gains in throughput and resource efficiency.
Introduction
Traditional "AI-native" databases follow a model-centric paradigm where developers must manually select, tune, and manage specific neural networks. This approach requires significant machine learning expertise and creates substantial development overhead. While Automated ML (AutoML) tools attempt to bridge this gap, they are often computationally expensive and poorly integrated with core database engines, leading to inefficient data movement and high latency. MorphingDB addresses these challenges by shifting to a task-centric architecture that automates the entire deep learning lifecycle within a database environment.
System Architecture
MorphingDB is implemented as a PostgreSQL extension that bridges the gap between relational data management and deep learning frameworks. The architecture is divided into three primary layers: the Interface Layer, the Processing Layer, and the Storage Layer.
- Interface Layer: Provides a declarative SQL extension allowing users to define tasks (e.g.,
CREATE TASK) rather than specific models. - Processing Layer: Handles model selection, loading, and inference. It utilizes a DAG-based batch pipeline to optimize execution across CPU and GPU resources.
- Storage Layer: Manages a "Model Zoo" and specialized storage schemas. It introduces the Mvec Tensor Representation, a new data type that stores raw data alongside explicit shape metadata, enabling lossless conversion to PyTorch tensors.
Task-Centric Model Selection
A core innovation of MorphingDB is its two-phase transfer learning framework for model selection. Instead of exhaustive iterative training, the system treats model selection as a geometric projection problem.
- Offline Phase: The system constructs a "transferability subspace" by analyzing the performance of 198 pre-trained models on historical tasks.
- Online Phase: When a new task is submitted, MorphingDB uses a CLIP-based feature extractor to project the task into the established subspace. The optimal model is identified via vector multiplication, providing near-optimal accuracy with minimal computational overhead.
Optimized Inference and Storage
MorphingDB optimizes performance through several database-specific techniques:
- Decoupled Storage: By separating model architecture from weight parameters, the system supports "partial loading." This allows the database to update specific layers without reloading massive binary files, reducing I/O overhead.
- Vectorized Sharing: To eliminate redundant computations, the system pre-embeds data and uses SIMD instructions to share vectorized representations across concurrent queries.
- Cost-Aware Scheduling: The system dynamically decides whether to execute operators on the CPU or GPU. For small, low-dimensional tasks, it avoids the overhead of GPU data transfer, whereas for heavy image or NLP tasks, it leverages GPU batching.
Performance Evaluation
MorphingDB was evaluated against leading AI-native DBMSs and AutoML frameworks across nine datasets spanning time-series, image, and NLP domains. Key results include:
- Throughput: Achieved up to 4x higher throughput than EvaDB, Madlib, and GaussML on time-series tasks.
- Latency: Reduced inference time by over 70% on image datasets compared to EvaDB, primarily due to the vectorized storage format.
- Efficiency: Provided a superior balance of accuracy and resource consumption compared to AutoGluon and AutoKeras, finding high-performing models in a fraction of the time.
Conclusion
MorphingDB represents a significant step toward truly autonomous AI-native databases. By treating AI models as managed database assets—similar to indexes—it removes the burden of manual model management from developers while delivering superior performance through hardware-aware optimization and efficient transfer learning.
Summary updated