Task processing method, system and device, medium and computer program product
By deploying the thinking chain of large models on small model devices, the problem of hardware limitations of small models is solved, and knowledge distillation of large models is realized by large models is improved, the performance of small models is simplified, and the distillation process is reduced, and hardware requirements are reduced.
Patent Information
- Application Number
- CN202411212094.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-30
AI Technical Summary
In the era of large language models, knowledge distillation between large models and small models is difficult to complete. Traditional methods require the deployment of large models and small models locally at the same time. Many small model holders cannot perform knowledge distillation due to hardware limitations, improving the performance of small models. the problem.
By deploying small models on the first device and deploying large models on the second device, using the large model output thinking chain in the second device to distillate the small models in the first device, avoiding the hardware limitations of the traditional method and realizing Multi-objective joint training of small models enhances the generation ability of small models.
The knowledge distillation of small models is realized, which improves the model performance of small models, allowing more institutions and enterprises to use the capabilities of large models to enhance local small models, simplify the distillation process, and reduce hardware requirements.
Smart Images

Figure CN119167982A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a specific field of knowledge distillation technology, and in particular to task processing methods, systems, devices, media and computer program products. Background Art
[0002] In the era of large language models, with the widespread application of large models with huge parameters such as GPT-4 (Generative Pre-trained Transformer 4) and GLM-4, knowledge distillation between large models and small models is difficult to complete. Traditional knowledge distillation algorithms require the deployment of large and small models locally at the same time, and loading large and small models for training at the same time. However, many small model holders find it difficult to run large-scale large models locally due to their own hardware limitations. Therefore, for small model holders who only have small models, it is impossible to perform knowledge distillation on the small model based on the large model, thereby improving the model performance of the small model.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a task processing method, system, device, medium and computer program product, aiming to solve the technical problem of how to realize knowledge distillation of small models based on large models for small model holders who only have small models.
[0005] To achieve the above object, the present application proposes a task processing method, which is applied to a first device, the first device is connected to a second device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device, and the method includes:
[0006] Sending a task processing thought chain generation request to a second device based on a task training set corresponding to at least one task, and receiving a task processing thought chain fed back by the second device, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label, and the second device outputs the task processing thought chain based on the large model and the task training set;
[0007] Based on the task data, determine first target indication information and second target indication information for multi-target joint training of the small model, wherein the first target indication information is used to indicate processing of the task data, and the second target indication information is used to indicate a thinking chain logic for explaining processing of the task data;
[0008] Based on the task data, the task processing result label and the first target indication information, the first target of the small model is trained, and based on the task data, the task processing thinking chain and the second target indication information, the second target of the small model is iteratively trained until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model.
[0009] In one embodiment, determining the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data includes:
[0010] Obtaining a preset task processing prefix, and performing splicing processing on the preset task processing prefix and the task data to obtain the first target indication information;
[0011] A preset thinking chain generation prefix is obtained, and the preset thinking chain generation prefix and the task data are concatenated to obtain the second target indication information.
[0012] In one embodiment, training the first objective of the small model based on the task data, the task processing result label and the first objective indication information includes:
[0013] Determine a first prediction result corresponding to the task data output by the small model according to the first target indication information;
[0014] Calculating a first prediction loss according to the first prediction result and the task processing result label;
[0015] The small model is optimized according to the first prediction loss to train a first objective of the small model.
[0016] In one embodiment, iteratively training the second goal of the small model based on the task data, the task processing thought chain and the second goal indication information includes:
[0017] Determining a second prediction result corresponding to the task data and output by the small model according to the second target indication information;
[0018] Calculating a second prediction loss according to the second prediction result and the task processing thinking chain;
[0019] The small model is optimized according to the second prediction loss to train a second objective of the small model.
[0020] In one embodiment, based on the task data, the task processing result label and the first target indication information, the first target of the small model is trained, and based on the task data, the task processing thought chain and the second target indication information, the second target of the small model is iteratively trained, further comprising:
[0021] In each round of iterative training, based on the task data, the task processing result label and the first target indication information, a first predicted loss is determined;
[0022] Determine a second predicted loss based on the task data, the task processing thought chain and the second target indication information;
[0023] A total prediction loss is obtained by weighted summing the first prediction loss and the second prediction loss, and the small model is optimized according to the total prediction loss to jointly train the first objective and the second objective of the small model.
[0024] In one embodiment, the task processing thought chain generation request includes a determination task processing thought chain generation request and a question and answer task processing thought chain generation request.
[0025] The sending a task processing thought chain generation request to the second device based on the task training set corresponding to the at least one task includes:
[0026] When the task is a determination task, generating a determination task processing thought chain generation request according to a task training set corresponding to the determination task, and sending the determination task processing thought chain generation request to the second device; and / or,
[0027] When the task is a question-answering task, a question-answering task processing thinking chain generation request is generated according to a task training set corresponding to the question-answering task, and the question-answering task processing thinking chain generation request is sent to the second device.
[0028] In addition, to achieve the above-mentioned purpose, the present application provides a task processing method, which is applied to a second device, the second device is connected to the first device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device, and the method includes:
[0029] receiving a task processing thought chain generation request sent by the first device based on a task training set corresponding to at least one task, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label;
[0030] Based on the task processing thought chain generation request, the task data in the task training set is input into the large model, the task processing thought chain is output, and the task processing thought chain is sent to the first device;
[0031] Among them, the first device determines the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and trains the first target of the small model based on the task data, the task processing result label and the first target indication information, and iteratively trains the second target of the small model based on the task data, the task processing thinking chain and the second target indication information until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model, wherein the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for explaining the processing of the task data.
[0032] In addition, to achieve the above-mentioned purpose, the present application provides a task processing system, including a first device and a second device connected to each other, wherein a small model to be trained is deployed in the first device, and a large model is deployed in the second device.
[0033] The first device is used to send a task processing thought chain generation request to the second device based on a task training set corresponding to at least one task, and receive a task processing thought chain fed back by the second device, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label;
[0034] The second device is used to receive a task processing thinking chain generation request sent by the first device based on a task training set corresponding to at least one task, input the task data in the task training set into the large model based on the task processing thinking chain generation request, output a task processing thinking chain, and send the task processing thinking chain to the first device;
[0035] The first device is further used to determine first target indication information and second target indication information for multi-target joint training of the small model based on the task data, wherein the first target indication information is used to indicate processing of the task data, and the second target indication information is used to indicate a thinking chain logic for explaining processing of the task data;
[0036] The first device is also used to train the first target of the small model based on the task data, the task processing result label and the first target indication information, and iteratively train the second target of the small model based on the task data, the task processing thinking chain and the second target indication information, until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model.
[0037] In addition, to achieve the above objectives, the present application also proposes a task processing device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task processing method described above.
[0038] In addition, to achieve the above objectives, the present application also proposes a medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task processing method described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the task processing method described above are implemented.
[0040] In the embodiment of the present application, a small model is deployed on a first device and a large model is deployed on a second device. The thought chain output by the large model in the second device performs knowledge distillation on the small model in the first device. This avoids the phenomenon that the traditional distillation method needs to deploy a large model and a small model locally at the same time before using the large model to perform knowledge distillation on the small model. This avoids the hardware limitations and high cost of deploying a large model locally, allowing more institutions and enterprises to use the capabilities of the large model to enhance the local small model.
[0041] And the first device will send a task processing thinking chain generation request to the second device based on the task training set corresponding to at least one task, and receive the task processing thinking chain fed back by the second device. The task training set includes task data and task processing result labels, and the task processing thinking chain is used to explain the thinking chain logic of processing task data to generate task processing result labels. Therefore, it is possible for the first device to construct a task processing thinking chain generation request based on the task training set stored in itself, so that the task processing thinking chain fed back by the second device is more in line with the task in the task training set. And the second device will output the task processing thinking chain based on the large model and the task training set. In addition, it is possible to use the model capability of the large model in the second device to output the task processing thinking chain corresponding to the task training set.
[0042] And the first device will determine the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for interpreting the processing of the task data. It can be achieved that the first device can guide the small model to perform multi-target joint training, such as the first target indication information and the second target indication information, so that the subsequent small model can increase the ability to generate thinking chain logic while retaining its own ability to process task data during multi-target joint training. And based on the task data, the task processing result label and the first target indication information, the first target of the small model will be trained, and based on the task data, the task processing thinking chain and the second target indication information, the second target of the small model will be iteratively trained until the preset joint training end condition is met, and the trained small model is obtained to perform task processing according to the trained small model. That is, when the small model is training the model, it will achieve two goals for one task data, that is, while processing the task data, it can also realize the thinking chain logic of interpreting the processing of the task data, so that when the trained small model is processing the task, it can retain its own task processing function while generating the corresponding thinking chain, thereby improving the model performance of the small model. And when training the small model, the task processing thinking chain sent by the large model is used for model training, and the large model and the small model can be in different devices. Therefore, for the model holder who only has the small model, the large model in the second device can be remotely called, and the task processing thinking chain generated by the large model can be used to train the small model and complete the knowledge distillation of the small model. That is, the small model holder who only has the small model can perform knowledge distillation on the small model according to the large model, so that the small model also has the ability to generate thinking chains. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0045] Figure 1 A flowchart of the first embodiment of the task processing method of the present application is provided;
[0046] Figure 2 This is a schematic diagram of the scenario flow of model training for institution A and institution B in the task processing method of this application;
[0047] Figure 3 A flowchart of the third embodiment of the task processing method of the present application is provided;
[0048] Figure 4 This is a schematic diagram of the scenario architecture of the first device and the second device in the task processing system of an embodiment of the present application;
[0049] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the task processing method in the embodiment of the present application.
[0050] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0052] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0053] The first embodiment of the task processing method of this application is proposed below. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the task processing method of this application. In this embodiment, the task processing method is applied to the first device, and the first device is connected to the second device in communication. The first device and the second device can both be a computing service device with data processing, network communication and program running functions, such as a server, a tablet computer, a personal computer, a mobile phone, etc. The first device and the second device can be devices deployed in different enterprises. Therefore, each enterprise can use its own equipment to jointly train the model. In a specific implementation, specific natural language processing tasks can be set according to the specific needs of each enterprise. For example, in a dialogue scenario, a task of generating a reply and a thought chain for the above text is set, and in a summary generation scenario, a task of generating a text summary and a thought chain for the text is set. The operations performed or the functions implemented by the first device and the second device during the model training process are different or the same. Therefore, in the following embodiments, the two devices are distinguished as the first and the second. In some application scenarios, the first device can also be referred to as a server or a coordination end, etc. The second device is referred to as a client or a participating end, etc.
[0054] A small model to be trained is deployed in the first device, and a large model is deployed in the second device. The small model can be a small language model, and the large model can be a large language model. A language model is a model that can be used to perform natural language processing tasks, such as GPT-4 (pre-trained language model), OPT (Open Pre-trained Transformer, pricing model), BLOOM (BigScience, large open language model), CLIP (Contrast ive Language-Image Pre-Trai ning, contrast language-image pre-training) and EVA (distributed database system). The large language model and the small language model in this embodiment are both language models. The structure of the large language model is more complex and has more parameters, while the structure of the small language model is relatively simple and has fewer parameters. The models that can be deployed or supported by each enterprise may be heterogeneous. Based on this, the small model deployed in the first device and the large model deployed in the second device in this embodiment are heterogeneous. Heterogeneous means that the model architectures of the two models are different and the scales of the model parameters are also different. Due to the differences in structure and number of parameters, the large model is better than the small model in processing natural language tasks. Therefore, the large model can be used to assist in training the small model so that the small model can also have some of the capabilities of the large model. For example, the large model can be trained to generate a thought chain, and then the small model can be trained according to the thought chain generated by the large model so that the small model also has the ability to generate a thought chain.
[0055] The model to be trained refers to the model parameters in the model that need to be optimized through the training process, and its initial model parameters can be obtained after model pre-training (or the pre-trained model can be used as the model to be trained), or, its initial model parameters can also be initialized according to experience or randomly initialized. The process of using a pre-trained model as the model to be trained and training the model to be trained on a specific processing task is also called "fine-tuning", and "training" is used to represent this process in the following embodiments. In a specific implementation, a small model that has been pre-trained is used as the small model to be trained, and the small model to be trained is further trained, so that a better training effect can be obtained, that is, the trained model can have a stronger task processing capability, such as being able to generate an accurate chain of thought. In this embodiment, it is not limited to using a pre-trained small model as the small model to be trained, nor is it limited to a specific pre-training method.
[0056] In this embodiment, the task processing method is applied to a first device, the first device is connected to a second device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device. The task processing method includes steps S10-S30.
[0057] Step S10, sending a task processing thought chain generation request to the second device based on the task training set corresponding to at least one task, and receiving the task processing thought chain fed back by the second device;
[0058] It should be noted that the task training set includes task data and task processing result labels. The task processing thinking chain is used to explain the thinking chain logic of processing task data to generate task processing result labels. The second device outputs the task processing thinking chain based on the large model and the task training set.
[0059] Optionally, the task can be a judgment task (such as a sentiment classification task), a question-answering task (i.e., selecting the correct answer from the answers to a question, such as a multiple-choice question), or any other task that can be processed by a small model. Optionally, a thought chain can be a text data that reasoned and answered the question step by step. The task processing thought chain is a thought chain corresponding to the task data, including the thought chain logic that explains the task data processing to generate the task processing result label.
[0060] Optionally, the first device can remotely call the large model of the second device, so as to assist in training the small model in the first device with the model capability of the large model in the second device.
[0061] Optionally, the first device can call the big model interface provided by the second device, or use other calling methods to call the big model in the second device, so as to use the big model in the second device to perform model training on each task data in the task training set, output the task processing thinking chain corresponding to each task data, and feed back all task processing thinking chains to the first device.
[0062] Optionally, the first device may first determine a task training set for at least one task, and construct a task processing thought chain generation request corresponding to the task training set. Optionally, the task processing thought chain generation request may include: describing the task content of the task, and requiring the large model in the second device to answer the question and explain why the question is this answer, so as to generate a thought chain.
[0063] Optionally, a task processing thought chain generation request may be sent to the second device, and the task training set may be sent to the second device. The large model in the second device performs model training on the task data in the task training set according to the task processing thought chain generation request, outputs the task processing thought chain corresponding to each task data, and feeds back all the task processing thought chains to the first device.
[0064] For example, if the task is a question-and-answer task, the task data in the task training set corresponding to the question-and-answer task is the question-and-answer task data, and the task processing result label is the correct answer. For example, the question in the question-and-answer task data is "A migratory bird flew north over the highest peak on earth, where is it now?", and the candidate answers of the question-and-answer task data include "A. China; B. United States; C. Japan; D. Centaurus". The task processing result label is A. China. The first device can construct a task processing thought chain generation request, which may include: answering the question-and-answer task data, and requiring the large model in the second device to answer the question and explain why the question is this answer, thereby generating a thought chain. Optionally, the task processing thought chain generation request can be a prompt. The first device sends the thought chain generation request to the second device, and the large model in the second device will give the following reasoning answer according to the task processing thought chain generation request when performing model training on the task data: "Because the highest peak in the world is Mount Everest, it is located at the junction of China and Nepal, and China is in the north, so this migratory bird flew into China. Based on the above reasoning, the final answer is A, China". This reasoning is the task processing thinking chain. This task processing thinking chain is fed back to the first device to perform model training on the small model in the first device.
[0065] Optionally, the task processing thought chain can be used as a medium for the large model in the second device to assist the small model in the first device in knowledge distillation (transfer). Because the small model (such as a small language model) itself has weak capabilities and sometimes cannot complete task reasoning independently, a correct thought chain containing correct logic can effectively improve the small model's ability to work on the task.
[0066] In a feasible embodiment, the task processing thought chain generation request includes a determination task processing thought chain generation request and a question and answer task processing thought chain generation request.
[0067] In step S10, a task processing thought chain generation request is sent to the second device based on a task training set corresponding to at least one task, including at least one item of steps a10-a20.
[0068] Step a10, when the task is a determination task, generating a determination task processing thought chain generation request according to a task training set corresponding to the determination task, and sending the determination task processing thought chain generation request to the second device; and / or,
[0069] Step a20, when the task is a question-answering task, a question-answering task processing thinking chain generation request is generated according to a task training set corresponding to the question-answering task, and the question-answering task processing thinking chain generation request is sent to the second device.
[0070] Optionally, the first device may store task training sets corresponding to different types of tasks, such as task training sets corresponding to judgment tasks and task training sets corresponding to question-answering tasks. Optionally, each task training set may include at least one task data and a corresponding task processing result label.
[0071] Optionally, the first device may determine the task training set for model training according to different actual scenario requirements. If the actual scenario requirements require processing of the judgment task, the task training set for model training is determined to be the task training set corresponding to the judgment task; if the actual scenario requirements require processing of the question-and-answer task, the task training set for model training is determined to be the task training set corresponding to the question-and-answer task.
[0072] Optionally, when determining that the task is a judgment task, the task training set corresponding to the judgment task stored in the storage area of the first device can be determined, and a judgment task processing thought chain generation request can be generated based on the task data and task processing result label corresponding to the judgment task in the task training set. Optionally, the relevant information of the judgment task processing thought chain generation request can be described through prompts, such as answering the judgment task data, and requiring the large model in the second device to answer the question and explain why the question is this answer, so as to generate a thought chain.
[0073] Optionally, after determining that the judgment task processing thinking chain generates a request corresponding to the judgment task, the first device will send it to the second device. The second device will perform model training based on the large model and the task training set corresponding to the judgment task, output the task processing thinking chain, and feed it back to the first device.
[0074] Optionally, when determining that the task is a question-and-answer task, a task training set corresponding to the question-and-answer task stored in the storage area of the first device may be determined, and a question-and-answer task processing thought chain generation request may be generated based on the task data and task processing result label corresponding to the question-and-answer task in the task training set. Optionally, the relevant information of the question-and-answer task processing thought chain generation request may be described through prompts, such as answering the question-and-answer task data, and requiring the large model in the second device to answer the question and explain why the question is this answer, thereby generating a thought chain.
[0075] Optionally, after determining that the question-and-answer task processing thinking chain generates a request corresponding to the question-and-answer task, the first device will send it to the second device. The second device will perform model training based on the large model and the task training set corresponding to the question-and-answer task, output the task processing thinking chain, and feed it back to the first device.
[0076] In this embodiment, when the task is a judgment task, a determination task processing thinking chain generation request generated according to the task training set corresponding to the determination task is sent to the second device, so that the task processing thinking chain generated by the second device according to the determination task processing thinking chain generation request can be more closely matched with the judgment task. When the task is a question-and-answer task, a question-and-answer task processing thinking chain generation request generated according to the task training set corresponding to the question-and-answer task is sent to the second device, so that the task processing thinking chain generated by the second device according to the question-and-answer task processing thinking chain generation request can be more closely matched with the question-and-answer task.
[0077] Step S20, based on the task data, determining first target indication information and second target indication information for multi-target joint training of the small model, the first target indication information is used to indicate processing of the task data, and the second target indication information is used to indicate a thinking chain logic for explaining processing of the task data;
[0078] Optionally, when the first device performs model training on the local small model, the task data in the task training set can be input into the small model, and the small model can perform multi-task learning settings when performing model training. That is, it can be set to determine the various target indication information of the small model when performing multi-target joint training on the task data, that is, the first target indication information for indicating the processing of the task data and the thinking chain logic for indicating the interpretation of the processing of the task data.
[0079] For example, when the task data is question-and-answer task data corresponding to a question-and-answer task, the questions and candidate answers of the question-and-answer task data can be input into the small model, and the small model will perform multi-objective joint training on the question-and-answer task data, such as training two objectives at the same time under one task, and before performing the multi-objective joint training, it will generate the first objective indication information and the second objective indication information of the multi-objective joint training. The first objective indication information can be used to indicate the answer to the question and candidate answers of the question-and-answer task data and determine the task processing result label (i.e., the correct answer). The second objective indication information can be used to indicate the thinking chain logic for explaining the correct answer to the question-and-answer task data.
[0080] In a feasible embodiment, in step S20, first target indication information and second target indication information for multi-target joint training of the small model are determined based on the task data, including steps b10-b20.
[0081] Step b10, obtaining a preset task processing prefix, and performing splicing processing on the preset task processing prefix and the task data to obtain first target indication information;
[0082] Optionally, the preset task processing prefix may be a string used to represent the processing of the task data by the small model, for example, the preset task processing prefix may be a string of "Please select the correct answer from the candidate answers".
[0083] Optionally, the preset task processing prefix and the task data may be concatenated, such as by string concatenation, to obtain the first target indication information. Optionally, the prefix portion of the string corresponding to the task data may be determined, and the string corresponding to the preset task processing prefix may be added to the prefix portion, thereby completing the concatenation of the preset task processing prefix and the task data.
[0084] For example, if the task data is the question-answering task data corresponding to the question-answering task, and the question-answering task data includes questions and candidate answers, the question-answering task data can be input into the small model. When training the small model, a preset task processing prefix can be added to the prefix part of the question-answering task data, such as selecting a string of the correct answer from the candidate answers to obtain the first target indication information, so that when the small model is trained, the first target of the small model is trained according to the first target indication information. For example, generate the correct answer among the candidate answers.
[0085] Step b20, obtaining a preset thinking chain generation prefix, concatenating the preset thinking chain generation prefix and the task data to obtain the second target indication information.
[0086] Optionally, the preset prefix for generating a thought chain may be a string of "please answer this question and explain why" for representing the logic of the thought chain for explaining the processing of the task data.
[0087] Optionally, the preset thinking chain generated prefix and the task data can be spliced, such as string splicing, to obtain the first target indication information. Optionally, the prefix part of the string corresponding to the task data can be determined, and the string corresponding to the preset thinking chain generated prefix can be added to the prefix part, thereby completing the splicing of the preset thinking chain generated prefix and the task data.
[0088] Optionally, if the task data is question-and-answer task data, and the question-and-answer task data includes questions and candidate answers, the question-and-answer task data can be input into the small model. When training the small model, a prefix part of the question-and-answer task data can be added to generate a prefix by a preset thinking chain, such as a string of "please answer the question and explain why", to obtain the second target indication information, so that when the small model is trained, the second target of the small model can be trained according to the second target indication information.
[0089] In this embodiment, the first target indication information is obtained by concatenating the preset task processing prefix with the task data, thereby ensuring the validity of the first target indication information obtained; the second target indication information is obtained by concatenating the preset thinking chain generation prefix with the task data, thereby ensuring the validity of the second target indication information obtained.
[0090] Step S30, based on the task data, the task processing result label and the first target indication information, train the first target of the small model, and based on the task data, the task processing thinking chain and the second target indication information, iteratively train the second target of the small model until the preset joint training end conditions are met, and obtain the trained small model to perform task processing according to the trained small model.
[0091] Optionally, the first goal can be that the small model processes the task data to generate a task processing result label, such as the small model generates the correct answer among the candidate answers. The second goal can be the thinking chain logic of the small model processing the task data to generate the task processing result label, such as the small model generates a thinking chain corresponding to the task data.
[0092] Optionally, the preset joint training end condition may be a pre-set condition that needs to be met to end the joint training of the small model, and may be set as needed, which is not limited in this embodiment. For example, in a specific implementation, it may be set to the convergence of the loss function of the small model, or the number of rounds of joint training reaching a set number of rounds, or the duration of joint training reaching a set duration, etc.
[0093] Optionally, the small model in the first device can perform two goals when performing model training. When training the first goal of the small model, the small model can perform model training on the task data according to the first goal indication information to obtain the first prediction result (i.e., the task processing result label predicted by the small model), and then optimize the model parameters of the small model according to the task processing result label and the first prediction result to achieve the training of the first goal of the small model. The small model can also perform model training on the task data according to the second goal indication information to obtain the second prediction result (i.e., the thinking chain predicted by the small model), and then optimize the model parameters of the small model according to the task processing thinking chain and the second prediction result to achieve the training of the second goal of the small model. Optionally, the small model can be trained for multiple iterations until the preset joint training end conditions are met, and a trained small model is obtained. Then, in the subsequent application process, task processing can be performed directly according to the trained small model, so that the small model can output the corresponding thinking chain while outputting the task processing result label.
[0094] In addition, to assist in understanding the principle of using a large model to perform knowledge distillation on a small model in this embodiment, an example is given below.
[0095] If the task data is a judgment task, such as a sentiment classification task (e.g., judging whether the sentiment of a text is "positive" or "negative"). In the task training set, the sentiment classification task includes text data (X) and corresponding sentiment labels (y). Optionally, the first device can construct a task processing thought chain generation request based on the task training set, and send it to the second device. The large model in the second device generates a request based on the task processing thought chain, performs model training on the sentiment classification task data corresponding to the sentiment classification task in the task training set, and generates a corresponding task processing thought chain.
[0096] Optionally, the task data of the emotion classification task can be described through prompt, and a task processing thought chain generation request corresponding to the task training set can be generated, for example: "I will give a piece of text, please judge its emotion and explain why. The text content is as follows: This movie is so good that it makes people drowsy." Then call the big model in the second device, and send the task processing thought chain generation request to the big model in the second device, and send the task training set to the big model of the second device. The big model of the second device performs model training on each task data in the task training set to generate a corresponding task processing thought chain, and feed it back to the first device. For example, the task processing thought chain is "Although this comment mentions that it is good-looking, it is actually an irony, so I think it contains negative emotions."
[0097] Optionally, the first device can call the large model interface provided by the second device, use the large model in the second device to process the task data in the task training set, output the corresponding task processing thinking chain, and feed it back to the first device, and encrypt the task processing thinking chain when feeding it back to the first device, and then feed it back to the first device, the first device decrypts the encrypted task processing thinking chain to obtain the task processing thinking chain corresponding to the task data in the task training set. Optionally, each task data in the task training set has a corresponding task processing thinking chain. And after the first device obtains the task processing thinking chain, it can update the task processing thinking chain to the task training set, so that the task data, task processing result label and task processing thinking chain in the task training set are in a one-to-one correspondence.
[0098] Optionally, the first device can train the small model locally, and can input the task data in the task training set into the small model, and determine the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data. When performing multi-target joint training, the first target of the small model is trained based on the task data, the task processing result label and the first target indication information, and the second target of the small model is trained based on the task data, the task processing thought chain and the second target indication information.
[0099] For example, when training the first target of the small model, it can be processed in the following format, that is, please choose the correct answer from the answer: Question: This movie is so good that it makes people sleepy. What emotion does it express? Options: Positive, negative---training target---> negative. When training the second target of the small model, it can be processed in the following format, that is, please answer this question and explain why. Question: This movie is so good that it makes people sleepy. What emotion does it express? Options: Positive, negative---training target---> Although this comment mentions that it is good-looking, it is actually an irony, so I think it contains negative emotions. And use the corresponding loss function for joint training until the model converges, obtain the trained small model, and complete the distillation process of the small model.
[0100] In addition, if Figure 2 As shown, if organization B is the big model demander in the first device, organization A is the big model owner in the second device. Optionally, in the thought chain generation stage, organization B can determine a task training set corresponding to at least one task, the task training set includes task data X, label y (i.e., task processing result label), and can use prompt engineering to build a prompt request big model to analyze problem X and generate a thought chain, and then generate a prompt text (i.e., task processing thought chain generation request).
[0101] The prompt text is sent to institution A together with the task training set. The large model (large scale) in institution A will perform model training on the task data in the task training set, including model training in two directions, namely answering questions and generating thought chains. The output thought chain will be fed back to institution B as a task processing thought chain. Institution B updates the task training set based on the acquired thought chain, so that the updated task training set includes task data X, label y, and thought chain c. In the distillation training stage, institution B can determine the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data X, label y, and thought chain c in the task training set. For the first target indication information, it can be generated for the task data X using the prediction prefix (i.e., the preset task processing prefix), that is, the prediction prefix and the task data X are spliced. For the second target indication information, it is generated for the task data X using the thought chain prefix (i.e., the preset thought chain generation prefix), that is, the thought chain prefix and the task data X are spliced. And input it into the small model in organization B (weak capability, suitable for a single task), and in the small model, the first goal y of the small model will be trained based on the task data, the task processing result label and the first goal indication information, and the second goal c of the small model will be iteratively trained based on the task data, the task processing thinking chain and the second goal indication information. And calculate the joint loss Loss. That is, jointly calculate the corresponding loss value, and then update the model based on the loss value obtained by the joint calculation until the model converges, completes the training, and obtains an enhanced small model.
[0102] Optionally, this embodiment can avoid local deployment of large models. Since traditional distillation methods require the deployment of large models and small models locally at the same time, high computing resources are required. This embodiment avoids the hardware limitations and high costs of deploying large models locally by remotely calling large models in other organizations, allowing more organizations to use the capabilities of large models to enhance local small models. The distillation process can also be simplified by generating requests through task processing thought chains, such as generating thought chains through prompt projects, making the distillation process more simplified and automated. The thought chain is obtained through the large model, and the distillation can be completed by jointly training the small model locally. It has a wide range of applications and can be applied to a wide range of task types, including but not limited to emotion classification, question and answer thinking, etc. It only needs to adjust the task processing thought chain generation request, and can be applied to different task scenarios.
[0103] In this embodiment, a small model is deployed on the first device and a large model is deployed on the second device. The thought chain output by the large model in the second device performs knowledge distillation on the small model in the first device. This avoids the phenomenon that the traditional distillation method needs to deploy both the large model and the small model locally at the same time before using the large model to perform knowledge distillation on the small model. This avoids the hardware limitations and high cost of deploying the large model locally, allowing more institutions and enterprises to use the capabilities of the large model to enhance the local small model.
[0104] And the first device will send a task processing thinking chain generation request to the second device based on the task training set corresponding to at least one task, and receive the task processing thinking chain fed back by the second device. The task training set includes task data and task processing result labels, and the task processing thinking chain is used to explain the thinking chain logic of processing task data to generate task processing result labels. Therefore, it is possible for the first device to construct a task processing thinking chain generation request based on the task training set stored in itself, so that the task processing thinking chain fed back by the second device is more in line with the task in the task training set. And the second device will output the task processing thinking chain based on the large model and the task training set. In addition, it is possible to use the model capability of the large model in the second device to output the task processing thinking chain corresponding to the task training set.
[0105] And the first device will determine the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for interpreting the processing of the task data. It can be achieved that the first device can guide the small model to perform multi-target joint training, such as the first target indication information and the second target indication information, so that the subsequent small model can increase the ability to generate thinking chain logic while retaining its own ability to process task data during multi-target joint training. And based on the task data, the task processing result label and the first target indication information, the first target of the small model will be trained, and based on the task data, the task processing thinking chain and the second target indication information, the second target of the small model will be iteratively trained until the preset joint training end condition is met, and the trained small model is obtained to perform task processing according to the trained small model. That is, when the small model is training the model, it will achieve two goals for one task data, that is, while processing the task data, it can also realize the thinking chain logic of interpreting the processing of the task data, so that when the trained small model is processing the task, it can retain its own task processing function while generating the corresponding thinking chain, thereby improving the model performance of the small model. And when training the small model, the task processing thinking chain sent by the large model is used for model training, and the large model and the small model can be in different devices. Therefore, for the model holder who only has the small model, the large model in the second device can be remotely called, and the task processing thinking chain generated by the large model can be used to train the small model and complete the knowledge distillation of the small model. That is, the small model holder who only has the small model can perform knowledge distillation on the small model according to the large model, so that the small model also has the ability to generate thinking chains.
[0106] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment can be referred to the above introduction, and will not be repeated later. On this basis, in step S30, based on the task data, the task processing result label and the first target indication information, the step of training the first target of the small model includes steps c10-c30.
[0107] Step c10, determining a first prediction result corresponding to the task data output by the small model according to the first target indication information;
[0108] Optionally, the first prediction result may be a task processing result label predicted by the small model for the task data, such as the correct answer predicted for the question-answering task data.
[0109] Optionally, the first device may perform model training according to the first target indication information when performing model training on the input task data. That is, the task data is processed to output a first prediction result. For example, when the task data is question-and-answer task data, such as the question in the question-and-answer task data is "A migratory bird flew north over the highest peak on Earth, where is it now?", the candidate answers to the question-and-answer task data include "A. China; B. United States; C. Japan; D. Centaurus". Then the first prediction result can be the answer to the question, such as the answer A. China.
[0110] Step c20, calculating a first prediction loss based on the first prediction result and the task processing result label;
[0111] Optionally, a first loss function corresponding to the first target indication information, such as a cross entropy loss function, may be determined. The first prediction result and the task processing result label corresponding to the same task data are input into the first loss function for calculation to obtain a first prediction loss.
[0112] Step c30, optimizing the small model according to the first prediction loss to train the first objective of the small model.
[0113] Optionally, after determining the first prediction loss, the model parameters of the small model can be reversely updated according to the first prediction loss to achieve the first goal of training the small model.
[0114] While training the first goal of the small model, the second goal of the small model will be iteratively trained based on the task data, task processing thinking chain and the second goal indication information. The first goal and the second goal of the small model will be jointly trained until the preset joint training end conditions are met, and the trained small model is obtained.
[0115] Optionally, the small model includes an adapter and a model body, and the model parameters of the adapter in the small model can be optimized according to the first prediction loss to train the first objective of the small model.
[0116] In this embodiment, the first prediction result corresponding to the task data output by the small model is determined based on the first target indication information, the first prediction loss is calculated based on the first prediction result and the task processing result label, and the small model is optimized based on the first prediction loss to train the first target of the small model, so that the trained small model can process the task data.
[0117] Further, in a feasible embodiment, in step S30, based on the task data, the task processing thinking chain and the second target indication information, the step of iteratively training the second target of the small model includes steps d10-d30.
[0118] Step d10, determining a second prediction result corresponding to the task data output by the small model according to the second target indication information;
[0119] Optionally, the second prediction result may be a chain of thought that explains processing the task data to generate a task processing result label, such as a logical explanation of the correct answer predicted for the question-answering task data.
[0120] Optionally, when the first device performs model training on the input task data, it can perform model training according to the second target indication information to output a predicted chain of thought and use it as the second prediction result. For example, when the task data is question-and-answer task data, the question in the question-and-answer task data is "A migratory bird flew north over the highest peak on earth, where is it now?", and the candidate answers for the question-and-answer task data include "A. China; B. United States; C. Japan; D. Centaurus". Then the second prediction result can be because the world's highest peak is Mount Everest, which is located at the junction of China and Nepal. China is in the north, so the migratory bird flew into China. Based on the above reasoning, the final answer is A, China.
[0121] Step d20, calculating a second prediction loss based on the second prediction result and the task processing thinking chain;
[0122] Optionally, a second loss function corresponding to the second target indication information may be determined, such as a sequence-to-sequence model loss function. The second prediction result and the task processing thought chain corresponding to the same task data are input into the second loss function for calculation to obtain a second prediction loss.
[0123] Step d30, optimizing the small model according to the second prediction loss to train the second objective of the small model.
[0124] Optionally, after determining the second prediction loss, the model parameters of the small model can be reversely updated according to the second prediction loss to achieve the second goal of training the small model.
[0125] While training the second goal of the small model, the first goal of the small model will be iteratively trained based on the task data, task processing result label and the first goal indication information. The first goal and the second goal of the small model will be jointly trained until the preset joint training end condition is met, and the trained small model is obtained.
[0126] Optionally, the small model includes an adapter and a model body, and the model parameters of the adapter in the small model can be optimized according to the second prediction loss to train the second objective of the small model.
[0127] In this embodiment, the second prediction result corresponding to the task data output by the small model is determined based on the second target indication information, and the second prediction loss is calculated based on the second prediction result and the task processing thinking chain. The small model is optimized based on the second prediction loss to train the second target of the small model, so that the trained small model can have the ability to generate thinking chains, thereby improving the model performance of the small model.
[0128] Furthermore, in a feasible embodiment, in step S30, the first goal of the small model is trained based on the task data, the task processing result label and the first goal indication information, and the second goal of the small model is iteratively trained based on the task data, the task processing thinking chain and the second goal indication information, and also includes steps e10-e30.
[0129] Step e10, in each round of iterative training, determining a first prediction loss based on the task data, the task processing result label and the first target indication information;
[0130] Optionally, in each round of iterative training of the small model, the first prediction result corresponding to the task data output by the small model can be determined according to the first target indication information, and the first prediction result and the task processing result label corresponding to the same task data are input into the first loss function to calculate the first prediction loss. The specific implementation details can refer to the above embodiment.
[0131] Step e20, determining a second predicted loss based on the task data, the task processing thought chain and the second target indication information;
[0132] Optionally, in each round of iterative training of the small model, the second prediction result corresponding to the task data output by the small model can be determined according to the second target indication information, and the second prediction result corresponding to the same task data and the task processing thinking chain are input into the second loss function to calculate the second prediction loss. The specific implementation details can refer to the above embodiment.
[0133] Step e30, performing weighted summation of the first prediction loss and the second prediction loss to obtain a total prediction loss, and optimizing the small model according to the total prediction loss to jointly train the first objective and the second objective of the small model.
[0134] Optionally, after calculating the first prediction loss corresponding to the first target indication information and the second prediction loss corresponding to the second target indication information, a weighted sum of the two can be performed to obtain a total prediction loss. Optionally, different weights can be set for the first prediction loss and the second prediction loss according to a preset weight setting rule. Then, a weighted sum is performed based on the weight corresponding to the first prediction loss, the first prediction loss, the weight corresponding to the second prediction loss, and the second prediction loss to obtain a total prediction loss, and the model parameters of the small model are optimized in reverse based on the total prediction loss to achieve the first goal and the second goal of jointly training the small model.
[0135] Optionally, the weight setting rule can be set by the user or based on other rules, which is not limited here. For example, the weight corresponding to the first predicted loss is 0.5, and the weight corresponding to the second predicted loss is 0.5.
[0136] For example, if the small model is a language model, the loss function generated by the language model is L, is the cross entropy loss function, the language model is f, the task data is X, Xg = f(X), Xg is the generated result text, such as the first prediction result (such as the predicted correct answer) and / or the second prediction result (such as the predicted thought chain). Then Ltotal = aL1(f(X), y) + bL2(f(X), c);
[0137] Wherein, Ltotal is the total prediction loss. L1(f(X), y) is the first prediction loss. L2(f(X), c) is the second prediction loss. a is the weight corresponding to the first prediction loss. b is the weight corresponding to the second prediction loss. c is the task processing thought chain. y is the task processing result label. Optionally, the sum of a and b is 1, and can be set according to user needs, such as setting a to 0.5 and b to 0.5.
[0138] Optionally, the small model includes an adapter and a model body, and the model parameters of the adapter in the small model can be optimized according to the total prediction loss to jointly train the first objective and the second objective of the small model.
[0139] In this embodiment, a first prediction loss is determined based on task data, task processing result label and first target indication information, a second prediction loss is determined based on task data, task processing thinking chain and second target indication information, a weighted sum of the first prediction loss and the second prediction loss is performed to obtain a total prediction loss, and the small model is optimized according to the total prediction loss to jointly train the first target and the second target of the small model, so that the small model can have the ability to generate thinking chains while processing the task data, and because the task processing thinking chain is output by the large model in the second device, the large model can use the task processing thinking chain as a medium to perform knowledge distillation on the small model, so that the small model also has the ability to generate thinking chains.
[0140] In addition, the present application embodiment provides a task processing method, referring to Figure 3 , Figure 3 The third embodiment of the task processing method of the present application is a flowchart of the third embodiment. Optionally, the third embodiment of the present application can be performed based on the first or second embodiment, and the same or similar contents as the above embodiments can be referred to the above introduction, and will not be repeated later.
[0141] In this embodiment, the task processing method is applied to the second device, the second device is connected to the first device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device. The task processing method includes steps S100 to S200.
[0142] Step S100, generating a request for a task processing thought chain sent based on a task training set corresponding to at least one task;
[0143] It should be noted that the task training set includes task data and task processing result labels, and the task processing thinking chain is used to explain the thinking chain logic of processing task data to generate task processing result labels.
[0144] Optionally, the specific introduction of the first device and the second device may refer to the above embodiments and will not be elaborated here.
[0145] Optionally, the first device may first determine the task scenario to which the small model needs to be applied, and then determine a task training set corresponding to at least one task according to the task scenario, and send a task processing thought chain generation request to the second device according to the task training set. Optionally, the task may include a question-and-answer task, a judgment task, and other types of tasks, which are not limited here.
[0146] Optionally, the first device sends the task processing thinking chain generation request and the task training set to the second device via wired or wireless transmission. Optionally, the second device may first determine whether the first device has the authority to call the large model, and if it is determined that the first device has the authority to call the large model, receive the task training set and the task processing thinking chain generation request sent by the first device. Optionally, the second device may also directly receive the task training set and the task processing thinking chain generation request sent by the first device. It may also be indirectly received through a third-party device.
[0147] Step S200, based on the task processing thinking chain generation request, the task data in the task training set is input into the large model, the task processing thinking chain is output, and the task processing thinking chain is sent to the first device.
[0148] It should be noted that the first device determines the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and trains the first target of the small model based on the task data, the task processing result label and the first target indication information, and iteratively trains the second target of the small model based on the task data, the task processing thinking chain and the second target indication information until the preset joint training end conditions are met, and a trained small model is obtained to perform task processing according to the trained small model, wherein the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for explaining the processing of the task data.
[0149] Optionally, after receiving the task training set and the task processing thinking chain generation request, the second device can first determine each task data in the task training set, and input each task data into the big model in turn for thinking chain reasoning training according to the task processing thinking chain generation request, that is, the big model will perform a logical analysis on the task data according to the task processing thinking chain generation request, and determine the thinking chain logic of the prediction result corresponding to the task data. For example, when the task data is question-and-answer task data, the question and the candidate answer are input into the big model, and the big model will give the predicted correct answer and analyze why it is the correct answer, and then output the analysis process to obtain the task processing thinking chain corresponding to the task data.
[0150] For example, when the task is a question-and-answer task, the question in the question-and-answer task data is "A migratory bird flew north over the highest peak on Earth, where is it now?", and the candidate answers to the question-and-answer task data include "A. China; B. United States; C. Japan; D. Centaurus". Then, a large model with strong requirements for thinking chain template information built based on prompt engineering can be used to answer the question and provide reasoning data on why the answer is given in this way. Therefore, after the question, candidate answers and thinking chain template information are input into the large model, the large model will give the following reasoning answer: "Because the highest peak in the world is Mount Everest, it is located at the junction of China and Nepal, and China is in the north, so this migratory bird flew into China. Based on the above reasoning, the final answer is A, China". This reasoning is the task processing thinking chain corresponding to the question-and-answer task data.
[0151] Optionally, after the large model in the second device generates a thinking chain corresponding to each task data in the task training set by using the task processing thinking chain generation request sent by the first device, the thinking chain corresponding to each task data is sent to the first device. After receiving the thinking chain corresponding to each task data sent by the second device, the first device associates and stores the thinking chain corresponding to each task data with the corresponding task data.
[0152] In this embodiment, a small model is deployed on the first device and a large model is deployed on the second device. The thought chain output by the large model in the second device performs knowledge distillation on the small model in the first device. This avoids the phenomenon that the traditional distillation method needs to deploy both the large model and the small model locally at the same time before using the large model to perform knowledge distillation on the small model. This avoids the hardware limitations and high cost of deploying the large model locally, allowing more institutions and enterprises to use the capabilities of the large model to enhance the local small model.
[0153] And the first device will send a task processing thinking chain generation request to the second device based on the task training set corresponding to at least one task, and receive the task processing thinking chain fed back by the second device. The task training set includes task data and task processing result labels, and the task processing thinking chain is used to explain the thinking chain logic of processing task data to generate task processing result labels. Therefore, it is possible for the first device to construct a task processing thinking chain generation request based on the task training set stored in itself, so that the task processing thinking chain fed back by the second device is more in line with the task in the task training set. And the second device will output the task processing thinking chain based on the large model and the task training set. In addition, it is possible to use the model capability of the large model in the second device to output the task processing thinking chain corresponding to the task training set.
[0154] And the first device will determine the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for interpreting the processing of the task data. It can be achieved that the first device can guide the small model to perform multi-target joint training, such as the first target indication information and the second target indication information, so that the subsequent small model can increase the ability to generate thinking chain logic while retaining its own ability to process task data during multi-target joint training. And based on the task data, the task processing result label and the first target indication information, the first target of the small model will be trained, and based on the task data, the task processing thinking chain and the second target indication information, the second target of the small model will be iteratively trained until the preset joint training end condition is met, and the trained small model is obtained to perform task processing according to the trained small model. That is, when the small model is training the model, it will achieve two goals for one task data, that is, while processing the task data, it can also realize the thinking chain logic of interpreting the processing of the task data, so that when the trained small model is processing the task, it can retain its own task processing function while generating the corresponding thinking chain, thereby improving the model performance of the small model. And when training the small model, the task processing thinking chain sent by the large model is used for model training, and the large model and the small model can be in different devices. Therefore, for the model holder who only has the small model, the large model in the second device can be remotely called, and the task processing thinking chain generated by the large model can be used to train the small model and complete the knowledge distillation of the small model. That is, the small model holder who only has the small model can perform knowledge distillation on the small model according to the large model, so that the small model also has the ability to generate thinking chains.
[0155] In addition, to achieve the above purpose, refer to Figure 4 The present application also proposes a task processing system, comprising a first device A100 and a second device A200 connected to each other, a small model to be trained is deployed in the first device A100, and a large model is deployed in the second device A200, and the system includes:
[0156] The first device A100 is configured to send a task processing thought chain generation request to the second device based on a task training set corresponding to at least one task, and receive a task processing thought chain fed back by the second device, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label;
[0157] The second device A200 is used to receive a task processing thinking chain generation request sent by the first device based on a task training set corresponding to at least one task, input the task data in the task training set into the big model based on the task processing thinking chain generation request, output the task processing thinking chain, and send the task processing thinking chain to the first device;
[0158] The first device A100 is further used to determine first target indication information and second target indication information for multi-target joint training of the small model based on the task data, the first target indication information being used to indicate processing of the task data, and the second target indication information being used to indicate a thinking chain logic for explaining processing of the task data;
[0159] The first device A100 is also used to train the first goal of the small model based on the task data, the task processing result label and the first goal indication information, and iteratively train the second goal of the small model based on the task data, the task processing thinking chain and the second goal indication information, until the preset joint training end conditions are met, and the trained small model is obtained to perform task processing according to the trained small model.
[0160] The task processing system provided by the present application adopts the task processing method in the above embodiment, and can realize knowledge distillation of the small model according to the large model for the small model holder who only has a small model. Compared with the prior art, the beneficial effects of the task processing system provided by the present application are the same as the beneficial effects of the task processing method provided by the above embodiment, and other technical features of the task processing system are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0161] The present application provides a task processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task processing method in the above-mentioned embodiment one.
[0162] Reference below Figure 5 , which shows a schematic diagram of the structure of a task processing device suitable for implementing an embodiment of the present application. The task processing device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The task processing device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0163] like Figure 5 As shown, the task processing device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the task processing device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the task processing device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a task processing device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0164] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0165] The task processing device provided by the present application adopts the task processing method in the above embodiment, and can realize knowledge distillation of the small model according to the large model for the small model holder who only has a small model. Compared with the prior art, the beneficial effects of the task processing device provided by the present application are the same as the beneficial effects of the task processing method provided by the above embodiment, and the other technical features in the task processing device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0166] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0167] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0168] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the task processing method in the above-mentioned embodiment.
[0169] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0170] The computer-readable storage medium may be included in the task processing device; or may exist independently without being installed in the task processing device.
[0171] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the task processing device, the task processing device can execute the step flow of the task processing method.
[0172] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0173] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0174] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0175] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned task processing method, and can improve the universality of federated forgetting learning. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the task processing method provided in the above-mentioned embodiment, and will not be repeated here.
[0176] The present application also provides a computer program product, including a computer program, which implements the steps of the task processing method as described above when the computer program is executed by a processor.
[0177] The computer program product provided by the present application can realize knowledge distillation of the small model according to the large model for the small model holder who only has the small model. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the task processing method provided by the above embodiment, which will not be repeated here.
[0178] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A task processing method, It is characterized in that Applied to a first device, the first device is connected to a second device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device, the method includes: Sending a task processing thought chain generation request to a second device based on a task training set corresponding to at least one task, and receiving a task processing thought chain fed back by the second device, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label, and the second device outputs the task processing thought chain based on the large model and the task training set; Based on the task data, determine first target indication information and second target indication information for multi-target joint training of the small model, wherein the first target indication information is used to indicate processing of the task data, and the second target indication information is used to indicate a thinking chain logic for explaining processing of the task data; Based on the task data, the task processing result label and the first target indication information, the first target of the small model is trained, and based on the task data, the task processing thinking chain and the second target indication information, the second target of the small model is iteratively trained until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model.
2. The method according to claim 1, It is characterized in that The determining, based on the task data, first target indication information and second target indication information for the multi-target joint training of the small model comprises: Obtaining a preset task processing prefix, and performing splicing processing on the preset task processing prefix and the task data to obtain the first target indication information; A preset thinking chain generation prefix is obtained, and the preset thinking chain generation prefix and the task data are concatenated to obtain the second target indication information.
3. The method according to claim 1, It is characterized in that The first objective of training the small model based on the task data, the task processing result label and the first objective indication information includes: Determine a first prediction result corresponding to the task data output by the small model according to the first target indication information; Calculating a first prediction loss according to the first prediction result and the task processing result label; The small model is optimized according to the first prediction loss to train a first objective of the small model.
4. The task processing method according to claim 1, It is characterized in that The iterative training of the second goal of the small model based on the task data, the task processing thinking chain and the second goal indication information includes: Determining a second prediction result corresponding to the task data and output by the small model according to the second target indication information; Calculating a second prediction loss according to the second prediction result and the task processing thinking chain; The small model is optimized according to the second prediction loss to train a second objective of the small model.
5. The task processing method according to claim 1, It is characterized in that The first target of the small model is trained based on the task data, the task processing result label and the first target indication information, and the second target of the small model is iteratively trained based on the task data, the task processing thinking chain and the second target indication information, further comprising: In each round of iterative training, based on the task data, the task processing result label and the first target indication information, a first predicted loss is determined; Determine a second predicted loss based on the task data, the task processing thought chain and the second target indication information; A total prediction loss is obtained by weighted summing the first prediction loss and the second prediction loss, and the small model is optimized according to the total prediction loss to jointly train the first objective and the second objective of the small model.
6. The method according to claim 1, It is characterized in that The task processing thought chain generation request includes a determination task processing thought chain generation request and a question and answer task processing thought chain generation request. The sending a task processing thought chain generation request to the second device based on the task training set corresponding to the at least one task includes: When the task is a determination task, generating a determination task processing thought chain generation request according to a task training set corresponding to the determination task, and sending the determination task processing thought chain generation request to the second device; and / or, When the task is a question-answering task, a question-answering task processing thinking chain generation request is generated according to a task training set corresponding to the question-answering task, and the question-answering task processing thinking chain generation request is sent to the second device.
7. A task processing method, It is characterized in that Applied to a second device, the second device is connected to a first device, a small model to be trained is deployed in the first device, and a large model is deployed in the second device, the method includes: receiving a task processing thought chain generation request sent by the first device based on a task training set corresponding to at least one task, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label; Based on the task processing thought chain generation request, the task data in the task training set is input into the large model, the task processing thought chain is output, and the task processing thought chain is sent to the first device; Among them, the first device determines the first target indication information and the second target indication information of the multi-target joint training of the small model based on the task data, and trains the first target of the small model based on the task data, the task processing result label and the first target indication information, and iteratively trains the second target of the small model based on the task data, the task processing thinking chain and the second target indication information until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model, wherein the first target indication information is used to indicate the processing of the task data, and the second target indication information is used to indicate the thinking chain logic for explaining the processing of the task data.
8. A task processing system, It is characterized in that The method comprises a first device and a second device connected to each other, wherein a small model to be trained is deployed in the first device, and a large model is deployed in the second device. The first device is used to send a task processing thought chain generation request to the second device based on a task training set corresponding to at least one task, and receive a task processing thought chain fed back by the second device, wherein the task training set includes task data and a task processing result label, and the task processing thought chain is used to explain the thought chain logic of processing the task data to generate the task processing result label; The second device is used to receive a task processing thinking chain generation request sent by the first device based on a task training set corresponding to at least one task, input the task data in the task training set into the large model based on the task processing thinking chain generation request, output a task processing thinking chain, and send the task processing thinking chain to the first device; The first device is further used to determine first target indication information and second target indication information for multi-target joint training of the small model based on the task data, wherein the first target indication information is used to indicate processing of the task data, and the second target indication information is used to indicate a thinking chain logic for explaining processing of the task data; The first device is also used to train the first target of the small model based on the task data, the task processing result label and the first target indication information, and iteratively train the second target of the small model based on the task data, the task processing thinking chain and the second target indication information, until the preset joint training end condition is met, and a trained small model is obtained to perform task processing according to the trained small model.
9. A task processing device, It is characterized in that The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task processing method according to any one of claims 1 to 7.
10. A medium, It is characterized in that The medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the task processing method according to any one of claims 1 to 7 are implemented.
11. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the task processing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data generation method and device, electronic equipment and storage medium
CN116663530A
Chinese reasoning task model construction method and device, equipment and medium
CN117076640A
Model training method and device based on thinking chain
CN118114770A
Flexible thinking chain learning method and device based on large language model and medium
CN118333153A
Prompting Machine-Learned Models Using Chains of Thought
US20230394328A1
