TL;DR
This paper introduces NeurStore, a novel system for efficiently managing deep learning (DL) models within databases. By treating models as collections of tensors and leveraging structural similarities, NeurStore significantly reduces storage overhead through tensor-level deduplication and adaptive delta quantization. This allows for faster model loading and inference, crucial for the growing trend of in-database AI analytics.
What Problem Does This Paper Address?
The increasing adoption of AI-powered analytics within databases means that DL models are becoming a common sight. However, existing database systems struggle to efficiently store and manage these models. Typically, models are stored as large, monolithic files or compressed using generic methods that don't exploit the inherent structure of DL models. This leads to substantial storage overhead, especially as the number and size of models grow. Furthermore, loading these large models for inference can introduce significant latency. The core problem is the lack of an efficient, in-database solution that can store DL models compactly while still enabling fast and accurate utilization.
Methods
NeurStore tackles this problem with a three-pronged approach:
- Tensor-Based Storage Engine: Instead of treating each model as an indivisible unit, NeurStore breaks models down into their constituent tensors. It then uses a Hierarchical Navigable Small World (HNSW) graph to index these tensors. This allows for identifying and reusing "base tensors" (original parameters) across different models. Only the differences (deltas) between a new tensor and its closest base tensor are stored, enabling fine-grained deduplication.
- Delta Quantization Algorithm: To further compress these delta tensors, NeurStore employs a novel adaptive delta quantization technique. This method quantizes the differences between tensors, which are typically smaller and less sensitive to precision loss than the original tensors. The algorithm dynamically adjusts the bit width for each delta tensor based on its value distribution and a user-defined precision tolerance, balancing compression with accuracy.
- Compression-Aware Model Loading: NeurStore avoids the costly process of fully decompressing models before inference. Instead, it integrates decompression directly into the computation graph. This "on-demand" decompression allows for direct computation on compressed tensors, significantly reducing model loading latency and memory footprint. It also supports flexible loading, where users can choose to load only partial delta bits for even faster inference at the cost of slightly reduced accuracy.
Datasets
The paper evaluates NeurStore using a collection of 800 DL models totaling 361GB, sourced from Hugging Face. For experimental workloads, they use:
- IMDB dataset: For sequence classification tasks (DistilBERT models).
- Beans dataset: For image classification tasks (Vision Transformer models).
- Avazu dataset: For tabular classification tasks (MLP models).
Key Insights and Ideas
- Tensors, not Models, are the Unit of Deduplication: The fundamental insight is that DL models share a lot of structural similarity at the tensor level, not just at the model level. Exploiting this allows for much more effective deduplication than traditional methods.
- Compressing Deltas is More Effective: Quantizing the differences between tensors (deltas) rather than the full tensors themselves leads to better compression ratios and less accuracy degradation. This is because deltas are typically smaller in magnitude and range.
- On-Demand Decompression is Key for Performance: The overhead of full model decompression for inference is a major bottleneck. By integrating decompression into the computation pipeline, NeurStore dramatically speeds up model utilization.
- Flexibility is Crucial: Offering users control over the precision tolerance and flexible model loading allows them to tailor the system to their specific needs, balancing storage, accuracy, and performance.
Key Results
- Storage Savings: NeurStore achieves substantial storage reduction, using 93% and 70% of the space required by ELF (a specialized model compression method) and PostgresML (a database-native ML system), respectively. It achieves a compression ratio of 1.38x compared to 1.32x for ELF.
- End-to-End Performance: NeurStore reduces total query latency by up to 47% compared to PostgresML and 20% compared to ELF*.
- Throughput: NeurStore achieves higher write throughput (39 queries/min vs. 35 for ELF) and significantly higher read throughput (up to 2.5x faster than ELF).
- Model Loading Speed: NeurStore achieves up to 61% speedup in model loading over ELF*.
- Accuracy: With a default precision tolerance of 5.96 × 10⁻⁸, over 90% of tested models show no performance degradation. Flexible loading (8-bit delta) results in an average accuracy change of less than 0.1% for most models.
- Extensibility: NeurStore integration with DuckDB and ClickHouse also shows significant improvements in throughput and storage efficiency.
Limitations and Future Work
- Similarity Threshold Tuning: The paper notes that the similarity threshold (τ) for delta encoding is a key parameter. While they identify an optimal range (around 0.16), finding the best value might require experimentation for specific workloads.
- Generalizability of Delta Quantization: While effective, the delta quantization algorithm's performance is tied to the assumption that deltas are smaller and less sensitive to quantization. This might not hold true for all types of model updates or architectures.
- Future Work: The authors suggest further exploring more advanced quantization techniques and optimizing the HNSW index for even greater efficiency. They also mention the potential for integrating NeurStore with other database systems and exploring its use in more complex AI workflows.
Summary updated