Multi-stage knowledge enhancement model training method and device, electronic equipment and storage medium
Through multi-stage knowledge-enhanced model training methods, including question-and-answer construction, multi-task training and thinking chain results training for complex knowledge problems, the problem of insufficient in-depth reasoning ability of the language model on multi-source complex knowledge problems is solved, and the knowledge application ability of the model is improved.
Patent Information
- Application Number
- CN202411951252.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-18
AI Technical Summary
Existing language models lack deep reasoning capabilities on multi-source complex knowledge problems, making it difficult to establish an effective reasoning chain between multi-source knowledge, affecting its effectiveness in practical applications.
A multi-stage knowledge-enhanced model training method is adopted to gradually improve the model's knowledge understanding, memory and reasoning ability by constructing question-and-answer pairs, multi-task training and thinking chain results training for complex knowledge problems.
Through multi-task training and training of complex knowledge problems, the model can better understand and memorize knowledge, and establish an effective reasoning chain between multi-source knowledge, which improves the ability to apply knowledge and solves the limitations of existing technology in complex knowledge reasoning.
Smart Images

Figure CN119849631A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a multi-stage knowledge-enhanced model training method, device, electronic device and storage medium. Background Art
[0002] With the development of artificial intelligence technology, large language models have made significant progress in natural language processing tasks. The training methods of language models mainly include large-scale pre-training methods, knowledge enhancement methods based on QA tasks, and multi-task training methods.
[0003] Although the language models obtained by large-scale pre-training methods have excellent performance in many natural language processing (NLP) tasks, they still have obvious deficiencies in the level of knowledge understanding and reasoning, especially in multi-source complex knowledge problems. Language models can often only make shallow associations or simple knowledge recall, and lack deep reasoning ability. Although the knowledge enhancement method based on question answering (QA) tasks can effectively enhance the model's understanding of knowledge, this approach only focuses on the understanding of knowledge and often ignores the reasoning and application of knowledge. It does not maximize the model's active thinking about the knowledge reasoning process, resulting in the model only being able to understand known knowledge in practical applications, and unable to use known knowledge to understand new knowledge, affecting the model's knowledge transfer and generalization capabilities. The model obtained by the multi-task training method can only memorize and understand knowledge for a single source or a single task, and it is difficult to establish an effective reasoning chain between multi-source knowledge. This limitation affects the effectiveness of the model in practical applications when facing multi-source complex knowledge problems. Summary of the invention
[0004] The present invention provides a multi-stage knowledge-enhanced model training method, device, electronic device and storage medium to solve the defects existing in the related technology.
[0005] The present invention provides a multi-stage knowledge-enhanced model training method, comprising: Based on the training corpus with the target topic, construct a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair; Based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question, multi-task training is performed on the pre-trained language model to obtain an alternative model; Based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question, the candidate model is trained to obtain the target language model.
[0006] According to a multi-stage knowledge-enhanced model training method provided by the present invention, the pre-trained language model is subjected to multi-task training based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answer to the new question to obtain an alternative model, including: The pre-trained language model is trained on the following three types of tasks to obtain the candidate model: Based on the training corpus and the question-answer pairs, performing question-answering task training on the pre-trained language model; Based on the training corpus, the target topic of the training corpus, and the multiple related questions, the pre-trained language model is trained on a self-questioning task; Based on the question-answer pair, the new question and the answer to the new question, the pre-trained language model is trained for a knowledge reasoning task.
[0007] According to a multi-stage knowledge enhancement model training method provided by the present invention, the thought chain result includes multiple answer targets, and the answer to the complex knowledge question includes the answer to each answer target; The thought chain result based on the complex knowledge question and the answer to the complex knowledge question is used to train the candidate model to obtain the target language model, including: For any one of the multiple answer objectives, input the any one of the answer objectives into the candidate model, and the candidate model generates a specific question corresponding to the any one of the answer objectives, and generates a predicted answer to the specific question; Based on the predicted responses corresponding to the multiple solution objectives and the answers to the multiple solution objectives, the candidate model is trained to obtain the target language model.
[0008] According to a multi-stage knowledge-enhanced model training method provided by the present invention, the alternative model is trained based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question to obtain the target language model, which includes: The complex knowledge question is input into the pre-trained language model or the alternative model to obtain the thought chain result output by the pre-trained language model or the alternative model.
[0009] According to a multi-stage knowledge-enhanced model training method provided by the present invention, the question-answer pairs include multiple types; The multiple types of question-answer pairs are generated based on the training corpus in a reading comprehension manner.
[0010] According to a multi-stage knowledge-enhanced model training method provided by the present invention, the pre-trained language model is multi-task trained based on the training corpus, the question-answer pairs, the multiple related questions, the new question and the answer to the new question to obtain an alternative model, which includes: Based on the training corpus, the initial language model is trained in an autoregressive manner to obtain the pre-trained language model.
[0011] According to a multi-stage knowledge-enhanced model training method provided by the present invention, the training corpus includes multiple types of text data, and the different types of text data have different data sources.
[0012] The present invention also provides a multi-stage knowledge-enhanced model training device, comprising: A training sample determination module, configured to construct, based on a training corpus with a target topic, a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair; A first training module is used to perform multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question to obtain an alternative model; The second training module is used to train the candidate model based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question to obtain the target language model.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a multi-stage knowledge-enhanced model training method as described in any one of the above is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-stage knowledge-enhanced model training method as described in any one of the above.
[0015] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the multi-stage knowledge-enhanced model training method as described in any one of the above.
[0016] The multi-stage knowledge-enhanced model training method, device, electronic device and storage medium provided by the present invention can enhance the candidate model's understanding and memory of knowledge through multi-task training, and can enable the obtained target language model to complete the answer reasoning of complex knowledge questions by training the candidate model. The method uses a step-by-step progressive approach, gradually moving from the memory, understanding, and reasoning process of multi-task training to the scene fusion of complex knowledge problems, comprehensively improving the knowledge application ability of the target language model, thereby solving the limitation problem of the existing technology in complex knowledge reasoning. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 This is one of the flow charts of the multi-stage knowledge-enhanced model training method provided by the present invention.
[0019] Figure 2 This is the second flow chart of the multi-stage knowledge-enhanced model training method provided by the present invention.
[0020] Figure 3 It is a structural schematic diagram of the multi-stage knowledge enhanced model training device provided by the present invention.
[0021] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] In the existing language model training methods, large-scale pre-training models mainly memorize knowledge by learning a large amount of corpus. Although they can remember a large amount of language information, their understanding of knowledge is relatively superficial. Language models rely more on pattern matching and simple recall, and cannot deeply understand the connection between knowledge points. Therefore, it is necessary to improve the language model's in-depth understanding of the knowledge content in the training corpus, further strengthen the model's ability to memorize knowledge information, and deepen the connection between knowledge information.
[0024] Knowledge enhancement methods based on question-answering tasks usually convert training corpus into reading comprehension and combine it with relevant question-answering data for training. This training method can effectively enhance the model's understanding of knowledge, but this method only focuses on the understanding of knowledge and often ignores the reasoning and application of knowledge. It does not maximize the model's active thinking about the knowledge reasoning process, resulting in the model being able to understand known knowledge in actual applications, but unable to use known knowledge to understand new knowledge, affecting the model's knowledge transfer and generalization capabilities. Therefore, it is necessary to design a multi-task training method to enhance the model's ability to actively ask questions and think, so as to promote the model's knowledge sharing and learning between multiple tasks, thereby improving overall performance.
[0025] Models obtained by multi-task training methods often perform poorly when faced with multi-source complex knowledge problems and are difficult to reason effectively. This is because most models can only memorize and understand knowledge from a single source or a single task, and it is difficult to establish an effective reasoning chain between multi-source knowledge. This limitation affects the effectiveness of the model in practical applications when faced with multi-source complex knowledge problems. To solve this problem, the reasoning ability of the model must be enhanced to better process and derive complex knowledge relationships, thereby coping with diverse reasoning tasks.
[0026] To solve the above problems, a multi-stage knowledge-enhanced model training method is provided in an embodiment of the present invention.
[0027] Figure 1 A schematic diagram of a multi-stage knowledge-enhanced model training method provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes: S1, constructing a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair based on a training corpus with a target topic; S2, performing multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question to obtain an alternative model; S3, based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question, the candidate model is trained to obtain a target language model.
[0028] Specifically, the multi-stage knowledge-enhanced model training method provided in the embodiment of the present invention is executed by a multi-stage knowledge-enhanced model training device, which can be configured in a computer, which can be a local computer or a cloud computer. The local computer can be a computer, a tablet, etc., which is not specifically limited here.
[0029] First, step S1 is performed to construct question-answer pairs, multiple related questions corresponding to the target topic, and answers to new questions determined by the question-answer pairs using training corpus with the target topic.
[0030] The training corpus can be multiple corpora in a general corpus, which can be collected manually or online. The training corpus can cover a wide range of topics and fields to ensure that the model can learn rich knowledge. Each corpus in the training corpus can have a target topic, which can be pre-set.
[0031] Question-answer pairs can be question-answer pairs generated from the content of the training corpus. The types of questions can include information extraction, summary generation, cloze, multiple choice, and sentence completion.
[0032] Each corpus in the training corpus can identify multiple related questions through its target topic. Multiple related questions can cover important information such as key concepts, knowledge, characters and conclusions in each corpus, and the answer to each related question can be found in the corresponding corpus.
[0033] New questions can be generated by summarizing the questions in the question-answer pair, and the answers to the new questions can be obtained by reasoning about the new questions.
[0034] Then, step S2 is executed to perform multi-task training on the pre-trained language model using the training corpus, question-answer pairs, multiple related questions, new questions, and answers to the new questions to obtain an alternative model.
[0035] Each task may include a question-answering task for answering questions, a self-questioning task for raising new questions, and a knowledge reasoning task for using known knowledge to answer new questions. Different tasks may use different information as task data, which is the training data used for training the task.
[0036] The pre-trained language model may be an existing language model or a language model obtained by pre-training with a large amount of general corpus, which is not specifically limited here.
[0037] The question-answering task requires the pre-trained language model to be able to generate correct answers based on given corpus and questions. The self-questioning task requires the pre-trained language model to generate multiple most relevant questions given the corpus articles and the target topic, for example, the top k questions. The knowledge reasoning task requires the pre-trained language model to complete the answer reasoning for new questions based on multiple question-answer pairs.
[0038] Finally, step S3 is executed. Complex knowledge problems refer to problems that can contain multiple solution goals. Complex knowledge problems can be split into solution ideas containing multiple solution goals according to the thinking chain method through the instruction following ability of the existing language model. Each solution goal constitutes the result of the thinking chain. Each solution goal corresponds to a sub-problem that needs to be solved.
[0039] The answer to a complex knowledge question refers to the summary result of the answers corresponding to multiple solution objectives. The alternative model can be trained through the thinking chain results of the complex knowledge question and the answers to the complex knowledge question. The thinking chain results are processed by the powerful ability obtained through the multi-task training of the alternative model, and the alternative model is trained in combination with the answers to the complex knowledge question, so that the alternative model can learn the ability to solve complex knowledge problems.
[0040] The multi-stage knowledge-enhanced model training method provided in the embodiment of the present invention first constructs question-answer pairs, multiple related questions corresponding to the target topic, and answers to new questions determined by the question-answer pairs based on the training corpus with the target topic; then, based on the training corpus, question-answer pairs, multiple related questions, new questions, and answers to new questions, multi-task training is performed on the pre-trained language model to obtain an alternative model; finally, based on the thinking chain results of complex knowledge problems and the answers to complex knowledge problems, the alternative model is trained to obtain a target language model. This method can enhance the understanding and memory of knowledge by the alternative model through multi-task training, and can enable the obtained target language model to complete the answer reasoning of complex knowledge problems by training the alternative model. This method uses a step-by-step progressive approach, gradually from the memory, understanding, and reasoning process of multi-task training to the scene fusion of complex knowledge problems, and comprehensively improves the knowledge application ability of the target language model, thereby solving the limitations of the existing technology in complex knowledge reasoning.
[0041] On the basis of the above embodiment, the multi-task training of the pre-trained language model based on the training corpus, the question-answer pair, the multiple related questions, the new question and the answer to the new question to obtain the candidate model includes: The pre-trained language model is trained on the following three types of tasks to obtain the candidate model: Based on the training corpus and the question-answer pairs, performing question-answering task training on the pre-trained language model; Based on the training corpus, the target topic of the training corpus, and the multiple related questions, the pre-trained language model is trained on a self-questioning task; Based on the question-answer pair, the new question and the answer to the new question, the pre-trained language model is trained for a knowledge reasoning task.
[0042] Specifically, when performing multi-task training on the pre-trained language model, the following three types of task training can be performed in detail. The training order of these three types of tasks can be set as needed. They can be trained individually or jointly. There is no specific limitation here. Finally, an alternative model can be obtained.
[0043] When training for question-answering tasks, training corpus and question-answer pairs can be used. The training corpus and the questions of the question-answer pairs can be used as inputs to the pre-trained language model, and the answers to the question-answer pairs can be used as labels to compare with the first output results of the pre-trained language model. Based on the comparison results, the cross-entropy loss function is used to optimize the accuracy of the pre-trained language model when generating output results, thereby implementing question-answering task training. The trained model can have question-answering capabilities.
[0044] When conducting self-questioning task training, the training corpus, the target topic carried by the training corpus, and multiple related questions can be used for implementation. The training corpus and the target topic can be used as inputs of the pre-trained language model, and multiple related questions can be used as labels to compare with the second output result of the pre-trained language model, and based on the comparison result, the self-questioning task training is conducted. The trained model can have the ability to ask self-questions.
[0045] When training for knowledge reasoning tasks, question-answer pairs, new questions, and answers to new questions can be used. The question-answer pairs and new questions can be used as inputs to the pre-trained language model, and the answers to the new questions can be used as labels to compare with the third output results of the pre-trained language model. Based on the comparison results, knowledge reasoning task training can be performed. The trained model can have knowledge reasoning capabilities.
[0046] When jointly training question-answering tasks, self-questioning tasks, and knowledge reasoning tasks, all tasks share the structural parameters of the pre-trained language model to promote knowledge transfer and collaborative learning between different tasks, so as to improve the generalization and knowledge integration capabilities of the pre-trained language model.
[0047] In the embodiment of the present invention, a language model with enhanced knowledge understanding and knowledge reasoning, i.e., an alternative model, can be obtained through multi-task training. The alternative model can simultaneously have question-answering capability, self-questioning capability, and knowledge reasoning capability.
[0048] Based on the above embodiment, the thought chain result includes multiple solution targets, and the answer to the complex knowledge question includes the answer to each solution target; The thought chain result based on the complex knowledge question and the answer to the complex knowledge question is used to train the candidate model to obtain the target language model, including: For any one of the multiple answer objectives, input the any one of the answer objectives into the candidate model, and the candidate model generates a specific question corresponding to the any one of the answer objectives, and generates a predicted answer to the specific question; Based on the predicted responses corresponding to the multiple solution objectives and the answers to the multiple solution objectives, the candidate model is trained to obtain the target language model.
[0049] Specifically, the result of the thought chain may include multiple solution targets, and the answer to a complex knowledge question may include the answer to each solution target. When training the candidate model, the same operation may be performed on each solution target, that is, any solution target among the multiple solution targets may be input into the candidate model, and the specific question corresponding to the solution target may be generated by the self-questioning ability of the candidate model, and the predicted response to the specific question may be generated by the knowledge reasoning ability of the candidate model.
[0050] Afterwards, the information integration capability of the alternative model can be used to summarize the predicted responses corresponding to multiple solution targets and the answers to multiple solution targets to obtain predicted answers and standard answers. The predicted answers and standard answers can be used to train the alternative model to obtain the target language model.
[0051] In the embodiment of the present invention, complex knowledge problems are decomposed by means of thought chains, and then the training of alternative models is realized, so that the obtained target language model can be used to accurately answer complex knowledge problems.
[0052] On the basis of the above embodiment, the alternative model is trained based on the thinking chain result of the complex knowledge question and the answer to the complex knowledge question to obtain the target language model, which includes: The complex knowledge question is input into the pre-trained language model or the alternative model to obtain the thought chain result output by the pre-trained language model or the alternative model.
[0053] Specifically, before training the alternative model, it is necessary to first determine the thinking chain result. The thinking chain result can be obtained with the help of the existing pre-trained language model or the instruction-following ability of the alternative model obtained through multi-task training. That is, complex knowledge problems are input into the pre-trained language model or the alternative model to obtain the thinking chain result output by the pre-trained language model or the alternative model.
[0054] In the embodiment of the present invention, the thought chain result can be determined accurately and quickly by pre-training the language model or the alternative model.
[0055] Based on the above embodiment, the question-answer pairs include multiple types; The multiple types of question-answer pairs are generated based on the training corpus in a reading comprehension manner.
[0056] Specifically, question-answer pairs can include multiple types, such as information extraction, summary generation, cloze, multiple choice, sentence completion, etc., so that the candidate model can support multiple types of knowledge questions and answers, and improve the question-answering ability of the candidate model. Moreover, generating multiple types of question-answer pairs in the form of reading comprehension can improve the accuracy of the answers to the question-answer pairs.
[0057] On the basis of the above embodiment, the pre-trained language model is multi-task trained based on the training corpus, the question-answer pair, the multiple related questions, the new question and the answer to the new question to obtain an alternative model, which includes: Based on the training corpus, the initial language model is trained in an autoregressive manner to obtain the pre-trained language model.
[0058] Specifically, before performing multi-task training on the pre-trained language model, the initial language model may be trained in an autoregressive manner using the training corpus to obtain the pre-trained language model.
[0059] The initial language model can be a general large language model (LLM). The initial language model can predict the next word based on the previous word through autoregression, and can extract language patterns and general knowledge from the training corpus using unsupervised learning.
[0060] Through this process, the pre-trained language model can learn and memorize a wide range of underlying knowledge.
[0061] Therefore, if Figure 2 As shown, in an embodiment of the present invention, in order to obtain a target language model, three stages of knowledge enhancement can be performed through the initial language model. The first stage is a pre-training stage to obtain a pre-trained language model. The second stage is a multi-task training stage, including question-answering task training, self-questioning task training, and knowledge reasoning task training to obtain an alternative model. The third stage is a complex question answer reasoning stage to obtain a target language model.
[0062] On the basis of the above embodiment, the training corpus includes multiple types of text data, and the different types of text data have different data sources.
[0063] Specifically, in an embodiment of the present invention, the training corpus may include various types of text data, including news articles, encyclopedias, academic papers, social media content, etc. This can make the models obtained through subsequent training more adaptable, master various language patterns and general knowledge, and enable the target language model to be applied to reasoning and solving multi-source complex knowledge problems.
[0064] like Figure 3 As shown, based on the above embodiment, a multi-stage knowledge-enhanced model training device is provided in an embodiment of the present invention, comprising: A training sample determination module 31 is used to construct a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair based on a training corpus with a target topic; A first training module 32 is used to perform multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question and the answer to the new question to obtain an alternative model; The second training module 33 is used to train the candidate model based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question to obtain a target language model.
[0065] On the basis of the above-mentioned embodiment, in the multi-stage knowledge-enhanced model training device provided in the embodiment of the present invention, the first training module is specifically used for: The pre-trained language model is trained on the following three types of tasks to obtain the candidate model: Based on the training corpus and the question-answer pairs, performing question-answering task training on the pre-trained language model; Based on the training corpus, the target topic of the training corpus, and the multiple related questions, the pre-trained language model is trained on a self-questioning task; Based on the question-answer pair, the new question and the answer to the new question, the pre-trained language model is trained for a knowledge reasoning task.
[0066] On the basis of the above-mentioned embodiment, in the multi-stage knowledge-enhanced model training device provided in the embodiment of the present invention, the thought chain result includes multiple answer targets, and the answer to the complex knowledge question includes the answer to each answer target; The second training module is specifically used for: For any one of the multiple answer objectives, input the any one of the answer objectives into the candidate model, and the candidate model generates a specific question corresponding to the any one of the answer objectives, and generates a predicted answer to the specific question; Based on the predicted responses corresponding to the multiple solution objectives and the answers to the multiple solution objectives, the candidate model is trained to obtain the target language model.
[0067] On the basis of the above-mentioned embodiment, the multi-stage knowledge-enhanced model training device provided in the embodiment of the present invention further includes a thinking chain result generation module for: The complex knowledge question is input into the pre-trained language model or the alternative model to obtain the thought chain result output by the pre-trained language model or the alternative model.
[0068] On the basis of the above-mentioned embodiment, in the multi-stage knowledge-enhanced model training device provided in the embodiment of the present invention, the question-answer pairs include multiple types; The multiple types of question-answer pairs are generated based on the training corpus in a reading comprehension manner.
[0069] On the basis of the above embodiment, the multi-stage knowledge enhanced model training device provided in the embodiment of the present invention further includes a third training module for: Based on the training corpus, the initial language model is trained in an autoregressive manner to obtain the pre-trained language model.
[0070] On the basis of the above-mentioned embodiments, in the multi-stage knowledge-enhanced model training device provided in the embodiments of the present invention, the training corpus includes multiple types of text data, and the data sources of the different types of text data are different.
[0071] Specifically, the functions of each module in the multi-stage knowledge-enhanced model training device provided in the embodiment of the present invention correspond one-to-one to the operating procedures of each step in the above-mentioned method embodiment, and the effects achieved are also consistent. Please refer to the above-mentioned embodiment for details, and no further details will be given in the embodiment of the present invention.
[0072] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the multi-stage knowledge enhanced model training method provided in the above embodiments.
[0073] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0074] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the multi-stage knowledge-enhanced model training method provided in the above-mentioned embodiments.
[0075] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the multi-stage knowledge-enhanced model training method provided in the above-mentioned embodiments.
[0076] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0077] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-stage knowledge-enhanced model training method, characterized in that: include: Based on the training corpus with the target topic, construct a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair; Based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question, multi-task training is performed on the pre-trained language model to obtain an alternative model; Based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question, the candidate model is trained to obtain the target language model.
2. The multi-stage knowledge-enhanced model training method according to claim 1, characterized in that: The method of performing multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question to obtain an alternative model includes: The pre-trained language model is trained on the following three types of tasks to obtain the candidate model: Based on the training corpus and the question-answer pairs, performing question-answering task training on the pre-trained language model; Based on the training corpus, the target topic of the training corpus, and the multiple related questions, the pre-trained language model is trained on a self-questioning task; Based on the question-answer pair, the new question and the answer to the new question, the pre-trained language model is trained for a knowledge reasoning task.
3. The multi-stage knowledge-enhanced model training method according to claim 1, characterized in that: The thought chain result includes a plurality of answer targets, and the answer to the complex knowledge question includes the answer to each answer target; The thought chain result based on the complex knowledge question and the answer to the complex knowledge question is used to train the candidate model to obtain the target language model, including: For any one of the multiple answer objectives, input the any one of the answer objectives into the candidate model, and generate a specific question corresponding to the any one of the answer objectives by the candidate model, and generate a predicted answer to the specific question; Based on the predicted responses corresponding to the multiple solution objectives and the answers to the multiple solution objectives, the candidate model is trained to obtain the target language model.
4. The multi-stage knowledge-enhanced model training method according to claim 1, characterized in that: The thought chain result based on the complex knowledge question and the answer to the complex knowledge question is used to train the candidate model to obtain the target language model, which includes: The complex knowledge question is input into the pre-trained language model or the alternative model to obtain the thought chain result output by the pre-trained language model or the alternative model.
5. The multi-stage knowledge-enhanced model training method according to claim 1, characterized in that: The question-answer pairs include multiple types; The multiple types of question-answer pairs are generated based on the training corpus in a reading comprehension manner.
6. The multi-stage knowledge-enhanced model training method according to any one of claims 1 to 5, characterized in that: The method of performing multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question to obtain an alternative model comprises: Based on the training corpus, the initial language model is trained in an autoregressive manner to obtain the pre-trained language model.
7. The multi-stage knowledge-enhanced model training method according to any one of claims 1 to 5, characterized in that: The training corpus includes multiple types of text data, and the different types of text data come from different sources.
8. A multi-stage knowledge-enhanced model training device, characterized in that: include: A training sample determination module, configured to construct, based on a training corpus with a target topic, a question-answer pair, a plurality of related questions corresponding to the target topic, and an answer to a new question determined by the question-answer pair; A first training module is used to perform multi-task training on the pre-trained language model based on the training corpus, the question-answer pairs, the multiple related questions, the new question, and the answers to the new question to obtain an alternative model; The second training module is used to train the candidate model based on the thinking chain results of the complex knowledge question and the answer to the complex knowledge question to obtain the target language model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the multi-stage knowledge-enhanced model training method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the multi-stage knowledge-enhanced model training method as described in any one of claims 1 to 7.
Citation Information
Cited By
Model cluster driven hybrid enhanced question-answering system, method and equipment and medium
CN120338124A
Method and system for enhancing logical reasoning ability of large language model
CN120806171A