A model lightweight method based on cross-domain weak correlation

By introducing cross-domain weak correlation attention functions and adaptive optimization parameter functions into the deep learning model, combined with multi-modal input features and quantification technology, the problem of high computational cost of the deep learning model is solved, and more efficient calculations and more efficient calculations are achieved. Low energy consumption processing speed.

CN118428422BActive Publication Date: 2024-10-29NORTHEAST DIANLI UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410629841.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-10-29
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

Existing deep learning models require a large amount of resources during training and calculation, resulting in high computing costs and time requirements.

Method used

A model lightweighting method based on cross-domain weak correlation is adopted. By introducing cross-domain weak correlation attention function and adaptive optimization parameter function into the deep learning model, combined with multi-modal input features and quantification technology, computing requirements are reduced and efficiency is improved.

Benefits of technology

Significantly reduces computing requirements and reduces reliance on high-performance computing resources, achieving faster processing speeds and lower energy consumption, while maintaining the core performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118428422B_ABST
    Figure CN118428422B_ABST
Patent Text Reader

Abstract

The present invention discloses a model lightweight method based on cross-domain weak correlation, and relates to the technical field of model lightweight. The present invention comprises the following steps: S1, establishing a deep learning model including multimodal input, and introducing a cross-domain weak correlation attention function and an adaptive optimization parameter function into the model, wherein each layer in the deep learning model is composed of the self-attention MSA feature of each modality and a multi-layer perceptron MLP. The present invention effectively replaces the part with higher computational cost in the traditional deep learning model by adopting a parameter function with high computational efficiency and simple structure. The newly introduced function can significantly reduce the overall computational requirements while keeping the core performance of the model unaffected, and reduces the dependence on high-performance computing resources, thereby achieving faster processing speed and lower energy consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of model lightweighting, and specifically relates to a model lightweighting method based on cross-domain weak correlation. Background Art

[0002] Deep learning models refer to algorithms that use multi-layer network structures to learn deep features and patterns in data. These models can automatically extract complex, hierarchical features from large amounts of data, but conventional deep learning models, especially those with multiple layers and complex structures, usually require a lot of computing resources. This demand leads to high computing costs, especially during the training phase, which requires a lot of data and computing time to achieve optimal performance.

[0003] In view of this, the present invention is proposed. Summary of the invention

[0004] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a model lightweight method based on cross-domain weak correlation, thereby solving the problems raised in the above-mentioned background technology.

[0005] In order to solve the above technical problems, the basic concept of the technical solution adopted by the present invention is:

[0006] A model lightweight method based on cross-domain weak correlation includes the following steps:

[0007] S1, establish a deep learning model with multimodal input, and introduce cross-domain weak correlation attention function and adaptive optimization parameter function into the model, where each layer in the deep learning model is composed of self-attention MSA features of each modality and multi-layer perceptron MLP;

[0008] S2, in the multimodal self-attention MSA feature, the input features are first projected to three learnable mask modules, and the linear layer reprojects the attention features and combines them with the value matrix;

[0009] S3, quantitatively analyzes the correlation between all feature triplet samples extracted from the same modality;

[0010] S4, copy the features of the highly correlated MSA blocks to the weakly correlated MSA blocks;

[0011] S5, deploy the model to the hardware platform, and use post-training quantization to quantize the weights and activation values ​​of the trained model;

[0012] S6, after the model is deployed, the performance and efficiency of the model are verified through real-time online prediction and offline batch prediction.

[0013] Optionally, in step S2, the input features are projected to three learnable mask modules, and the linear layer reprojects the attention features and combines them with the value matrix as follows:

[0014] S21, input features First, it is sent to three learnable mask modules for embedding mapping EM and converted into query matrix Q, key matrix K and value matrix V, which are expressed as:

[0015]

[0016] S22, the attention matrix A is obtained from the query matrix Q and the key matrix K. The expression of the attention matrix A is:

[0017]

[0018] In the formula, QK T is the dot product of the transpose of the query matrix Q and the key matrix K, d is the d channels, D is the number of convolution channels, R is the feature space, N is the image size, and σ is the softmax probability value;

[0019] S23, use a linear layer to reproject the attention features back And combined with the value matrix V, its expression is:

[0020]

[0021] In formula (3), Z MSA It is the output of the multi-head self-attention mechanism.

[0022] Optionally, after step S23 is completed, the output representation of the MSA needs to be input into the MLP block, which includes two linear layers separated by GeLU activation. The calculation at a given layer is: both the MSA and MLP blocks have regularized residual connections, and the expression is:

[0023]

[0024] Z i ←MLP(Z i )+Z i (5).

[0025] Optionally, the process of copying the features of the highly correlated MSA block to the weakly correlated MSA block in step S4 is:

[0026] S41, reusing features of adjacent layers to perform MSA calculation across one or more layers of the model;

[0027] S42, using an adaptive optimization parameter function, copying the features of the highly correlated MSA block to the weakly correlated MSA block;

[0028] S43, the adaptive optimization parameter function consists of two linear layers and a depth convolution in the middle, and its expression is:

[0029]

[0030] Where FC is a fully connected layer for linear transformation, DwC is a depth-wise separable convolution, FC0 is another fully connected layer, and ECA is effective channel attention.

[0031] Optionally, the process of analyzing the correlation between all feature triple samples in step S3 is:

[0032] S31, a cosine correlation matrix is ​​established for self-attention features from different categories and layers. It is observed from the matrix that self-attention features are highly correlated in the middle layer;

[0033] S32, calculates the correlation matrix between each set of video-speech-text triple features at different layers to quantitatively analyze the correlation between all feature triple samples extracted from the same short video.

[0034] Optionally, the hardware platform for deploying the model in step S5 includes but is not limited to an artificial intelligence development board, NVIDIA Jetson TX2, and the server is a public cloud.

[0035] Optionally, MegEngine is used when quantizing the model in step S5.

[0036] Optionally, the online prediction in step S6 is to design an API that can be embedded in the existing platform for the client to call; the offline prediction is to purchase a server or rent a server for deployment, read data for a certain time period from the database at regular intervals every day, and write the prediction results into the database for use.

[0037] Optionally, after completing the model verification, step S6 needs to convert the trained model into PMML or ONNX format, and after the data conversion is successful, verify the converted model.

[0038] After adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art. Of course, any product implementing the present invention does not necessarily need to achieve all the advantages described below at the same time:

[0039] This application effectively replaces the computationally expensive parts of traditional deep learning models by adopting parameter functions with high computational efficiency and simple structure. The newly introduced functions can significantly reduce the overall computing requirements while maintaining the core performance of the model, reducing dependence on high-performance computing resources, thereby achieving faster processing speed and lower energy consumption.

[0040] The specific implementation modes of the present invention are further described in detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings described below are only some embodiments. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0042] In the figure:

[0043] Figure 1 Lightweight flow chart for the model.

[0044] It should be noted that these drawings and textual descriptions are not intended to limit the conceptual scope of the present invention in any way, but are intended to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0045] The present invention will now be described in further detail with reference to the accompanying drawings.

[0046] See also Figure 1 As shown, in this embodiment, a model lightweight method based on cross-domain weak correlation is provided, including the following steps:

[0047] S1, establish a deep learning model with multimodal input, and introduce cross-domain weak correlation attention function and adaptive optimization parameter function into the model, where each layer in the deep learning model is composed of self-attention MSA features of each modality and multi-layer perceptron MLP;

[0048] S2, in the multimodal self-attention MSA feature, the input features are first projected to three learnable mask modules, and the linear layer reprojects the attention features and combines them with the value matrix;

[0049] S21, input features First, it is sent to three learnable mask modules for embedding mapping EM and converted into query matrix Q, key matrix K and value matrix V, which are expressed as:

[0050]

[0051] It should be noted that by converting the input features into query matrices, key matrices, and value matrices, the model can more effectively capture and express the intrinsic associations between different modalities. This conversion enables the model to not only process the features of a single data type, but also integrate information from multiple data sources, improving its ability to handle complex data environments.

[0052] S22, the attention matrix A is obtained from the query matrix Q and the key matrix K. The expression of the attention matrix A is:

[0053]

[0054] In the formula, QK T is the dot product of the transpose of the query matrix Q and the key matrix K, d is the d channels, D is the number of convolution channels, R is the feature space, N is the image size, and σ is the softmax probability value.

[0055] It should be noted that the method of reprojecting the attention features using a linear layer and combining it with the value matrix can compress complex multi-dimensional information into a more efficient expression form.

[0056] In formula (2), QK T is the dot product of the transpose of the query matrix Q and the key matrix K;

[0057] S23, use a linear layer to reproject the attention features back And combined with the value matrix V, its expression is:

[0058]

[0059] In formula (3), Z MSA It is the output of the multi-head self-attention mechanism.

[0060] It should be noted that the method of using linear layers to reproject attention features and combining them with value matrices can compress complex multidimensional information into a more efficient expression form, thereby improving the information processing capability of the model.

[0061] S24, the output representation of MSA is input into the MLP block, which includes two linear layers separated by GeLU activation. The calculation at a given layer is: Both MSA and MLP blocks have regularized residual connections, which are expressed as:

[0062]

[0063] Z i ←MLP(Z i )+Z i (5).

[0064] It should be noted that by introducing multiple linear layers separated by the GeLU activation function, the nonlinear processing capability of the model is increased, enabling the model to learn more complex data patterns.

[0065] S3, quantitatively analyzes the correlation between all feature triplet samples extracted from the same modality;

[0066] S31, a cosine correlation matrix is ​​established for self-attention features from different categories and layers. It is observed from the matrix that self-attention features are highly correlated in the middle layer;

[0067] S32, calculates the correlation matrix between each set of video-speech-text triple features at different layers to quantitatively analyze the correlation between all feature triple samples extracted from the same short video.

[0068] It should be noted that by establishing the cosine correlation matrix of self-attention features, the interdependence and mutual influence between features in different categories and levels can be revealed. It is found that self-attention features are highly correlated in the middle layers, which helps to optimize the structure and parameters of these layers during model design.

[0069] S4, copy the features of the highly correlated MSA blocks to the weakly correlated MSA blocks;

[0070] The process of copying the features of the highly correlated MSA block to the weakly correlated MSA block in step S4 is as follows:

[0071] S41, reusing features of adjacent layers to perform MSA calculation across one or more layers of the model;

[0072] S42, using an adaptive optimization parameter function, copying the features of the highly correlated MSA block to the weakly correlated MSA block;

[0073] S43, the adaptive optimization parameter function consists of two linear layers and a depth convolution in the middle, and its expression is:

[0074]

[0075] Where FC is a fully connected layer for linear transformation, DwC is a depth-wise separable convolution, FC0 is another fully connected layer, and ECA is effective channel attention.

[0076] It should be noted that the adaptive optimization parameter function can ensure that the reused features are translation invariant and equivalent, and can serve as a regularizer to improve the generalization of the model.

[0077] S5, deploy the model to the hardware platform, and use post-training quantization to quantize the weights and activation values ​​of the trained model;

[0078] The hardware platform for deploying the model in step S5 includes but is not limited to one of an artificial intelligence development board and NVIDIA JetsonTX2, and the server is a public cloud. MegEngine is used when quantizing the model in step S5.

[0079] It should be noted that by combining multiple hardware platforms and advanced model quantization techniques, not only the adaptability and flexibility of the model are enhanced, but also the cost efficiency and performance of deployment are improved.

[0080] S6, after the model is deployed, the performance and efficiency of the model are verified through real-time online prediction and offline batch prediction.

[0081] In step S6, online prediction is to design an API that can be embedded in the existing platform for client calls; offline prediction is to purchase or rent a server for deployment, read data for a certain time period from the database at regular intervals every day, and write the prediction results into the database for use.

[0082] It should be noted that by designing an API that can be embedded in existing platforms, the newly added prediction functions can be easily integrated into the existing system without the need for large-scale changes to the client, which improves the acceptability and ease of use of the technology.

[0083] More specifically, offline batch processing enables the system to process large amounts of data efficiently and is suitable for in-depth data analysis and pattern recognition, which may be difficult to implement in online prediction due to time constraints.

[0084] S7, converts the trained model into PMML or ONNX format. After the data conversion is successful, the converted model is verified to ensure that the expected prediction and recognition results before the conversion are obtained.

[0085] It should be noted that this application uses the high correlation between the attention matrix and different blocks of MSA in the model to improve the model calculation efficiency. Unlike calculating MSA separately at each layer, this project explores a simple and effective strategy to exploit the dependencies between different layers.

[0086] More specifically, this application uses fast and simple parameter functions to replace the modules with higher computational costs of previous deep models, greatly reducing the computational cost of the model proposed in this project without reducing model performance.

[0087] The present invention is not limited to the above-mentioned embodiments. Anyone should be aware that any structural changes made under the enlightenment of the present invention, and any technical solutions that are the same or similar to the present invention, fall within the protection scope of the present invention. The technology, shape, and structural parts not described in detail in the present invention are all well-known technologies.

Claims

1. A model lightweight method based on cross-domain weak correlation, characterized in that: The following steps are involved: S1, establish a deep learning model with multimodal input, and introduce cross-domain weak correlation attention function and adaptive optimization parameter function in the model. Each layer in the deep learning model consists of self-attention of each modality. Features and Multilayer Perceptron constitute; S2, in multimodal self-attention In the feature, the input features are first projected to three learnable mask modules, and the linear layer reprojects the attention features and combines them with the value matrix; S3, quantitatively analyzes the correlation between all feature triplet samples extracted from the same modality; S4, the highly correlated The features of the block are copied to the weakly related in the block; S5, deploy the model to the hardware platform, and use post-training quantization to quantize the weights and activation values ​​of the trained model; S6, after the model is deployed, the performance and efficiency of the model are verified through real-time online prediction and offline batch prediction; In step S2, the input features are projected to three learnable mask modules, and the linear layer reprojects the attention features and combines them with the value matrix as follows: S21, input features First, it is fed into three learnable mask modules for embedding mapping , converted to a query matrix , key matrix Sum Matrix , whose expression is: (1) S22, from the query matrix and key matrix The attention matrix obtained from , attention matrix The expression is: (2) In the formula, The query matrix and key matrix The dot product of the transpose of for channels, is the number of convolution channels, is the feature space, is the image size, σ is the softmax probability value; S23, use a linear layer to reproject the attention features back , and combined with the value matrix Combined, the expression is: (3) In the formula, is the output of the multi-head self-attention mechanism; After step S23 is completed, The output represents the input to In the block, this part consists of two linear layers separated by a GeLU activation, and the computation at a given layer is: Both the and MLP blocks have regularized residual connections, which are expressed as: (4) (5); In step S4, the high correlation The features of the block are copied to the weakly related The process in the block is: S41, reuse the features of adjacent layers to cross one or more layers of the model calculate; S42, using the adaptive optimization parameter function, the high correlation The features of the block are copied to the weakly related MSA blocks; S43, the adaptive optimization parameter function consists of two linear layers and a depth convolution in the middle, and its expression is: (6) In the formula, is a fully connected layer used for linear transformation. is a depth-wise separable convolution, is another fully connected layer, For effective channel attention; The process of analyzing the correlation between all feature triple samples in step S3 is as follows: S31, a cosine correlation matrix is ​​established for self-attention features from different categories and layers. It is observed from the matrix that self-attention features are highly correlated in the middle layer; S32, calculates the correlation matrix between each set of video-speech-text triple features at different layers to quantitatively analyze the correlation between all feature triple samples extracted from the same short video.

2. According to claim 1, a model lightweight method based on cross-domain weak correlation is characterized in that: The hardware platform for deploying the model in step S5 is one of the artificial intelligence development board and NVIDIA Jetson TX2, and the server is a public cloud.

3. According to the model lightweight method based on cross-domain weak correlation according to claim 1, it is characterized in that: In the step S5, MegEngine is used to quantize the model.

4. According to the model lightweight method based on cross-domain weak correlation according to claim 1, it is characterized in that: In step S6, online prediction is to design an API that can be embedded in the existing platform for client calls; offline prediction is to purchase or rent a server for deployment, read data for a certain time period from the database at regular intervals every day, and write the prediction results into the database for use.

5. According to the model lightweight method based on cross-domain weak correlation according to claim 1, it is characterized in that: After completing the model verification, step S6 needs to convert the trained model into PMML or ONNX format. After the data conversion is successful, the converted model is verified.

Citation Information

Patent Citations

  • Lightweight visual question and answer method based on bidirectional segmentable deep self-attention network

    CN114647752A

  • Lightweight adaptive network learning method oriented to multi-mode and multi-task learning

    CN116644316A