Method and platform for generating large vertical model based on model rubbing and storage medium

By selecting and adjusting neurons from open source models and conducting knowledge distillation training, the problem of insufficient performance and efficiency of general large models in the vertical category field is solved, and high-accuracy and efficient large vertical category model generation is achieved, and in Model complexity is reduced without affecting accuracy.

CN118709735AInactive Publication Date: 2024-09-27SHENZHEN LEXING SMART IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410869347.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-09-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

General-purpose large models cannot meet the performance and efficiency requirements in specific vertical fields. The training efficiency in the existing technology is low and the accuracy is not high enough.

Method used

By selecting the pre-training model with the best performance from multiple open source models, selecting some neurons in each hidden layer as alternative models, conducting knowledge distillation training, adjusting the weights and the number of neurons, and generating a vertical class model with higher accuracy. model, and achieve model simplification by reducing neurons in the hidden layer.

Benefits of technology

It improves the accuracy and training efficiency of the model, generates high-performance, high-efficiency large models for specific fields, and reduces the complexity of the model without affecting accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709735A
    Figure CN118709735A
Patent Text Reader

Abstract

The invention relates to the technical field of model learning, in particular to a vertical class large model generation method and platform based on model rubbing and a storage medium. The method comprises the following steps: S1, taking an open source model with the best performance in a plurality of open source models as a first model; s2, training the first model based on a first data set in a preset field, adjusting the weight of the first model, and generating a second data set based on the first model and the first data set; s3, training a second model through knowledge distillation, and adjusting the weight of the second model according to a # imgabs0 # output result corresponding to jth data in the second data set and a # imgabs1 # output result output by inputting the jth data into the second model; and S4, compressing the second model according to the position of the hidden layer of the second model and the number of neurons. According to the method, the problems of high complexity and low precision of a large model are solved, the complexity of the large model is reduced, and the precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of model learning technology, and more specifically to a method, platform and storage medium for generating large vertical models based on model rubbing. Background Art

[0002] With the rapid development of artificial intelligence technology, large models are increasingly used in natural language processing, computer vision and other fields. However, for specific vertical fields, general large models often cannot meet the user's requirements for performance and efficiency. In order to solve this problem, it is hoped to develop high-performance and high-efficiency large models for specific vertical fields. In the prior art, for example: Chinese patent CN117877111A provides a lightweight action recognition model training method and system, which relates to the field of action recognition technology, including: collecting multiple action images containing human bodies and marking corresponding action type labels to form a training data set; building a teacher network model for each action type, and inputting each action image marked with an action type label to train the teacher network model, and after the training is completed, the model parameters; building a student network model, using a semi-supervised method to train the student network model using the training data set, and using the knowledge distillation method to gradually update the model parameters of the student network model according to the output of each teacher network model and the output of the student network model and the model parameters of each teacher network model, until the output of the student network model reaches the preset convergence condition and the student network model is used as a lightweight action recognition model. The beneficial effect is that the action recognition model accurately recognizes and has lightweight characteristics at the same time. For example, Korean patent KR102492318B1 provides a model learning method and device, as well as a data recognition method. The disclosed model learning method includes selecting at least one of a plurality of teacher models; training a student model based on the output data of at least one teacher model selected for input data. Both of the above patents solve the problem of training a student model through a teacher model and reducing the weight of the student model, but the training efficiency is low and the accuracy is not high enough. Summary of the invention

[0003] In order to better solve the above problems, the present invention provides a method for generating a vertical large model based on model rubbing, the method comprising: Step S1: taking the open source model with the best performance among multiple open source models as a pre-training model, and arbitrarily selecting m2 neurons from m1 neurons in each hidden layer of the pre-training model as candidate models, and obtaining multiple candidate models, and selecting the one with the best performance from the multiple candidate models as the first model; Step S2: training the first model based on a first data set in a preset field, and Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; Step S3: Based on the first model and the second data set, the second model is trained by knowledge distillation, and the jth data in the second data set is input into the second model to obtain the jth data. Output the results, and based on the The output result is the same as the first data set corresponding to the jth data in the second data set. Outputting the result to adjust the weight of the second model; Step S4: reducing the weight of the second model according to the position and number of neurons of the hidden layer of the second model; The pre-trained model includes n1 hidden layers, each of which includes m1 neurons; the second model includes n1 hidden layers, each of which includes m2 neurons, and m1 is greater than m2.

[0004] As a preferred technical solution of the present invention, step S1 comprises the following steps: Step S11: input the test data of the preset field into the plurality of open source models, and compare the outputted plurality of first test results with the test answer, and use the open source model corresponding to the first test result closest to the test answer as the pre-trained model; Step S12: randomly selecting m2 neurons from the m1 neurons in each hidden layer of the pre-trained model, and using the neurons selected from each hidden layer as model parameters, and obtaining a plurality of the model parameters; Step S13: Generate multiple alternative models based on taking each of the model parameters as the neurons of the hidden layer corresponding to the pre-trained model, and input the test data of the preset field into each of the alternative models, obtain multiple second test results output by the multiple alternative models, and use the alternative model closest to the test answer among the second test results as the first model.

[0005] As a preferred technical solution of the present invention, the training of the first model in step S2 includes the following steps: Step S21: inputting the i-th data in the first data set into the first model, and obtaining the i-th data corresponding to the i-th data. Output the result; Step S22: The output result is compared with the i-th answer to obtain a first difference, and when the first difference is greater than a set difference, the weight of the first model is adjusted so that the first difference is less than or equal to the set difference; Step S23: Input the i-th data into the first model after weight adjustment, and obtain the i-th data. Output the result and combine the i-th data and the Outputting the result as a data pair in the second data set; Among them, the Output results and the The output results are all the possibility sizes of multiple possible output results of the first model, the i-th answer is the only correct result corresponding to the i-th data, and the value of i is a continuous positive integer greater than or equal to 1.

[0006] As a preferred technical solution of the present invention, the step S2 further includes: When the first difference cannot be less than or equal to the set difference by adjusting the weight of the first model, the value of m2 is increased by a first value, and step S1 is repeated to reacquire the first model, and steps S21-S23 are repeated, wherein the first value is greater than or equal to 1.

[0007] As a preferred technical solution of the present invention, step S3 includes the following steps: Step S31: Input the jth data in the second data set into the second model, and obtain the jth data. Output the result and write the The output result is the same as the jth data corresponding to the jth data. The output results are compared and a second difference is obtained; Step S32: When the second difference is greater than a set difference, adjust the weight of the second model according to the second difference so that the second difference is less than or equal to the set difference, and the value of j is a continuous positive integer greater than or equal to 1.

[0008] As a preferred technical solution of the present invention, step S4 includes: Step S41: Randomly select from the kth hidden layer of the second model neurons and shield the selected The closer the neurons are to the input layer, the larger the k value is. Greater than or equal to , the number of neurons remaining in each hidden layer after removing the shielded neurons is greater than or equal to 1, is a positive integer greater than or equal to 0; Step S42: Generate a third data set through the first model, input the mth data in the third data set into the second model obtained in step S41, and Output the result and write the Compare the output result with the mth answer corresponding to the mth data to obtain a third difference; Step S43: When the third difference is less than or equal to the set difference or when the third difference is greater than the set difference, the weight of the second model is adjusted to satisfy the condition that the third difference is less than or equal to the set difference, and step S41 and this step are repeated to increase the weight corresponding to the kth hidden layer. , until the third difference is greater than the set difference and the third difference cannot be less than or equal to the set difference by adjusting the weight of the second model; Step S44: The k-th layer maximum As the number of neurons shielded by the kth hidden layer, the value of k is a continuous positive integer greater than or equal to 1 and less than or equal to the number of hidden layers of the second model.

[0009] As a preferred technical solution of the present invention, the second model is reduced in weight from the first hidden layer to the Nth hidden layer, where N is the number of hidden layers of the second model.

[0010] As a preferred technical solution of the present invention, the second model removes the neurons to obtain the professional model of the preset field.

[0011] The present invention also provides a vertical large model generation platform based on model rubbing, which is used to implement the above method, and the platform includes: A selection unit is used to select the open source model with the best performance among the multiple open source models as a pre-trained model, and arbitrarily select m2 neurons from m1 neurons in each hidden layer of the pre-trained model as candidate models, and obtain multiple candidate models, and select the one with the best performance from the multiple candidate models as the first model; a generating unit, configured to train the first model based on a first data set in a preset field, and to generate a first model according to the i-th training data, the i-th training data and the i-th training data in the first data set; Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; A learning unit is configured to train the second model based on the first model and the second data set through knowledge distillation, input the jth data in the second data set into the second model, and obtain the jth data. Output the results, and based on the The output result is the same as that described in The output result adjusts the weight and number of neurons of the second model; A weight reduction unit, used to reduce the weight of the second model according to the position and number of neurons of the hidden layer of the second model; The pre-trained model includes n1 hidden layers, each of which includes m1 neurons; the second model includes n1 hidden layers, each of which includes m2 neurons, and m1 is greater than m2.

[0012] The present invention also provides a computer storage medium, wherein the storage medium stores program instructions, wherein when the program instructions are executed, the device where the storage medium is located is controlled to execute the above method.

[0013] Compared with the prior art, the beneficial effects of the present invention are at least as follows: The present invention arbitrarily selects m2 neurons from each hidden layer of the pre-trained model as the model parameters, obtains multiple sets of the model parameters through multiple selections, generates multiple candidate models by bringing the multiple sets of model parameters into the pre-trained model, and uses the candidate model with the highest accuracy as the first model. When the first model fails to reach the preset accuracy, that is, the difference between the model output and the standard answer is greater than the set difference, the accuracy of the first model is improved by increasing the value of m2, and the number of neurons in the hidden layer of the second model is determined. Through the technical solution, the first model with the highest accuracy can be obtained, thereby generating accurate training data for the second model, improving the accuracy and training efficiency of the second model, and training the first model with the first data set in the preset field to obtain the second model with higher accuracy. Since the first model is a general large model and the preset field is a vertical subdivision field, the accuracy of the first model for the specific subdivision field may not be particularly high. Therefore, it is necessary to train the first model using the first data set of the preset field, so as to lay a foundation for obtaining the second model with higher accuracy by distilling the knowledge of the first model and improving the training efficiency of the second model. The second model is trained based on the second data set to obtain the second model with higher accuracy. Although the structure of the second model is relatively streamlined, in order not to affect its accuracy, the neurons in each hidden layer are shielded to determine whether the neurons can be reduced. When the accuracy is high, it means to remove the neurons in the selected kth hidden layer at this time. The neurons do not affect the accuracy of the second model, and the purpose of weight loss can be achieved. Otherwise, the third difference will be less than or equal to the maximum value of the preset difference. The number of neurons reduced as the kth hidden layer is used to achieve weight reduction of the second model, and the professional vertical model with higher accuracy and simplicity is obtained through the mutual coordination of the above steps. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1This is a flow chart of a method for generating a vertical large model based on model rubbing according to the present invention; Figure 2 A platform structure diagram is generated for a vertical large model based on model rubbing of the present invention. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0016] The present invention provides a method for generating a vertical large model based on model rubbing, such as Figure 1 As shown, the method includes: Step S1: taking the open source model with the best performance among multiple open source models as a pre-training model, and arbitrarily selecting m2 neurons from m1 neurons in each hidden layer of the pre-training model as candidate models, and obtaining multiple candidate models, and selecting the one with the best performance from the multiple candidate models as the first model; Specifically, the pre-trained model is a general large model, and the test data of the preset field is used to test the multiple open source models, and the open source model with the highest accuracy for the preset field is obtained as the pre-trained model. Since the second model is a professional model for the preset field, and the number of neurons in each hidden layer of the second model is m2, the pre-trained model is a general model and each hidden layer has m1 neurons. Therefore, m2 neurons are arbitrarily selected from each hidden layer of the pre-trained model as the model parameters, and multiple sets of model parameters are obtained after multiple selections, and the multiple sets of model parameters are brought The pre-trained model is input to generate multiple candidate models, and the test data is input into each of the candidate models, and the candidate model that outputs the second test result most accurately is obtained, and is used as the first model. When the alternative model fails to reach the preset accuracy, that is, the difference between the model output and the standard answer is greater than the set difference, the accuracy of the alternative model is improved by increasing the value of m2, and the number of neurons in the hidden layer of the second model is determined. Through the above technical solution, the first model with the highest accuracy can be obtained, and the accurate training data of the second model can be further generated through the first model, thereby improving the accuracy of the second model and the training efficiency.

[0017] Step S2: training the first model based on a first data set in a preset field, and Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; Specifically, since the first model is a general large model and the preset field is a vertical sub-field, the accuracy of the first model for the specific sub-field may not be particularly high. Therefore, in order to obtain the second model for the preset field through rubbing using the first model, it is necessary to train the first model by using the first data set of the preset field, input the i-th training data in the first data set into the first model, and obtain the i-th training data according to the output of the first model. Output the results and write the above The difference between the output result and the i-th answer corresponding to the i-th training data is the first difference, and the weight of the first model is adjusted to the first loss; Specifically, since the first model is a general large model and the preset field is a vertical sub-field, the accuracy of the first model for the specific sub-field may not be particularly high. Therefore, in order to obtain the second model for the preset field through rubbing using the first model, it is necessary to train the first model by using the first data set of the preset field, input the i-th training data in the first data set into the first model, and obtain the i-th training data according to the output of the first model. Output the results and write the above The difference between the output result and the i-th answer corresponding to the i-th training data is the first difference, and by adjusting the weight of the first model to the first loss element, the second model includes n1 hidden layers, each of the hidden layers includes m2 neurons, and m1 is greater than m2.

[0018] Specifically, the second model is a vertical model that is more refined than the pre-trained model for the preset field, that is, a professional model, and has the same number of hidden layers as the pre-trained model, but the number of neurons contained in each of the hidden layers is smaller than the number of neurons in the corresponding hidden layer of the pre-trained model. The second model is less complex than the pre-trained model.

[0019] Furthermore, the step S1 comprises the following steps: Step S11: input the test data of the preset field into the plurality of open source models, and compare the outputted plurality of first test results with the test answer, and use the open source model corresponding to the first test result closest to the test answer as the pre-trained model; Specifically, by inputting the above-mentioned test data of the above-mentioned preset field into the above-mentioned multiple open source models, and taking the above-mentioned multiple first test results output by the above-mentioned multiple open source models as the above-mentioned open source model that is closest to the above-mentioned test answer, that is, the above-mentioned open source model with the highest accuracy for the above-mentioned preset field as the above-mentioned pre-trained model, through the above-mentioned technical scheme, a pre-trained model with higher accuracy can be obtained, laying a foundation for further obtaining a first model with higher accuracy based on the above-mentioned pre-trained model.

[0020] Step S12: randomly selecting m2 neurons from the m1 neurons in each hidden layer of the pre-trained model, and using the neurons selected from each hidden layer as the model parameters, and obtaining multiple groups of the model parameters; Step S13: Generate multiple alternative models based on taking each of the model parameters as the neurons of the hidden layer corresponding to the pre-trained model, and input the test data of the preset field into each of the alternative models, obtain multiple second test results output by the multiple alternative models, and use the alternative model closest to the test answer among the second test results as the first model.

[0021] Specifically, since the second model is a professional model for the above-mentioned preset field, and the number of neurons in each hidden layer of the above-mentioned second model is m2, and the pre-trained model is a general model with m1 neurons in each hidden layer, therefore, by arbitrarily selecting m2 neurons from each hidden layer of the above-mentioned pre-trained model as the above-mentioned model, and obtaining multiple sets of the above-mentioned model parameters after multiple selections, and generating multiple above-mentioned alternative models by bringing the multiple sets of the above-mentioned model parameters into the above-mentioned pre-trained model, and similarly inputting the above-mentioned test data into each of the above-mentioned alternative models, and obtaining the above-mentioned alternative model that outputs the second test result most accurately, and using it as the first model, through the above-mentioned technical solution, the first model with the highest accuracy can be obtained, and the accurate training data of the second model can be further generated through the above-mentioned first model, thereby improving the accuracy of the above-mentioned second model.

[0022] Furthermore, the training of the first model in step S2 includes the following steps: Step S21: input the i-th data in the first data set into the first model, and obtain the i-th data corresponding to the i-th data. Output the result; Step S22: The output result is compared with the i-th answer to obtain a first difference, and when the first difference is greater than a set difference, the weight of the first model is adjusted so that the first difference is less than or equal to the set difference; Specifically, the first model, i.e., the general model, is trained by using the i-th data in the first data set, and the i-th data in the first model is trained by using the i-th data in the first data set. The output result is compared with the i-th answer corresponding to the i-th data in the first data set, and the first difference is obtained. By adjusting the weight of the first model, the i-th answer corresponding to the i-th data in the first data set is obtained. The output result is close to the above-mentioned i-th answer. Through the above-mentioned technical solution, the accuracy of the above-mentioned first model for the above-mentioned preset field can be improved, laying a foundation for obtaining the above-mentioned second model with higher accuracy through the above-mentioned first model.

[0023] Step S23: Input the i-th data into the first model after weight adjustment, and obtain the i-th data. Output the result and combine the i-th data and the Outputting the result as a data pair in the second data set; Among them, the Output results and the The output results are all the possibility sizes of multiple possible output results of the first model, the i-th answer is the only correct result corresponding to the i-th data, and the value of i is a continuous positive integer greater than or equal to 1.

[0024] Specifically, by inputting the i-th data into the first model with higher training accuracy, and obtaining the i-th data Output result, due to the above The output result is the possible size, i.e., the probability value, of each of the possible output results among the multiple possible output results output by the classification output layer of the first model, wherein, therefore, by using the i-th data and the The data composed of the output results is used to train the above-mentioned second model, so that the above-mentioned second model can learn the knowledge of the above-mentioned first model more easily. The training data for training the above-mentioned second model can be obtained through the above-mentioned technical solution, providing a data basis for obtaining the above-mentioned second model with higher accuracy.

[0025] Furthermore, the step S2 further includes: When the first difference cannot be less than or equal to the set difference by adjusting the weight of the first model, the value of m2 is increased by a first value, and step S1 is repeated to reacquire the first model, and steps S21-S23 are repeated, wherein the first value is greater than or equal to 1.

[0026] Specifically, when the first model cannot satisfy that the first difference is less than or equal to the preset difference by adjusting its weight, it means that the first model is underfitting. Therefore, it is necessary to increase the value of the neuron m2 in each hidden layer of the second model, and re-obtain the first model corresponding to the second model through the step S1, and retrain the first model so that its accuracy is within the preset difference range. Through the technical solution, a more suitable number of neurons in the hidden layer of the second model is obtained, thereby improving the accuracy of the second model.

[0027] Furthermore, step S3 includes the following steps: Step S31: Input the jth data in the second data set into the second model, and obtain the jth data. Output the result and write the The output result is the same as the jth data corresponding to the jth data. The output results are compared and a second difference is obtained; Step S32: When the second difference is greater than a set difference, adjust the weight of the second model according to the second difference so that the second difference is less than or equal to the set difference, and the value of j is a continuous positive integer greater than or equal to 1.

[0028] Specifically, the second model is trained by using the second data set generated by the first model. Since the first model has the same neural network structure as the second model, the jth data in the second data set is input into the second model and the obtained jth data is The output result is the same as the jth data corresponding to the above The output results are compared, and the weight of the second model is adjusted according to the second difference obtained by the comparison, so as to improve the training efficiency and obtain the second model with higher accuracy.

[0029] Furthermore, the step S4 comprises: Step S41: Randomly select from the kth hidden layer of the second model neurons and shield the selected The closer the neurons are to the input layer, the larger the k value is. Greater than or equal to , the number of neurons remaining in each hidden layer after removing the shielded neurons is greater than or equal to 1, is a positive integer greater than or equal to 0; Specifically, since the second model includes n1 hidden layers and each hidden layer includes m1 neurons, although the structure of the second model is relatively simple, in order to not affect its accuracy, by shielding the neurons in each hidden layer, it is determined whether the neurons can be reduced in weight. The kth hidden layer is the kth one starting from the direction close to the output layer. In the method of using neurons, where the value of k starts from 1, it is determined which neurons in each hidden layer can be removed without affecting the accuracy of the second model to reduce the weight of the second model.

[0030] Step S42: Generate a third data set through the first model, input the mth data in the third data set into the second model obtained in step S41, and Output the result and write the Compare the output result with the mth answer corresponding to the mth data to obtain a third difference; Step S43: When the third difference is less than or equal to the set difference or when the third difference is greater than the set difference, the weight of the second model is adjusted to satisfy the condition that the third difference is less than or equal to the set difference, and step S41 and this step are repeated to increase the weight corresponding to the kth hidden layer. , until the third difference is greater than the set difference and the third difference cannot be less than or equal to the set difference by adjusting the weight of the second model; Step S44: The k-th layer maximum As the number of neurons shielded by the kth hidden layer, the value of k is a continuous positive integer greater than or equal to 1 and less than or equal to the number of hidden layers of the second model.

[0031] Specifically, the third data set is generated by the first model, and the data in the third data set is input into the second model, and the output result, i.e., the first The output result is compared with the mth answer to obtain the third difference, that is, the loss difference between the two. The larger the loss difference, the lower the accuracy of the second model, and vice versa. When the accuracy is high, it means that the selected kth hidden layer is removed at this time. The neurons do not affect the accuracy of the second model, and the purpose of weight loss can be achieved. Otherwise, the third difference will be less than or equal to the maximum value of the preset difference. As the number of neurons reduced in the kth hidden layer, the above-mentioned second model weight reduction is achieved.

[0032] Furthermore, the second model is weight-reduced in order from the first hidden layer to the Nth hidden layer, where N is the number of hidden layers of the second model.

[0033] Further, the second model removes the neurons to obtain the professional model of the preset field.

[0034] The present invention also provides a vertical large model generation platform based on model rubbing, which is used to implement the above method, such as Figure 2 As shown, the platform includes: A selection unit is used to select the open source model with the best performance among the multiple open source models as a pre-trained model, and arbitrarily select m2 neurons from m1 neurons in each hidden layer of the pre-trained model as candidate models, and obtain multiple candidate models, and select the one with the best performance from the multiple candidate models as the first model; a generating unit, configured to train the first model based on a first data set in a preset field, and to generate a first model according to the i-th training data, the i-th training data and the i-th training data in the first data set; Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; A learning unit is configured to train the second model based on the first model and the second data set through knowledge distillation, input the jth data in the second data set into the second model, and obtain the jth data. Output the results, and based on the The output result is the same as that described in The output result adjusts the weight and number of neurons of the second model; A weight reduction unit, used to reduce the weight of the second model according to the position and number of neurons of the hidden layer of the second model; The pre-trained model includes n1 hidden layers, each of which includes m1 neurons; the second model includes n1 hidden layers, each of which includes m2 neurons, and m1 is greater than m2.

[0035] The present invention also provides a computer storage medium, wherein the storage medium stores program instructions, wherein when the program instructions are executed, the device where the storage medium is located is controlled to execute the above method.

[0036] In summary, the present invention arbitrarily selects m2 neurons from each hidden layer of the pre-trained model as the model parameters, obtains multiple sets of model parameters through multiple selections, generates multiple candidate models by bringing the multiple sets of model parameters into the pre-trained model, and uses the candidate model with the highest accuracy as the first model, and when the first model fails to reach the preset accuracy, that is, the difference between the model output and the standard answer is greater than the set difference, the accuracy of the first model is improved by increasing the value of m2, and the number of neurons in the hidden layer of the second model is determined. Through the technical solution, the first model with the highest accuracy can be obtained, thereby generating accurate training data for the second model, improving the accuracy and training efficiency of the second model, and training the first model using the first data set in the preset field to obtain the second model with higher accuracy. Since the first model is a general large model and the preset field is a vertical subdivision field, the accuracy of the first model for the specific subdivision field may not be particularly high. Therefore, it is necessary to train the first model using the first data set of the preset field, so as to lay a foundation for obtaining the second model with higher accuracy by distilling the knowledge of the first model and improving the training efficiency of the second model. The second model is trained based on the second data set to obtain the second model with higher accuracy. Although the structure of the second model is relatively streamlined, in order not to affect its accuracy, the neurons in each hidden layer are shielded to determine whether the neurons can be reduced. When the accuracy is high, it means to remove the neurons in the selected kth hidden layer at this time. The neurons do not affect the accuracy of the second model, and the purpose of weight loss can be achieved. Otherwise, the third difference will be less than or equal to the maximum value of the preset difference. The number of neurons reduced as the kth hidden layer is used to achieve weight reduction of the second model, and the professional vertical model with higher accuracy and simplicity is obtained through the mutual coordination of the above steps.

[0037] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0038] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0039] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for generating vertical large models based on model rubbing, It is characterized in that The method comprises: Step S1: taking the open source model with the best performance among multiple open source models as a pre-training model, and arbitrarily selecting m2 neurons from m1 neurons in each hidden layer of the pre-training model as candidate models, and obtaining multiple candidate models, and selecting the one with the best performance from the multiple candidate models as the first model; Step S2: training the first model based on a first data set in a preset field, and Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; Step S3: Based on the first model and the second data set, the second model is trained by knowledge distillation, and the jth data in the second data set is input into the second model to obtain the jth data. Output the results, and based on the The output result is the same as the first data set corresponding to the jth data in the second data set. Outputting the result to adjust the weight of the second model; Step S4: reducing the weight of the second model according to the position and number of neurons of the hidden layer of the second model; The pre-trained model includes n1 hidden layers, each of which includes m1 neurons; the second model includes n1 hidden layers, each of which includes m2 neurons, and m1 is greater than m2.

2. The method according to claim 1, It is characterized in that The step S1 comprises the following steps: Step S11: input the test data of the preset field into the plurality of open source models, and compare the outputted plurality of first test results with the test answer, and use the open source model corresponding to the first test result closest to the test answer as the pre-trained model; Step S12: randomly selecting m2 neurons from the m1 neurons in each hidden layer of the pre-trained model, and using the neurons selected from each hidden layer as model parameters, and obtaining a plurality of the model parameters; Step S13: Generate multiple alternative models based on taking each of the model parameters as the neurons of the hidden layer corresponding to the pre-trained model, and input the test data of the preset field into each of the alternative models, obtain multiple second test results output by the multiple alternative models, and use the alternative model closest to the test answer among the second test results as the first model.

3. The method according to claim 1, It is characterized in that The training of the first model in step S2 comprises the following steps: Step S21: inputting the i-th data in the first data set into the first model, and obtaining the i-th data corresponding to the i-th data. Output the result; Step S22: The output result is compared with the i-th answer to obtain a first difference, and when the first difference is greater than a set difference, the weight of the first model is adjusted so that the first difference is less than or equal to the set difference; Step S23: Input the i-th data into the first model after weight adjustment, and obtain the i-th data. Output the result and combine the i-th data and the Outputting the result as a data pair in the second data set; Among them, the Output results and the The output results are all the possibility sizes of multiple possible output results of the first model, the i-th answer is the only correct result corresponding to the i-th data, and the value of i is a continuous positive integer greater than or equal to 1.

4. The method according to claim 3, It is characterized in that The step S2 further comprises: When the first difference cannot be less than or equal to the set difference by adjusting the weight of the first model, the value of m2 is increased by a first value, and step S1 is repeated to reacquire the first model, and steps S21-S23 are repeated, wherein the first value is greater than or equal to 1.

5. The method according to claim 1, It is characterized in that The step S3 comprises the following steps: Step S31: Input the jth data in the second data set into the second model, and obtain the jth data. Output the result and write the The output result is the same as the jth data corresponding to the jth data. The output results are compared and a second difference is obtained; Step S32: When the second difference is greater than a set difference, adjust the weight of the second model according to the second difference so that the second difference is less than or equal to the set difference, and the value of j is a continuous positive integer greater than or equal to 1.

6. The method according to claim 1, It is characterized in that The step S4 comprises: Step S41: Randomly select from the kth hidden layer of the second model neurons and shield the selected The closer the neurons are to the input layer, the larger the k value is. Greater than or equal to , the number of neurons remaining in each hidden layer after removing the shielded neurons is greater than or equal to 1, is a positive integer greater than or equal to 0; Step S42: Generate a third data set through the first model, input the mth data in the third data set into the second model obtained in step S41, and Output the result and write the Compare the output result with the mth answer corresponding to the mth data to obtain a third difference; Step S43: When the third difference is less than or equal to the set difference or when the third difference is greater than the set difference, the weight of the second model is adjusted to satisfy the condition that the third difference is less than or equal to the set difference, and step S41 and this step are repeated to increase the weight corresponding to the kth hidden layer. , until the third difference is greater than the set difference and the third difference cannot be less than or equal to the set difference by adjusting the weight of the second model; Step S44: The k-th layer maximum As the number of neurons shielded by the kth hidden layer, the value of k is a continuous positive integer greater than or equal to 1 and less than or equal to the number of hidden layers of the second model.

7. The method according to claim 6, It is characterized in that The second model is weighted down in order from the first hidden layer to the Nth hidden layer, where N is the number of hidden layers of the second model.

8. The method according to claim 6, It is characterized in that The second model removes the kth hidden layer neurons to obtain the professional model of the preset field.

9. A vertical large model generation platform based on model rubbing, used to implement the method described in any one of claims 1 to 8, It is characterized in that The platform includes: A selection unit is used to select the open source model with the best performance among the multiple open source models as a pre-trained model, and arbitrarily select m2 neurons from m1 neurons in each hidden layer of the pre-trained model as candidate models, and obtain multiple candidate models, and select the one with the best performance from the multiple candidate models as the first model; a generating unit, configured to train the first model based on a first data set in a preset field, and to generate a first model according to the i-th training data, the i-th training data and the i-th training data in the first data set; Outputting the result and the i-th answer to adjust the weight of the first model, and generating a second data set based on the first model and the first data set; A learning unit is configured to train the second model based on the first model and the second data set through knowledge distillation, input the jth data in the second data set into the second model, and obtain the jth data. Output the results, and based on the The output result is the same as that described in The output result adjusts the weight and number of neurons of the second model; A weight reduction unit, used to reduce the weight of the second model according to the position and number of neurons of the hidden layer of the second model; The pre-trained model includes n1 hidden layers, each of which includes m1 neurons; the second model includes n1 hidden layers, each of which includes m2 neurons, and m1 is greater than m2.

10. A computer storage medium, It is characterized in that The storage medium stores program instructions, wherein when the program instructions are executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 8.