Abstract
Materialized model query aims to find the most appropriate materialized model as the initial model for model reuse. It is the precondition of model reuse, and has recently attracted much attention. Nonetheless, the existing methods suffer from the need to provide source data, limited range of applications, and inefficiency since they do not construct a suitable metric to measure the target-related knowledge of materialized models. To address this, we present MMQ, a source-data free, general, efficient, and effective materialized model query framework. It uses a Gaussian mixture-based metric called separation degree to rank materialized models. For each materialized model, MMQ first vectorizes the samples in the target dataset into probability vectors by directly applying this model, then utilizes Gaussian distribution to fit for each class of probability vectors, and finally uses separation degree on the Gaussian distributions to measure the target-related knowledge of the materialized model. Moreover, we propose an improved MMQ (I-MMQ), which significantly reduces the query time while retaining the query performance of MMQ. Extensive experiments on a range of practical model reuse workloads demonstrate the effectiveness and efficiency of MMQ.
Introduction
In modern deep learning, "model reuse" or transfer learning has become the standard practice. Instead of training from scratch, practitioners fine-tune models pre-trained on massive datasets. However, as repositories like Hugging Face and TensorFlow Hub grow to hold thousands of models, selecting the optimal starting model becomes a significant challenge. Choosing an inappropriate model can lead to "negative transfer," where pre-existing knowledge actually hinders the new task.
Existing selection methods often require access to the original source training data, are restricted to specific label sets, or require expensive partial retraining of all candidates. To overcome these hurdles, we propose the Materialized Model Query (MMQ) framework, which identifies the best model by measuring how well a candidate naturally separates target data into distinct clusters without needing source data or retraining.
The MMQ Framework
The MMQ framework operates on the intuition that a good source model should already be able to distinguish between the classes in a new target dataset.
The process consists of three primary stages:
- Vectorization: The target dataset $D_t$ is passed through a candidate model $M_i$. MMQ captures the "soft labels"—the probability distribution across all classes—rather than just the final prediction.
- Fitting: For each class in the target dataset, MMQ fits a multivariate Gaussian distribution to the resulting probability vectors.
- Computation (Separation Degree): The framework calculates the Separation Degree (SD) between these Gaussian distributions. A higher SD indicates that the model's internal representations already distinguish well between the target classes, making it a superior candidate for transfer learning.
To address efficiency concerns with high-dimensional output spaces, we introduced I-MMQ (Improved MMQ). This variant utilizes a random, untrained fully connected layer to project high-dimensional vectors into a lower-dimensional space, significantly accelerating computation with minimal impact on ranking accuracy.
Key Results and Insights
We evaluated MMQ across diverse tasks, including image classification (ImageNet, CIFAR), text classification (IMDB, RCV1), and image regression. The framework was tested on various architectures, from LeNet to DenseNet and MobileNet.
- Accuracy: MMQ achieves a significantly higher Pearson Correlation Coefficient (PCC) with ground-truth fine-tuning performance compared to state-of-the-art methods like CAS and REAPER.
- Efficiency: I-MMQ demonstrated a 10x speedup over standard MMQ in large-scale scenarios, ranking dozens of models in minutes where brute-force retraining would take weeks.
- Privacy and Generality: By operating solely on the target data and model outputs, MMQ preserves the privacy of source datasets and remains effective even when target labels differ from source labels.
Conclusion
MMQ provides a robust, efficient, and source-data-free solution for the materialized model query problem. By leveraging the separation degree of class distributions, it enables practitioners to bypass expensive trial-and-error in model selection. Future work may extend this framework to unsupervised scenarios and emerging architectures like Vision Transformers.
Summary updated