MorphingDB: A Task-Centric AI-Native DBMS for Model Management and Inference

Sai Wu, Ruichen Xia, Dingyu Yang, Rui Wang, Huihang Lai, Jiarui Guan, Jiameng Bai, Dongxiang Zhang, Xiu Tang, Zhongle Xie, Peng Lu, Gang Chen · DOI

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.

The three-layer architecture of MorphingDB, illustrating the flow from SQL extensions to model selection, loading, and inferring.
  1. Interface Layer: Provides a declarative SQL extension allowing users to define tasks (e.g., CREATE TASK) rather than specific models.
  2. Processing Layer: Handles model selection, loading, and inference. It utilizes a DAG-based batch pipeline to optimize execution across CPU and GPU resources.
  3. 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.

The two-phase model selection framework, showing offline embedding of historical tasks and online projection for real-time selection.
  • 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

BibTeX
@article{wu2025morphingdb,
  author = {Sai Wu and Ruichen Xia and Dingyu Yang and Rui Wang and Huihang Lai and Jiarui Guan and Jiameng Bai and Dongxiang Zhang and Xiu Tang and Zhongle Xie and Peng Lu and Gang Chen},
  title = {{MorphingDB: A Task-Centric AI-Native DBMS for Model Management and Inference}},
  journal = {Proc. ACM Manag. Data},
  year = {2025},
  doi = {10.1145/3769844},
}
Figure