Model training method and device, equipment, storage medium and program product
By decomposing the large language model into multiple knowledge blocks and training for different domain tasks, the problem of low accuracy of inference results of large language models in the prior art is solved, and high accuracy inference on domain tasks is achieved.
Patent Information
- Application Number
- CN202411270572.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-13
AI Technical Summary
Existing large language models cannot establish a complete domain knowledge semantic space system when inference, resulting in low accuracy of results.
By obtaining domain knowledge corpus and instruction sets, the large language model is decomposed into multiple knowledge blocks, model training is carried out for different domain tasks, and a complete domain knowledge semantic space system is established.
The accuracy of inference results of large language models in domain tasks is improved, and corresponding knowledge blocks are established by accurately injecting domain knowledge, which enhances the model's domain knowledge understanding ability.
Smart Images

Figure CN119129681A_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, device, equipment, storage medium and program product. Background Art
[0002] At present, when large language models are applied to specific domain scenarios, it is often necessary to inject knowledge from the domain scenarios into the large model to supplement the domain knowledge that has not been learned or only a small part of it has been learned from the corpus of general scenarios. There are currently two methods of knowledge injection: one is knowledge injection based on the self-supervised learning model, and the other is knowledge injection based on the supervised instruction fine-tuning model.
[0003] Both of the above two modes of knowledge injection are unable to establish a complete semantic space system of domain knowledge, resulting in low accuracy of the results obtained by reasoning using large language models. Summary of the invention
[0004] The purpose of the present invention is to provide a model training method, device, equipment, storage medium and program product to solve the problem of low accuracy of the results obtained by reasoning using the existing large language model.
[0005] In order to achieve the above object, in a first aspect, the present invention provides a model training method, comprising:
[0006] Obtain domain knowledge corpus and domain knowledge instruction set;
[0007] According to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, where different knowledge blocks correspond to different domain tasks, and different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task;
[0008] Based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
[0009] In some embodiments, obtaining a domain knowledge instruction set includes:
[0010] For each of the multiple domain tasks, obtain pre-built seed instructions;
[0011] The seed instructions are learned to generate a set of domain knowledge instructions corresponding to the domain task.
[0012] In some embodiments, different domain tasks correspond to different sets of domain knowledge instructions;
[0013] The step of obtaining multiple knowledge blocks of a large language model according to the domain knowledge instruction set includes:
[0014] For each instruction in the domain knowledge instruction set corresponding to each domain task, the instruction is input into the large language model, and the word unit token outputted by each layer in the large language model is obtained and visualized;
[0015] Based on the visualized tokens, obtain the blocks in the large language model that are strongly related to the domain task;
[0016] According to the obtained multiple blocks in the large language model that are strongly related to the domain task, the knowledge block in the large language model corresponding to the domain task is determined.
[0017] In some embodiments, the domain knowledge includes factual knowledge, conceptual knowledge, and process reasoning knowledge; the plurality of domain tasks include a first domain task related to the factual knowledge, a second domain task related to the conceptual knowledge, and a third domain task related to the process reasoning knowledge; the plurality of knowledge blocks include a first knowledge block related to the factual knowledge, a second knowledge block related to the conceptual knowledge, and a third knowledge block related to the process reasoning knowledge;
[0018] The method of performing model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set to obtain the trained large language model includes:
[0019] Based on factual knowledge corpus, conceptual knowledge corpus, a domain knowledge instruction set corresponding to the first domain task, and a domain knowledge instruction set corresponding to the second domain task, training the first knowledge block and the second knowledge block in the large language model to obtain a first large language model, wherein the first large language model is a large language model with the factual knowledge and the conceptual knowledge;
[0020] Based on the domain knowledge instruction set corresponding to the third domain task, the third knowledge block in the first large language model is trained to obtain a trained large language model, and the trained large language model is a large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge.
[0021] In some embodiments, the training of the first knowledge block and the second knowledge block in the large language model based on the factual knowledge corpus, the conceptual knowledge corpus, the domain knowledge instruction set corresponding to the first domain task, and the domain knowledge instruction set corresponding to the second domain task to obtain the first large language model includes:
[0022] After training the first knowledge block based on the factual knowledge corpus and training the second knowledge block based on the conceptual knowledge corpus, an intermediate large language model is obtained;
[0023] Based on the domain knowledge instruction set corresponding to the first domain task and the domain knowledge instruction set corresponding to the second domain task, the intermediate large language model is trained to obtain the first large language model.
[0024] In a second aspect, an embodiment of the present invention further provides a model training device, comprising:
[0025] An acquisition module is used to acquire domain knowledge corpus and domain knowledge instruction set;
[0026] A processing module, used for obtaining multiple knowledge blocks of a large language model according to the domain knowledge instruction set, where different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task;
[0027] The model training module is used to perform model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set to obtain a trained large language model.
[0028] In a third aspect, an embodiment of the present invention further provides a model training device, including a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, and the processor is used to perform the following operations:
[0029] Obtain domain knowledge corpus and domain knowledge instruction set;
[0030] According to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, where different knowledge blocks correspond to different domain tasks, and different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task;
[0031] Based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
[0032] In a fourth aspect, an embodiment of the present invention further provides a model training device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; when the processor executes the program, the model training method as described in the first aspect above is implemented.
[0033] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the model training method described in the first aspect above.
[0034] In a sixth aspect, an embodiment of the present invention further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps in the model training method described in the first aspect above.
[0035] The above technical solution of the present invention has at least the following beneficial effects:
[0036] In an embodiment of the present invention, domain knowledge corpus and a domain knowledge instruction set are obtained; then, according to the domain knowledge instruction set, multiple knowledge blocks of a large language model are obtained, different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; finally, based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on the multiple knowledge blocks of the large language model to obtain a trained large language model; based on different domain knowledge instruction sets, the present invention mines the corresponding knowledge blocks of the large language model, and accurately injects the corresponding knowledge into the specified knowledge blocks, so that a complete semantic space system of domain knowledge can be established in the large language model, and then in subsequent applications, the large language model trained by the present invention is used to perform reasoning on domain tasks, which can improve the accuracy of the obtained results. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram showing a flow chart of a model training method provided by an embodiment of the present invention;
[0038] Figure 2 A schematic diagram showing a module of a model training device provided by an embodiment of the present invention;
[0039] Figure 3 A schematic diagram showing the hardware structure of a model training device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0041] The knowledge injection based on the self-supervised learning model is specifically as follows: secondary pre-training of domain knowledge in the pre-training phase model, self-supervised learning of the domain knowledge corpus according to the model of predicting the next token, so as to inject the domain knowledge into the large language model.
[0042] The knowledge injection based on the supervised instruction fine-tuning model is specifically as follows: constructing the instruction fine-tuning of the second stage of the large language model, organizing the domain knowledge corpus into a set of task instructions, and injecting the domain knowledge into the large language model through the supervised learning model.
[0043] Both of the above modes have certain problems in the comprehensiveness and efficiency of domain knowledge injection. Self-supervised learning requires a large amount of domain knowledge corpus to establish a semantic space system of domain knowledge from a fine-grained bottom-up perspective; supervised instruction fine-tuning requires a sufficiently rich knowledge system of the instruction set to establish the semantic space relevance of domain knowledge from top to bottom. At present, neither of the two modes of knowledge injection can establish a complete semantic space system of domain knowledge, which will result in low accuracy of the results obtained by reasoning using a large language model.
[0044] In order to solve the above technical problems, a model training method, device, equipment, storage medium and program product are provided. The method and the device are based on the same application concept. Since the principles of solving the problem by the method and the device are similar, the implementation of the device and the method can refer to each other, and the repeated parts will not be repeated.
[0045] like Figure 1 FIG. 1 is a flow chart of a model training method provided by an embodiment of the present invention, and the method may include:
[0046] Step 101, obtaining domain knowledge corpus and domain knowledge instruction set.
[0047] Here, the domain knowledge corpus is a pre-constructed domain knowledge corpus, and the specific construction steps may include:
[0048] 1) Collect domain-related corpus, such as relevant basic knowledge, business knowledge, product descriptions, rules and regulations in the field. Original domain knowledge materials can be collected from relevant domain websites, books, papers, etc.
[0049] 2) Preprocess the domain-related corpus collected above, such as denoising, deduplication, and high-quality screening, to obtain high-quality and diverse domain knowledge corpus in the domain.
[0050] In an optional embodiment, in the above step 101, obtaining a domain knowledge instruction set includes:
[0051] Step 1011, for each domain task of the plurality of domain tasks, obtain a pre-built seed instruction.
[0052] The seed instructions include preset domain knowledge text related to the domain task, preset instructions for the preset domain knowledge text, and an output format for the preset instructions.
[0053] It should be noted that the seed instruction can be an artificially constructed instruction to ensure the rigor of the domain task. Generally, the seed instruction includes multiple ones.
[0054] In one example, the task is a NER task, and the first preset text is: Guangzhou's weather is really hot. The first preset instruction for the first preset text is: Please extract entities in the text. The output format of the first preset instruction is JSON format, that is, {'entity': [entity name]}.
[0055] Step 1012: learning the seed instructions to generate a domain knowledge instruction set corresponding to the domain task.
[0056] A more powerful large model (such as GPT4o) can be used to learn seed instructions and generate a large number of domain task instructions as a set of domain knowledge instructions corresponding to the domain tasks.
[0057] It should be noted that in order to ensure the rigor of the domain task, the instructions generated in step 1012 may be manually reviewed, that is, after a large number of instructions are generated, they are manually reviewed to obtain a set of domain knowledge instructions corresponding to the domain task.
[0058] Step 102, according to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task.
[0059] The domain knowledge includes factual knowledge, conceptual knowledge and process reasoning knowledge. The domain knowledge corpus includes factual knowledge corpus, conceptual knowledge corpus and process reasoning knowledge corpus. The domain knowledge instruction set obtained in step 101 corresponds to the domain task, that is, different domain tasks correspond to different domain knowledge instruction sets, that is, different domain knowledge corresponds to different domain knowledge instruction sets.
[0060] In an optional embodiment, this step 102 includes:
[0061] Step 1021, for each instruction in the domain knowledge instruction set corresponding to each domain task, the instruction is input into the large language model, the word unit token output by each layer in the large language model is obtained, and the token is visualized.
[0062] For example, the instruction (prompt) input to the large language model is: Please extract entities from the text. \nText: The weather in Shanghai is really hot. \nPlease output the JSON format {'entity': [entity name]}. After that, the word unit token output by each layer in the large language model is visualized, as shown in Table 1 below:
[0063] Table 1
[0064]
[0065]
[0066] Step 1022: Based on the visualized tokens, obtain the blocks in the large language model that are strongly related to the domain task.
[0067] Here, experts can analyze the visualized tokens to identify and judge the blocks in the large language model that are strongly related to the domain task. This block can be defined as a strong capability block for the domain task. For example, in the above example, when the token of "Shanghai" is inferred, "things" is output at the 17th layer, "entity" is output at the 18th to 26th layers, "place" is output at the 27th to 29th layers, and "Shanghai" is output at the 30th to 40th layers. The reasoning process has a certain logic from abstract to concrete, so the 17th to 40th layers are defined as the task-strongly related and explainable blocks of this case (instruction). It should be noted that each instruction in the domain knowledge instruction set corresponding to the domain task is processed according to the above steps to obtain multiple blocks in the large language model that are strongly related to the domain task.
[0068] Step 1023: Determine the knowledge block in the large language model corresponding to the domain task according to the multiple blocks in the large language model that are strongly related to the domain task.
[0069] Among them, a common block can be determined based on multiple blocks strongly related to the domain task in the obtained large language model, and the common block can be determined as a knowledge block corresponding to the domain task in the large language model.
[0070] It should be noted that the domain knowledge instruction set corresponding to each domain task is processed according to the above steps, and finally multiple knowledge blocks of the large language model are obtained.
[0071] Step 103 , based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
[0072] Based on different domain knowledge instruction sets, the corresponding knowledge blocks of the large language model are mined, and then step 103 is executed to perform model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set. It can also be understood that the corresponding domain instructions are accurately injected into the specified knowledge blocks, so that a complete semantic space system of domain knowledge can be established in the large language model. In subsequent applications, the large language model trained by the present invention can be used to perform reasoning on domain tasks, which can improve the accuracy of the results obtained.
[0073] In an optional embodiment, the domain knowledge includes factual knowledge, conceptual knowledge and process reasoning knowledge; the multiple domain tasks include a first domain task related to the factual knowledge, a second domain task related to the conceptual knowledge and a third domain task related to the process reasoning knowledge; the multiple knowledge blocks include a first knowledge block related to the factual knowledge, a second knowledge block related to the conceptual knowledge and a third knowledge block related to the process reasoning knowledge; accordingly, the above step 103, based on the domain knowledge corpus and the domain knowledge instruction set, performs model training on the multiple knowledge blocks of the large language model to obtain the trained large language model, includes:
[0074] Step 1031, based on the factual knowledge corpus, the conceptual knowledge corpus, the domain knowledge instruction set corresponding to the first domain task, and the domain knowledge instruction set corresponding to the second domain task, train the first knowledge block and the second knowledge block in the large language model to obtain a first large language model, which is a large language model with the factual knowledge and the conceptual knowledge.
[0075] It should be noted that the large language model required for training in the present invention is a base large language model, such as Qwen-14B-chat. The base large language model comes with one pre-training, and the following pre-training is called secondary pre-training.
[0076] In an optional embodiment, this step 1031 includes:
[0077] (1) After training the first knowledge block based on the factual knowledge corpus and training the second knowledge block based on the conceptual knowledge corpus, an intermediate large language model is obtained.
[0078] Here, the factual knowledge corpus is injected into the first knowledge block using a secondary pre-training mode, and this process is also a training process. The injection method may be to seal other layers and only inject them into the layer corresponding to the first knowledge block; wherein, sealing other layers means not adjusting the network parameters of other layers; injecting only into the layer corresponding to the first knowledge block means only adjusting the network parameters of the layer corresponding to the first knowledge block. The injection method may also be: injecting by adding LoRA to the layer corresponding to the first knowledge block, and then combining LoRA into the layer corresponding to the first knowledge block; specifically, it can be understood as: extracting the network parameters of the layer corresponding to the first knowledge block, using the LoRA method, which can be understood as a plug-in method, only adjusting the network parameters of the layer corresponding to the first knowledge block, and then using the adjusted network parameters of the layer corresponding to the first knowledge block in the layer corresponding to the first knowledge block.
[0079] Similarly, the concept knowledge corpus is injected into the second knowledge block using the secondary pre-training mode. This process is also a training process. The specific method of injection can be found in the corresponding part of the factual knowledge corpus, which will not be repeated here. Through the above training, the intermediate large language model is obtained.
[0080] (2) Based on the domain knowledge instruction set corresponding to the first domain task and the domain knowledge instruction set corresponding to the second domain task, the intermediate large language model is trained to obtain the first large language model.
[0081] Here, based on the domain knowledge instruction set corresponding to the first domain task (i.e., the domain knowledge instruction set corresponding to factual knowledge) and the domain knowledge instruction set corresponding to the second domain task (i.e., the domain knowledge instruction set corresponding to conceptual knowledge), in accordance with the ordinary material method, on the basis of the intermediate large language model, the above-mentioned domain knowledge instruction set is injected into the intermediate large language model through the supervised learning model (see step (1) for the injection method), thereby obtaining the first large language model with factual knowledge and conceptual knowledge.
[0082] Step 1032: Based on the domain knowledge instruction set corresponding to the third domain task, the third knowledge block in the first large language model is trained to obtain a trained large language model, wherein the trained large language model is a large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge.
[0083] Here, based on the domain knowledge instruction set corresponding to the third domain task (i.e., the domain knowledge instruction set corresponding to the process reasoning knowledge), the domain knowledge instruction set corresponding to the third domain task is injected into the third knowledge block in the first large language model through the supervised learning mode to obtain the trained large language model. It should be understood that each instruction of the domain knowledge instruction set corresponding to the third domain task is input into the first large language model to obtain an output result; the output result is used to adjust the network parameters of the corresponding layer of the third knowledge block to obtain the adjusted large language model for the training of the next instruction until the large model converges to obtain the trained large language model, that is, the large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge. The above-mentioned model training method can inject domain knowledge into the large model with low resources, low consumption and high efficiency.
[0084] The method of the embodiment of the present invention mines the knowledge blocks corresponding to the large language model for different types of knowledge (factual knowledge, conceptual knowledge, process reasoning knowledge), and accurately injects the corresponding knowledge into the specified knowledge blocks. The bottom-up domain knowledge secondary pre-training model is used for factual knowledge and conceptual knowledge; the top-down instruction fine-tuning model is used for process reasoning knowledge. The two models are integrated and connected in both directions to connect the domain knowledge from fine-grained static knowledge to associative knowledge, thereby establishing a complete domain knowledge system in the large language model.
[0085] like Figure 2 As shown, an embodiment of the present invention also provides a model training device, which includes:
[0086] An acquisition module 201 is used to acquire domain knowledge corpus and domain knowledge instruction set;
[0087] The processing module 202 is used to obtain multiple knowledge blocks of the large language model according to the domain knowledge instruction set, where different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task;
[0088] The model training module 203 is used to perform model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set to obtain a trained large language model.
[0089] Optionally, the acquisition module 201 includes:
[0090] A first acquisition unit is used to acquire a pre-built seed instruction for each domain task of the plurality of domain tasks;
[0091] The first processing unit is used to learn the seed instruction and generate a domain knowledge instruction set corresponding to the domain task.
[0092] Optionally, different domain tasks correspond to different domain knowledge instruction sets; accordingly, the processing module 202 includes:
[0093] A second processing unit is used to input each instruction in the domain knowledge instruction set corresponding to each domain task into the large language model, obtain the word unit token output by each layer in the large language model, and visualize the token;
[0094] A third processing unit is used to obtain a block in the large language model that is strongly related to the domain task based on the visually displayed token;
[0095] The fourth processing unit is used to determine the knowledge block corresponding to the domain task in the large language model according to the multiple blocks strongly related to the domain task in the obtained large language model.
[0096] Optionally, the domain knowledge includes factual knowledge, conceptual knowledge and process reasoning knowledge; the multiple domain tasks include a first domain task related to the factual knowledge, a second domain task related to the conceptual knowledge and a third domain task related to the process reasoning knowledge; the multiple knowledge blocks include a first knowledge block related to the factual knowledge, a second knowledge block related to the conceptual knowledge and a third knowledge block related to the process reasoning knowledge; accordingly, the model training module 203 includes:
[0097] A first model training unit is used to train the first knowledge block and the second knowledge block in the large language model based on factual knowledge corpus, conceptual knowledge corpus, a domain knowledge instruction set corresponding to the first domain task, and a domain knowledge instruction set corresponding to the second domain task to obtain a first large language model, wherein the first large language model is a large language model with the factual knowledge and the conceptual knowledge;
[0098] The second model training unit is used to train the third knowledge block in the first large language model based on the domain knowledge instruction set corresponding to the third domain task to obtain a trained large language model, wherein the trained large language model is a large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge.
[0099] Optionally, the first model training unit is specifically used for:
[0100] After training the first knowledge block based on the factual knowledge corpus and training the second knowledge block based on the conceptual knowledge corpus, an intermediate large language model is obtained;
[0101] Based on the domain knowledge instruction set corresponding to the first domain task and the domain knowledge instruction set corresponding to the second domain task, the intermediate large language model is trained to obtain the first large language model.
[0102] The model training device of the embodiment of the present invention obtains domain knowledge corpus and domain knowledge instruction set; then, according to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; finally, based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on the multiple knowledge blocks of the large language model to obtain a trained large language model; based on different domain knowledge instruction sets, the present invention mines the knowledge blocks of the corresponding large language model and accurately injects the corresponding knowledge into the specified knowledge blocks, so that a complete semantic space system of domain knowledge can be established in the large language model, and then in subsequent applications, the large language model trained by the present invention is used to perform reasoning on domain tasks, which can improve the accuracy of the obtained results.
[0103] In order to better achieve the above goals, Figure 3 As shown, an embodiment of the present invention further provides a model training device, including a processor 300 and a transceiver 310, wherein the transceiver 310 receives and sends data under the control of the processor 300, and the processor 300 is used to perform the following process:
[0104] Obtain domain knowledge corpus and domain knowledge instruction set;
[0105] According to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, where different knowledge blocks correspond to different domain tasks, and different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task;
[0106] Based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
[0107] Optionally, the processor 300 is further configured to:
[0108] For each of the multiple domain tasks, obtain pre-built seed instructions;
[0109] The seed instructions are learned to generate a set of domain knowledge instructions corresponding to the domain task.
[0110] Optionally, different domain tasks correspond to different domain knowledge instruction sets; accordingly, the processor 300 is further configured to:
[0111] For each instruction in the domain knowledge instruction set corresponding to each domain task, the instruction is input into the large language model, and the word unit token outputted by each layer in the large language model is obtained and visualized;
[0112] Based on the visualized tokens, obtain the blocks in the large language model that are strongly related to the domain task;
[0113] According to the obtained multiple blocks in the large language model that are strongly related to the domain task, the knowledge block in the large language model corresponding to the domain task is determined.
[0114] Optionally, the domain knowledge includes factual knowledge, conceptual knowledge and process reasoning knowledge; the multiple domain tasks include a first domain task related to the factual knowledge, a second domain task related to the conceptual knowledge and a third domain task related to the process reasoning knowledge; the multiple knowledge blocks include a first knowledge block related to the factual knowledge, a second knowledge block related to the conceptual knowledge and a third knowledge block related to the process reasoning knowledge; accordingly, the processor 300 is further configured to:
[0115] Based on factual knowledge corpus, conceptual knowledge corpus, a domain knowledge instruction set corresponding to the first domain task, and a domain knowledge instruction set corresponding to the second domain task, training the first knowledge block and the second knowledge block in the large language model to obtain a first large language model, wherein the first large language model is a large language model with the factual knowledge and the conceptual knowledge;
[0116] Based on the domain knowledge instruction set corresponding to the third domain task, the third knowledge block in the first large language model is trained to obtain a trained large language model, and the trained large language model is a large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge.
[0117] Optionally, the processor 300 is further configured to:
[0118] After training the first knowledge block based on the factual knowledge corpus and training the second knowledge block based on the conceptual knowledge corpus, an intermediate large language model is obtained;
[0119] Based on the domain knowledge instruction set corresponding to the first domain task and the domain knowledge instruction set corresponding to the second domain task, the intermediate large language model is trained to obtain the first large language model.
[0120] The module training device of the embodiment of the present invention obtains domain knowledge corpus and domain knowledge instruction set; then, according to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; finally, based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on the multiple knowledge blocks of the large language model to obtain the trained large language model; based on different domain knowledge instruction sets, the present invention mines the corresponding knowledge blocks of the large language model and accurately injects the corresponding knowledge into the specified knowledge blocks, so that a complete semantic space system of domain knowledge can be established in the large language model, and then in subsequent applications, the large language model trained by the present invention is used to perform reasoning on domain tasks, which can improve the accuracy of the obtained results.
[0121] An embodiment of the present invention also provides a module training device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the various processes in the module training method embodiment described above are implemented, and the same technical effect can be achieved. To avoid repetition, they will not be described here.
[0122] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, each process in the module training method embodiment described above is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0123] An embodiment of the present invention also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps in the model training method as described above.
[0124] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0125] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A device that specifies functions in one or more processes and / or one or more blocks.
[0126] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable storage medium produce a paper product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0127] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that the computer or other programmable device executes a series of operating steps to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0128] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A model training method, It is characterized in that include: Obtain domain knowledge corpus and domain knowledge instruction set; According to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, where different knowledge blocks correspond to different domain tasks, and different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; Based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
2. The method according to claim 1, It is characterized in that Get domain knowledge instruction set, including: For each of the multiple domain tasks, obtain pre-built seed instructions; The seed instructions are learned to generate a set of domain knowledge instructions corresponding to the domain task.
3. The method according to claim 1, It is characterized in that Different domain tasks correspond to different sets of domain knowledge instructions; The step of obtaining multiple knowledge blocks of a large language model according to the domain knowledge instruction set includes: For each instruction in the domain knowledge instruction set corresponding to each domain task, the instruction is input into the large language model, and the word unit token outputted by each layer in the large language model is obtained and visualized; Based on the visualized tokens, obtain the blocks in the large language model that are strongly related to the domain task; According to the obtained multiple blocks in the large language model that are strongly related to the domain task, the knowledge block in the large language model corresponding to the domain task is determined.
4. The method according to claim 1, It is characterized in that The domain knowledge includes factual knowledge, conceptual knowledge and process reasoning knowledge; the multiple domain tasks include a first domain task related to the factual knowledge, a second domain task related to the conceptual knowledge and a third domain task related to the process reasoning knowledge; the multiple knowledge blocks include a first knowledge block related to the factual knowledge, a second knowledge block related to the conceptual knowledge and a third knowledge block related to the process reasoning knowledge; The method of performing model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set to obtain the trained large language model includes: Based on factual knowledge corpus, conceptual knowledge corpus, a domain knowledge instruction set corresponding to the first domain task, and a domain knowledge instruction set corresponding to the second domain task, training the first knowledge block and the second knowledge block in the large language model to obtain a first large language model, wherein the first large language model is a large language model with the factual knowledge and the conceptual knowledge; Based on the domain knowledge instruction set corresponding to the third domain task, the third knowledge block in the first large language model is trained to obtain a trained large language model, and the trained large language model is a large language model with factual knowledge, the conceptual knowledge and the process reasoning knowledge.
5. The method according to claim 4, It is characterized in that The method of training the first knowledge block and the second knowledge block in the large language model based on the factual knowledge corpus, the conceptual knowledge corpus, the domain knowledge instruction set corresponding to the first domain task, and the domain knowledge instruction set corresponding to the second domain task to obtain the first large language model includes: After training the first knowledge block based on the factual knowledge corpus and training the second knowledge block based on the conceptual knowledge corpus, an intermediate large language model is obtained; Based on the domain knowledge instruction set corresponding to the first domain task and the domain knowledge instruction set corresponding to the second domain task, the intermediate large language model is trained to obtain the first large language model.
6. A model training device, It is characterized in that include: An acquisition module is used to acquire domain knowledge corpus and domain knowledge instruction set; A processing module, used for obtaining multiple knowledge blocks of a large language model according to the domain knowledge instruction set, where different knowledge blocks correspond to different domain tasks, different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; The model training module is used to perform model training on multiple knowledge blocks of the large language model based on the domain knowledge corpus and the domain knowledge instruction set to obtain a trained large language model.
7. A model training device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, It is characterized in that The processor is configured to perform the following operations: Obtain domain knowledge corpus and domain knowledge instruction set; According to the domain knowledge instruction set, multiple knowledge blocks of the large language model are obtained, where different knowledge blocks correspond to different domain tasks, and different domain tasks correspond to different domain knowledge, and each knowledge block is strongly related to the corresponding domain task; Based on the domain knowledge corpus and the domain knowledge instruction set, model training is performed on multiple knowledge blocks of the large language model to obtain a trained large language model.
8. A model training device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; It is characterized in that When the processor executes the program, the model training method as described in any one of claims 1 to 5 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps in the model training method as described in any one of claims 1 to 5 are implemented.
10. A computer program product, It is characterized in that It includes computer instructions, which, when executed by a processor, implement the steps in the model training method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Domain knowledge-driven large language model fine tuning method, system and equipment and storage medium
CN117056531A
Large language model training method and device, storage medium and computer equipment
CN117194631A
Knowledge-guided question and answer method and device based on large language model
CN117573841A
Industrial knowledge large model construction method based on general large language model
CN117668258A
