Self-adaptive model migration method and system based on reverse multi-teaching distillation
Through the adaptive model migration method of reverse multi-professor distillation, the adaptability problem of cross-device and cross-scenario migration is solved, and the efficient operation and generalization ability of the model on edge devices and low-computing power devices are achieved.
Patent Information
- Application Number
- CN202511197679.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-26
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-08-26
AI Technical Summary
Knowledge distillation guided by a traditional single teacher model is difficult to adapt to complex cross-device and cross-scenario migration requirements, which limits the application of the model on edge devices and low-computing power devices.
An adaptive model migration method based on reverse multi-professor distillation is adopted. By obtaining the parameters of the target device, the reference device with the lowest computing power is selected, a parameter-matching model is established, and the reference scenario model is trained on the reference device. The pre-connected large model is used as the teacher model to guide the student model training. The professor model is selected based on the correlation between the target application scenario and the reference scenario to perform knowledge transfer.
It improves the adaptability and generalization ability of the model in different devices and scenarios, ensures the efficient operation of the model in resource-constrained environments, and improves the efficiency and generalization ability of the migration model.
Smart Images

Figure CN120688581A_ABST
Abstract
Description
Technical Field
[0001] Multiple embodiments of this specification relate to, in particular, an adaptive model migration method and system based on reverse multi-professor distillation. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, deep learning models have achieved remarkable success in a variety of fields, including image recognition, natural language processing, and speech recognition. However, these high-performance models typically require significant computing resources and storage space, which limits their application on edge devices, mobile terminals, or low-computing devices. To overcome this limitation, model compression and transfer learning techniques have gradually gained attention. In particular, knowledge distillation methods, by transferring knowledge from large teacher models to small student models, enable lightweight models to maintain high accuracy while reducing the demand for computing resources.
[0003] However, in real-world applications, hardware differences between target devices and the diversity of application scenarios present new challenges for model migration. Traditional knowledge distillation guided by a single teacher model struggles to adapt to the complex demands of cross-device and cross-scenario migration. Therefore, research is needed on techniques to miniaturize the model and further enhance generalization. Summary of the Invention
[0004] Multiple embodiments of this specification describe an adaptive model migration method and system based on reverse multi-professor distillation.
[0005] In a first aspect, the embodiments of this specification provide an adaptive model migration method based on reverse multi-professional distillation, comprising the steps of:
[0006] Obtaining parameters of multiple target devices that may be migrated, and obtaining a reference device with the lowest computing power based on the parameters of the multiple target devices;
[0007] Acquire multiple reference scenes and sample data corresponding to the reference scenes, assign a reference device to each reference scene, and establish a model on the reference device with a scale matching the parameters of the reference device;
[0008] Using the sample data corresponding to each reference scene, respectively, the model on the corresponding reference device is trained, and the trained model is recorded as the reference scene model;
[0009] According to the parameters of the reference device, a student model is established, and the pre-connected large model is used as a teacher model to guide the training of the student model, and the trained student model is used as the standard model;
[0010] Acquire a selected target application scenario, and obtain a correlation between the target application scenario and each of the reference scenarios;
[0011] Selecting a plurality of reference scene models whose correlation degree is higher than a preset reference threshold as teaching models;
[0012] The standard model is taught using a plurality of the teaching models, and the standard model is migrated to the target device after the teaching is completed.
[0013] In a second aspect, the embodiments of this specification provide an adaptive model migration system based on reverse multi-professional distillation, including:
[0014] A reference device module obtains parameters of multiple target devices that may be migrated, and obtains a reference device with the lowest computing power based on the parameters of the multiple target devices;
[0015] A reference scene module acquires multiple reference scenes and sample data corresponding to the reference scenes, assigns a reference device to each reference scene, and establishes a model on the reference device whose scale matches the parameters of the reference device;
[0016] The reference model module uses the sample data corresponding to each reference scene to train the model on the corresponding reference device, and the trained model is recorded as the reference scene model;
[0017] The standard model module establishes a student model based on the parameters of the reference device, uses the pre-connected large model as the teacher model to guide the training of the student model, and the trained student model serves as the standard model;
[0018] an association module, which obtains a selected target application scenario and obtains a degree of association between the target application scenario and each of the reference scenarios;
[0019] A selection module selects a plurality of reference scene models with correlations higher than a preset reference threshold as teaching models;
[0020] The migration module uses a plurality of the teaching models to teach the standard model, and migrates the standard model to the target device after the teaching is completed.
[0021] In a third aspect, embodiments of this specification provide an electronic device, including a processor and a memory;
[0022] The processor is connected to the memory;
[0023] The memory is used to store executable program code;
[0024] The processor reads the executable program code stored in the memory to run a program corresponding to the executable program code, so as to execute the method described in any one of the above aspects.
[0025] In a fourth aspect, an embodiment of this specification provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the above aspects is implemented.
[0026] In a fifth aspect, embodiments of this specification provide a computer program product, including a computer program, which implements the method described in any of the above aspects when executed by a processor.
[0027] The beneficial effects of the technical solutions provided by some embodiments of this specification include at least:
[0028] In multiple embodiments of this specification, an adaptive model migration method and system based on reverse multi-teacher distillation is provided. By dynamically selecting multiple reference scenario models that are most suitable for the target application scenario as the teaching model, it is possible to extract knowledge from different angles and integrate it into the student model, which not only improves the adaptability of the model to specific tasks, but also enhances its generalization ability in new scenarios. A reference device with the lowest computing power is generated according to the specific parameters of the target device, and a matching model is built on this basis to ensure that the model can run efficiently in a resource-constrained environment. Knowledge distillation under the guidance of traditional single-teacher models is difficult to cope with complex cross-device and cross-scenario migration requirements. The reverse multi-teacher distillation strategy adopted in this application, combined with the correlation screening teaching model, effectively improves the efficiency and generalization ability of the migration model.
[0029] Other features and advantages of the various embodiments of this specification will be further disclosed in the following detailed description and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0031] Figure 1 A schematic diagram of the adaptive model migration provided in the embodiments of this specification.
[0032] Figure 2 A flow chart of the adaptive model migration method provided in the embodiments of this specification.
[0033] Figure 3 This is a schematic diagram of obtaining the correlation provided in the embodiments of this specification.
[0034] Figure 4 Schematic diagram of the adaptive model migration system provided in the embodiments of this specification.
[0035] Figure 5This is a schematic diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0036] The following is an explanation and description of the technical solutions of the embodiments of this specification in conjunction with the drawings of the embodiments of this specification. However, the following embodiments are only preferred embodiments of this specification and are not exhaustive. Based on the embodiments in the implementation mode, other embodiments obtained by those skilled in the art without making any creative work are all within the scope of protection of this specification.
[0037] Throughout this specification, the claims, and the accompanying drawings, the terms "first," "second," "third," and the like are used to distinguish between different items, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may include other steps or elements inherent to the process, method, product, or apparatus.
[0038] In the following description, terms such as "inside", "outside", "up", "down", "left", "right", etc. that indicate directions or positional relationships are only used to facilitate the description of the embodiments and simplify the description. They do not indicate or imply that the devices or elements referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, they should not be understood as limitations on this specification.
[0039] The data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions.
[0040] Before introducing the technical solution in this specification, the application scenarios and related technologies of the technical solution are introduced.
[0041] Model transfer is a technology that enables machine learning models trained in one environment or device to be transferred and effectively run in a different environment or device. This technology is particularly suitable for situations where the target device has limited resources, such as mobile devices and embedded systems. Through model transfer, complex models that originally required high computing power can be adapted to devices with lower computing power, thereby expanding the model's application range.
[0042] The significance of model migration lies in overcoming the limitations of high-performance computing resources, enabling advanced machine learning models to be used across a wide range of hardware. This is particularly true in areas such as the Internet of Things (IoT) and edge computing, where direct deployment of large-scale models is often impractical due to the diversity of devices and their limited computing resources. Model migration provides an effective solution that ensures model performance while meeting device resource constraints.
[0043] For example, in a smart home system, smart speakers from different brands have different hardware configurations. Suppose we develop a complex speech recognition model designed to improve the ability to understand specific sentences. However, high-end smart speakers are equipped with powerful processors and ample memory, while low-end models are relatively limited. Using the adaptive model transfer method based on reverse multi-teaching distillation described above, we can adjust and optimize this complex speech recognition model so that it not only runs efficiently on high-end devices but also adapts to the resource constraints of low-end devices, ensuring that all users can experience high-quality voice interaction services. In this way, even if the hardware conditions vary, each smart speaker can still maintain consistent service quality and user experience.
[0044] This manual provides an adaptive model migration method and system based on reverse multi-professional distillation. Figure 1 This method and system first selects a reference device 11 with the lowest computing power based on the parameters of multiple possible target devices 24 to be migrated, and builds a scale-matched model on this device. Sample data corresponding to each reference scenario 13 is then used to train the corresponding model. Subsequently, a pre-installed large model is used as a teacher model to guide the training of the student model, ultimately obtaining the standard model 22. By analyzing the correlation between the target application scenario 21 and the reference scenario 13, an appropriate reference scenario model 12 is selected as the teaching model to teach the standard model 22. Finally, the optimized standard model 22 is migrated to the target device 24.
[0045] Specifically, this manual first provides an adaptive model migration method based on reverse multi-professional distillation, see the attached Figure 2 , including the steps of:
[0046] Step S1) Obtain parameters of multiple target devices 24 that may be migrated, and obtain a reference device 11 with the lowest computing power based on the parameters of the multiple target devices 24. Specifically, it includes:
[0047] Collecting hardware parameter information of the target device 24, including processor type, number of cores, memory capacity, available storage space, floating-point computing capability, maximum power consumption limit, and supported inference frameworks;
[0048] Normalize the performance of multiple target devices 24, unify hardware parameters of different dimensions into performance indicators, and obtain a comprehensive computing power evaluation value of the target device 24;
[0049] According to the comprehensive computing power evaluation values of all target devices 24 , the target device 24 with the lowest comprehensive computing power evaluation value is selected as the reference device 11 .
[0050] For example, in this embodiment, an intelligent image recognition system needs to be deployed on three different devices. The hardware parameter information of the target device 24 is collected to obtain:
[0051] Device A: Processor type: Intel Xeon E5-2699 v4, number of cores: 22, memory capacity: 128GB, available storage space: 2TB SSD, floating-point computing power: 3.8 TFLOPS, maximum power consumption limit: 145W, supported inference frameworks: TensorFlow, PyTorch.
[0052] Device B: Processor type: Intel Core i7-9700K, number of cores: 8, memory capacity: 16GB, available storage space: 512GB SSD, floating-point computing power: 1.5 TFLOPS, maximum power consumption limit: 95W, supported inference frameworks: TensorFlow, ONNX Runtime.
[0053] Device C: Processor type: Qualcomm Snapdragon 855, Number of cores: 8, Memory capacity: 6GB, Available storage space: 128GB UFS, Floating-point computing power: 0.7 TFLOPS, Maximum power consumption limit: 5W, Supported inference framework: TensorFlow Lite.
[0054] Normalize hardware parameters for performance to facilitate comparison. This is done using methods known in the art: convert each parameter into a relative value or score, then weight them and sum them to produce a comprehensive computing power assessment. For example, weights are assigned based on factors such as processor performance, memory size, and floating-point computing power, and a score representing the overall performance of the device is calculated based on these weights.
[0055] For example, floating-point computing capability is used as the primary performance indicator, with the highest weight. Other hardware parameters have lower weights. The final calculation results show that Device A scores 3.8, Device B scores 1.5, and Device C scores 0.7. Therefore, Device C is selected as reference device 11. The migrated model must run smoothly on Device C.
[0056] Step S2 ) Acquire multiple reference scenes 13 and sample data corresponding to the reference scenes 13 , assign a reference device 11 to each reference scene 13 , and establish a model on the reference device 11 with a scale matching the parameters of the reference device 11 .
[0057] Different reference scenarios 13 are defined or identified, each of which has its own specific application background and requirements, as well as corresponding sample data sets. For example, in the field of image recognition, reference scenarios 13 include face recognition, object detection, text recognition, etc.
[0058] Based on the selected reference device 11 with the lowest computing power, a reference device 11 is assigned to each reference scenario 13. The hardware parameters of the reference devices 11 are identical, but the instances are different. That is, there are multiple reference devices 11 with the same hardware parameters. A model of initial scale is initialized on the selected reference device 11. The model has a predetermined number of layers, neurons, and weight settings.
[0059] The step of establishing a model on the reference device 11 whose scale matches the parameters of the reference device 11 includes:
[0060] Establishing an initial model of a preset initial scale on the reference device 11 and running it, and recording the running time, wherein the initial model has a preset number of layers, number of neurons, and weights;
[0061] When the running time is less than the preset lower limit reference time, the number of the neurons is increased; when the running time is greater than the preset upper limit reference time, the number of the neurons is reduced until the running time is between the lower limit reference time and the upper limit reference time.
[0062] Specifically, run the model and record the runtime. If the model runtime is too short (below the preset lower limit), it indicates that the model may be too small and cannot fully utilize the device resources. In this case, consider increasing the number of neurons to improve model complexity. Conversely, if the runtime is too long (exceeding the preset upper limit), it may mean that the model is too complex and unsuitable for the current device. In this case, reduce the number of neurons to optimize the model size. Continuously adjust the model size until its runtime is within a reasonable range.
[0063] Step S3) The sample data corresponding to each reference scene 13 is used to train the model on the corresponding reference device 11 , and the trained model is recorded as the reference scene model 12 .
[0064] A corresponding sample dataset is required for each reference scenario 13. This dataset should represent the various situations within that scenario and have sufficient diversity to train a robust model. Based on the model scale (number of layers, neurons, etc.) determined in step S2, the model is configured on the reference device 11, including loading initial weights and setting hyperparameters such as the learning rate. The model is trained using the sample dataset corresponding to the reference scenario 13. Data is fed into the model, and model parameters are adjusted based on the discrepancy between the model output and the actual labels.
[0065] During training, various techniques can be employed to improve model performance and training efficiency, such as batch gradient descent, stochastic gradient descent (SGD), and the Adam optimizer. Key metrics during training are monitored to assess the model's learning progress and effectiveness. After training, the model is evaluated using a validation set to check its generalization capabilities. Once the model achieves a satisfactory level of performance, it is saved as a reference scenario model12. The reference scenario model12 is optimized for a specific reference scenario13 and is designed to perform well within the same or similar application contexts.
[0066] For example, in reference scenario 13, "Basic Object Classification," reference device 11 is Device C. Collect photos of everyday objects, covering different categories, such as books, cups, and mobile phones. Based on the hardware limitations of Device C, deploy a lightweight CNN model on it. Train the model using the aforementioned sample dataset, monitoring the downward trend of the loss function and classification accuracy. Check the model's performance through cross-validation, adjusting the model architecture or training parameters as necessary. Once the model demonstrates good classification capabilities and adapts to the resource limitations of Device C, save it as reference scenario model 12 for subsequent knowledge distillation tasks.
[0067] Step S4) A student model is established based on the parameters of the reference device 11 , and a pre-connected large model is used as a teacher model to guide the training of the student model. The trained student model is used as the standard model 22 .
[0068] Based on the hardware parameters of the reference device 11 (such as processor type, number of cores, and memory capacity), a student model is designed to run on that device. This often means choosing a smaller model architecture to accommodate lower computing resources and storage space. The student model's complexity should be designed to match the performance of the reference device 11, ensuring that the model not only runs efficiently on the device but also achieves the expected accuracy.
[0069] The teacher model is a pre-trained, highly accurate model that provides rich feature representations and predictive capabilities. During training, the teacher model's outputs (such as predicted probability distributions and intermediate-layer feature representations) are used to guide the learning of the student model. This approach, known as "knowledge distillation," allows the student model to learn from the teacher model's knowledge, even if the student model is much smaller than the teacher.
[0070] During training, in addition to traditional loss functions (such as cross-entropy loss, which is used to measure the accuracy of the student model's direct prediction of sample data), additional loss terms are introduced. For example, the loss function is defined by comparing the output differences between the student model and the teacher model to improve the performance of the student model.
[0071] After training, if the student model can effectively learn from the teacher model and demonstrate good performance on the validation set, it is considered the standard model. 22 This model retains the essence of the teacher model’s knowledge while also being adaptable to low-resource environments, making it suitable for the target application scenario. 21
[0072] Step S5) Acquire the selected target application scenario 21 and obtain the correlation between the target application scenario 21 and each reference scenario 13. Specifically, it includes:
[0073] Extracting feature description information of the target application scenario 21, recorded as target feature description information, wherein the feature description information includes input data modality, output indicators, data distribution characteristics, target device 24 type and application scenario description;
[0074] Extracting feature description information of each reference scene 13 and recording it as reference feature description information;
[0075] The target feature description information is compared with the reference feature description information to obtain the correlation between the target application scenario 21 and each reference scenario 13 .
[0076] The characteristic description information of the target application scenario 21 (target characteristic description information) includes input data modality, output indicators, data distribution characteristics, target device 24 type and application scenario description.
[0077] The input data modality is used to determine the type of data used in the target application scenario 21, such as images, audio, text, etc. Output metrics are used to define the type of results expected from the application scenario, such as classification labels, numerical predictions, etc. Data distribution characteristics are used to analyze and record the statistical characteristics of the input dataset, including but not limited to mean, variance, data distribution shape, etc. Target device 24 type is used to identify the hardware platform on which the target application scenario 21 is planned to be deployed, taking into account factors such as computing power and memory size. The application scenario description is used to detail the purpose and usage scenarios of the application, which helps to understand its functional requirements and performance requirements.
[0078] For each reference scenario 13, similar feature descriptions in the five aspects described above are extracted, enabling direct comparison with the target scenario. Semantic similarity: Natural language processing techniques are used to analyze the semantic similarity between the descriptions of the target application scenario 21 and the reference scenario 13. This helps us understand the degree of similarity in purpose and usage between the two. Data distribution similarity: Based on statistical properties of the input data, such as mean and variance, the similarity of the data distribution between the target and reference scenarios 13 is calculated. This is crucial for ensuring the model's generalization ability across different datasets. Task structure similarity: Based on information such as input data modality and output metrics, the task structures of the two scenarios are evaluated to determine whether they are consistent or similar. For example, if both scenarios perform object classification based on image data, their task structures are highly similar. Comprehensive correlation calculation: Combining the three dimensions mentioned above (semantic similarity, data distribution similarity, and task structure similarity), a weighted summation or other appropriate method is used to calculate the overall correlation between the target application scenario 21 and each reference scenario 13. The weights can be adjusted based on the specific application context and requirements.
[0079] For example, the application scenario is "urban traffic flow monitoring," requiring the identification of the most appropriate reference scenario 13 for model transfer. The target feature description includes the input data modality being a video stream (frame image) and the output metric being vehicle count estimation. Data distribution characteristics include significant daytime / nighttime lighting variations and diverse weather conditions. The target device 24 is an edge computing device with limited GPU resources. The application scenario is described as real-time monitoring of traffic flow at major road intersections to support intelligent traffic management decisions.
[0080] The following reference scene 13 and reference scene model 12 are provided. Reference scene 13A is "parking space detection in a parking lot," with input data modality: static images captured by a fixed camera, output indicator: count of available parking spaces, data distribution characteristics: stable indoor environment with little illumination variation, reference device 11 type: ordinary PC, and application scenario description: assisting a parking lot management system in automatically updating parking space status.
[0081] The correlation between "urban traffic flow monitoring" and "parking lot space detection" may not be very high. Although both involve vehicle detection, there are significant differences in input data modality, data distribution characteristics, and application scenario descriptions. Therefore, we will continue to search for other more similar reference scenarios13, such as "vehicle identification at highway entrances and exits," whose feature descriptions are more consistent with the target scenario, thereby improving the success rate of model transfer.
[0082] This embodiment can evaluate the similarity or correlation between the target application scenario 21 and each reference scenario 13, thereby providing a basis for subsequent selection of the most suitable target model 23 for migration.
[0083] Please see the attached Figure 3 The step of comparing the target feature description information with the reference feature description information to obtain the correlation between the target application scenario 21 and each reference scenario 13 includes:
[0084] Respectively identifying the semantics of the application scenario description in the target feature description information and the reference feature description information, and calculating to obtain semantic similarity;
[0085] Obtaining data distribution similarity based on input data modalities and data distribution characteristics of the target feature description information and the reference feature description information;
[0086] Obtaining the task structure similarity based on input data modalities, output indicators, and data distribution characteristics of the target feature description information and the reference feature description information;
[0087] According to the weighted sum of the semantic similarity, data distribution similarity and task structure similarity, the correlation between the target application scenario 21 and each reference scenario 13 is obtained.
[0088] In order to evaluate the relevance between the target application scenario 21 and each reference scenario 13, a multi-dimensional comparison is adopted, including semantic similarity, data distribution similarity, and task structure similarity.
[0089] Extract the application scenario description from the target feature description and the reference feature description. Use word embedding models (such as Word2Vec and GloVe) or sentence embedding models (such as BERT) to convert the application scenario description into a numerical vector. Then, calculate the distance between these vectors (such as cosine similarity) to measure their semantic similarity.
[0090] Compare the data types (e.g., images, audio, etc.) and their statistical properties (e.g., mean, variance) of the target scene and the reference scene13. For example, in image classification tasks, you can analyze the image's color histogram, texture features, etc. Use statistical tests (e.g., Kolmogorov-Smirnov test) or distance metrics based on feature representation (e.g., Euclidean distance, Mahalanobis distance) to quantify the similarity of distributions between different datasets.
[0091] In addition to considering the nature of the data itself, it's also important to consider the specific requirements of the task, such as the input signal type, the desired output (classification, regression, etc.), and how to handle different types of data distributions. Computing task structural similarity: Define a set of rules or employ machine learning methods to automatically assess the structural similarity between two tasks. For example, if two tasks are both image-based classification and have a similar number of categories, the two tasks are considered to have high structural similarity.
[0092] Based on specific application requirements, different weights are assigned to semantic similarity, data distribution similarity, and task structure similarity. These weights are determined by learning from historical data. The three similarities are summed according to their respective weights to obtain a final correlation score between the target application scenario 21 and each reference scenario 13.
[0093] For example, the target application scenario 21 is "urban traffic flow monitoring", and there is a reference scenario 13 which is "vehicle identification at highway entrances and exits". In terms of semantic similarity, both involve vehicle detection, but one focuses on traffic flow monitoring, while the other focuses on vehicle access management. The semantic similarity score between the two is calculated using semantic analysis tools. In terms of data distribution similarity, considering that both process vehicle images in a road environment, although the lighting conditions and shooting angles may be different, they still have a high data distribution similarity. In terms of task structure similarity, the input of both is video frame images, and the output involves the number or existence status of vehicles, so their task structures are also relatively similar.
[0094] According to the preset weights (e.g., semantic similarity 0.3, data distribution similarity 0.4, task structure similarity 0.3), the comprehensive correlation score between the two scenarios is calculated.
[0095] Step S6) Selecting a plurality of reference scene models 12 with correlations higher than a preset reference threshold as teaching models.
[0096] For example, target application scenario 21 is "Urban Traffic Flow Monitoring." Its correlation scores with reference scenarios 13 are as follows: Reference scenario 13A, "Parking Lot Detection," has a correlation score of 0.5. Reference scenario 13B, "Vehicle Identification at Highway Entrances and Exits," has a correlation score of 0.8. Reference scenario 13C, "Street Pedestrian Counting," has a correlation score of 0.4. Reference scenario 13D, "Road Construction Area Monitoring," has a correlation score of 0.7.
[0097] When the preset reference threshold is set to 0.6, the correlation between the reference scene 13B and the reference scene 13D exceeds the threshold and is selected as the teaching model.
[0098] Step S7) Using a plurality of the teaching models to teach the standard model 22, and migrating the standard model 22 to the target device 24 after the teaching is completed.
[0099] The steps of using a plurality of teaching models to teach the standard model 22 include:
[0100] Receive sample data of the target application scenario 21, build a unified input interface, and input the sample data of the target application scenario 21 into each teaching model and the standard model 22;
[0101] Obtaining the output results of each teaching model on the sample data respectively, wherein the output results include the predicted probability distribution of the last layer, the feature representation of the middle layer, and the confidence score;
[0102] Performing weighted fusion on the output results of multiple teaching models to obtain a feature knowledge base, wherein the weight of the weighted fusion is obtained according to the correlation between the reference scenario 13 corresponding to the teaching model and the target application scenario 21;
[0103] Calculating a loss function, where the loss function is obtained based on output distribution difference loss, intermediate feature alignment loss, and confidence loss;
[0104] Dynamically adjust the weight of each teaching model's weighted fusion based on its performance on the current sample data;
[0105] The weight of the standard model 22 is updated through the back-propagation algorithm so that it gradually approaches the feature knowledge base obtained by weighted fusion of multiple teaching models.
[0106] Ensure that all models (professor models and standard models 22) receive input data in a consistent format to facilitate fair comparison and knowledge transfer. Collect real sample data (such as images, text, sensor data, etc.) for the target application scenario 21. Build a unified input interface to preprocess the data (such as normalization, resizing, modality conversion, etc.) to make it meet the input requirements of all models. Input the processed data into each professor model and standard model 22 simultaneously. For example, the target scenario is "urban traffic flow monitoring" and the input is 1080p video frames. Professor model A (from "highway vehicle recognition") accepts 720p input, and professor model B (from "street pedestrian counting") accepts RGB+depth maps. The unified interface needs to downsample the original data to 720p and use monocular estimation to complete it when the depth map is not available to ensure that all models can run.
[0107] After receiving sample data, each teacher model outputs multi-level knowledge information, primarily including predicted probability distributions, intermediate-layer feature representations, and confidence scores. The predicted probability distribution is the class probability output by the final softmax layer. The intermediate-layer feature representations refer to the activation values of certain key layers (such as the last convolutional layer), reflecting the teacher model's ability to extract abstract features. The confidence score indicates the model's confidence in the current prediction (e.g., maximum probability value or entropy value), and is used to measure the teacher's reliability for that sample. For example, teacher model A predicts the probabilities of three types of vehicles in a frame as [0.85, 0.10, 0.05], respectively. The intermediate feature map is 14×14×256 in size, and the confidence score is 0.85.
[0108] The outputs of multiple teaching models are weighted and fused to construct a feature library. The higher the correlation, the greater the weight, and the stronger the influence of its output on the standard model 22. For example, if the correlation of teaching model A is 0.8, the weight is set to 0.6. If the correlation of teaching model B is 0.7, the weight is set to 0.4. The fused soft label = 0.6 × pA + 0.4 × pB. pA represents the soft label value of teaching model A, and pB represents the soft label value of teaching model B.
[0109] The loss function consists of three parts, guiding the standard model22 to approximate the knowledge of the teacher group from multiple dimensions.
[0110] Ltotal=α×Ldistill+β×Lfeature+γ×Lconfidence.
[0111] Ltotal represents the total loss, Ldistill represents the output distribution difference loss, Lfeature represents the intermediate feature alignment loss, and Lconfidence represents the confidence loss. α, β, and γ are coefficients that can be set statically or adjusted dynamically. Some teaching models may perform poorly on specific samples (e.g., due to misclassification or low confidence), so their influence should be reduced.
[0112] Backpropagation is performed on the standard model 22 using the total loss Ltotal. Only the parameters of the student model are updated, while all teacher models remain frozen (not updated). After multiple rounds of iterations, the standard model 22 gradually absorbs the knowledge of multiple teachers, forming a lightweight, robust, and high-performance model. After the teaching is completed, the model is migrated to the target device 24.
[0113] On the other hand, this specification provides an adaptive model transfer system based on reverse multi-professor distillation, please refer to the attached Figure 4 ,include:
[0114] The reference device 11 module 100 obtains parameters of multiple target devices 24 that may be migrated, and obtains the reference device 11 with the lowest computing power based on the parameters of the multiple target devices 24;
[0115] The reference scene 13 module 200 obtains a plurality of reference scenes 13 and sample data corresponding to the reference scenes 13, assigns a reference device 11 to each reference scene 13, and establishes a model on the reference device 11 whose scale matches the parameters of the reference device 11;
[0116] The reference model module 300 uses the sample data corresponding to each reference scene 13 to train the model on the corresponding reference device 11. The trained model is recorded as the reference scene model 12.
[0117] The standard model 22 module 400 establishes a student model based on the parameters of the reference device 11, uses the pre-connected large model as a teacher model to guide the training of the student model, and the trained student model serves as the standard model 22;
[0118] The association module 500 acquires the selected target application scenario 21 and obtains the degree of association between the target application scenario 21 and each of the reference scenarios 13;
[0119] A selection module 600 selects a plurality of reference scene models 12 having a correlation degree higher than a preset reference threshold as teaching models;
[0120] The migration module 700 uses a plurality of the teaching models to teach the standard model 22 and migrates the standard model 22 to the target device 24 after the teaching is completed.
[0121] See also Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of this specification is shown.
[0122] like Figure 5 As shown, the electronic device 1100 may include: at least one processor 1101, at least one network interface 1104, a user interface 1103, a memory 1105, and at least one communication bus 1102. The communication bus 1102 may be used to implement communication between the aforementioned components. The user interface 1103 may include buttons, and optionally may also include a standard wired interface or a wireless interface. The network interface 1104 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc. The processor 1101 may include one or more processing cores. The processor 1101 utilizes various interfaces and circuits to connect the various components within the electronic device 1100. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 1105, and accessing data stored in the memory 1105, the processor 1101 performs various functions of the routing device and processes data. Optionally, the processor 1101 may be implemented in hardware using at least one of a DSP, an FPGA, and a PLA. The processor 1101 may integrate one or a combination of a CPU, a GPU, and a modem. Among them, the CPU mainly processes the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content that needs to be displayed on the display; and the modem is used to handle wireless communication.
[0123] It is understandable that the above-mentioned modem may not be integrated into the processor 1101, but may be implemented by a separate chip.
[0124] Memory 1105 may include either RAM or ROM. Optionally, memory 1105 may include non-transitory computer-readable media. Memory 1105 may be used to store instructions, programs, codes, code sets, or instruction sets. Memory 1105 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, sound playback function, image playback function, etc.), instructions for implementing the aforementioned method embodiments, etc.; the data storage area may store data related to the aforementioned method embodiments, etc. Memory 1105 may also optionally be at least one storage device located remotely from the aforementioned processor 1101. Memory 1105, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and application programs. Processor 1101 may be configured to invoke the application programs stored in memory 1105 and execute the methods described in the aforementioned embodiments.
[0125] The embodiments of this specification also provide a computer-readable storage medium having instructions stored therein that, when executed on a computer or processor, cause the computer or processor to perform the steps of the aforementioned embodiments. If the components of the aforementioned electronic device are implemented as software functional units and sold or used as independent products, they may be stored in the computer-readable storage medium.
[0126] The embodiments of this specification also provide a computer program product, including a computer program, which implements multiple steps in the above embodiments when executed by a processor.
[0127] In the absence of conflict, the technical features in this embodiment and implementation scheme can be combined arbitrarily.
[0128] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product comprises multiple computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium accessible by a computer or a data storage device such as a server or data center that integrates multiple available media. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0129] When implemented via hardware or firmware, the aforementioned method flow is programmed into the hardware circuit to obtain the corresponding hardware circuit structure and realize the corresponding function. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit, whose logical function is determined by the user's device programming. Designers can "integrate" a digital system on a PLD through self-programming, eliminating the need for chip manufacturers to design and manufacture dedicated integrated circuit chips. Moreover, today, instead of manually manufacturing integrated circuit chips, this programming is often performed using "logic compiler" software. This is similar to the software compiler used in program development. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There are not just one HDL, but many. Those skilled in the art will also understand that simply by programming the method flow in one of the aforementioned hardware description languages and programming it into the integrated circuit, a hardware circuit that implements the logical method flow can be easily obtained.
[0130] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.
Claims
1. An adaptive model migration method based on reverse multi-professor distillation, characterized in that: Including steps: Obtaining parameters of multiple target devices that may be migrated, and obtaining a reference device with the lowest computing power based on the parameters of the multiple target devices; Acquire multiple reference scenes and sample data corresponding to the reference scenes, assign a reference device to each reference scene, and establish a model on the reference device with a scale matching the parameters of the reference device; Using the sample data corresponding to each reference scene, respectively, the model on the corresponding reference device is trained, and the trained model is recorded as the reference scene model; According to the parameters of the reference device, a student model is established, and the pre-connected large model is used as a teacher model to guide the training of the student model, and the trained student model is used as the standard model; Acquire a selected target application scenario, and obtain a correlation between the target application scenario and each of the reference scenarios; Selecting a plurality of reference scene models whose correlation degree is higher than a preset reference threshold as teaching models; The standard model is taught using a plurality of the teaching models, and the standard model is migrated to the target device after the teaching is completed.
2. The adaptive model migration method based on reverse multi-professor distillation according to claim 1, characterized in that: The steps of obtaining parameters of multiple target devices that may be migrated and obtaining a reference device with the lowest computing power based on the parameters of the multiple target devices include: Collecting hardware parameter information of the target device, including processor type, number of cores, memory capacity, available storage space, floating-point computing capability, maximum power consumption limit, and supported inference frameworks; Normalize the performance of multiple target devices, unify hardware parameters of different dimensions into performance indicators, and obtain the comprehensive computing power evaluation value of the target device; According to the comprehensive computing power evaluation values of all target devices, the target device with the lowest comprehensive computing power evaluation value is selected as the reference device.
3. The adaptive model migration method based on reverse multi-professor distillation according to claim 1 or 2, characterized in that: The step of establishing a model on the reference device with a scale matching the parameters of the reference device comprises: Establishing an initial model of a preset initial scale on the reference device and running it, and recording the running time, wherein the initial model has a preset number of layers, number of neurons, and weights; When the running time is less than the preset lower limit reference time, the number of the neurons is increased; when the running time is greater than the preset upper limit reference time, the number of the neurons is reduced until the running time is between the lower limit reference time and the upper limit reference time.
4. The adaptive model migration method based on reverse multi-professor distillation according to claim 1 or 2, characterized in that: The step of obtaining the degree of association between the target application scenario and each of the reference scenarios includes: Extracting characteristic description information of the target application scenario, recorded as target characteristic description information, wherein the characteristic description information includes input data modality, output indicators, data distribution characteristics, target device type, and application scenario description; Extracting feature description information of each reference scene and recording it as reference feature description information; The target feature description information is compared with the reference feature description information to obtain the correlation between the target application scenario and each reference scenario.
5. The adaptive model migration method based on reverse multi-professor distillation according to claim 4, characterized in that: The step of comparing the target feature description information with the reference feature description information to obtain the correlation between the target application scenario and each reference scenario includes: Respectively identifying the semantics of the application scenario description in the target feature description information and the reference feature description information, and calculating to obtain semantic similarity; Obtaining data distribution similarity based on input data modalities and data distribution characteristics of the target feature description information and the reference feature description information; Obtaining the task structure similarity based on input data modalities, output indicators, and data distribution characteristics of the target feature description information and the reference feature description information; The relevance between the target application scenario and each reference scenario is obtained according to the weighted sum of the semantic similarity, the data distribution similarity and the task structure similarity.
6. The adaptive model migration method based on reverse multi-professor distillation according to claim 1 or 2, characterized in that: The steps of using a plurality of teaching models to teach the standard model include: Receive sample data of the target application scenario, build a unified input interface, and input the sample data of the target application scenario into each teaching model and the standard model; Obtaining the output results of each teaching model on the sample data respectively, wherein the output results include the predicted probability distribution of the last layer, the feature representation of the middle layer, and the confidence score; Performing weighted fusion on the output results of multiple teaching models to obtain a feature knowledge base, wherein the weight of the weighted fusion is obtained according to the correlation between the reference scenario corresponding to the teaching model and the target application scenario; Calculating a loss function, where the loss function is obtained based on output distribution difference loss, intermediate feature alignment loss, and confidence loss; Dynamically adjust the weight of each teaching model's weighted fusion based on its performance on the current sample data; The weights of the standard model are updated through the back-propagation algorithm so that it gradually approaches the feature knowledge base obtained by weighted fusion of multiple teaching models.
7. An adaptive model transfer system based on reverse multi-professor distillation, characterized in that: include: A reference device module obtains parameters of multiple target devices that may be migrated, and obtains a reference device with the lowest computing power based on the parameters of the multiple target devices; A reference scene module acquires multiple reference scenes and sample data corresponding to the reference scenes, assigns a reference device to each reference scene, and establishes a model on the reference device whose scale matches the parameters of the reference device; The reference model module uses the sample data corresponding to each reference scene to train the model on the corresponding reference device, and the trained model is recorded as the reference scene model; The standard model module establishes a student model based on the parameters of the reference device, uses the pre-connected large model as the teacher model to guide the training of the student model, and the trained student model serves as the standard model; an association module, acquiring a selected target application scenario and obtaining a degree of association between the target application scenario and each of the reference scenarios; A selection module selects a plurality of reference scene models with correlations higher than a preset reference threshold as teaching models; The migration module uses a plurality of the teaching models to teach the standard model, and migrates the standard model to the target device after the teaching is completed.
8. An electronic device, characterized in that: including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method and device for model distillation
CN112529181A
Image classification method and system, electronic equipment and storage medium
CN114049515A
Knowledge distillation and quantification technology for power scene edge calculation large model compression
CN115223049A
Model construction method and device based on knowledge distillation, equipment and medium
CN118014008A
Category prediction model training method, prediction method, device, and storage medium
WO2024087468A1