Model training method and device, electronic equipment and readable storage medium
By dividing the large model into hierarchical levels and training it in order of increasing cognitive difficulty, the problem of poor training effect of large models in existing technologies is solved, multi-level cognitive ability is established, and the processing ability of the model is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, large-scale model training is carried out by randomly selecting text data from instruction tasks, which hinders the improvement of the large-scale model's processing capabilities and results in poor model training performance.
By acquiring a first text dataset, including the text of multiple first instruction tasks, and training a large model in order of hierarchical level from low to high, its cognitive ability is gradually improved.
Large models with different capability levels were established, which improved the training effect of the large models and enabled them to have multi-level cognitive abilities, thus better solving complex problems.
Smart Images

Figure CN116991976B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a model training method, apparatus, electronic device and readable storage medium. Background Technology
[0002] With the rapid development of Natural Language Processing (NLP) technology, large models have been widely used. Large models perform natural language processing on input instructions, and their output can conform to human behavioral norms and interaction patterns, thereby realizing human-computer interaction.
[0003] Large models typically require training before human-computer interaction. A pre-trained model is built using massive amounts of text data and an autoregressive learning model, accumulating rich knowledge within it. This pre-trained model is then fine-tuned using text data related to instruction tasks, allowing it to learn how to utilize knowledge to solve real-world instruction tasks, thereby significantly improving the large model's ability to handle such tasks.
[0004] Currently, when fine-tuning pre-trained models, text data from instruction tasks is usually randomly selected, which hinders the improvement of the processing capabilities of large models and results in poor model training performance. Summary of the Invention
[0005] This invention provides a model training method, apparatus, electronic device, and readable storage medium to solve the problem in the prior art that training large models by randomly selecting text data of instruction tasks hinders the improvement of the processing capacity of large models and results in poor model training effects.
[0006] In a first aspect, embodiments of the present invention provide a model training method, the method comprising:
[0007] Obtain a first text dataset, which includes the description text of multiple first instruction tasks;
[0008] Obtain the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing;
[0009] The first model is trained sequentially based on the description text of the first instruction task at each of the hierarchical levels in the first text dataset, arranged from lowest to highest cognitive difficulty.
[0010] Secondly, embodiments of the present invention provide a model training apparatus, the apparatus comprising:
[0011] The first acquisition module is used to acquire a first text dataset, which includes the description text of multiple first instruction tasks;
[0012] The second acquisition module is used to acquire the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing.
[0013] The training module is used to train the first model sequentially based on the description text of the first instruction task at the first level in the first text dataset, according to the hierarchical level from low to high cognitive difficulty.
[0014] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the above-described model training method.
[0015] Fourthly, embodiments of the present invention provide a readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described model training method.
[0016] In this embodiment of the invention, a first text dataset is acquired, comprising description texts of multiple first instruction tasks; the hierarchical level of each first instruction task is acquired, the hierarchical level indicating the cognitive difficulty of the first instruction task in natural language processing; and the first model is trained sequentially based on the description texts of the first instruction tasks at each hierarchical level in the first text dataset, in ascending order of hierarchical level. Thus, by dividing the instruction tasks into hierarchical levels according to cognitive difficulty and training the large model in ascending order of cognitive difficulty, iterative and continuous capability improvement can be achieved, establishing a large model with different capability levels, improving the training effect of the large model, enabling the large model to possess multi-level cognitive capabilities, and solving more complex problems. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the model training method provided in an embodiment of the present invention;
[0019] Figure 2This is a schematic diagram illustrating the task dimensions of a rich set of instructions generated from a large model.
[0020] Figure 3 This is a schematic diagram of aggregated task categories in the NLP instruction task system;
[0021] Figure 4 This is a schematic diagram of the structure of the model training device provided in an embodiment of the present invention;
[0022] Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] It should be noted that the model training method provided in this embodiment of the invention relates to the field of natural language processing technology, and can be widely applied in various fields such as finance and artificial intelligence. For example, when applied to the financial field, its instruction tasks can involve financial knowledge, such as the instruction task "whether the act of charging customers exorbitant interest rates complies with financial laws and regulations." Furthermore, when applied to the field of artificial intelligence, its instruction tasks can involve behavioral instructions and question-and-answer instructions; for example, it can be applied to robots, where instructions can be input to enable the robot to perform corresponding tasks.
[0025] For large NLP models, in order to enable them to be used in corresponding applications, they need to be trained. The process of building a large model is as follows:
[0026] (1) By using a massive amount of text data and an autoregressive learning model, a pre-trained model is constructed, which contains rich knowledge.
[0027] (2) Fine-tune the pre-trained model using text data of the instruction task, so that the pre-trained model can learn how to use knowledge to solve the actual instruction task, thereby greatly improving the ability of the large model to solve the instruction task.
[0028] (3) Through the reinforcement learning mode of human-computer interaction, the output results of the large model conform to human behavior norms and interaction modes.
[0029] The model training in this embodiment mainly involves the process of stage (2), that is, on the basis of pre-training, fine-tuning the large model to improve the ability of the large model to solve instruction tasks.
[0030] Currently, fine-tuning pre-trained models typically involves randomly selecting text data for the instruction tasks, ignoring the inherent hierarchical nature of these tasks. This hinders the improvement of large models' processing capabilities, resulting in poor training performance. Furthermore, neglecting the intrinsic connections between NLP task instructions leads to a shallow understanding of the tasks within large models, lacking a cognitive structure similar to the human brain. This hinders the later improvement of large models' capabilities and often results in catastrophic knowledge forgetting.
[0031] The purpose of this invention is to establish a large model with different ability levels, so that the large model has a cognitive ability system similar to that of humans.
[0032] The model training method provided in the embodiments of the present invention will be described in detail below.
[0033] See Figure 1 The figure shows a schematic flowchart of the model training method provided in an embodiment of the present invention. Figure 1 As shown, the method may include the following steps:
[0034] Step 101: Obtain a first text dataset, which includes description texts of multiple first instruction tasks.
[0035] In this embodiment of the invention, the model training method relates to the field of natural language processing technology, and can be widely applied in various scenarios such as finance and artificial intelligence. The model training method of this disclosure can be executed by the model training device of this disclosure. The model training device of this disclosure can be configured in any electronic device to execute the model training method of this disclosure.
[0036] Instruction tasks are instruction-based tasks. Essentially, they involve inputting instructions that enable a large model to use its learned knowledge to perform natural language processing and achieve the corresponding task. For example, instruction tasks could include "find words with multiple meanings in the following two sentences" or "write a romantic poem about the moon."
[0037] The first instruction task can be described by text, and the text describing 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 "to segment the input sentence into words" or "to classify the input text". The first instruction task can also be a multi-dimensional instruction task, such as the instruction task "to segment the input sentence into words and count the number of words", where the instruction task may involve word segmentation and counting tasks, or "to segment the input sentence into words, and if there are entities, output the entity type", where the instruction task may involve word segmentation and entity recognition tasks.
[0038] The first text dataset can be obtained by user annotation. For example, NLP experts can organize the system of instruction tasks and establish a systematic and complete instruction task system. The first text dataset can include instruction tasks in this instruction task system. Alternatively, it can be generated by a large model. For example, experts can build seed instructions, and the large model can expand and enrich them based on the seed instructions to generate multiple instruction tasks. Or it can be a combination of both. No specific limitations are made here.
[0039] Step 102: Obtain the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing.
[0040] Drawing on Bloom's cognitive framework, NLP instruction tasks can be divided into six levels: memorization, comprehension, simple reasoning, complex reasoning, evaluation and proof, and creation.
[0041] Memory refers to recognizing and memorizing concepts and knowledge, storing them in a large model, and being able to retrieve them at any time. Factual knowledge and concepts involved in NLP instruction tasks belong to this category. For example, the capital of country A is region A, and Zhang San's height is 2 meters. These are all examples of memory-based knowledge. Another example is filling in the blanks with idioms, or having the large model complete the second half of a given poem. These are all examples of NLP instruction tasks that fall under the category of memory.
[0042] Understanding refers to the comprehension of things or knowledge. Natural Language Understanding (NLU) covers a wide range, but the understanding involved here is usually superficial. It mainly involves establishing the connection between new and old knowledge. For example, tasks such as changing a sentence into a passive sentence, listing the subject of a sentence, and identifying entities in a sentence all belong to the level of understanding.
[0043] Simple reasoning refers to the application of learned concepts, rules, and principles, demonstrating the ability to apply learned knowledge to new situations and solve practical problems. Examples include multi-question comprehension tasks such as "Where was Zhang San's daughter born?" and reading comprehension exercises.
[0044] Complex reasoning refers to the ability to break down complex knowledge into its components and understand the relationships between them. For example, the task "find the words with multiple meanings in the following two sentences" involves first understanding the meaning of multiple meanings, then segmenting the two sentences into words, then finding two words that are completely identical at the character level, and determining whether the two characters express the same meaning in their respective sentences.
[0045] Evaluation and verification: This refers to making inferences that conform to objective facts by comprehensively considering internal and external data and information. For NLP instruction tasks, objective evaluations and corresponding evidence can be provided. For example, instruction task: "Does the practice of charging customers exorbitant interest rates comply with financial laws and regulations?"
[0046] Creation refers to the ability to recombine learned knowledge or add one's own information to form a new whole, such as the instruction task "Please write a romantic poem on the theme of the moon".
[0047] These six levels are ranked from lowest to highest cognitive difficulty as memory, comprehension, simple reasoning, complex reasoning, evaluation and proof, and creation. Memory is the simplest in terms of cognitive difficulty, while creation is the most complex.
[0048] Users can use Bloom's cognitive system to label the first instruction task according to the above six levels, or large models can label the first instruction task according to the above six levels, or a combination of both can be used to label the first instruction task. No specific limitations are made here.
[0049] In this step, by obtaining the hierarchical level of each first instruction task, the processing capability of the large model can be iteratively increased in terms of cognitive difficulty from low to high during the fine-tuning of the first model, i.e., the large model, for the instruction task.
[0050] Step 103: Train the first model by sequentially training the description texts of the first instruction tasks at the first level of the first text dataset, according to the order of cognitive difficulty from low to high.
[0051] The first model can be a large model, i.e., a model for natural language processing, and it can be a pre-trained model.
[0052] The training of the first model is carried out iteratively in order of increasing cognitive difficulty according to the hierarchical levels. The first model can be trained firstly based on the first instruction task at the lower level. After the first model has completed learning how to process the instruction task at the lower level, it can be trained again based on the first instruction task at the higher level, and so on, until the training of the highest level of cognitive difficulty is completed. At this time, the training of the first model is completed.
[0053] Specifically, the completion of training on the training dataset of a certain level, the achievement of the processing result index of the instruction task at that level, or the saturation of the learning gain of the first model for the instruction task at that level can indicate that the first model has completed the learning of the instruction task at that level.
[0054] Optionally, step 103 specifically includes:
[0055] The first model is trained based on the first training dataset in the first text dataset, wherein the first training dataset includes the description text of the first instruction task at the first level.
[0056] When the learning gain of the first model for the instruction task of the first level is saturated, the first model is further trained based on the second training dataset in the first text dataset. The second training dataset includes the expression text of the first instruction task of the second level, which is more cognitively difficult than the first level.
[0057] Specifically, for a given level, a training dataset can be obtained from the first text dataset. This training dataset includes the description text of the first instruction task for that level. This description text is then input into the first model for natural language processing, allowing the large model to learn the processing logic of the first instruction task for that level and adjust its parameters. When the training dataset is fully trained and / or the first model has reached learning saturation for that level, it indicates that the first model has completed learning the processing logic for the instruction task at that level.
[0058] During training, the processing results of the first model on the instruction task can be statistically analyzed. These results can include task accuracy (ACC) and overall task score (F1). If the processing results no longer increase or increase at a slow rate, it indicates that the learning gain of the first model for the first level of instruction tasks is saturated; otherwise, it indicates that the learning gain of the first model for the first level of instruction tasks is not saturated.
[0059] If the learning gain of the first model for low-level instruction tasks is saturated, then training on high-level instruction tasks can be continued. In this way, the training efficiency of the first model can be improved while the first model fully learns how to handle instruction tasks.
[0060] Optionally, the method further includes:
[0061] If the preset conditions are met, the first model is determined to have been successfully trained;
[0062] The target conditions include at least one of the following:
[0063] The first text dataset has been trained.
[0064] The processing result index of the first instruction task of the first target level by the first model reaches the preset expected index, and the first target level is the highest level in terms of cognitive difficulty among all levels.
[0065] In this way, the capability system of a large model can be constructed in a progressive manner according to the knowledge hierarchy of NLP tasks, so that the pre-trained model has a capability system of different levels of knowledge, which helps to improve the later capabilities of the large model.
[0066] In this embodiment, a first text dataset is acquired, comprising descriptions of multiple first instruction tasks. The hierarchical level of each first instruction task is obtained, indicating its cognitive difficulty in natural language processing. The first model is trained sequentially based on the descriptions of the first instruction tasks at each hierarchical level in the first text dataset, from lowest to highest. Thus, by dividing the instruction tasks into hierarchical levels based on cognitive difficulty and training the large model in ascending order of cognitive difficulty, iterative improvement of capabilities is possible. This allows for the establishment of large models with different capability levels, enhancing the training effect of the large model and enabling it to possess multi-level cognitive capabilities to solve more complex problems.
[0067] The first instruction task can be a multi-dimensional instruction task. Optionally, step 101 specifically includes:
[0068] Obtain a second text dataset, which includes the representation text of multiple second instruction tasks;
[0069] Based on the description text of the second instruction task in the second text dataset, obtain at least one description text of the first instruction task; the first instruction task is an instruction task on N task dimensions, the N task dimensions include the task dimension of the second instruction task, and N is an integer greater than 1;
[0070] The description text of at least one of the first instruction tasks is aggregated into the second text dataset to obtain the first text dataset.
[0071] The second instruction task can be a single-dimensional instruction task. NLP experts sort out the system of instruction tasks and establish a systematic and complete instruction task system. The second text dataset can include instruction tasks in this instruction task system.
[0072] The first instruction task can be multi-dimensional, which can be obtained by users constructing multiple task combinations based on the second instruction task. Alternatively, it can be extended using large models such as chatGPT or GPT4 to generate multi-dimensional first instruction tasks. A combination of these two methods, i.e., human-machine collaboration, can also be used to obtain multi-dimensional first instruction tasks. Correspondingly, the first instruction tasks can be aggregated into the second text dataset to obtain the first text dataset.
[0073] Optionally, obtaining at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset includes:
[0074] Obtain a task prompt template, which includes main task dimension information, task combination dimension information and input text. The main task dimension information indicates the task dimension of the second instruction task, and the task combination dimension information indicates other task dimensions that are different from the task dimension of the second instruction task.
[0075] The task prompt template is input into the second model for natural language processing, and at least one description text of the first instruction task is output.
[0076] The N task dimensions include at least one of the task dimensions of the second instruction task and the task dimensions indicated by the task combined with the dimension information.
[0077] In this implementation, the second instruction task in the second text dataset can be refined and its examples expanded. A task prompt template can be constructed, and with the help of a large model, richer candidate instruction tasks can be generated. An example of a prompt is as follows:
[0078] Please build richer subtasks around the #word segmentation task#.
[0079] The following dimensions can be combined: syntax, information, similarity, classification and ranking, conversion, translation, text generation, security, multiple sentences, output format, statistical analysis, etc.
[0080] #input#:
[0081] Output in JSON format, with 10 results per output. Subtasks should be varied and have low similarity.
[0082] #output#:
[0083] #Subtask:
[0084] In the aforementioned prompt, "word segmentation task" is the main task dimension information, while "syntax, information, similarity, classification and ranking, conversion, translation, text generation, security, multiple sentences, output format, statistical analysis, etc." are task-related dimension information. The input text can be "Zhang San is a member of Association A in Region A".
[0085] 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, outputting at least one description of the first instruction task. For example, in the prompt above, 10 first instruction tasks can be output at once. These 10 first instruction tasks are multi-dimensional tasks that combine the task dimension of word segmentation and the task dimension indication information. These 10 first instruction tasks require diverse sub-tasks with low similarity.
[0086] Experts can construct multiple second instruction tasks, which can serve as seed tasks. These seed tasks can be expanded using a second model to output multiple first instruction tasks, which can be multi-dimensional tasks.
[0087] Figure 2 This is a schematic diagram illustrating the task dimensions of a rich set of instructions generated from a large model, such as... Figure 2 As shown, the basic task is word segmentation, which can be further refined and expanded by combining dimensions such as grammar, information, similarity, classification and ranking, conversion, translation, text generation, security, multi-sentence, output format, and statistical analysis. For example, it can be refined by combining the information task dimension, and the examples can be expanded from the aspects of entity category and entity word.
[0088] Optionally, obtaining at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset includes:
[0089] Obtain at least one description text of the first instruction task input by the user, wherein the description text of the first instruction task is constructed by the user based on the description text of the second instruction task in the second text dataset.
[0090] For each type of task in the second text dataset, users can construct multi-dimensional instruction task examples. For instance, for the word segmentation task, instruction tasks combining multiple tasks can be designed as follows:
[0091] The input statement is segmented into words, and the number of words is counted.
[0092] The input statement is segmented into words, and the most important words are output.
[0093] The input statement is segmented into words and then output in list format.
[0094] The input sentence is segmented into words, and the importance of the words is ranked.
[0095] The input statement is segmented into words, and only words of entity type are output;
[0096] The input statement is segmented into words, and only verbs are output.
[0097] The input statement is segmented into words, and only the subject is output.
[0098] The input statement is segmented into words, and only words with verb-object relationships are output;
[0099] The input statement is segmented into words, and the subject is replaced with the symbol "###".
[0100] The input statement is segmented into words, and if there are entities, the entity type is output.
[0101] The input statement is segmented into words and then categorized and output according to part of speech.
[0102] The input sentence is segmented into words, and the first word is translated into English.
[0103] Segment the input statement into words and construct a sentence using the three most important words;
[0104] The input sentence is segmented into words, and the most important words and their corresponding pinyin are output.
[0105] Segment the input sentence into words and output the two most similar words;
[0106] The input statement is segmented into words, the longest word is output, and the tokens of the word are output in reverse order.
[0107] The system can filter the instruction tasks generated by the large model and integrate them into user-constructed instruction tasks. These tasks are then aggregated into a second text dataset to obtain the first text dataset. This allows for the generation of multi-dimensional instruction tasks, ensuring both the diversity of task instructions and establishing intrinsic logical relationships between them. This enables the large model to learn the logic between task instructions and to learn the inherent logic from knowledge to simple tasks and then to complex tasks.
[0108] Optionally, step 102 specifically includes:
[0109] Aggregate and classify the first instruction tasks in the first text dataset to obtain the aggregated task category of each first instruction task;
[0110] Based on the aggregated task category, the hierarchical level of the first instruction task is determined.
[0111] A large model such as GPT4 can be used to aggregate and classify the first instruction tasks according to the preset aggregated task categories obtained by experts, so as to obtain the aggregated task categories of each first instruction task. Figure 3 This is a diagram illustrating the aggregated task categories of the NLP instruction task system, such as... Figure 3 As shown, the aggregated task category for instruction tasks such as part-of-speech tagging, synonym generation, and lexical analysis can be "basic NLP," while the aggregated task category for instruction tasks such as point identification and fact identification can be "determination." The aggregated task category can be two-dimensional, such as... Figure 3 As shown, basic NLP and decision-making instructions can be further aggregated into a pre-defined aggregated task category such as "creation", "description", and "dialogue".
[0112] Then, using a large model or based on user-defined aggregated task categories, the first instruction task can be classified into hierarchical levels. This simplifies the classification process for the hierarchical levels of the first instruction task and improves its efficiency.
[0113] The model training apparatus provided in the embodiments of the present invention will be described below.
[0114] See Figure 4 The figure shows a schematic diagram of the structure of the model training device provided in an embodiment of the present invention, as shown in the figure. Figure 4 As shown, the model training device 400 includes:
[0115] The first acquisition module 401 is used to acquire a first text dataset, which includes description texts of multiple first instruction tasks;
[0116] The second acquisition module 402 is used to acquire the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing.
[0117] Training module 403 is used to train the first model sequentially based on the description text of the first instruction task at the first level in the first text dataset, according to the hierarchical level from low to high cognitive difficulty.
[0118] Optionally, the training module 403 is specifically used for:
[0119] The first model is trained based on the first training dataset in the first text dataset, wherein the first training dataset includes the description text of the first instruction task at the first level.
[0120] When the learning gain of the first model for the instruction task of the first level is saturated, the first model is further trained based on the second training dataset in the first text dataset. The second training dataset includes the expression text of the first instruction task of the second level, which is more cognitively difficult than the first level.
[0121] Optionally, the first acquisition module 401 includes:
[0122] The first acquisition unit is used to acquire a second text dataset, which includes the description text of multiple second instruction tasks;
[0123] The second acquisition unit is used to acquire at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset; the first instruction task is an instruction task on N task dimensions, the N task dimensions include the task dimensions of the second instruction task, and N is an integer greater than 1;
[0124] An aggregation unit is used to aggregate the description text of at least one of the first instruction tasks into the second text dataset to obtain the first text dataset.
[0125] Optionally, the second acquisition unit is specifically used for:
[0126] Obtain a task prompt template, which includes main task dimension information, task combination dimension information and input text. The main task dimension information indicates the task dimension of the second instruction task, and the task combination dimension information indicates other task dimensions that are different from the task dimension of the second instruction task.
[0127] The task prompt template is input into the second model for natural language processing, and at least one description text of the first instruction task is output.
[0128] The N task dimensions include at least one of the task dimensions of the second instruction task and the task dimensions indicated by the task combined with the dimension information.
[0129] Optionally, the second acquisition unit is specifically used for:
[0130] Obtain at least one description text of the first instruction task input by the user, wherein the description text of the first instruction task is constructed by the user based on the description text of the second instruction task in the second text dataset.
[0131] Optionally, the second acquisition module 402 is specifically used for:
[0132] Aggregate and classify the first instruction tasks in the first text dataset to obtain the aggregated task category of each first instruction task;
[0133] Based on the aggregated task category, the hierarchical level of the first instruction task is determined.
[0134] The model training device 400 can implement all the processes implemented in the above-described model training method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0135] The electronic device provided in the embodiments of the present invention will be described below.
[0136] See Figure 5 The figure shows a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 5 As shown, the electronic device 500 includes: a processor 501, a memory 502, a user interface 503, and a bus interface 504.
[0137] Processor 501 is used to read the program from memory 502 and execute the following procedures:
[0138] Obtain a first text dataset, which includes the description text of multiple first instruction tasks;
[0139] Obtain the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing;
[0140] The first model is trained sequentially based on the description text of the first instruction task at each of the hierarchical levels in the first text dataset, arranged from lowest to highest cognitive difficulty.
[0141] exist Figure 5 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 501 and memory represented by memory 502 together. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 504 provides an interface. For different user devices, user interface 503 can also be an interface capable of connecting external or internal devices, including but not limited to keypads, displays, speakers, microphones, joysticks, etc.
[0142] The processor 501 is responsible for managing the bus architecture and general processing, while the memory 502 can store the data used by the processor 501 when performing operations.
[0143] Optionally, processor 501 is also used for:
[0144] The first model is trained based on the first training dataset in the first text dataset, wherein the first training dataset includes the description text of the first instruction task at the first level.
[0145] When the learning gain of the first model for the instruction task of the first level is saturated, the first model is further trained based on the second training dataset in the first text dataset. The second training dataset includes the expression text of the first instruction task of the second level, which is more cognitively difficult than the first level.
[0146] Optionally, processor 501 is also used for:
[0147] Obtain a second text dataset, which includes the representation text of multiple second instruction tasks;
[0148] Based on the description text of the second instruction task in the second text dataset, obtain at least one description text of the first instruction task; the first instruction task is an instruction task on N task dimensions, the N task dimensions include the task dimension of the second instruction task, and N is an integer greater than 1;
[0149] The description text of at least one of the first instruction tasks is aggregated into the second text dataset to obtain the first text dataset.
[0150] Optionally, processor 501 is also used for:
[0151] Obtain a task prompt template, which includes main task dimension information, task combination dimension information and input text. The main task dimension information indicates the task dimension of the second instruction task, and the task combination dimension information indicates other task dimensions that are different from the task dimension of the second instruction task.
[0152] The task prompt template is input into the second model for natural language processing, and at least one description text of the first instruction task is output.
[0153] The N task dimensions include at least one of the task dimensions of the second instruction task and the task dimensions indicated by the task combined with the dimension information.
[0154] Optionally, processor 501 is also used for:
[0155] Obtain at least one description text of the first instruction task input by the user, wherein the description text of the first instruction task is constructed by the user based on the description text of the second instruction task in the second text dataset.
[0156] Optionally, processor 501 is also used for:
[0157] Aggregate and classify the first instruction tasks in the first text dataset to obtain the aggregated task category of each first instruction task;
[0158] Based on the aggregated task category, the hierarchical level of the first instruction task is determined.
[0159] Preferably, the present invention also provides an electronic device, including a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the computer program is executed by the processor 501, it implements the various processes of the above-described model training method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0160] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described model training method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0161] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0162] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0163] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0164] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0165] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0166] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0167] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A model training method, characterized in that, The method includes: Obtain a first text dataset, which includes the description text of multiple first instruction tasks; Obtain the hierarchical level of each first instruction task, wherein the hierarchical level is used to indicate the cognitive difficulty of the first instruction task in natural language processing; The first model is trained sequentially based on the description text of the first instruction task at the first level of the first text dataset, according to the order of cognitive difficulty from low to high. The step of training the first model based on the description text of the first instruction task at each of the first hierarchical levels in the first text dataset, in order of increasing cognitive difficulty, includes: The first model is trained based on the first training dataset in the first text dataset, wherein the first training dataset includes the description text of the first instruction task at the first level. When the learning gain of the first model for the instruction task of the first level is saturated, the first model is further trained based on the second training dataset in the first text dataset. The second training dataset includes the expression text of the first instruction task of the second level, which is more cognitively difficult than the first level.
2. The method according to claim 1, characterized in that, The process of obtaining the first text dataset includes: Obtain a second text dataset, which includes the representation text of multiple second instruction tasks; Based on the description text of the second instruction task in the second text dataset, obtain at least one description text of the first instruction task; the first instruction task is an instruction task on N task dimensions, the N task dimensions include the task dimension of the second instruction task, and N is an integer greater than 1; The description text of at least one of the first instruction tasks is aggregated into the second text dataset to obtain the first text dataset.
3. The method according to claim 2, characterized in that, The step of obtaining at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset includes: Obtain a task prompt template, which includes main task dimension information, task combination dimension information and input text. The main task dimension information indicates the task dimension of the second instruction task, and the task combination dimension information indicates other task dimensions that are different from the task dimension of the second instruction task. The task prompt template is input into the second model for natural language processing, and at least one description text of the first instruction task is output. The N task dimensions include at least one of the task dimensions of the second instruction task and the task dimensions indicated by the task combined with the dimension information.
4. The method according to claim 2, characterized in that, The step of obtaining at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset includes: Obtain at least one description text of the first instruction task input by the user, wherein the description text of the first instruction task is constructed by the user based on the description text of the second instruction task in the second text dataset.
5. The method according to claim 1, characterized in that, The process of obtaining the hierarchical level of each first instruction task includes: Aggregate and classify the first instruction tasks in the first text dataset to obtain the aggregated task category of each first instruction task; Based on the aggregated task category, the hierarchical level of the first instruction task is determined.
6. A model training device, characterized in that, The device includes: The first acquisition module is used to acquire a first text dataset, which includes the description text of multiple first instruction tasks; The second acquisition module is used to acquire the hierarchical level of each first instruction task, the hierarchical level being used to indicate the... The cognitive difficulty of the first instruction task in natural language processing; The training module is used to train the first model sequentially based on the description text of the first instruction task at the first level in the first text dataset, according to the hierarchical level from low to high cognitive difficulty. The training module is specifically used for: The first model is trained based on the first training dataset in the first text dataset, wherein the first training dataset includes the description text of the first instruction task at the first level. When the learning gain of the first model for the instruction task of the first level is saturated, the first model is further trained based on the second training dataset in the first text dataset. The second training dataset includes the expression text of the first instruction task of the second level, which is more cognitively difficult than the first level.
7. The apparatus according to claim 6, characterized in that, The first acquisition module includes: The first acquisition unit is used to acquire a second text dataset, which includes the description text of multiple second instruction tasks; The second acquisition unit is used to acquire at least one description text of the first instruction task based on the description text of the second instruction task in the second text dataset; the first instruction task is an instruction task on N task dimensions, the N task dimensions include the task dimensions of the second instruction task, and N is an integer greater than 1; An aggregation unit is used to aggregate the description text of at least one of the first instruction tasks into the second text dataset to obtain the first text dataset.
8. The apparatus according to claim 7, characterized in that, The second acquisition unit is specifically used for: Obtain a task prompt template, which includes main task dimension information, task combination dimension information and input text. The main task dimension information indicates the task dimension of the second instruction task, and the task combination dimension information indicates other task dimensions that are different from the task dimension of the second instruction task. The task prompt template is input into the second model for natural language processing, and at least one description text of the first instruction task is output. The N task dimensions include at least one of the task dimensions of the second instruction task and the task dimensions indicated by the task combined with the dimension information.
9. The apparatus according to claim 7, characterized in that, The second acquisition unit is specifically used for: Obtain at least one description text of the first instruction task input by the user, wherein the description text of the first instruction task is constructed by the user based on the description text of the second instruction task in the second text dataset.
10. The apparatus according to claim 6, characterized in that, The second acquisition module is specifically used for: Aggregate and classify the first instruction tasks in the first text dataset to obtain the aggregated task category of each first instruction task; Based on the aggregated task category, the hierarchical level of the first instruction task is determined.
11. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the model training method as described in any one of claims 1 to 5.
12. A readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements the steps of the model training method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Model training method and device and storage medium
CN113535930A