Model processing method and device, computer equipment and computer readable storage medium
By introducing relevant and irrelevant documents during the training process and adjusting language model parameters, the problem of traditional models being susceptible to irrelevant information is solved, and the accuracy and robustness of the model are improved.
Patent Information
- Application Number
- CN202510261132.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-07-22
AI Technical Summary
Traditional language processing models rely on the recall quality of the searcher and are susceptible to unrelated information interference, resulting in low answer accuracy.
By introducing relevant and irrelevant documents during the training process, the model's screening and discernment ability is enhanced, and the parameters are adjusted using training answers and reference answers until the training cutoff conditions are met, a more accurate target basic language model is obtained.
It improves the accuracy of the language processing model, enhances the model's ability to screen and judge information, reduces the dependence on the accuracy of the searcher, and improves the performance of the model in practical applications.
Smart Images

Figure CN120354900A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of natural language processing, and particularly to a model processing method, apparatus, computer device, and computer-readable storage medium. Background Art
[0002] With the development of artificial intelligence, various language processing models have emerged, such as GPT, LLaMA, etc. The RAG (Retrieval-Augmented Generation) system is widely used in knowledge-intensive tasks, such as question-and-answer systems, document generation, and recommendation systems, to improve the knowledge coverage and generation effect of the model.
[0003] However, in traditional model processing methods, language processing models often rely on the recall quality of the retriever. If the retrieved documents contain information irrelevant to the question, the language processing model may be interfered with and unable to provide accurate answers, resulting in a problem of low accuracy. Summary of the Invention
[0004] Based on this, in view of the above technical problems, it is necessary to provide a model processing method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the accuracy of the target basic language model.
[0005] In a first aspect, this application provides a model processing method, including:
[0006] Obtain training data; the training data includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information, and the first retrieval document set includes at least one of first relevant documents and first irrelevant documents;
[0007] Based on at least one of the first relevant documents and the first irrelevant documents and the first input information, train a preset basic language model to obtain a training answer corresponding to the first input information;
[0008] According to the training answer and the reference answer, adjust the parameters of the basic language model to obtain a new basic language model, and return the step of training the preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, until the training termination condition is met, to obtain the trained target basic language model.
[0009] In a second aspect, this application provides a model processing apparatus, including:
[0010] An acquisition module for acquiring training data; the training data includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information, and the first retrieval document set includes at least one of first relevant documents and first irrelevant documents;
[0011] A training module for training a preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information;
[0012] An adjustment module for adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model, and returning the step of training the preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, until the training termination condition is met, to obtain a trained target basic language model.
[0013] In a third aspect, the present application provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps in the above method are implemented.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method are implemented.
[0015] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above method are implemented.
[0016] The above model processing method, device, computer device, computer-readable storage medium, and computer program product are based on at least one of the first relevant documents and the first irrelevant documents in the first retrieval document set and the first input information, so that the target basic language model can obtain a more accurate target answer for training on relevant documents, or train stronger discrimination and screening capabilities for irrelevant documents, without relying on the absolute accuracy of the retriever, thereby obtaining a more accurate training answer corresponding to the first input information. Then, according to the training answer and the reference answer, the parameters of the basic language model are adjusted to obtain a new basic language model, and the training is returned to continue, improving the accuracy of the target basic language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is an application environment diagram of a model processing method provided by an embodiment of the present application;
[0018] Figure 2Schematic flowchart of a model processing method provided by an embodiment of this application;
[0019] Figure 3 Schematic diagram of model training and testing provided by an embodiment of this application;
[0020] Figure 4 Block diagram of the structure of a model processing device provided by an embodiment of this application;
[0021] Figure 5 Internal structure diagram of a computer device provided by an embodiment of this application;
[0022] Figure 6 Another internal structure diagram of a computer device provided by an embodiment of this application;
[0023] Figure 7 Internal structure diagram of a computer-readable storage medium provided by an embodiment of this application. Detailed implementation manners
[0024] In order to make the objectives, technical solutions, and advantages of this application clearer and more understandable, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used to explain this application and are not used to limit this application.
[0025] The model processing method provided by an embodiment of this application can be applied to an application environment as shown in Figure 1 . Among them, the terminal 102 communicates with the server 104 through a communication network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed in the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0026] As shown in Figure 2 , an embodiment of this application provides a model processing method, taking the application of this method to the terminal 102 or the server 104 in Figure 1 as an example for illustration. It can be understood that the computer device can include at least one of a terminal and a server. This method includes the following steps:
[0027] S202. Obtain training data; the training data includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information. The first retrieval document set includes at least one of first relevant documents and first irrelevant documents.
[0028] The training data is data used to train a basic language model. The first input information is the information input when training the basic language model. The type of the first input information can be text, picture, video, file, etc., and is not limited thereto. Exemplarily, the first input information can be a question, a statement, an instruction, a taken photo, or an input file, etc., and is not limited thereto. The first retrieval document set contains at least one document, and the document can be in various forms such as a text file, web page content, book chapter, etc. The reference answer is the correct output content corresponding to the first input information, and is the result given by the basic language model after learning, analyzing, and reasoning the relevant information in the first document set.
[0029] The first relevant document refers to a document that has a close connection with the first input information in terms of theme, content, or semantics. The first relevant document contains useful information that can help the basic language model generate the correct answer, and is the key object for the basic language model to learn and extract key knowledge. For example, for the first input information of "How to calculate the sum?", the first relevant document can be the content describing the addition function. The first irrelevant document is a document that has no obvious association with the first input information in terms of theme, content, or semantics. Adding the first irrelevant document to the training data aims to enable the basic language model to learn how to distinguish effective and invalid information, enhance the information screening and judgment ability of the basic language model, improve the generalization performance and accuracy of the basic language model, and prevent the basic language model from being overly sensitive or wrongly matching irrelevant information in actual applications.
[0030] The computer device obtains the training data of at least one data point, and the training data of each data point includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information.
[0031] Exemplarily, the training data of the data point includes the following data:
[0032] First input information (Q): "How to calculate the sum?";
[0033] First retrieval document set ( ): Multiple documents returned from the retriever. The first retrieval document set can include first relevant documents ( ) and first irrelevant documents ( ), where the first relevant documents ( ): Documents directly related to the first input information, such as content describing the addition function; the first irrelevant document ( ): Documents unrelated to the first input information, such as documents describing other mathematical functions or content in unrelated fields.
[0034] Reference Answer (A): The answer generated based on the first retrieved document set. The reference answer can be in the Chain-of-Thought style, for example: "To calculate the sum, use the function sum(a, b), for example: sum(3, 5) = 8."
[0035] In some embodiments, the first retrieved document set includes the first relevant documents and the first irrelevant documents, and the number of the first relevant documents is greater than the number of the first irrelevant documents.
[0036] Exemplarily, the computer device obtains N pieces of training data. Each piece of training data includes the first input information, the first retrieved document set corresponding to the first input information, and the reference answer corresponding to the first input information. The first retrieved document set includes the first relevant documents and the first irrelevant documents. The N pieces of training data are divided according to the ratio of N*P% and N*(100 - P)%. For N*P% of the training data, the relevant and irrelevant documents are retained. For N*(100 - P)% of the data, only the irrelevant documents are retained. Among them, N*P% is greater than N*(100 - P)%.
[0037] It can be understood that for P% (such as 60%) of the questions, the relevant and irrelevant documents of the questions are retained. This part of the training is to enable the model to find the answers to the questions on the one hand and to learn the ability to find answers from the documents on the other hand. At the same time, introducing the irrelevant documents of the questions is to enhance the robustness of the model. For (100 - P)% (such as 40%) of the questions, only the irrelevant documents of the questions are retained, which is used to train the model to recognize and ignore irrelevant information, ensuring that the model will not have the problem of large model hallucinations when it does not obtain the relevant documents of the questions.
[0038] S204. Train a preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain the training answer corresponding to the first input information.
[0039] Among them, the basic language model (LLM, Large Language Model) is a type of artificial intelligence model based on deep learning. By training on a large amount of text data, it learns the structure, semantics, and grammar rules of the human language, and thus has powerful natural language understanding and generation capabilities. For example, the basic language model can be a powerful pre-trained model such as GPT, LLaMA, etc. as the generator. The training answer is the answer output by the basic language model during the training process for the first input information.
[0040] In some embodiments, the computer device inputs the first document set and the first input information into a pre-trained basic language model for processing, and outputs a training answer.
[0041] In some embodiments, based on at least one of the first relevant documents and the first irrelevant documents and the first input information, the preset basic language model is trained to obtain a training answer corresponding to the first input information, including:
[0042] If the first retrieved document set includes the first relevant document, then based on the first relevant document and the first input information, the preset basic language model is trained to obtain a first training answer corresponding to the first input information; the first training answer is used to explain the first input information; or,
[0043] If the first retrieved document set includes the first irrelevant document and does not include the first relevant document, then based on the first irrelevant document and the first input information, the preset basic language model is trained to obtain a second training answer corresponding to the first input information; the second training answer is used to indicate that there is no first relevant document corresponding to the first input information.
[0044] If the first retrieved document set includes the first relevant document, and at the same time the first retrieved document set may include the first irrelevant document or may not include the first irrelevant document, then the first relevant document and the first input information are input into the basic language model for processing, and a first training answer corresponding to the first input information is output.
[0045] In some embodiments, the first training answer includes an inference chain, and the inference chain includes references and inferences to the first relevant documents.
[0046] The inference chain is a series of logical derivation steps that the basic language model goes through to obtain the answer, which can clearly show the thinking process from the problem input to the answer generation, just like the thinking context of humans when solving problems. The inclusion of the inference chain in the first training answer makes the answer more logical and interpretable, facilitating user understanding and improving accuracy and interpretability.
[0047] The computer device generates the inference chain through a fixed prompt template. Exemplarily, "Generate the answer step by step in the way guided by the following questions when generating the answer:
[0048] (1) What kind of question is this?
[0049] (2) What function does this question involve?
[0050] (3) How is this function processed?
[0051] (4) How to process this question in combination with this function?"
[0052] According to the above template, an inference chain (Chain-of-Thought) can be generated.
[0053] Exemplarily, the first input information is "How to calculate the sum of two numbers?", the first retrieved document set includes the first relevant document, and the first relevant document is "The function sum(a, b) is used to calculate the sum of two numbers", then the first training answer includes an inference chain, and the first training answer is "To sum two numbers, combine the usage of the function'sum(a, b)' in Doc1, as shown in the example: sum(3, 5) = 8."
[0054] In some embodiments, the computer device verifies the inference chain and outputs the first training answer after the verification passes. It can be understood that the computer device or the staff can verify the inference chain to determine whether the inference chain quotes the correct documents and whether it reflects the inference logic.
[0055] If the first retrieved document set includes the first irrelevant document and does not include the first relevant document, then the first irrelevant document and the first input information are input into the basic language model for processing to obtain the second training answer corresponding to the first input information.
[0056] S206. According to the training answer and the reference answer, adjust the parameters of the basic language model to obtain a new basic language model, and return the step of training the preset basic language model based on at least one of the first relevant document and the first irrelevant document and the first input information to obtain the training answer corresponding to the first input information, until the training cut-off condition is met, and the trained target basic language model is obtained.
[0057] The computer device performs supervised fine-tuning (SFT) on the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model. By fine-tuning on domain-specific data, the performance of the model in professional tasks is significantly improved. At the same time, it is independent of the retriever type, has wide applicability, and enhances the adaptability of the model.
[0058] In some embodiments, adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model includes:
[0059] Determine the cross-entropy loss value between the training answer and the reference answer;
[0060] Based on the cross-entropy loss value, adjust the parameters of the basic language model to obtain a new basic language model.
[0061] Among them, the cross-entropy loss value is a commonly used loss function (Loss Function) in machine learning, especially in classification tasks, and is used to measure the difference between the model's prediction result and the true label.
[0062] The computer device determines the cross-entropy loss value between the training answer and the reference answer using the following formula:
[0063]
[0064] Among them, L refers to the cross-entropy loss value, N is the number of training data, represents the probability obtained by the base language model during training when accepting as the input, and refers to the training answer, the first input information, and the dependent document of the k-th training data among N pieces of training data. If only contains the first irrelevant document , the base language model can learn to generate a second training answer, such as "No relevant information found". If contains the first relevant document in it, the base language model can learn to generate the first training answer and at the same time use Chain-of-Thought to find the content corresponding to the answer in the document.
[0065] The training termination condition can be set as needed. For example, the training termination condition can be that the cross-entropy loss value is less than a preset threshold, or the number of training times reaches a preset number, etc., and is not limited to this.
[0066] It can be seen that in the embodiments of the present application, based on at least one of the first relevant document and the first irrelevant document in the first retrieval document set and the first input information, the target base language model can train to obtain a more accurate target answer for the relevant document, or train a stronger discrimination and screening ability for the irrelevant document, without relying on the absolute accuracy of the retriever, and then obtain a more accurate training answer corresponding to the first input information. Then, according to the training answer and the reference answer, the parameters of the base language model are adjusted to obtain a new base language model, and the process returns to continue training, improving the accuracy of the target base language model.
[0067] In some embodiments, according to the training answer and the reference answer, the parameters of the base language model are adjusted to obtain a new base language model, and the process returns to the step of training the preset base language model based on at least one of the first relevant document and the first irrelevant document and the first input information to obtain the training answer corresponding to the first input information. Until when the training termination condition is met and the trained target base language model is obtained, the method further includes:
[0068] In response to the second input information, obtain a second retrieval document set corresponding to the second input information; the second retrieval document set includes at least one of second relevant documents and second irrelevant documents;
[0069] Based on at least one of the second relevant documents and the second irrelevant documents and the second input information, generate a target answer corresponding to the second input information through the target base language model.
[0070] Wherein, the second input information is the information input during the testing or application process of the base language model. The type of the second input information can be text, picture, video, file, etc., and is not limited thereto. Exemplarily, the second input information can be a question, a statement, an instruction, a taken photo, or an input file, etc., and is not limited thereto. The second retrieval document set contains at least one document, and the document can be in various forms such as a text file, web content, a book chapter, etc. The target answer is the correct output content corresponding to the second input information, and is the result given by the base language model after learning, analyzing, and reasoning the relevant information in the second document set.
[0071] Exemplarily, the second input information is the question Q "How to calculate the sum?", the user inputs the question Q into the target base language model, and the retriever is called through the target base language model to retrieve the first t documents corresponding to the question Q , which constitutes the second retrieval document set. Among them, the retriever can be BM25, Dense Retriever (such as DPR), or semantic indexing (such as FAISS).
[0072] The computer device splices the question Q with the retrieved document set into a prompt information Prompt as follows:
[0073] Question: {Q}
[0074] Relevant documents:
[0075] - Doc1: {Content}
[0076] - Doc2: {Content} ...
[0078] Generate a target answer containing an inference chain according to the second input information through the target base language model, for example: To sum two numbers, combine the usage of the function'sum(a, b)' in Doc1, and the example is as follows: sum(3, 5) = 8.
[0079] It can be seen that in this embodiment, the second retrieval document set corresponding to the second input information is obtained. The second retrieval document set includes at least one of the second relevant documents and the second irrelevant documents. Then, through the trained more accurate target base language model, based on at least one of the second relevant documents and the second irrelevant documents, and the second input information, a more accurate target answer can be generated.
[0080] In some embodiments, as Figure 3 shown, during the training process of the base language model by the computer device, training data is obtained. The training data includes the first input information (query), the first retrieval document set corresponding to the first input information, and the reference answer corresponding to the first input information. If the first retrieval document set includes the first relevant documents and the first irrelevant documents, then based on the first relevant documents and the first input information, the base language model is trained to obtain the first training answer corresponding to the first input information. The first training answer is used to explain the first input information, such as the CoT answer related to the question. If the first retrieval document set includes the first irrelevant documents and does not include the first relevant documents, then based on the first irrelevant documents and the first input information, the base language model is trained to obtain the second training answer corresponding to the first input information. The second training answer is used to prompt that there are no first relevant documents for the first input information, such as no relevant materials found. Until the training termination condition is met, the trained target base language model is obtained.
[0081] During the testing process of the target base language model, the second retrieval document set is obtained through the Retrieval-Augmented Generation (RAG) system. The second retrieval document set includes RAG candidate documents. Each RAG candidate document and the second input information (query) are input into the target base language model to generate the target answer corresponding to the second input information. The second retrieval document set includes at least one of the second relevant documents and the second irrelevant documents.
[0082] It should be understood that although each step in the flowcharts involved in the above embodiments is shown in sequence according to the indication of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0083] Based on the same inventive concept, an embodiment of the present application further provides a model processing device. The solution for solving the problem provided by this device is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the model processing device provided below can refer to the limitations on the model processing method in the foregoing, and will not be repeated here.
[0084] As Figure 4 shown, an embodiment of the present application provides a model processing device 400, including:
[0085] An acquisition module 402, configured to acquire training data; the training data includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information, and the first retrieval document set includes at least one of a first relevant document and a first irrelevant document;
[0086] A training module 404, configured to train a preset basic language model based on at least one of the first relevant document and the first irrelevant document and the first input information to obtain a training answer corresponding to the first input information;
[0087] An adjustment module 406, configured to adjust the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model, and return the step of training the preset basic language model based on at least one of the first relevant document and the first irrelevant document and the first input information to obtain a training answer corresponding to the first input information, until the training cut-off condition is met, and an already trained target basic language model is obtained.
[0088] In some embodiments, in terms of training a preset basic language model based on at least one of the first relevant document and the first irrelevant document and the first input information to obtain a training answer corresponding to the first input information, the training module 404 is specifically configured to:
[0089] If the first retrieval document set includes a first relevant document, train the preset basic language model based on the first relevant document and the first input information to obtain a first training answer corresponding to the first input information; the first training answer is used to explain the first input information; or,
[0090] If the first retrieval document set includes a first irrelevant document and does not include a first relevant document, train the preset basic language model based on the first irrelevant document and the first input information to obtain a second training answer corresponding to the first input information; the second training answer is used to prompt that there is no first relevant document corresponding to the first input information.
[0091] In some embodiments, in terms of adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model, the adjustment module 406 is specifically configured to:
[0092] Determine the cross-entropy loss value between the training answer and the reference answer;
[0093] Based on the cross-entropy loss value, adjust the parameters of the basic language model to obtain a new basic language model.
[0094] In some embodiments, the above device further includes a model application module, and the model application module is used for:
[0095] In response to the second input information, obtain a second retrieval document set corresponding to the second input information; the second retrieval document set includes at least one of second relevant documents and second irrelevant documents;
[0096] Through the target basic language model, based on at least one of the second relevant documents and the second irrelevant documents and the second input information, generate a target answer corresponding to the second input information.
[0097] Each module in the above model processing device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in the form of hardware or independent of the processor, or stored in the memory in the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the above modules.
[0098] In some embodiments, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 5 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to model processing. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it realizes the steps in the above model processing method.
[0099] In some embodiments, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be asFigure 6 As shown in the figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements the steps in the above-mentioned model processing method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen; the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad set on the computer device housing, or an external keyboard, touchpad, or mouse, etc.
[0100] Those skilled in the art can understand that Figure 5 or Figure 6 The structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0101] In some embodiments, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the steps in the above-mentioned method embodiments.
[0102] In some embodiments, as Figure 7 shown, an internal structure diagram of a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program. When the computer program is executed by the processor, it implements the steps in the above-mentioned method embodiments.
[0103] In some embodiments, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by the processor, it implements the steps in the above-mentioned method embodiments.
[0104] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.
[0105] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0106] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.
[0107] The above embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A model processing method, characterized in that, Including: Obtain training data; the training data includes first input information, a first retrieval document set corresponding to the first input information, and a reference answer corresponding to the first input information, and the first retrieval document set includes at least one of first relevant documents and first irrelevant documents; Based on at least one of the first relevant documents and the first irrelevant documents and the first input information, train a preset basic language model to obtain a training answer corresponding to the first input information; According to the training answer and the reference answer, adjust the parameters of the basic language model to obtain a new basic language model, and return the step of training the preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, until a training cut-off condition is met, to obtain a trained target basic language model.
2. The method according to claim 1, wherein The step of training the preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information includes: If the first retrieval document set includes first relevant documents, train the preset basic language model based on the first relevant documents and the first input information to obtain a first training answer corresponding to the first input information; the first training answer is used to explain the first input information; or, If the first retrieval document set includes first irrelevant documents and does not include first relevant documents, train the preset basic language model based on the first irrelevant documents and the first input information to obtain a second training answer corresponding to the first input information; the second training answer is used to indicate that there are no first relevant documents corresponding to the first input information.
3. The method according to claim 2, wherein The first training answer includes an inference chain, and the inference chain includes references and inferences to the first relevant documents.
4. The method according to claim 1, characterized in that The step of adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model includes: Determine the cross-entropy loss value between the training answer and the reference answer; Based on the cross-entropy loss value, adjust the parameters of the basic language model to obtain a new basic language model.
5. The method according to any one of claims 1 to 4, characterized in that, The first retrieval document set includes first relevant documents and first irrelevant documents, and the number of the first relevant documents is greater than the number of the first irrelevant documents.
6. The method according to any one of claims 1 to 4, characterized in that After the step of adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model, and returning the step of training the preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, until a training cut-off condition is met, to obtain a trained target basic language model, the method further includes: In response to the second input information, obtain a second set of retrieved documents corresponding to the second input information; the second set of retrieved documents includes at least one of second relevant documents and second irrelevant documents; Based on at least one of the second relevant documents and the second irrelevant documents and the second input information, generate a target answer corresponding to the second input information through the target basic language model.
7. A model processing device, characterized in that, It includes: An acquisition module for acquiring training data; The training data includes first input information, a first set of retrieved documents corresponding to the first input information, and a reference answer corresponding to the first input information, and the first set of retrieved documents includes at least one of first relevant documents and first irrelevant documents; A training module for training a preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information; An adjustment module for adjusting the parameters of the basic language model according to the training answer and the reference answer to obtain a new basic language model, and returning the step of training a preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, until when the training cut-off condition is met, an already-trained target basic language model is obtained.
8. The device according to claim 7, characterized in that In terms of training a preset basic language model based on at least one of the first relevant documents and the first irrelevant documents and the first input information to obtain a training answer corresponding to the first input information, the training module specifically is used for: If the first set of retrieved documents includes first relevant documents, train a preset basic language model based on the first relevant documents and the first input information to obtain a first training answer corresponding to the first input information; The first training answer is used to explain the first input information; Or, If the first set of retrieved documents includes first irrelevant documents and does not include first relevant documents, train a preset basic language model based on the first irrelevant documents and the first input information to obtain a second training answer corresponding to the first input information; The second training answer is used to prompt that there are no first relevant documents corresponding to the first input information.
9. A computer device, the computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.