Model training method and device, electronic equipment and readable storage medium
By dynamically monitoring and adjusting the proportion of instruction tasks in the training data, the randomness problem in the fine-tuning process of the pre-trained model is solved, the collaborative learning of knowledge and reasoning is realized, and the ability of large models to handle complex instruction tasks is improved.
Patent Information
- Application Number
- CN202311147454.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-09-07
AI Technical Summary
In existing technologies, when fine-tuning pre-trained models, text data for instruction tasks is usually randomly selected, resulting in poor model training performance, especially for complex instruction tasks. This ignores the need for collaboration between knowledge and reasoning, and creates a learning bottleneck.
By acquiring the application attributes and cognitive difficulty level of the instruction task, the model's learning gain at different levels is dynamically monitored, the proportion of tasks in the training data is adjusted, and the proportion of low-level tasks is increased to promote the collaborative learning of knowledge and reasoning, thereby achieving collaborative solutions to complex instruction tasks.
It improves the training effect of large models during fine-tuning, enhances the accuracy of handling complex instruction tasks, realizes the synergistic promotion of knowledge and reasoning, and improves the model's problem-solving ability.
Smart Images

Figure CN116991975B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of natural language processing, and particularly relate to a model training method and device, electronic equipment and readable storage medium. BACKGROUND
[0002] With the rapid development of natural language processing (NLP) technology, large models have been widely applied. The large model processes the input instruction task through natural language processing, and the output result can conform to human behavior norms and interaction modes, thereby realizing human-computer interaction.
[0003] Before human-computer interaction, the large model usually needs to be trained. Through massive text data, a pre-training model is constructed by using a self-recurrent learning mode, so that the pre-training model has rich knowledge; the pre-training model is fine-tuned through text data of instruction tasks, so that the pre-training model learns how to use knowledge to solve actual instruction tasks, thereby greatly improving the ability of the large model to solve instruction tasks.
[0004] The solution of the instruction task of NLP usually needs both knowledge and reasoning factors. For a specific task, there is no effective method to construct which knowledge is needed and which reasoning ability is involved. At present, when fine-tuning the pre-training model, the text data of instruction tasks is usually randomly selected, and the effect of model training is poor. SUMMARY
[0005] Embodiments of the present application provide a model training method and device, electronic equipment and readable storage medium to solve the problem that when fine-tuning the pre-training model in the prior art, the text data of instruction tasks is randomly selected, resulting in poor model training effect.
[0006] In a first aspect, embodiments of the present application provide a model training method, which comprises:
[0007] obtaining a first text data set, the first text data set comprising a plurality of first instruction task expression texts;
[0008] obtaining an application attribute of each first instruction task and a hierarchical level of each first instruction task under the application attribute, the application attribute of the first instruction task being used to indicate whether the first instruction task is a knowledge application task or a reasoning task, and the hierarchical level being used to indicate the cognitive difficulty of the first instruction task in natural language processing;
[0009] train the first model based on a first training data set in the first text data set, the first training data set comprising expression texts of first instruction tasks of a first target hierarchical level, the first target hierarchical level comprising a first hierarchical level and a second hierarchical level under each application attribute, the second hierarchical level being lower in cognitive difficulty than the first hierarchical level;
[0010] in a case where a learning gain of the first model for instruction tasks of the first hierarchical level is in a saturated state, increase a proportion of expression texts of first instruction tasks of a second hierarchical level under a first application attribute in the first training data set based on a first validation data set in the first text data set, to obtain a second training data set, the first application attribute being determined based on a second application attribute, the learning gain of the first model for first instruction tasks of the second hierarchical level under the second application attribute being in a saturated state, the first validation data set comprising expression texts of first instruction tasks of the second hierarchical level under each application attribute;
[0011] continue training the first model based on the second training data set.
[0012] In a second aspect, an embodiment of the present application provides a model training device, and the device comprises:
[0013] a first obtaining module, configured to obtain a first text data set, the first text data set comprising expression texts of a plurality of first instruction tasks;
[0014] a second obtaining module, configured to obtain an application attribute of each first instruction task and obtain a hierarchical level of each first instruction task under the application attribute, the application attribute of the first instruction task being used to indicate whether the first instruction task is a knowledge application task or an inference task, and the hierarchical level being used to indicate a cognitive difficulty of the first instruction task in natural language processing;
[0015] a first training module, configured to train a first model based on a first training data set in the first text data set, the first training data set comprising expression texts of first instruction tasks of a first target hierarchical level, the first target hierarchical level comprising a first hierarchical level and a second hierarchical level under each application attribute, the second hierarchical level being lower in cognitive difficulty than the first hierarchical level;
[0016] a proportion increasing module, configured to, in a case where the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state, increase, based on a first validation data set in the first text data set, a proportion of expression text of the first instruction task of the second hierarchical level under a first application attribute in the first training data set to obtain a second training data set, the first application attribute being determined based on a second application attribute, the learning gain of the first model for the first instruction task of the second hierarchical level under the second application attribute being in a saturated state, the first validation data set including expression text of the first instruction task of the second hierarchical level under each application attribute;
[0017] a second training module, configured to continue training the first model based on the second training data set.
[0018] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the computer program, when executed by the processor, implements the steps of the model training method.
[0019] In a fourth aspect, a readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the model training method.
[0020] In the embodiments of the present application, the instruction task is divided into hierarchical levels from two dimensions of application attribute and cognitive difficulty, and in the training process of the first model for the instruction task of the current hierarchical level and the lower hierarchical level, the learning gain of the first model for the instruction task of the current hierarchical level is monitored, and in a case where the learning gain is in a saturated state, the learning gain of the first model for the first instruction task of the lower hierarchical level under different application attributes is monitored, so as to monitor a case where the learning gain of the first model for the first instruction task of the lower hierarchical level under the second application attribute is in a saturated state, increase the proportion of expression text of the first instruction task of the lower hierarchical level under the first application attribute in the first training data set, and continue to train the first model for the instruction task of the current hierarchical level and the lower hierarchical level. In this way, the problem of randomness of the large model in the adjustment of the instruction task in the fine-tuning process can be solved, the learning gain of the first model for the instruction task of the lower hierarchical level under different application attributes is monitored in the training process, and in a case where the learning gain of the instruction task of an application attribute is in a saturated state, the instruction task of the lower hierarchical level under another application attribute is increased, and the large model is continuously trained, so that the large model learns the solution ability of knowledge and reasoning cooperation under different application attributes, that is, knowledge and reasoning, so as to improve the training effect of the large model, and further improve the processing accuracy of the large model for the instruction task. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0022] Figure 1 is a flowchart of the model training method provided by the embodiments of the present application;
[0023] Figure 2 is a structural diagram of the model training device provided by the embodiments of the present application;
[0024] Figure 3 is a structural diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0026] It should be noted that the model training method provided by the embodiments of the present application relates to the technical field of natural language processing, which can be widely applied in various fields such as the financial field and the artificial intelligence field. For example, when applied in the financial field, the instruction task can involve financial knowledge, such as the instruction task "whether the behavior of collecting the head chopping interest from the customer conforms to the financial laws and regulations". For another example, when applied in the artificial intelligence field, the instruction task can involve behavior instructions and question and answer instructions, for example, it can be applied in a robot, and an instruction can be input to make the robot perform the corresponding task.
[0027] For a large model of NLP, in order to enable it to be applied, it needs to be trained, and the construction process of the large model is as follows:
[0028] (1) Through massive text data, a pre-training model is constructed by using a self-recurrent learning mode, so that the pre-training model has rich knowledge;
[0029] (2) The pre-training model is fine-tuned through the text data of the instruction task, so that the pre-training model learns how to use knowledge to solve actual instruction tasks, thereby greatly improving the ability of the large model to solve instruction tasks;
[0030] (3) Through the learning mode of human-computer interaction reinforcement learning, the output result of the large model conforms to the behavior specification and interaction mode of human beings.
[0031] The model training of the embodiment of the application mainly involves the process of the second (2) stage, that is, fine-tuning the large model on the basis of pre-training to improve the ability of the large model to solve instruction tasks.
[0032] The solution of the instruction task of NLP usually needs both knowledge and reasoning factors, and there is no effective method to construct which knowledge is needed and which reasoning ability is involved for a specific task. However, when the pre-trained model is fine-tuned at present, the text data of the instruction task is usually randomly selected, and the internal logic between the instruction tasks is ignored, so the effect of model training is relatively poor.
[0033] Especially for the solution of complex instruction tasks, it usually needs to have both knowledge and reasoning capabilities, and the instruction task can be fine-tuned in the training process of the large model. Since the instruction fine-tuning is randomly selected, the fine-tuning effect of the complex instruction task is poor in the instruction fine-tuning process of the large model, that is, the large model has little effect on the processing of complex instruction tasks. This is because the random selection of instruction tasks ignores the collaborative demand of knowledge and reasoning in the fine-tuning process of complex instruction tasks, and one-sidedly increasing knowledge or reasoning has a saturation bottleneck for the learning of complex instruction tasks by the large model.
[0034] And the purpose of the embodiment of the application is to dynamically detect the learning bottleneck of the large model for complex instruction tasks, and through the instruction fine-tuning method of knowledge and reasoning collaboration, the large model has the complex problem solving ability driven by knowledge and reasoning.
[0035] The model training method provided by the embodiment of the application will be described in detail below.
[0036] Referring to Figure 1 , the flowchart of the model training method provided by the embodiment of the application is shown. As Figure 1 shown, the method can include the following steps:
[0037] Step 101, acquiring a first text data set, the first text data set including a plurality of first instruction task expression texts;
[0038] In the embodiment of the application, the model training method relates to the field of natural language processing technology, which can be widely used in various scenes such as finance and artificial intelligence. The model training method of the embodiment of the application can be executed by the model training device of the embodiment of the application. The model training device of the embodiment of the application can be configured in any electronic device to execute the model training method of the embodiment of the application.
[0039] The instruction task is an instruction task, which essentially inputs instructions to enable the large model to utilize learned knowledge for natural language processing to achieve the corresponding task. For example, the instruction task is "find the word with multiple meanings in the following two sentences", and for example, "please write a romantic poem on the theme of the moon".
[0040] The first instruction task can be described by text, and the expression text of the first instruction task is the instruction description information of the first instruction task. The first instruction task can be a single-dimensional instruction task, such as the instruction task "tokenizing the input sentence", "classifying the input text", and the first instruction task can also be a multi-dimensional instruction task, such as the instruction task "tokenizing the input sentence and counting the number of words", wherein the instruction task can involve the tokenization task and the statistics task, "tokenizing the input sentence and outputting the entity type if there is an entity", wherein the instruction task can involve the tokenization task and the entity recognition task.
[0041] The first text data set can be obtained by user labeling, for example, an NLP expert combs the instruction task system to establish a systematic and complete instruction task system, and the first text data set can include the instruction task in the instruction task system, or can be generated by a large model, for example, an expert constructs a seed instruction, and a large model expands and enriches based on the seed instruction to generate multiple instruction tasks, or a combination of the two, which is not limited here.
[0042] In step 102, the application attribute of each first instruction task is obtained, and the hierarchical level of each first instruction task under the application attribute is obtained, the application attribute of the first instruction task is used to indicate whether the first instruction task is a knowledge application task or a reasoning task, and the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing.
[0043] The application attribute of the instruction task includes two kinds, one indicating that the instruction task is a knowledge application task, and the solution of the knowledge application task is mainly knowledge-based, such as the instruction task "How tall is Zhang San". One indicates that the instruction task is a reasoning task, and the solution of the reasoning task is mainly reasoning-based, such as the instruction task "find the word with multiple meanings in the following two sentences".
[0044] The instruction task of NLP can be divided into six hierarchical levels of memory, understanding, simple reasoning, complex reasoning, evaluation proof and creation by referring to Bloom's cognitive system:
[0045] Memory: refers to the recognition and memory of concepts, knowledge, and the storage of them in the large model and can be extracted at any time, among which the factual knowledge and concepts involved in the NLP instruction task belong to this category, such as the capital of country A is region A, and the height of Zhang San is 2 meters, etc. belong to memory knowledge, and for example, fill in the idiom, given the first half of the poem, let the large model complete the second half, which belongs to the NLP instruction task in the memory category.
[0046] Understanding: refers to the understanding of things or knowledge, and the scope of natural language understanding (NLU) is wide, but the understanding involved here is usually shallow, mainly to establish the relevance between new and old knowledge, such as transforming a sentence into a passive sentence, listing the subject of a sentence, and identifying the entity of a sentence. Instruction tasks such as the instruction task belong to the level of understanding.
[0047] Simple reasoning: refers to the use of learned concepts, rules, and principles, which reflects the ability to apply learned knowledge to new situations and solve practical problems. For example, multi-hop question answering "Where was Zhang San's daughter born?" and reading comprehension instruction tasks.
[0048] Complex reasoning: refers to the ability to decompose complex knowledge into components and understand the relationship between parts, such as the instruction task "Find the words with multiple meanings in the following two sentences". This task involves first understanding the meaning of a word with multiple meanings, then performing word segmentation on the two sentences, and then finding two words that are identical at the character level, and determining whether the semantics of the two characters in their respective sentences are the same.
[0049] Evaluation proof: refers to making inferences that conform to objective facts by synthesizing internal and external materials and information. For NLP instruction tasks, objective evaluations and corresponding evidence can be given, such as the instruction task "Does the behavior of collecting customer's chopping heads interest comply with financial laws and regulations".
[0050] Creation: refers to the ability to recombine learned knowledge or add self-generated information to form a new whole, such as the instruction task "Please write a romantic poem on the theme of the moon".
[0051] These six levels are ranked from low to high in cognitive difficulty as memory, understanding, simple reasoning, complex reasoning, evaluation proof, and creation, that is, memory is the simplest in cognitive difficulty, and creation is the most complex in cognitive difficulty.
[0052] The first instruction task can be annotated by a user according to the six hierarchical levels of Bloom's cognitive system, or can be annotated by a large model according to the six hierarchical levels, or both.
[0053] For the annotation of application attributes, a user can perform the annotation, or a large model can classify according to knowledge application tasks and reasoning tasks to obtain the application attributes of the first instruction task, or both.
[0054] In this way, the first instruction task has two-dimensional task attributes, namely application attributes and cognitive difficulty, and each first instruction task has application attributes and hierarchical levels under the application attributes. For example, the instruction task "please write a romantic poem on the theme of the moon" indicates that the instruction task is a reasoning task, and the hierarchical level is "creation".
[0055] In this step, by obtaining the two-dimensional task attributes of each first instruction task, the learning gain of the first model for low-level instruction tasks can be monitored during the fine-tuning of the first model for instruction tasks, the learning saturation of the first model for knowledge application tasks and reasoning tasks can be analyzed, and the proportion of knowledge application tasks and reasoning tasks in the training data can be dynamically adjusted, so that the large model can promote learning through knowledge and reasoning for complex instruction tasks, and the large model can continuously improve the learning of complex instruction tasks. And, the processing capacity of the large model can be iteratively increased from low to high in the order of cognitive difficulty.
[0056] Step 103, based on the first training data set in the first text data set, the first model is trained, the first training data set includes the expression text of the first instruction task of the first target hierarchical level, the first target hierarchical level includes the first hierarchical level and the second hierarchical level under each application attribute, the second hierarchical level is lower than the first hierarchical level in cognitive difficulty.
[0057] The first model can be a large model, i.e. a model for natural language processing, and the first model can be a pre-trained model.
[0058] The first instruction task of the first hierarchical level is a complex instruction task relative to the first instruction task of the second hierarchical level.
[0059] The first model can be iteratively trained in order of cognitive difficulty from low to high according to the hierarchical levels, that is, the first model is trained based on the first instruction task of the low-level first, and the complex instruction task is trained after the first model completes the learning of the low-level instruction task.
[0060] When training to the first hierarchical level, the first model can be trained based on a first training data set in the first text data set. The first training data set can include the first and second hierarchical levels under each application attribute, that is, the first model is trained based on the knowledge application task and reasoning task of the first hierarchical level and the knowledge application task and reasoning task of the second hierarchical level. The first hierarchical level is the hierarchical level of the current complex instruction task.
[0061] Specifically, the representation text of the first instruction task in the first training data set can be input to the first model for natural language processing, so that the large model can learn the processing logic of the instruction task and adjust the parameters of the large model until the training period (epoch) ends.
[0062] The first training data set can be obtained by obtaining a plurality of first instruction tasks of the first and second hierarchical levels under each application attribute from the first text data set, or by dividing the first text data set into a training data set, a validation data set and a test data set, and obtaining a plurality of first instruction tasks of the first and second hierarchical levels under each application attribute from the training data set.
[0063] The training data set is used to train the first model. The validation data set is used to monitor the learning gain of the first model for the instruction task of the low-level hierarchical level, so as to adjust the training data set for further training, and the proportion of the knowledge application task and / or reasoning task of the low-level hierarchical level can be adjusted. The test data set is used to monitor the learning gain of the first model for the current complex instruction task, so as to determine whether it is necessary to adjust the proportion of the knowledge application task and / or reasoning task of the low-level hierarchical level.
[0064] Optionally, before step 104, the method further comprises:
[0065] In the case where the training period of the first model ends, the first test data set in the first text data set is input to the first model for natural language processing, and the first test data set includes the representation text of the first instruction task of the first hierarchical level.
[0066] The processing of the first instruction task in the first test data set by the first model is counted to obtain a first processing result index of the first instruction task of the first hierarchical level.
[0067] In a case where the processing result indicator is in a saturated state, it is determined that the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state.
[0068] At the end of each training cycle (epoch) in the fine-tuning process of the first model, it can be evaluated whether the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state. The learning gain of the first model for the instruction task of the first hierarchical level can be evaluated based on the first test data set, which can include the knowledge application task and the reasoning task of the first hierarchical level. Specifically, the first test data set can be input to the first model for natural language processing to count the processing result indicator of the first model for the current complex instruction task, which can include the accuracy (ACC) of task processing and the comprehensive score (F1) of task processing, etc.
[0069] If the processing result indicator no longer increases or increases slowly during the test process, it indicates that the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state, otherwise it indicates that the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state.
[0070] Step 104, in a case where the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state, based on the first validation data set in the first text data set, the proportion of the representation text of the first instruction task of the second hierarchical level under the first application attribute in the first training data set is increased to obtain a second training data set, the first application attribute is determined based on a second application attribute, the learning gain of the first model for the first instruction task of the second hierarchical level under the second application attribute is in a saturated state, and the first validation data set includes the representation text of the first instruction task of the second hierarchical level under each application attribute.
[0071] If the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state, based on the first validation data set, the learning gain of the first model for the first instruction task of the lower hierarchical level under each application attribute is monitored, and based on the learning gain, the proportion of the representation text of the first instruction task of the second hierarchical level under the first application attribute in the first training data set is increased to obtain a second training data set.
[0072] Optionally, the step 104 specifically includes:
[0073] The first validation data set is input to the first model for natural language processing.
[0074] The first model is used to statistically process the first instruction task of each application attribute to obtain a second processing result index of the first instruction task of each application attribute.
[0075] Based on the second processing result index, a second application attribute is determined from the application attributes.
[0076] The proportion of the representation text of the first instruction task of the second level in the first training data set is increased to obtain a second training data set.
[0077] Specifically, the representation text of the first instruction task in the first verification data set can be input into the first model for natural language processing to statistically obtain a processing result index of a knowledge application task of a low level and a processing result index of an inference task.
[0078] Optionally, the second application attribute is determined from the application attributes based on the second processing result index, including:
[0079] In a case where the second processing result index is in a saturated state, the application attribute corresponding to the second processing result index is determined as the second application attribute.
[0080] If the processing result index of the knowledge application task no longer increases or increases slowly during the test process, it is indicated that the learning gain of the first model for the knowledge application task of the second level is in a saturated state, and at this time, the second application attribute is the application attribute of the knowledge application task. Otherwise, it is indicated that the learning gain of the first model for the knowledge application task of the second level is not in a saturated state.
[0081] If the processing result index of the inference task no longer increases or increases slowly, it is indicated that the learning gain of the first model for the inference task of the second level is in a saturated state, and at this time, the second application attribute is the application attribute of the inference task. Otherwise, it is indicated that the learning gain of the first model for the inference task of the second level is not in a saturated state.
[0082] The first application attribute is determined based on the second application attribute. If the second application attribute is the application attribute of the knowledge application task, the first application attribute is the application attribute of the inference task. If the second application attribute is the application attribute of the inference task, the first application attribute is the application attribute of the knowledge application task.
[0083] When the learning gain of the first model for the knowledge application task of the second hierarchical level is in a saturated state, the proportion of the expression text of the inference task of the second hierarchical level in the first training data set can be increased, and when the learning gain of the first model for the inference task of the second hierarchical level is in a saturated state, the proportion of the expression text of the knowledge application task of the second hierarchical level in the first training data set can be increased. If the learning gain of the first model for the knowledge application task and the inference task of the second hierarchical level is in a saturated state, the proportion of the expression text of the knowledge application task and the inference task of the second hierarchical level in the first training data set is increased respectively, and a second training data set is obtained.
[0084] Thus, in the instruction fine-tuning process, the effect indicators of the instruction tasks and the task learning degree of the knowledge and inference ability required in the current complex task are dynamically monitored. If the effect indicator of the current complex instruction task grows slowly, the effect indicators of the knowledge application task and the inference task in the verification data set are analyzed. If the effect indicator of the knowledge application task is in a saturated state, more instruction data sets of the inference task are selected in subsequent training if the effect indicator of the inference task is in a saturated state, more instruction data sets of the knowledge application task are selected in subsequent training, so that the large model learns the current complex instruction task. The technical effect achieved is that for the knowledge application task in the large model fine-tuning process, mainly provide instruction data sets of the knowledge application task, and for the inference task, mainly provide instruction data sets of the inference task.
[0085] In the case where the number of second hierarchical levels is at least two, the step 104 specifically comprises:
[0086] Based on the first verification data set, the proportion of the expression text of the first instruction task of each second hierarchical level under the first application attribute in the first training data set is sequentially increased in the order from high to low hierarchical level, and a second training data set is obtained.
[0087] In the monitoring process of the effect indicators of the instruction tasks of the low hierarchical level, the effect indicators of the knowledge application task and the inference task of the higher hierarchical level can be monitored first. If the learning gain of the knowledge application task is in a saturated state, the proportion of the inference task of the monitored hierarchical level in the training data set is increased, and if the learning gain of the inference task is in a saturated state, the proportion of the knowledge application task in the training data set is increased. If both are in a saturated state, the effect indicators of the knowledge application task and the inference task of the lower hierarchical level are monitored, and the process is repeated.
[0088] Step 105, based on the second training data set, the first model is continuously trained.
[0089] The training process of the first model based on the second training data set is similar to the training process of the first model based on the first training data set, which will not be described here.
[0090] In this embodiment, by dividing the instruction tasks from two dimensions of application attributes and cognitive difficulty into hierarchical levels, and in the training process of the first model for instruction tasks of the current hierarchical level and the lower hierarchical level, the learning gain of the first model for instruction tasks of the current hierarchical level is monitored, and in the case that the learning gain is in a saturated state, the learning gain of the first model for the first instruction task of the lower hierarchical level under different application attributes is monitored, so as to monitor the case that the learning gain of the first model for the first instruction task of the lower hierarchical level under the second application attribute is in a saturated state, the proportion of the representation text of the first instruction task of the lower hierarchical level under the first application attribute in the first training data set is increased, and the training of the first model for instruction tasks of the current hierarchical level and the lower hierarchical level is continued. In this way, the problem of randomness of the adjustment of the large model to the instruction task in the fine-tuning process can be solved, the learning gain of the first model for instruction tasks of the lower hierarchical level under different application attributes is monitored during the training process, and in the case that the learning gain of the instruction task of one application attribute is in a saturated state, the instruction task of the lower hierarchical level under another application attribute is increased, and the large model is continuously trained, so that the large model learns to cooperatively solve the complex instruction task under different application attributes, i.e., knowledge and reasoning, so that the large model learns the cooperative solving ability of knowledge and reasoning, thereby improving the training effect of the large model, and further improving the processing accuracy of the large model to the instruction task.
[0091] In the case that the training cycle of the first model based on the second training data set ends, step 104 can be executed again, and the training is continued until it is monitored that the learning gain of the first model for instruction tasks of the first hierarchical level is not in a saturated state.
[0092] Optionally, after the first model is continuously trained based on the second training data set, the method further comprises:
[0093] In the case that the learning gain of the first model for instruction tasks of the first hierarchical level is not in a saturated state, the first model is continuously trained based on a third training data set in the first text data set;
[0094] The third training data set comprises representation texts of first instruction tasks of a second target hierarchical level, the second target hierarchical level comprises a third hierarchical level, the first hierarchical level and the second hierarchical level under each application attribute, and the third hierarchical level is higher than the first hierarchical level in cognitive difficulty.
[0095] The training process of the first model based on the third training data set is similar to the training process of the first model based on the first training data set, which will not be described here.
[0096] In the case that the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state, it means that the learning degree of the first model for the complex instruction task still has room for improvement, and the first model can be further trained to improve the processing ability of the first model for the instruction task of a third hierarchical level which is more complex than the first hierarchical level.
[0097] The third training data set includes the representation texts of the current complex instruction task, i.e., the first instruction task of the third hierarchical level, and the first instruction task of the lower hierarchical level. The lower hierarchical level relative to the third hierarchical level includes the first hierarchical level and the second hierarchical level.
[0098] In this way, the processing of the instruction task of the lower hierarchical level to the higher hierarchical level continues to learn, and the processing ability of the complex instruction task is continuously enhanced.
[0099] In the case that the first hierarchical level is the highest level in terms of cognitive difficulty, after the step 105, the method further includes:
[0100] In the case that the training of the first text data set is completed, and / or the third processing result index of the first model for the first instruction task of the first hierarchical level reaches the preset expected index, it is determined that the training of the first model is successful.
[0101] In this way, a large model with optimal solution of complex tasks can be obtained.
[0102] The first instruction task can be a multi-dimensional instruction task. Optionally, the step 101 specifically includes:
[0103] Obtaining a second text data set, the second text data set including representation texts of a plurality of second instruction tasks;
[0104] Based on the representation texts of each second instruction task in the second text data set, obtaining representation texts of at least one first instruction task; the first instruction task is an instruction task in N task dimensions, the N task dimensions including the task dimensions of the second instruction task, and N is an integer greater than 1;
[0105] Aggregating the representation texts of at least one first instruction task to the second text data set to obtain the first text data set.
[0106] The second instruction task can be a single-dimensional instruction task, an NLP expert combs the system of instruction tasks, establishes a systematic and complete instruction task system, and the second text data set can include instruction tasks in the instruction task system.
[0107] The instruction task can be constructed by the user based on the second instruction task, thereby obtaining a multi-dimensional first instruction task. The first instruction task can also be generated by expanding the second instruction task based on a large model such as chatGPT, GPT4, etc. In addition, the first instruction task can also be obtained by combining the above two methods, i.e., a man-machine collaborative method. Accordingly, the first instruction task can be aggregated into the second text data set to obtain a first text data set.
[0108] Optionally, the expression text of at least one first instruction task is obtained based on the expression text of each second instruction task in the second text data set, comprising:
[0109] Obtaining a task prompt template, the task prompt template comprising a main instruction, a target instruction list and an input text, the main instruction being the abstract description information of the second instruction task, the target instruction list comprising the abstract description information of M types of instruction tasks, M being a positive integer;
[0110] Inputting the task prompt template into a second model for natural language processing, and outputting the expression text of at least one first instruction task;
[0111] Wherein, the N task dimensions include the task dimension of the second instruction task and the task dimension of at least one type of instruction task in the M types of instruction tasks.
[0112] In this embodiment, a task prompt template (prompt) of an instruction task can be constructed to expand more candidate instruction tasks by means of a large model. For example, the prompt is as follows:
[0113] “Please generate more rich instruction tasks based on the main instruction and the input combined with the available instruction list.
[0114] #Main instruction#: Tokenization task
[0115] #Instruction list: [Tokenization, Entity Recognition, Relation Extraction, Subject Identification, Verb-Object Relation Extraction, Sentiment Classification, …]
[0116] #input#: Zhang San is a member of the Association of Region A
[0117] Please output in json format: {instruction name: instruction description}
[0118] Output 10 instruction tasks
[0119] #output#:
[0120] Wherein, in the prompt, the "word segmentation task" is the summary description information of the second instruction task, the instruction list is the target instruction task, and "entity recognition, relationship extraction" are the summary description information of the instruction task, i.e., the entity recognition task and the relationship extraction task. "Zhang San is a member of the association in region A" is the input text.
[0121] The second model can be a large model such as chatGPT or GPT4. The task prompt template can be input into the second model for natural language processing, and at least one representation text of the first instruction task can be output. For example, in the prompt, 10 first instruction tasks can be output. These 10 first instruction tasks are multi-dimensional tasks combining the word segmentation task and other types of instruction tasks in the target instruction list.
[0122] Optionally, the representation text of at least one first instruction task is obtained based on the representation text of each second instruction task in the second text data set, comprising:
[0123] The representation text of at least one first instruction task input by the user is obtained, and the representation text of the first instruction task is constructed by the user based on the representation text of the second instruction task in the second text data set.
[0124] For each type of task in the second text data set, the user can construct multi-dimensional instruction task examples. For example, for the word segmentation task, the following multi-task combined instruction tasks can be designed:
[0125] Segment the input sentence and count the number of words;
[0126] Segment the input sentence and output the most important word;
[0127] Segment the input sentence and organize the output in the form of a list;
[0128] Segment the input sentence and sort the importance of the words;
[0129] Segment the input sentence and only output the entity type words;
[0130] Segment the input sentence and only output the verbs;
[0131] Segment the input sentence and only output the subject;
[0132] Segment the input sentence and only output the verb-object relationship words;
[0133] Tokenization is performed on the input sentence, and the subject is replaced with the symbol "###";
[0134] Tokenization is performed on the input sentence, and if there is an entity, the entity type is output;
[0135] Tokenization is performed on the input sentence, and the words are classified and output according to their parts of speech;
[0136] Tokenization is performed on the input sentence, and the first word is translated into English;
[0137] Tokenization is performed on the input sentence, and the most important three words are used to form a sentence;
[0138] Tokenization is performed on the input sentence, and the most important words and corresponding pinyin are output;
[0139] Tokenization is performed on the input sentence, and the most similar two words are output;
[0140] Tokenization is performed on the input sentence, and the longest word is output, and the token of the word is output in reverse order.
[0141] The instruction tasks generated by the large model can be filtered and integrated into the instruction tasks constructed by the user, and then aggregated into the second text data set to obtain the first text data set. In this way, multi-dimensional instruction tasks can be generated, which not only ensures the diversity of task instructions, but also establishes the endogenous logical relationship between task instructions. The large model can learn the logicality between task instructions and perform internal logicality learning from knowledge to simple tasks to complex tasks.
[0142] Optionally, the step 102 specifically includes:
[0143] Obtaining a task classification template, the task classification template including a classification list and a representation text of the first instruction task, the classification list including abstract description information of each application attribute;
[0144] Inputting the task classification template into a third model for natural language processing to output an application attribute of the first instruction task.
[0145] In this embodiment, a task classification template (prompt) of an instruction task can be constructed, and the instruction task is classified by means of a large model to obtain an application attribute of the instruction task. An example of the prompt is as follows:
[0146] "Please classify the following instruction task according to the classification list
[0147] #Classification list#: [knowledge class, reasoning class]
[0148] Output json format: {task classification: ***}
[0149] #input# : Tokenization of the input sentence
[0150] #output# : "
[0151] In the prompt, [knowledge class, reasoning class] is a classification list, the knowledge class is an abstract description of the application attribute of the knowledge application task, the reasoning class is an abstract description of the application attribute of the reasoning task, and tokenization of the input sentence is a representation text of the first instruction task.
[0152] The third model can be a large model such as chatGPT or GPT4. The task classification template can be input into the third model for natural language processing, and the application attribute of the first instruction task can be output. In the prompt, the application attribute of the knowledge class can be output.
[0153] In this way, the application attribute of the instruction task can be determined simply.
[0154] The model training device provided in the embodiments of the present application will be described below.
[0155] Referring to Figure 2 , the structure schematic diagram of the model training device provided in the embodiments of the present application is shown. As Figure 2 shown, the model training device 200 includes:
[0156] The first acquisition module 201 is configured to acquire a first text data set, and the first text data set includes representation texts of a plurality of first instruction tasks.
[0157] The second acquisition module 202 is configured to acquire an application attribute of each first instruction task and a hierarchical level of each first instruction task under the application attribute. The application attribute of the first instruction task is used to indicate whether the first instruction task is a knowledge application task or a reasoning task, and the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing.
[0158] The first training module 203 is configured to train a first model based on a first training data set in the first text data set. The first training data set includes representation texts of first instruction tasks of a first target hierarchical level. The first target hierarchical level includes a first hierarchical level and a second hierarchical level under each application attribute. The cognitive difficulty of the second hierarchical level is lower than that of the first hierarchical level.
[0159] The proportion increasing module 204 is configured to, in a case where the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state, increase, based on a first verification data set in the first text data set, a proportion of expression text of the first instruction task of the second hierarchical level under a first application attribute in the first training data set to obtain a second training data set, the first application attribute being determined based on a second application attribute, the learning gain of the first model for the first instruction task of the second hierarchical level under the second application attribute being in a saturated state, and the first verification data set including expression text of the first instruction task of the second hierarchical level under each application attribute.
[0160] The second training module 205 is configured to continue training the first model based on the second training data set.
[0161] Optionally, the apparatus further includes:
[0162] The processing module is configured to, in a case where a training period of the first model ends, input a first test data set in the first text data set to the first model for natural language processing, the first test data set including expression text of the first instruction task of the first hierarchical level.
[0163] The statistical module is configured to statistically determine a processing condition of the first model for the first instruction task in the first test data set to obtain a first processing result index of the first instruction task of the first hierarchical level.
[0164] The determining module is configured to, in a case where the first processing result index is in a saturated state, determine that the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state.
[0165] Optionally, the proportion increasing module 204 is specifically configured to:
[0166] Input the first verification data set to the first model for natural language processing.
[0167] Statistically determine a processing condition of the first model for the first instruction task of each application attribute to obtain a second processing result index of the first instruction task of each application attribute.
[0168] Determine the second application attribute from each application attribute based on the second processing result index.
[0169] Increase the proportion of expression text of the first instruction task of the second hierarchical level under the first application attribute in the first training data set to obtain the second training data set.
[0170] Optionally, the number of the second hierarchical levels is at least two, and the proportion increasing module 204 is specifically configured to:
[0171] based on the first verification data set, sequentially increasing, in order from high to low, a proportion of expression text of the first instruction task of each second hierarchical level under a first application attribute in the first training data set, to obtain a second training data set.
[0172] Optionally, the apparatus further comprises:
[0173] in a case where the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state, based on a third training data set in the first text data set, continuing training the first model;
[0174] wherein the third training data set comprises expression text of the first instruction task of a second target hierarchical level, the second target hierarchical level comprises a third hierarchical level, the first hierarchical level and the second hierarchical level under each application attribute, and the third hierarchical level is higher in cognitive difficulty than the first hierarchical level.
[0175] Optionally, the first obtaining module 201 comprises:
[0176] a first obtaining unit, configured to obtain a second text data set, the second text data set comprising expression text of a plurality of second instruction tasks;
[0177] a second obtaining unit, configured to obtain, based on the expression text of each second instruction task in the second text data set, expression text of at least one first instruction task; the first instruction task being an instruction task in N task dimensions, the N task dimensions comprising a task dimension of the second instruction task, and N being an integer greater than 1;
[0178] an aggregation unit, configured to aggregate the expression text of at least one first instruction task to the second text data set, to obtain the first text data set.
[0179] Optionally, the second obtaining unit is specifically configured to:
[0180] obtain a task prompt template, the task prompt template comprising a subject instruction, a target instruction list and input text, the subject instruction being abstract description information of the second instruction task, and the target instruction list comprising abstract description information of M types of instruction tasks, M being a positive integer;
[0181] input the task prompt template to a second model for natural language processing, to output the expression text of at least one first instruction task;
[0182] The N task dimensions include a task dimension of the second instruction task and a task dimension of at least one type of instruction task in the M types of instruction tasks.
[0183] Optionally, the second obtaining unit is specifically configured to:
[0184] obtain the representation text of at least one first instruction task input by a user, the representation text of the first instruction task being constructed by the user based on the representation text of the second instruction task in the second text data set.
[0185] Optionally, the second obtaining module 202 is specifically configured to:
[0186] obtain a task classification template, the task classification template including a classification list and the representation text of the first instruction task, the classification list including abstract description information of each application attribute;
[0187] input the task classification template into a third model for natural language processing, and output the application attribute of the first instruction task.
[0188] The model training apparatus 200 can realize each process realized in the model training method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.
[0189] The electronic device provided in the embodiment of the present application is described below.
[0190] Referring to Figure 3 , a structural schematic diagram of an electronic device provided in the embodiment of the present application is shown. As Figure 3 shown, the electronic device 300 includes a processor 301, a memory 302, a user interface 303, and a bus interface 304.
[0191] The processor 301 is configured to read a program in the memory 302 and perform the following processes:
[0192] obtain a first text data set, the first text data set including representation texts of a plurality of first instruction tasks;
[0193] obtain an application attribute of each first instruction task and a hierarchical level of each first instruction task under the application attribute, the application attribute of the first instruction task being used to indicate whether the first instruction task is a knowledge application task or an inference task, and the hierarchical level being used to indicate a cognitive difficulty of the first instruction task in natural language processing;
[0194] The first model is trained based on a first training data set in the first text data set, the first training data set including expression texts of first instruction tasks of a first target hierarchical level, the first target hierarchical level including a first hierarchical level and a second hierarchical level under each application attribute, the second hierarchical level being lower in cognitive difficulty than the first hierarchical level;
[0195] In a case where a learning gain of the first model for instruction tasks of the first hierarchical level is in a saturated state, a proportion of expression texts of first instruction tasks of a second hierarchical level under a first application attribute in the first training data set is increased based on a first verification data set in the first text data set, to obtain a second training data set, the first application attribute being determined based on a second application attribute, a learning gain of the first model for first instruction tasks of the second hierarchical level under the second application attribute being in a saturated state, the first verification data set including expression texts of first instruction tasks of the second hierarchical level under each application attribute;
[0196] The first model is continuously trained based on the second training data set.
[0197] In Figure 3 In the bus architecture, a bus and a bridge can be interconnected in any number, and various circuits of one or more processors represented by the processor 301 and the memory represented by the memory 302 are linked together. The bus architecture can also link various other circuits such as peripheral devices, voltage stabilizers, and power management circuits, which are well known in the art, and thus, further description thereof will not be given herein. The bus interface 304 provides an interface. The user interface 303 can also be an interface that can be externally connected to the required device for different user devices, including but not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0198] The processor 301 is responsible for managing the bus architecture and general processing, and the memory 302 can store data used by the processor 301 in performing operations.
[0199] Optionally, the processor 301 is further configured to:
[0200] In a case where a training period of the first model ends, a first test data set in the first text data set is input to the first model for natural language processing, the first test data set including expression texts of first instruction tasks of the first hierarchical level;
[0201] A processing condition of the first model for first instruction tasks in the first test data set is counted to obtain a first processing result index of first instruction tasks of the first hierarchical level;
[0202] In a case where the first processing result indicator is in a saturated state, it is determined that the learning gain of the first model for the instruction task of the first hierarchical level is in a saturated state.
[0203] Optionally, the processor 301 is further configured to:
[0204] input the first verification data set into the first model for natural language processing;
[0205] count the processing conditions of the first instruction task of each application attribute by the first model, to obtain a second processing result indicator of the first instruction task of each application attribute;
[0206] determine a second application attribute from each application attribute based on the second processing result indicator;
[0207] increase the proportion of expression texts of the first instruction task of the second hierarchical level under the first application attribute in the first training data set, to obtain a second training data set.
[0208] Optionally, the number of the second hierarchical levels is at least two, and the processor 301 is further configured to:
[0209] based on the first verification data set, increase the proportion of expression texts of the first instruction task of each second hierarchical level under the first application attribute in the first training data set in turn according to the order from high to low of the hierarchical levels, to obtain a second training data set.
[0210] Optionally, the processor 301 is further configured to:
[0211] in a case where the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state, continue to train the first model based on a third training data set in the first text data set;
[0212] wherein the third training data set includes expression texts of the first instruction task of a second target hierarchical level, the second target hierarchical level includes a third hierarchical level, the first hierarchical level and the second hierarchical level under each application attribute, and the third hierarchical level is higher than the first hierarchical level in cognitive difficulty.
[0213] Optionally, the processor 301 is further configured to:
[0214] obtain a second text data set, the second text data set including expression texts of a plurality of second instruction tasks;
[0215] obtaining expression text of at least one first instruction task based on expression text of each second instruction task in the second text data set; the first instruction task is an instruction task in N task dimensions, the N task dimensions include a task dimension of the second instruction task, and N is an integer greater than 1;
[0216] aggregating the expression text of at least one first instruction task to the second text data set to obtain the first text data set.
[0217] Optionally, the processor 301 is further configured to:
[0218] obtaining a task prompt template, the task prompt template including a main instruction, a target instruction list and input text, the main instruction being abstract description information of the second instruction task, and the target instruction list including abstract description information of M types of instruction tasks, M being a positive integer;
[0219] inputting the task prompt template into a second model for natural language processing to output expression text of at least one first instruction task;
[0220] The N task dimensions include a task dimension of the second instruction task and a task dimension of at least one type of instruction task in the M types of instruction tasks.
[0221] Optionally, the processor 301 is further configured to:
[0222] obtaining expression text of at least one first instruction task input by a user, the expression text of the first instruction task being constructed by the user based on expression text of the second instruction task in the second text data set.
[0223] Optionally, the processor 301 is further configured to:
[0224] obtaining a task classification template, the task classification template including a classification list and expression text of the first instruction task, the classification list including abstract description information of each application attribute;
[0225] inputting the task classification template into a third model for natural language processing to output an application attribute of the first instruction task.
[0226] Preferably, the embodiment of the present application further provides an electronic device, including a processor 301, a memory 302, a computer program stored on the memory 302 and executable on the processor 301, which implements each process of the above-mentioned model training method embodiment when executed by the processor 301 and achieves the same technical effect. To avoid repetition, it will not be repeated here.
[0227] The embodiment of the present application further provides a computer readable storage medium, and a computer program is stored on the computer readable storage medium. The computer program is executed by a processor to implement each process of the model training method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein. The computer readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0228] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0229] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein.
[0230] In the embodiments provided in the present application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division, and actual implementation can have another division manner. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0231] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present application.
[0232] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically independently, or two or more units can be integrated into one unit.
[0233] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes various storage media that can store program codes, such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.
[0234] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A model training method, characterized in that, The method comprises: obtaining a first text data set comprising expression texts of a plurality of first instruction tasks; obtaining an application attribute of each first instruction task, and obtaining a hierarchical level of each first instruction task under the application attribute, the application attribute of the first instruction task being used to indicate whether the first instruction task is a knowledge application task or an inference task, and the hierarchical level being used to indicate a cognitive difficulty of the first instruction task in natural language processing; training a first model based on a first training data set in the first text data set, the first training data set comprising expression texts of first instruction tasks of a first target hierarchical level, the first target hierarchical level comprising a first hierarchical level and a second hierarchical level under each application attribute, the second hierarchical level being lower in cognitive difficulty than the first hierarchical level; in a case where a learning gain of the first model for instruction tasks of the first hierarchical level is in a saturated state, increasing a proportion of expression texts of first instruction tasks of a second hierarchical level under a first application attribute in the first training data set based on a first validation data set in the first text data set, the first application attribute being determined based on a second application attribute, a learning gain of the first model for first instruction tasks of the second hierarchical level under the second application attribute being in a saturated state, the first validation data set comprising expression texts of first instruction tasks of the second hierarchical level under each application attribute; continuing to train the first model based on the second training data set.
2. The method of claim 1, wherein, Before the increasing of the proportion of the expression texts of the first instruction tasks of the second hierarchical level under the first application attribute in the first training data set based on the first validation data set in the first text data set to obtain the second training data set, the method further comprises: in a case where a training period of the first model ends, inputting a first test data set in the first text data set to the first model for natural language processing, the first test data set comprising expression texts of first instruction tasks of the first hierarchical level; statistically analyzing processing of the first instruction tasks in the first test data set by the first model to obtain a first processing result index of the first instruction tasks of the first hierarchical level; in a case where the first processing result index is in a saturated state, determining that the learning gain of the first model for instruction tasks of the first hierarchical level is in a saturated state.
3. The method of claim 1, wherein, The increasing of the proportion of the expression texts of the first instruction tasks of the second hierarchical level under the first application attribute in the first training data set based on the first validation data set in the first text data set to obtain the second training data set comprises: inputting the first validation data set to the first model for natural language processing; statistically analyzing processing of first instruction tasks of each application attribute by the first model to obtain a second processing result index of the first instruction tasks of each application attribute; determining the second application attribute from each application attribute based on the second processing result index; Increase the proportion of expression text of the first instruction task of the second hierarchical level under the first application attribute in the first training data set to obtain a second training data set.
4. The method according to claim 1 or 3, characterized in that, The number of the second hierarchical levels is at least two, and the increasing the proportion of expression text of the first instruction task of the second hierarchical level under the first application attribute in the first training data set based on the first validation data set in the first text data set to obtain a second training data set comprises: Increasing the proportion of expression text of the first instruction task of each second hierarchical level under the first application attribute in the first training data set in turn based on the first validation data set according to the order from high to low of the hierarchical levels to obtain a second training data set.
5. The method of claim 1, wherein, After the first model is continuously trained based on the second training data set, the method further comprises: In the case that the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state, continuously training the first model based on a third training data set in the first text data set; The third training data set comprises expression text of the first instruction task of a second target hierarchical level, the second target hierarchical level comprises a third hierarchical level, the first hierarchical level and the second hierarchical level under each application attribute, and the third hierarchical level is higher in cognitive difficulty than the first hierarchical level.
6. The method of claim 1, wherein, The first text data set is obtained by: obtaining a second text data set, the second text data set comprising expression text of a plurality of second instruction tasks; obtaining expression text of at least one first instruction task based on the expression text of each second instruction task in the second text data set; the first instruction task is an instruction task in N task dimensions, the N task dimensions comprising a task dimension of the second instruction task, and N is an integer greater than 1; aggregating the expression text of at least one first instruction task to the second text data set to obtain the first text data set.
7. The method of claim 6, wherein, The expression text of at least one first instruction task is obtained based on the expression text of each second instruction task in the second text data set, comprising: obtaining a task prompt template, the task prompt template comprising a subject instruction, a target instruction list and input text, the subject instruction being abstract description information of the second instruction task, and the target instruction list comprising abstract description information of M types of instruction tasks, M being a positive integer; inputting the task prompt template into a second model for natural language processing to output expression text of at least one first instruction task; The N task dimensions comprise a task dimension of the second instruction task and a task dimension of at least one type of instruction task in the M types of instruction tasks.
8. The method of claim 6, wherein, The expression text of at least one first instruction task is obtained based on the expression text of each second instruction task in the second text data set, comprising: obtaining expression text of at least one first instruction task input by a user, the expression text of the first instruction task being constructed by the user based on the expression text of the second instruction task in the second text data set.
9. The method of claim 1, wherein, The application attribute of each first instruction task is obtained, including: obtaining a task classification template, the task classification template including a classification list and expression text of the first instruction task, and the classification list including abstract description information of each application attribute; inputting the task classification template into a third model for natural language processing, and outputting the application attribute of the first instruction task.
10. A model training apparatus, comprising: The device includes: a first obtaining module configured to obtain a first text data set, the first text data set including expression text of a plurality of first instruction tasks; a second obtaining module configured to obtain an application attribute of each first instruction task and a hierarchical level of each first instruction task under the application attribute, the application attribute of the first instruction task being used to indicate whether the first instruction task is a knowledge application task or an inference task, and the hierarchical level being used to indicate cognitive difficulty of the first instruction task in natural language processing; a first training module configured to train a first model based on a first training data set in the first text data set, the first training data set including expression text of a first instruction task of a first target hierarchical level, the first target hierarchical level including a first hierarchical level and a second hierarchical level under each application attribute, and the second hierarchical level being lower in cognitive difficulty than the first hierarchical level; a proportion increasing module configured to, in a case where learning gain of the first model for an instruction task of the first hierarchical level is in a saturated state, increase a proportion of expression text of a first instruction task of a second hierarchical level under a first application attribute in the first training data set based on a first verification data set in the first text data set, obtain a second training data set, determine the first application attribute based on a second application attribute, learning gain of the first model for a first instruction task of a second hierarchical level under the second application attribute being in a saturated state, and the first verification data set including expression text of a first instruction task of a second hierarchical level under each application attribute; a second training module configured to continue training the first model based on the second training data set.
11. The apparatus of claim 10, wherein, The device further includes: a processing module configured to, in a case where a training period of the first model ends, input a first test data set in the first text data set into the first model for natural language processing, the first test data set including expression text of a first instruction task of the first hierarchical level; a statistical module configured to count processing of the first model on a first instruction task in the first test data set, and obtain a first processing result index of a first instruction task of the first hierarchical level; a determination module configured to, in a case where the first processing result index is in a saturated state, determine that learning gain of the first model for an instruction task of the first hierarchical level is in a saturated state.
12. The apparatus of claim 10, wherein, The proportion increasing module is specifically configured to: input the first verification data set into the first model for natural language processing; count processing of the first model on a first instruction task of each application attribute, and obtain a second processing result index of a first instruction task of each application attribute; determine a second application attribute from each application attribute based on the second processing result indicator; increase a proportion of expression text of the first instruction task of each second hierarchical level under the first application attribute in the first training data set to obtain a second training data set.
13. The apparatus of claim 10 or 12, wherein, The number of the second hierarchical levels is at least two, and the proportion increasing module is specifically configured to: based on the first verification data set, increase the proportion of expression text of the first instruction task of each second hierarchical level under the first application attribute in the first training data set in a descending order of hierarchical levels to obtain a second training data set.
14. The apparatus of claim 10, wherein, The device further comprises: in a case where the learning gain of the first model for the instruction task of the first hierarchical level is not in a saturated state, continue training the first model based on a third training data set in the first text data set; wherein the third training data set comprises expression text of the first instruction task of a second target hierarchical level, the second target hierarchical level comprises a third hierarchical level, the first hierarchical level and the second hierarchical level under each application attribute, and the third hierarchical level is higher in cognitive difficulty than the first hierarchical level.
15. The apparatus of claim 10, wherein, The first obtaining module comprises: a first obtaining unit configured to obtain a second text data set, the second text data set comprising expression text of a plurality of second instruction tasks; a second obtaining unit configured to obtain expression text of at least one first instruction task based on expression text of each second instruction task in the second text data set; the first instruction task is an instruction task in N task dimensions, the N task dimensions comprising a task dimension of the second instruction task, and N is an integer greater than 1; an aggregation unit configured to aggregate the expression text of at least one first instruction task to the second text data set to obtain the first text data set.
16. The apparatus of claim 15, wherein, The second obtaining unit is specifically configured to: obtain a task prompt template, the task prompt template comprising a subject instruction, a target instruction list and input text, the subject instruction being abstract description information of the second instruction task, and the target instruction list comprising abstract description information of M types of instruction tasks, M being a positive integer; input the task prompt template into a second model for natural language processing to output expression text of at least one first instruction task; wherein the N task dimensions comprise a task dimension of the second instruction task and a task dimension of at least one type of instruction task in the M types of instruction tasks.
17. The apparatus of claim 15, wherein, The second obtaining unit is specifically configured to: obtain expression text of at least one first instruction task input by a user, the expression text of the first instruction task being constructed by the user based on expression text of the second instruction task in the second text data set.
18. The apparatus of claim 10, wherein, The second obtaining module is specifically configured to: obtain a task classification template, the task classification template comprising a classification list and expression text of the first instruction task, the classification list comprising abstract description information of each application attribute; input the task classification template into a third model for natural language processing to output an application attribute of the first instruction task.
19. An electronic device, comprising: The electronic device comprises a processor, a memory, a computer program stored on the memory and executable on the processor, and the computer program implements the steps of the model training method according to any one of claims 1 to 9 when executed by the processor.
20. A readable storage medium, characterized by, The readable storage medium stores a computer program, and the computer program implements the steps of the model training method according to any one of claims 1 to 9 when executed by the processor.
Citation Information
Patent Citations
Text classification method, device and apparatus and computer readable storage medium
CN110287328A
Classification model training method and device, electronic equipment and storage medium
CN112560912A